Fortune Cow 4 v1.0.1版本的 MD5 值为:7ba46af6fc58566545d41cb8b412326c

以下内容为反编译后的 AFc1hSDK.java 源代码,内容仅作参考


package com.appsflyer.internal;

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;
import kotlin.io.TextStreamsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
@Metadata(d1 = {"\u00008\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\u0002\b\u0003\n\u0002\u0010$\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0006\b\u0000\u0018\u0000 \u00182\u00020\u0001:\u0001\u0018B/\u0012\u0006\u0010\u0007\u001a\u00020\n\u0012\u0014\u0010\u0014\u001a\u0010\u0012\u0004\u0012\u00020\u000f\u0012\u0004\u0012\u00020\u000f\u0018\u00010\u000e\u0012\b\b\u0002\u0010\u0015\u001a\u00020\u0012¢\u0006\u0004\b\u0016\u0010\u0017J\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\r\u001a\u00020\nX\u0087\u0002¢\u0006\u0006\n\u0004\b\u000b\u0010\fR \u0010\u0011\u001a\u0010\u0012\u0004\u0012\u00020\u000f\u0012\u0004\u0012\u00020\u000f\u0018\u00010\u000eX\u0087\u0002¢\u0006\u0006\n\u0004\b\u0003\u0010\u0010R\u0011\u0010\b\u001a\u00020\u0012X\u0007¢\u0006\u0006\n\u0004\b\b\u0010\u0013"}, d2 = {"Lcom/appsflyer/internal/AFc1hSDK;", "", "", "valueOf", "()Z", "Ljava/net/HttpURLConnection;", "", "p0", "AFInAppEventType", "(Ljava/net/HttpURLConnection;J)Z", "", "AFInAppEventParameterName", "[B", "values", "", "", "Ljava/util/Map;", "AFKeystoreWrapper", "", "I", "p1", "p2", "<init>", "([BLjava/util/Map;I)V", "AFa1xSDK"}, k = 1, mv = {1, 6, 0}, xi = 48)
public final class AFc1hSDK {
    public byte[] AFInAppEventParameterName;
    public int AFInAppEventType;
    public Map<String, String> valueOf;
    public static final AFa1xSDK AFa1xSDK = new AFa1xSDK(null);
    public static String AFKeystoreWrapper = "https://%smonitorsdk.%s/remote-debug/exception-manager";

    public AFc1hSDK(byte[] bArr, Map<String, String> map, int i) {
        Intrinsics.checkNotNullParameter(bArr, "");
        this.AFInAppEventParameterName = bArr;
        this.valueOf = map;
        this.AFInAppEventType = i;
    }

    @Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0005\b\u0086\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0006\u0010\u0007R\u0012\u0010\u0005\u001a\u00020\u0002X\u0087\u0002¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004"}, d2 = {"Lcom/appsflyer/internal/AFc1hSDK$AFa1xSDK;", "", "", "AFKeystoreWrapper", "Ljava/lang/String;", "AFInAppEventType", "<init>", "()V"}, k = 1, mv = {1, 6, 0}, xi = 48)
    public static final class AFa1xSDK {
        public AFa1xSDK(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private AFa1xSDK() {
        }
    }

    public final boolean valueOf() {
        HttpURLConnection httpURLConnection;
        Throwable th;
        long currentTimeMillis = System.currentTimeMillis();
        boolean z = false;
        try {
            String format = String.format(AFKeystoreWrapper, AppsFlyerLib.getInstance().getHostPrefix(), AFa1cSDK.AFInAppEventType().getHostName());
            Intrinsics.checkNotNullExpressionValue(format, "");
            Intrinsics.checkNotNullParameter(format, "");
            URLConnection openConnection = new URL(format).openConnection();
            if (openConnection != null) {
                httpURLConnection = (HttpURLConnection) openConnection;
                try {
                    z = AFInAppEventType(httpURLConnection, currentTimeMillis);
                } catch (Throwable th2) {
                    th = th2;
                    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();
                        }
                    }
                }
            } else {
                throw new NullPointerException("null cannot be cast to non-null type java.net.HttpURLConnection");
            }
        } catch (Throwable th3) {
            httpURLConnection = null;
            th = th3;
        }
    }

    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.AFInAppEventParameterName, Charsets.UTF_8).length());
        Map<String, String> map = this.valueOf;
        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.AFInAppEventType);
        httpURLConnection.setConnectTimeout(this.AFInAppEventType);
        httpURLConnection.addRequestProperty("Content-Type", "application/json");
        Map<String, String> map2 = this.valueOf;
        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.AFInAppEventParameterName.length));
        OutputStream outputStream = httpURLConnection.getOutputStream();
        Intrinsics.checkNotNullExpressionValue(outputStream, "");
        BufferedOutputStream bufferedOutputStream = outputStream instanceof BufferedOutputStream ? (BufferedOutputStream) outputStream : new BufferedOutputStream(outputStream, 8192);
        bufferedOutputStream.write(this.AFInAppEventParameterName);
        bufferedOutputStream.close();
        if (AFc1dSDK.valueOf(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.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 AFc1dSDK.valueOf(httpURLConnection);
    }
}