java - 使用 dkh 、 uid 和 af_v 参数

标签 java android

所以我去面试,他们要求我弄清楚这些参数dkh、uidaf_v是如何在给定的代码 fragment 中生成的。该代码 fragment 是从 apk 文件反编译的。 我应该在其中搜索 dkh 的 fragment 是:-

stringbuilder.append("https://track.appsflyer.com/api/v2.3/androidevent?buildnumber=1.15&app_id=").append(context.getPackageName());
    hashmap.put("brand", Build.BRAND);
    hashmap.put("device", Build.DEVICE);
    hashmap.put("product", Build.PRODUCT);
    hashmap.put("sdk", Integer.toString(android.os.Build.VERSION.SDK_INT));
    hashmap.put("model", Build.MODEL);
    hashmap.put("deviceType", Build.TYPE);
    obj = com.appsflyer.f.a().b("sdkExtension");
    if (obj == null)
    {
        break MISSING_BLOCK_LABEL_386;
    }
    if (((String) (obj)).length() > 0)
    {
        hashmap.put("sdkExtension", obj);
    }
    obj = i(context);
    obj1 = b(context, ((String) (obj)));
    if (obj1 == null)
    {
        break MISSING_BLOCK_LABEL_418;
    }
    hashmap.put("channel", obj1);
    if (obj1 == null) goto _L4; else goto _L3
    _L3:
    if (!((String) (obj1)).equals(obj)) goto _L5; else goto _L4
    _L5:
    hashmap.put("af_latestchannel", obj);
    _L37:
    obj = context.getSharedPreferences("appsflyer-data", 0);
    if (!((SharedPreferences) (obj)).contains("INSTALL_STORE")) goto _L7;             
    else goto _L6
    _L6:
    obj = ((SharedPreferences) (obj)).getString("INSTALL_STORE", null);
    _L15:
    if (obj == null)
    {
        break MISSING_BLOCK_LABEL_506;
    }
    hashmap.put("af_installstore", ((String) (obj)).toLowerCase());
    obj = h(context);
    if (obj == null)
    {
        break MISSING_BLOCK_LABEL_533;
    }
    hashmap.put("af_preinstall_name", ((String) (obj)).toLowerCase());
    obj = g(context);
    if (obj == null)
    {
        break MISSING_BLOCK_LABEL_560;
    }
    hashmap.put("af_currentstore", ((String) (obj)).toLowerCase());
    if (s == null)
    {
        break MISSING_BLOCK_LABEL_574;
    }
    obj = s;
    if (s.length() != 0)
    {
        break MISSING_BLOCK_LABEL_585;
    }
    obj = com.appsflyer.f.a().b("AppsFlyerKey");
    if (obj == null) goto _L9; else goto _L8
    _L8:
    if (((String) (obj)).length() <= 0) goto _L9; else goto _L10
    _L10:
    hashmap.put("appsflyerKey", obj);
    if (((String) (obj)).length() > 8)
    {
        hashmap.put("dkh", ((String) (obj)).substring(0, 8));
    }
    s = com.appsflyer.f.a().b("AppUserId");
    if (s == null)
    {
        break MISSING_BLOCK_LABEL_666;
    }
    hashmap.put("appUserId", s);
    s = com.appsflyer.f.a().a("userEmails");
    if (s == null) goto _L12; else goto _L11
    _L11:
    obj = new StringBuilder();
    i1 = s.length;
    l = 0;

我应该在其中搜索uid的代码 fragment 是:-

   hashmap.put("eventValue", s2);
    if (com.appsflyer.f.a().b("appid") != null)
    {
        hashmap.put("appid", com.appsflyer.f.a().b("appid"));
    }
    s = com.appsflyer.f.a().b("currencyCode");
    if (s == null)
    {
        break MISSING_BLOCK_LABEL_987;
    }
    if (s.length() != 3)
    {
        Log.w("AppsFlyer_1.15", (new StringBuilder("WARNING:currency code   

    should be 3 characters!!! '")).append(s).append("' is not a legal    
    value.").toString());
    }
    hashmap.put("currency", s);
    s = com.appsflyer.f.a().b("IS_UPDATE");
    if (s == null)
    {
        break MISSING_BLOCK_LABEL_1013;
    }
    hashmap.put("isUpdate", s);
    hashmap.put("af_preinstalled", Boolean.toString(j(context)));
    s = a(context.getContentResolver());
    if (s == null)
    {
        break MISSING_BLOCK_LABEL_1055;
    }
    hashmap.put("fb", s);
    a(context, ((Map) (hashmap)));
    s = com.appsflyer.k.a(context);
    if (s == null)
    {
        break MISSING_BLOCK_LABEL_1082;
    }
    hashmap.put("uid", s);
    _L28:
    try
    {
        hashmap.put("lang", Locale.getDefault().getDisplayLanguage());
    }
    // Misplaced declaration of an exception variable
    catch (String s) { }
    try
    {
        s = (TelephonyManager)context.getSystemService("phone");
        hashmap.put("operator", s.getSimOperatorName());
        hashmap.put("carrier", s.getNetworkOperatorName());
    }
    // Misplaced declaration of an exception variable
    catch (String s) { }
    s = (ConnectivityManager)context.getSystemService("connectivity");
    if (!s.getNetworkInfo(1).isConnectedOrConnecting()) goto _L18; else goto    

   _L17

af_v 是:-

    public final void run()
    {
    String s2 = com.appsflyer.AppsFlyerLib.a(a);
    Object obj = (Context)d.get();
    if (obj == null) goto _L2; else goto _L1
    _L1:
    String s = com.appsflyer.f.a().a(((Context) (obj)));
    if (s == null)
    {
        break MISSING_BLOCK_LABEL_70;
    }
    if (s.length() > 0 && a.get("referrer") == null)
    {
        a.put("referrer", s);
    }
    Map map;
    boolean flag1;
    flag1 = "true".equals(((Context) (obj)).getSharedPreferences("appsflyer- 
    data", 0).getString("sentSuccessfully", ""));
    s = (String)a.get("eventName");
    map = a;
    Object obj1;
    boolean flag;
    if (s == null)
    {
        flag = true;
    } else
    {
        flag = false;
    }
    map.put("counter",  

   Integer.toString(com.appsflyer.AppsFlyerLib.a(((Context) (obj)), flag)));
    flag = flag1;
   _L5:
    obj = a;
    if (!flag)
    {
        flag = true;
    } else
    {
        flag = false;
    }
    ((Map) (obj)).put("isFirstCall", Boolean.toString(flag));
    s = (String)a.get("appsflyerKey");
    if (s == null)
    {
        break MISSING_BLOCK_LABEL_195;
    }
    if (s.length() != 0)
    {
        break MISSING_BLOCK_LABEL_204;
    }
    Log.d(s2, "Not sending data yet, waiting for dev key");
    return;
    new j();
    Object obj2 = a;
    obj = (String)((Map) (obj2)).get("appsflyerKey");
    String s1 = (String)((Map) (obj2)).get("af_timestamp");
    obj2 = (String)((Map) (obj2)).get("uid");
    obj = com.appsflyer.j.a((new StringBuilder()).append(((String)   
    (obj)).substring(0, 7)).append(((String) (obj2)).substring(0, 
    7)).append(s1.substring(s1.length() - 7)).toString());
    a.put("af_v", obj);
    obj = com.appsflyer.AppsFlyerLib.b(a);
    try
    {
        com.appsflyer.AppsFlyerLib.a(c, ((String) (obj)), s, d, null, s2,   
    b);
        return;
    }
    catch (IOException ioexception)
    {
        s = ((String) (obj));
        obj1 = ioexception;
    }
    _L3:
    if (s != null && d != null && !c.contains("&isCachedRequest=true"))
    {
        Log.e(s2, ((IOException) (obj1)).getMessage(), ((Throwable)  
    (obj1)));
        com.appsflyer.a.a.a().a(new b(c, s, "1.15"), (Context)d.get());
        return;
    } else
    {
        return;
    }
    obj1;
    Log.e(s2, ((Throwable) (obj1)).getMessage(), ((Throwable) (obj1)));
    return;
    obj1;
    s = null;
      goto _L3
    _L2:
    flag = false;
    if (true) goto _L5; else goto _L4
    _L4:
    }
    }

经过对互联网的长期研究,我了解到这些参数和这些 fragment 所属的 .java 文件是 AppsFlyer SDK 的一部分,并与应用程序集成以用于跟踪目的不。下载应用程序和其他移动广告跟踪 Activity 的用户数量。 我也知道 hashmap.put 方法的用途,但不知道在此代码中的确切用途。 所以我的问题是这三个参数是如何生成的以及它们的用途?

最佳答案

dkh:

从下面的代码 fragment 中我们可以看到,dkh 只是 AppsFlyer key 的前 8 个字符。

obj = com.appsflyer.f.a().b("AppsFlyerKey");
// [...]
if (((String) (obj)).length() > 8)
{
    hashmap.put("dkh", ((String) (obj)).substring(0, 8));
}

至于它是如何使用的 - 在您发布的代码中,它不是。鉴于您发布的代码首先创建一个使用 URL 初始化的 StringBuilder,因此可以有把握地猜测正在构建的 hashamp 也与该 URL 相关。

处理 API 调用时, HashMap 最常见的用途是作为 HTTP 参数(例如通过 GET 或 POST)。因此,我的假设是所有这些 HashMap 条目只是发送到 AppsFlyer API 的参数。有些用于提供有关用户设备的信息,有些(例如 dkh)可能被 AppsFlyer 用于将设备信息与您的帐户关联起来。

uid

该代码 fragment 没有提供足够的信息来收集有关 uid 如何生成的任何有意义的信息。我们真正知道的是它不为 null,并且来自 AppsFlyer SDK 中基于以下代码段的其他函数:

s = com.appsflyer.k.a(context);
// [null check]
hashmap.put("uid", s);

鉴于上面 dkh 的上下文以及程序员之间的普遍共识“uid”代表“用户 ID”,我认为这是一个也将发送到 API 的用户标识符。

af_v

我认为对代码 fragment 应用一些格式会有所帮助:

obj = (String)((Map) (obj2)).get("appsflyerKey");
String s1 = (String)((Map) (obj2)).get("af_timestamp");
obj2 = (String)((Map) (obj2)).get("uid");
obj = com.appsflyer.j.a(
    new StringBuilder()
        .append(((String) (obj)).substring(0, 7))
        .append(((String) (obj2)).substring(0, 7))
        .append(s1.substring(s1.length() - 7))
   .toString()
);
a.put("af_v", obj);

从顶部开始,我们知道 obj 又是我们的 AppsFlyer key 。 s1 是某种时间戳。 obj2 是上面我们的 uid。 我们最终放入 af_v 中的字符串由以下三个部分组成:

  • AppsFlyer 键的前 7 个字符 (obj1)
  • uid 的前 7 个字符 (obj2)
  • 时间戳的最后 7 个字符

再说一次,这可能只是发送到 API,真正的用途只有 AppsFlyer 团队的人知道。它可能是特定请求的标识符 - 事实上它基于特定用户、时间戳和 API key ,这意味着它对于每个请求来说可能相当唯一,并且将它们(仅部分)压缩到一个字符串中可能不是这样对于任何人来说都不是特别有用的数据。

关于java - 使用 dkh 、 uid 和 af_v 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31543930/

相关文章:

java - 如何知道数组是否包含给定的值

java - 无法实例化 Activity ComponentInfo 无法实例化类

android - 有Android SDK到带有蜂窝的平板电脑吗?

java - 导入 org.apache.commons.net 无法解析

java - setListAdapter() 不起作用

java - 使用 GUI 打印字符串

android - 如何从请求者状态更改广播接收器获取 wifi 接入点的 SSID

java - 简单的输入限制问题

android - 适用于openCV应用程序的基于Android Windows的模拟器?

java - AdapterView.OnItemClickListener 不起作用