Pinjamwinwin v2.0.7版本的 MD5 值为:254981700b50ce03309ecdaac5d16485
以下内容为反编译后的 AFb1pSDK.java 源代码,内容仅作参考
package com.appsflyer.internal;
import android.app.Application;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import com.adjust.sdk.Constants;
import com.appsflyer.AFLogger;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.deeplink.DeepLink;
import com.appsflyer.deeplink.DeepLinkResult;
import com.appsflyer.internal.AFc1vSDK;
import com.appsflyer.internal.AFf1uSDK;
import com.jakewharton.timber.collection.util.HttpTip;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
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.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.json.JSONException;
import org.json.JSONObject;
public final class AFb1pSDK extends AFe1jSDK {
@VisibleForTesting
private static String AFLogger$LogLevel = "https://%sdlsdk.%s/v1.0/android/";
public static long getLevel;
private final AFe1nSDK AppsFlyer2dXConversionCallback;
private final List<AFf1uSDK> afErrorLogForExcManagerOnly;
private final CountDownLatch afWarnLog;
private final AFf1sSDK init;
private final AFe1xSDK onAppOpenAttributionNative;
private boolean onAttributionFailureNative;
private int onDeepLinkingNative;
private final AFb1fSDK onInstallConversionDataLoadedNative;
private final ExecutorService onInstallConversionFailureNative;
private int onResponseErrorNative;
private int onResponseNative;
public static class AnonymousClass1 {
static final int[] values;
static {
int[] iArr = new int[AFf1uSDK.AFa1ySDK.values().length];
values = iArr;
try {
iArr[AFf1uSDK.AFa1ySDK.FINISHED.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
values[AFf1uSDK.AFa1ySDK.STARTED.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
public AFb1pSDK(Context context, AFc1xSDK aFc1xSDK) {
super(null, AFLogger$LogLevel, Boolean.FALSE, Boolean.TRUE, null, context);
this.afErrorLogForExcManagerOnly = new ArrayList();
this.afWarnLog = new CountDownLatch(1);
this.AppsFlyer2dXConversionCallback = aFc1xSDK.afRDLog();
this.onInstallConversionDataLoadedNative = aFc1xSDK.values();
this.onAppOpenAttributionNative = aFc1xSDK.AFVersionDeclaration();
this.init = aFc1xSDK.getLevel();
this.onInstallConversionFailureNative = aFc1xSDK.AFInAppEventParameterName();
}
@Nullable
private Map<String, Object> AFInAppEventParameterName(final AFc1vSDK.AFa1wSDK aFa1wSDK) {
Boolean bool;
boolean z8 = false;
if (aFa1wSDK != null && aFa1wSDK.AFInAppEventType != null && ((bool = aFa1wSDK.valueOf) == null || !bool.booleanValue())) {
z8 = true;
}
if (z8) {
return new HashMap<String, Object>() {
{
put("type", "unhashed");
put("value", aFa1wSDK.AFInAppEventType);
}
};
}
return null;
}
public static DeepLinkResult AFKeystoreWrapper(AFb1pSDK aFb1pSDK, Context context) throws IOException, JSONException, InterruptedException {
DeepLink AFInAppEventParameterName;
while (true) {
AFe1nSDK aFe1nSDK = aFb1pSDK.AppsFlyer2dXConversionCallback;
int i3 = aFb1pSDK.onResponseErrorNative;
if (i3 <= 0 || i3 > 2) {
AFLogger.afErrorLogForExcManagerOnly("Unexpected ddl requestCount - start", new IllegalStateException("Metrics: Unexpected ddl requestCount = ".concat(String.valueOf(i3))));
} else {
int i10 = i3 - 1;
aFe1nSDK.afInfoLog[i10] = System.currentTimeMillis();
if (i10 == 0) {
long j10 = aFe1nSDK.afDebugLog;
if (j10 != 0) {
aFe1nSDK.AFKeystoreWrapper.put("from_fg", Long.valueOf(aFe1nSDK.afInfoLog[i10] - j10));
aFe1nSDK.AFInAppEventParameterName.AFInAppEventParameterName("ddl", new JSONObject(aFe1nSDK.AFKeystoreWrapper).toString());
} else {
AFLogger.afInfoLog("Metrics: fg ts is missing");
}
}
}
HttpURLConnection AFKeystoreWrapper = new AFa1rSDK(aFb1pSDK).AFKeystoreWrapper(aFb1pSDK.onAppOpenAttributionNative.AFInAppEventType);
AFe1nSDK aFe1nSDK2 = aFb1pSDK.AppsFlyer2dXConversionCallback;
int i11 = aFb1pSDK.onResponseErrorNative;
if (i11 <= 0 || i11 > 2) {
AFLogger.afErrorLogForExcManagerOnly("Unexpected ddl requestCount - end", new IllegalStateException("Metrics: Unexpected ddl requestCount = ".concat(String.valueOf(i11))));
} else {
int i12 = i11 - 1;
aFe1nSDK2.AFLogger[i12] = System.currentTimeMillis();
long j11 = aFe1nSDK2.afInfoLog[i12];
if (j11 != 0) {
long[] jArr = aFe1nSDK2.afErrorLog;
jArr[i12] = aFe1nSDK2.AFLogger[i12] - j11;
aFe1nSDK2.AFKeystoreWrapper.put("net", jArr);
aFe1nSDK2.AFInAppEventParameterName.AFInAppEventParameterName("ddl", new JSONObject(aFe1nSDK2.AFKeystoreWrapper).toString());
} else {
StringBuilder sb2 = new StringBuilder("Metrics: ddlStart[");
sb2.append(i12);
sb2.append("] ts is missing");
AFLogger.afInfoLog(sb2.toString());
}
}
if (AFKeystoreWrapper.getResponseCode() != 200) {
StringBuilder sb3 = new StringBuilder("[DDL] Error occurred. Server response code = ");
sb3.append(AFKeystoreWrapper.getResponseCode());
AFLogger.afDebugLog(sb3.toString());
return new DeepLinkResult(null, DeepLinkResult.Error.HTTP_STATUS_CODE);
}
JSONObject jSONObject = new JSONObject(AFb1zSDK.AFInAppEventParameterName(AFKeystoreWrapper));
aFb1pSDK.onAttributionFailureNative = jSONObject.optBoolean("is_second_ping", true);
if (jSONObject.optBoolean("found")) {
AFInAppEventParameterName = DeepLink.AFInAppEventParameterName(jSONObject.optJSONObject("click_event"));
AFInAppEventParameterName.AFInAppEventType.put("is_deferred", true);
} else {
AFInAppEventParameterName = null;
}
if (AFInAppEventParameterName != null) {
return new DeepLinkResult(AFInAppEventParameterName, null);
}
if (aFb1pSDK.onResponseErrorNative > 1 || !aFb1pSDK.getLevel() || !aFb1pSDK.onAttributionFailureNative) {
break;
}
AFLogger.afDebugLog("[DDL] Waiting for referrers...");
aFb1pSDK.afWarnLog.await();
AFe1nSDK aFe1nSDK3 = aFb1pSDK.AppsFlyer2dXConversionCallback;
long currentTimeMillis = System.currentTimeMillis();
long j12 = aFe1nSDK3.AFLogger[0];
if (j12 != 0) {
aFe1nSDK3.AFKeystoreWrapper.put("rfr_wait", Long.valueOf(currentTimeMillis - j12));
aFe1nSDK3.AFInAppEventParameterName.AFInAppEventParameterName("ddl", new JSONObject(aFe1nSDK3.AFKeystoreWrapper).toString());
} else {
AFLogger.afInfoLog("Metrics: ddlEnd[0] ts is missing");
}
if (aFb1pSDK.onResponseNative == aFb1pSDK.onDeepLinkingNative) {
return new DeepLinkResult(null, null);
}
aFb1pSDK.AFLogger$LogLevel();
}
}
public void AFLogger$LogLevel() {
String[] strArr;
this.onResponseErrorNative++;
StringBuilder sb2 = new StringBuilder("[DDL] Preparing request ");
sb2.append(this.onResponseErrorNative);
AFLogger.afDebugLog(sb2.toString());
if (this.onResponseErrorNative == 1) {
AFb1zSDK AFInAppEventType = AFb1zSDK.AFInAppEventType();
this.valueOf.put("is_first", Boolean.valueOf(this.onInstallConversionDataLoadedNative.values.AFInAppEventType("appsFlyerCount", 0) == 0));
Map<String, Object> map = this.valueOf;
StringBuilder sb3 = new StringBuilder();
sb3.append(Locale.getDefault().getLanguage());
sb3.append("-");
sb3.append(Locale.getDefault().getCountry());
map.put("lang", sb3.toString());
this.valueOf.put("os", Build.VERSION.RELEASE);
this.valueOf.put("type", Build.MODEL);
this.valueOf.put("request_id", AFb1xSDK.AFInAppEventParameterName(new WeakReference(this.onInstallConversionDataLoadedNative.valueOf.values)));
AFa1fSDK aFa1fSDK = AFInAppEventType.afRDLog;
if (aFa1fSDK != null && (strArr = aFa1fSDK.valueOf) != null) {
this.valueOf.put("sharing_filter", strArr);
}
Map<String, Object> AFInAppEventParameterName = AFInAppEventParameterName(AFa1bSDK.AFKeystoreWrapper(this.onInstallConversionDataLoadedNative.valueOf.values, new HashMap()));
Map<String, Object> AFInAppEventParameterName2 = AFInAppEventParameterName(AFa1bSDK.values(this.onInstallConversionDataLoadedNative.valueOf.values));
if (AFInAppEventParameterName != null) {
this.valueOf.put("gaid", AFInAppEventParameterName);
}
if (AFInAppEventParameterName2 != null) {
this.valueOf.put("oaid", AFInAppEventParameterName2);
}
}
Map<String, Object> map2 = this.valueOf;
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("timestamp", simpleDateFormat.format(new Date(currentTimeMillis)));
this.valueOf.put("request_count", Integer.valueOf(this.onResponseErrorNative));
ArrayList arrayList = new ArrayList();
for (AFf1uSDK aFf1uSDK : this.afErrorLogForExcManagerOnly) {
Map<String, String> values = values(aFf1uSDK);
if (values != null) {
arrayList.add(values);
}
}
if (!arrayList.isEmpty()) {
this.valueOf.put("referrers", arrayList);
}
AFInAppEventType(onAppOpenAttributionNative());
}
private boolean getLevel() {
List list = (List) this.valueOf.get("referrers");
return (list != null ? list.size() : 0) < this.onDeepLinkingNative && !this.valueOf.containsKey("referrers");
}
@VisibleForTesting
private String onAppOpenAttributionNative() {
String str = this.onAppOpenAttributionNative.AFInAppEventType;
String packageName = this.onInstallConversionDataLoadedNative.valueOf.values.getPackageName();
String values = this.onInstallConversionDataLoadedNative.values();
String concat = (values == null || values.trim().isEmpty()) ? HttpTip.defaultEmpty : "-".concat(values);
Uri.Builder buildUpon = Uri.parse(String.format(AFLogger$LogLevel, AppsFlyerLib.getInstance().getHostPrefix(), AFb1zSDK.AFInAppEventType().getHostName())).buildUpon();
StringBuilder sb2 = new StringBuilder();
sb2.append(packageName);
sb2.append(concat);
Uri.Builder appendPath = buildUpon.appendPath(sb2.toString());
StringBuilder sb3 = new StringBuilder();
sb3.append(this.valueOf.get("timestamp"));
sb3.append(str);
return appendPath.appendQueryParameter("af_sig", AFa1aSDK.values(sb3.toString(), str)).appendQueryParameter("sdk_version", AFb1zSDK.AFKeystoreWrapper).build().toString();
}
public final DeepLinkResult AFLogger() {
AFLogger.afDebugLog("[DDL] start");
FutureTask futureTask = new FutureTask(new Callable<DeepLinkResult>() {
@Override
public final DeepLinkResult call() throws Exception {
Application application = AFb1pSDK.this.AFKeystoreWrapper;
AFb1pSDK.AFInAppEventParameterName(AFb1pSDK.this);
AFb1pSDK.this.AFLogger$LogLevel();
return AFb1pSDK.AFKeystoreWrapper(AFb1pSDK.this, application);
}
});
this.onInstallConversionFailureNative.execute(futureTask);
try {
DeepLinkResult deepLinkResult = (DeepLinkResult) futureTask.get(getLevel, TimeUnit.MILLISECONDS);
this.AppsFlyer2dXConversionCallback.AFKeystoreWrapper(deepLinkResult, getLevel);
AFb1oSDK.AFInAppEventParameterName(deepLinkResult);
return deepLinkResult;
} catch (InterruptedException e10) {
e = e10;
AFLogger.afErrorLog("[DDL] Error occurred", e, true);
DeepLinkResult deepLinkResult2 = new DeepLinkResult(null, !(e.getCause() instanceof IOException) ? DeepLinkResult.Error.NETWORK : DeepLinkResult.Error.UNEXPECTED);
this.AppsFlyer2dXConversionCallback.AFKeystoreWrapper(deepLinkResult2, getLevel);
AFb1oSDK.AFInAppEventParameterName(deepLinkResult2);
return deepLinkResult2;
} catch (ExecutionException e11) {
e = e11;
AFLogger.afErrorLog("[DDL] Error occurred", e, true);
DeepLinkResult deepLinkResult22 = new DeepLinkResult(null, !(e.getCause() instanceof IOException) ? DeepLinkResult.Error.NETWORK : DeepLinkResult.Error.UNEXPECTED);
this.AppsFlyer2dXConversionCallback.AFKeystoreWrapper(deepLinkResult22, getLevel);
AFb1oSDK.AFInAppEventParameterName(deepLinkResult22);
return deepLinkResult22;
} catch (TimeoutException e12) {
AFLogger.afErrorLogForExcManagerOnly("[DDL] Timeout", e12);
StringBuilder sb2 = new StringBuilder("[DDL] Timeout, didn't manage to find deferred deep link after ");
sb2.append(this.onResponseErrorNative);
sb2.append(" attempt(s) within ");
sb2.append(getLevel);
sb2.append(" milliseconds");
AFLogger.afDebugLog(sb2.toString());
DeepLinkResult deepLinkResult3 = new DeepLinkResult(null, DeepLinkResult.Error.TIMEOUT);
this.AppsFlyer2dXConversionCallback.AFKeystoreWrapper(deepLinkResult3, getLevel);
AFb1oSDK.AFInAppEventParameterName(deepLinkResult3);
return deepLinkResult3;
}
}
@Override
public final AFd1wSDK values() {
return AFd1wSDK.DLSDK;
}
public static void AFInAppEventParameterName(AFb1pSDK aFb1pSDK) {
AFf1uSDK[] values;
ArrayList arrayList = new ArrayList();
for (AFf1uSDK aFf1uSDK : aFb1pSDK.init.values()) {
if (aFf1uSDK != null && aFf1uSDK.afDebugLog != AFf1uSDK.AFa1ySDK.NOT_STARTED) {
arrayList.add(aFf1uSDK);
}
}
aFb1pSDK.onDeepLinkingNative = arrayList.size();
Iterator it = arrayList.iterator();
while (it.hasNext()) {
final AFf1uSDK aFf1uSDK2 = (AFf1uSDK) it.next();
int i3 = AnonymousClass1.values[aFf1uSDK2.afDebugLog.ordinal()];
if (i3 == 1) {
StringBuilder sb2 = new StringBuilder("[DDL] ");
sb2.append(aFf1uSDK2.values.get("source"));
sb2.append(" referrer collected earlier");
AFLogger.afDebugLog(sb2.toString());
aFb1pSDK.AFInAppEventParameterName(aFf1uSDK2);
} else if (i3 == 2) {
aFf1uSDK2.addObserver(new Observer() {
@Override
public final void update(Observable observable, Object obj) {
StringBuilder sb3 = new StringBuilder("[DDL] ");
sb3.append(aFf1uSDK2.values.get("source"));
sb3.append(" referrer collected via observer");
AFLogger.afDebugLog(sb3.toString());
AFb1pSDK.this.AFInAppEventParameterName((AFf1uSDK) observable);
}
});
}
}
}
private static boolean valueOf(AFf1uSDK aFf1uSDK) {
Long l10 = (Long) aFf1uSDK.values.get("click_ts");
return l10 != null && System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(l10.longValue()) < TimeUnit.DAYS.toMillis(1L);
}
private static Map<String, String> values(AFf1uSDK aFf1uSDK) {
if (aFf1uSDK.afDebugLog == AFf1uSDK.AFa1ySDK.FINISHED) {
HashMap hashMap = new HashMap();
String str = (String) aFf1uSDK.values.get(Constants.REFERRER);
if (str != null) {
hashMap.put("source", (String) aFf1uSDK.values.get("source"));
hashMap.put("value", str);
return hashMap;
}
return null;
}
return null;
}
public void AFInAppEventParameterName(AFf1uSDK aFf1uSDK) {
if (valueOf(aFf1uSDK)) {
this.afErrorLogForExcManagerOnly.add(aFf1uSDK);
this.afWarnLog.countDown();
AFLogger.afDebugLog("[DDL] Added non-organic ".concat(aFf1uSDK.getClass().getSimpleName()));
return;
}
int i3 = this.onResponseNative + 1;
this.onResponseNative = i3;
if (i3 == this.onDeepLinkingNative) {
this.afWarnLog.countDown();
}
}
}