afun 2020238 v1.0版本的 MD5 值为:0e5438925c609ea263d060e5259b230d
以下内容为反编译后的 AFd1gSDK.java 源代码,内容仅作参考
package com.appsflyer.internal;
import androidx.annotation.WorkerThread;
import com.appsflyer.AFLogger;
import com.appsflyer.AppsFlyerLib;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.Map;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.io.TextStreamsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@Metadata(d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010$\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0007\b\u0000\u0018\u0000 \u00172\u00020\u0001:\u0001\u0017B/\u0012\u0006\u0010\u0007\u001a\u00020\n\u0012\u0014\u0010\u0013\u001a\u0010\u0012\u0004\u0012\u00020\r\u0012\u0004\u0012\u00020\r\u0018\u00010\f\u0012\b\b\u0002\u0010\u0014\u001a\u00020\u0010¢\u0006\u0004\b\u0015\u0010\u0016J\u000f\u0010\u0003\u001a\u00020\u0002H\u0007¢\u0006\u0004\b\u0003\u0010\u0004J\u001b\u0010\b\u001a\u00020\u0002*\u00020\u00052\u0006\u0010\u0007\u001a\u00020\u0006H\u0002¢\u0006\u0004\b\b\u0010\tR\u0012\u0010\b\u001a\u00020\nX\u0087\u0002¢\u0006\u0006\n\u0004\b\b\u0010\u000bR \u0010\u000e\u001a\u0010\u0012\u0004\u0012\u00020\r\u0012\u0004\u0012\u00020\r\u0018\u00010\fX\u0087\u0002¢\u0006\u0006\n\u0004\b\u000e\u0010\u000fR\u0011\u0010\u0003\u001a\u00020\u0010X\u0007¢\u0006\u0006\n\u0004\b\u0011\u0010\u0012"}, d2 = {"Lcom/appsflyer/internal/AFd1gSDK;", "", "", "values", "()Z", "Ljava/net/HttpURLConnection;", "", "p0", "AFInAppEventType", "(Ljava/net/HttpURLConnection;J)Z", "", "[B", "", "", "AFInAppEventParameterName", "Ljava/util/Map;", "", "valueOf", "I", "p1", "p2", "<init>", "([BLjava/util/Map;I)V", "AFa1vSDK"}, k = 1, mv = {1, 6, 0}, xi = 48)
public final class AFd1gSDK {
@Nullable
public Map<String, String> AFInAppEventParameterName;
@NotNull
public byte[] AFInAppEventType;
public int valueOf;
@NotNull
public static final AFa1vSDK AFa1vSDK = new AFa1vSDK(null);
@NotNull
public static String AFKeystoreWrapper = "https://%smonitorsdk.%s/remote-debug/exception-manager";
public AFd1gSDK(@NotNull byte[] bArr, @Nullable Map<String, String> map, int i) {
Intrinsics.checkNotNullParameter(bArr, "");
this.AFInAppEventType = bArr;
this.AFInAppEventParameterName = map;
this.valueOf = i;
}
@Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0004\b\u0086\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0005\u0010\u0006R\u0012\u0010\u0003\u001a\u00020\u0002X\u0087\u0002¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004"}, d2 = {"Lcom/appsflyer/internal/AFd1gSDK$AFa1vSDK;", "", "", "AFKeystoreWrapper", "Ljava/lang/String;", "<init>", "()V"}, k = 1, mv = {1, 6, 0}, xi = 48)
public static final class AFa1vSDK {
public AFa1vSDK(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private AFa1vSDK() {
}
}
@WorkerThread
public final boolean values() {
HttpURLConnection httpURLConnection;
Throwable th;
URLConnection openConnection;
long currentTimeMillis = System.currentTimeMillis();
boolean z = false;
try {
String format = String.format(AFKeystoreWrapper, AppsFlyerLib.getInstance().getHostPrefix(), AFb1tSDK.AFKeystoreWrapper().getHostName());
Intrinsics.checkNotNullExpressionValue(format, "");
Intrinsics.checkNotNullParameter(format, "");
openConnection = new URL(format).openConnection();
} catch (Throwable th2) {
httpURLConnection = null;
th = th2;
}
if (openConnection != null) {
httpURLConnection = (HttpURLConnection) openConnection;
try {
z = AFInAppEventType(httpURLConnection, currentTimeMillis);
} catch (Throwable th3) {
th = th3;
try {
long currentTimeMillis2 = System.currentTimeMillis() - currentTimeMillis;
StringBuilder sb = new StringBuilder("error: ");
sb.append(th);
sb.append("\n\ttook ");
sb.append(currentTimeMillis2);
sb.append("ms\n\t");
sb.append(th.getMessage());
String obj = sb.toString();
StringBuilder sb2 = new StringBuilder("HTTP: [");
sb2.append(httpURLConnection != null ? httpURLConnection.hashCode() : 0);
sb2.append("] ");
sb2.append(obj);
String obj2 = sb2.toString();
Intrinsics.checkNotNullParameter(obj2, "");
AFLogger.afRDLog("[Exception Manager]: ".concat(String.valueOf(obj2)));
} finally {
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
}
}
return z;
}
throw new NullPointerException("null cannot be cast to non-null type java.net.HttpURLConnection");
}
private final boolean AFInAppEventType(HttpURLConnection httpURLConnection, long j) {
InputStream errorStream;
String str;
httpURLConnection.setRequestMethod("POST");
StringBuilder sb = new StringBuilder();
sb.append(httpURLConnection.getRequestMethod());
sb.append(':');
sb.append(httpURLConnection.getURL());
StringBuilder sb2 = new StringBuilder(sb.toString());
sb2.append("\n length: ");
sb2.append(new String(this.AFInAppEventType, Charsets.UTF_8).length());
Map<String, String> map = this.AFInAppEventParameterName;
if (map != null) {
for (Map.Entry<String, String> entry : map.entrySet()) {
sb2.append("\n ");
sb2.append(entry.getKey());
sb2.append(": ");
sb2.append(entry.getValue());
}
}
StringBuilder sb3 = new StringBuilder("HTTP: [");
sb3.append(httpURLConnection.hashCode());
sb3.append("] ");
sb3.append((Object) sb2);
String obj = sb3.toString();
Intrinsics.checkNotNullParameter(obj, "");
AFLogger.afRDLog("[Exception Manager]: ".concat(String.valueOf(obj)));
httpURLConnection.setInstanceFollowRedirects(false);
httpURLConnection.setUseCaches(false);
httpURLConnection.setReadTimeout(this.valueOf);
httpURLConnection.setConnectTimeout(this.valueOf);
httpURLConnection.addRequestProperty("Content-Type", "application/json");
Map<String, String> map2 = this.AFInAppEventParameterName;
if (map2 != null) {
for (Map.Entry<String, String> entry2 : map2.entrySet()) {
httpURLConnection.addRequestProperty(entry2.getKey(), entry2.getValue());
}
}
httpURLConnection.setDoOutput(true);
httpURLConnection.setRequestProperty("Content-Length", String.valueOf(this.AFInAppEventType.length));
OutputStream outputStream = httpURLConnection.getOutputStream();
Intrinsics.checkNotNullExpressionValue(outputStream, "");
BufferedOutputStream bufferedOutputStream = outputStream instanceof BufferedOutputStream ? (BufferedOutputStream) outputStream : new BufferedOutputStream(outputStream, 8192);
bufferedOutputStream.write(this.AFInAppEventType);
bufferedOutputStream.close();
if (AFd1hSDK.AFKeystoreWrapper(httpURLConnection)) {
errorStream = httpURLConnection.getInputStream();
} else {
errorStream = httpURLConnection.getErrorStream();
}
if (errorStream != null) {
Intrinsics.checkNotNullExpressionValue(errorStream, "");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, Charsets.UTF_8), 8192);
str = CollectionsKt___CollectionsKt.joinToString$default(TextStreamsKt.readLines(bufferedReader), null, null, null, 0, null, null, 63, null);
bufferedReader.close();
}
str = "";
StringBuilder sb4 = new StringBuilder("response code:");
sb4.append(httpURLConnection.getResponseCode());
sb4.append(' ');
sb4.append(httpURLConnection.getResponseMessage());
sb4.append("\n\tbody:");
sb4.append(str);
sb4.append("\n\ttook ");
sb4.append(System.currentTimeMillis() - j);
sb4.append("ms");
String obj2 = sb4.toString();
StringBuilder sb5 = new StringBuilder("HTTP: [");
sb5.append(httpURLConnection.hashCode());
sb5.append("] ");
sb5.append(obj2);
String obj3 = sb5.toString();
Intrinsics.checkNotNullParameter(obj3, "");
AFLogger.afRDLog("[Exception Manager]: ".concat(String.valueOf(obj3)));
return AFd1hSDK.AFKeystoreWrapper(httpURLConnection);
}
}