Craftsman 4 v1.20.43版本的 MD5 值为:44824ed1b4bf939cc4a771f5f317f768
以下内容为反编译后的 ap.java 源代码,内容仅作参考
package com.appsflyer.internal;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import com.appsflyer.AFLogger;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerProperties;
import com.appsflyer.deeplink.DeepLink;
import com.appsflyer.deeplink.DeepLinkResult;
import com.appsflyer.internal.a;
import com.appsflyer.internal.ak;
import com.appsflyer.internal.cq;
import com.google.android.vending.expansion.downloader.Constants;
import com.google.firebase.messaging.Constants;
import com.ironsource.eventsmodule.a;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;
import java.util.TimeZone;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public final class ap extends cd {
public static long onAppOpenAttributionNative = 0;
private static String onResponseErrorNative = "https://%sdlsdk.%s/v1.0/android/";
private boolean AppsFlyerConversionListener;
private final JSONObject onAttributionFailure;
public int onAttributionFailureNative;
private final aw onConversionDataFail;
private final CountDownLatch onConversionDataSuccess;
private int onDeepLinking;
private int onResponseError;
private final List<cq> onResponseNative;
public ap(Context context, aw awVar) {
super(null, onResponseErrorNative, Boolean.FALSE, Boolean.TRUE, null, context);
this.onResponseNative = new ArrayList();
this.onConversionDataSuccess = new CountDownLatch(1);
this.onAttributionFailure = new JSONObject();
this.onConversionDataFail = awVar;
}
public final void valueOf(DeepLinkResult deepLinkResult) {
try {
this.onAttributionFailure.put("status", deepLinkResult.getStatus().toString());
this.onAttributionFailure.put("timeout_value", onAppOpenAttributionNative);
} catch (JSONException unused) {
}
aw awVar = this.onConversionDataFail;
awVar.AFKeystoreWrapper.edit().putString("ddl", this.onAttributionFailure.toString()).apply();
ar.AFInAppEventType(deepLinkResult);
}
private boolean values() {
List list = (List) this.values.get("referrers");
return (list != null ? list.size() : 0) < this.onResponseError && !this.values.containsKey("referrers");
}
public void AFInAppEventType(Context context) {
HashMap hashMap;
String[] strArr;
this.onAttributionFailureNative++;
StringBuilder sb = new StringBuilder("[DDL] Preparing request ");
sb.append(this.onAttributionFailureNative);
AFLogger.values(sb.toString());
if (this.onAttributionFailureNative == 1) {
ah AFKeystoreWrapper = ah.AFKeystoreWrapper();
this.values.put("is_first", Boolean.valueOf(ah.AFInAppEventType(context)));
Map<String, Object> map = this.values;
StringBuilder sb2 = new StringBuilder();
sb2.append(Locale.getDefault().getLanguage());
sb2.append(Constants.FILENAME_SEQUENCE_SEPARATOR);
sb2.append(Locale.getDefault().getCountry());
map.put(com.ironsource.environment.globaldata.a.f2471o, sb2.toString());
this.values.put(com.ironsource.environment.globaldata.a.x, Build.VERSION.RELEASE);
this.values.put("type", Build.MODEL);
this.values.put("request_id", AFKeystoreWrapper.getAppsFlyerUID(context));
m mVar = AFKeystoreWrapper.onDeepLinkingNative;
if (mVar != null && (strArr = mVar.AFInAppEventType) != null) {
this.values.put("sharing_filter", strArr);
}
Map<String, Object> valueOf = valueOf(ac.valueOf(context, new HashMap()));
Map<String, Object> valueOf2 = valueOf(ac.values(context));
if (valueOf != null) {
this.values.put(com.ironsource.environment.globaldata.a.v0, valueOf);
}
if (valueOf2 != null) {
this.values.put("oaid", valueOf2);
}
}
Map<String, Object> map2 = this.values;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US);
long currentTimeMillis = System.currentTimeMillis();
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
map2.put(a.AbstractC0146a.f2607d, simpleDateFormat.format(new Date(currentTimeMillis)));
this.values.put("request_count", Integer.valueOf(this.onAttributionFailureNative));
ArrayList arrayList = new ArrayList();
for (cq cqVar : this.onResponseNative) {
if (cqVar.values == cq.b.FINISHED) {
hashMap = new HashMap();
String str = (String) cqVar.valueOf.get(com.adjust.sdk.Constants.REFERRER);
if (str != null) {
hashMap.put(Constants.ScionAnalytics.PARAM_SOURCE, (String) cqVar.valueOf.get(Constants.ScionAnalytics.PARAM_SOURCE));
hashMap.put("value", str);
if (hashMap == null) {
arrayList.add(hashMap);
}
}
}
hashMap = null;
if (hashMap == null) {
}
}
if (!arrayList.isEmpty()) {
this.values.put("referrers", arrayList);
}
String devKey = AppsFlyerProperties.getInstance().getDevKey();
String AFInAppEventParameterName = ah.AFKeystoreWrapper().AFInAppEventParameterName(context);
String concat = (AFInAppEventParameterName == null || AFInAppEventParameterName.trim().isEmpty()) ? "" : com.google.android.vending.expansion.downloader.Constants.FILENAME_SEQUENCE_SEPARATOR.concat(String.valueOf(AFInAppEventParameterName));
Uri.Builder buildUpon = Uri.parse(String.format(this.onInstallConversionDataLoadedNative, AppsFlyerLib.getInstance().getHostPrefix(), ah.AFKeystoreWrapper().getHostName())).buildUpon();
StringBuilder sb3 = new StringBuilder();
sb3.append(context.getPackageName());
sb3.append(concat);
Uri.Builder appendPath = buildUpon.appendPath(sb3.toString());
StringBuilder sb4 = new StringBuilder();
sb4.append(this.values.get(a.AbstractC0146a.f2607d));
sb4.append(devKey);
values(appendPath.appendQueryParameter("af_sig", ag.valueOf(sb4.toString(), devKey)).appendQueryParameter("sdk_version", ah.values).build().toString());
}
public static class AnonymousClass4 {
static final int[] AFKeystoreWrapper;
static {
int[] iArr = new int[cq.b.values().length];
AFKeystoreWrapper = iArr;
try {
iArr[cq.b.FINISHED.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
AFKeystoreWrapper[cq.b.STARTED.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
public void AFInAppEventType(cq cqVar) {
if (values(cqVar)) {
this.onResponseNative.add(cqVar);
this.onConversionDataSuccess.countDown();
StringBuilder sb = new StringBuilder("[DDL] Added non-organic ");
sb.append(cqVar.getClass().getSimpleName());
AFLogger.values(sb.toString());
return;
}
int i2 = this.onDeepLinking + 1;
this.onDeepLinking = i2;
if (i2 == this.onResponseError) {
this.onConversionDataSuccess.countDown();
}
}
private static boolean values(cq cqVar) {
Long l2 = (Long) cqVar.valueOf.get("click_ts");
return l2 != null && System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(l2.longValue()) < TimeUnit.DAYS.toMillis(1L);
}
private Map<String, Object> valueOf(final a.d.C0103a c0103a) {
Boolean bool;
boolean z = false;
if (c0103a != null && c0103a.valueOf != null && ((bool = c0103a.AFInAppEventParameterName) == null || !bool.booleanValue())) {
z = true;
}
if (z) {
return new HashMap<String, Object>() {
{
put("type", "unhashed");
put("value", a.d.C0103a.this.valueOf);
}
};
}
return null;
}
static void AFKeystoreWrapper(ap apVar) {
cq[] cqVarArr;
ArrayList<cq> arrayList = new ArrayList();
for (cq cqVar : ah.AFKeystoreWrapper().AFLogger$LogLevel) {
if (cqVar != null && cqVar.values != cq.b.NOT_STARTED) {
arrayList.add(cqVar);
}
}
apVar.onResponseError = arrayList.size();
for (final cq cqVar2 : arrayList) {
int i2 = AnonymousClass4.AFKeystoreWrapper[cqVar2.values.ordinal()];
if (i2 == 1) {
StringBuilder sb = new StringBuilder("[DDL] ");
sb.append(cqVar2.valueOf.get(Constants.ScionAnalytics.PARAM_SOURCE));
sb.append(" referrer collected earlier");
AFLogger.values(sb.toString());
apVar.AFInAppEventType(cqVar2);
} else if (i2 == 2) {
cqVar2.addObserver(new Observer() {
@Override
public final void update(Observable observable, Object obj) {
StringBuilder sb2 = new StringBuilder("[DDL] ");
sb2.append(cqVar2.valueOf.get(Constants.ScionAnalytics.PARAM_SOURCE));
sb2.append(" referrer collected via observer");
AFLogger.values(sb2.toString());
ap.this.AFInAppEventType((cq) observable);
}
});
}
}
}
static DeepLinkResult values(ap apVar, Context context) throws IOException, JSONException, InterruptedException {
DeepLink valueOf;
while (true) {
long currentTimeMillis = System.currentTimeMillis();
if (apVar.onAttributionFailureNative == 1) {
apVar.onAttributionFailure.put("from_fg", currentTimeMillis - apVar.onConversionDataFail.AFKeystoreWrapper.getLong("fg_ts", 0L));
}
HttpURLConnection AFInAppEventType = new ak.a(apVar).AFInAppEventType();
JSONArray optJSONArray = apVar.onAttributionFailure.optJSONArray("net");
if (optJSONArray == null) {
optJSONArray = new JSONArray();
}
long currentTimeMillis2 = System.currentTimeMillis();
optJSONArray.put(apVar.onAttributionFailureNative - 1, currentTimeMillis2 - currentTimeMillis);
apVar.onAttributionFailure.put("net", optJSONArray);
if (AFInAppEventType.getResponseCode() != 200) {
StringBuilder sb = new StringBuilder("[DDL] Error occurred. Server response code = ");
sb.append(AFInAppEventType.getResponseCode());
AFLogger.values(sb.toString());
return new DeepLinkResult(null, DeepLinkResult.Error.HTTP_STATUS_CODE);
}
ah.AFKeystoreWrapper();
JSONObject jSONObject = new JSONObject(ah.valueOf(AFInAppEventType));
apVar.AppsFlyerConversionListener = jSONObject.optBoolean("is_second_ping", true);
if (jSONObject.optBoolean("found")) {
valueOf = DeepLink.valueOf(jSONObject.optJSONObject("click_event"));
valueOf.AFInAppEventType.put("is_deferred", true);
} else {
valueOf = null;
}
if (valueOf != null) {
return new DeepLinkResult(valueOf, null);
}
if (apVar.onAttributionFailureNative > 1 || !apVar.values() || !apVar.AppsFlyerConversionListener) {
break;
}
AFLogger.values("[DDL] Waiting for referrers...");
apVar.onConversionDataSuccess.await();
apVar.onAttributionFailure.put("rfr_wait", System.currentTimeMillis() - currentTimeMillis2);
if (apVar.onDeepLinking != apVar.onResponseError) {
apVar.AFInAppEventType(context);
} else {
return new DeepLinkResult(null, null);
}
}
}
}