Swiggy v4.51.1版本的 MD5 值为:5af7ec91512a0a8c1510e3f8bac20b8b

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


package com.appsflyer.internal;

import com.appsflyer.AFLogger;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.internal.AFc1oSDK;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.instrumentation.URLConnectionInstrumentation;
import com.newrelic.agent.android.util.SafeJsonPrimitive;
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.collections.CollectionsKt___CollectionsKt;
import kotlin.io.TextStreamsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.o;
@Instrumented
public final class AFc1rSDK {
    public static final AFa1wSDK AFa1wSDK = new AFa1wSDK(null);
    public static String valueOf = "https://%smonitorsdk.%s/remote-debug/exception-manager";
    public Map<String, String> AFInAppEventType;
    public byte[] AFKeystoreWrapper;
    public int values;

    public static final class AFa1wSDK {
        private AFa1wSDK() {
        }

        public AFa1wSDK(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

    public AFc1rSDK(byte[] bArr, Map<String, String> map, int i) {
        o.k(bArr, "");
        this.AFKeystoreWrapper = bArr;
        this.AFInAppEventType = map;
        this.values = i;
    }

    public final boolean AFInAppEventType() {
        int i;
        URLConnection openConnection;
        BufferedOutputStream bufferedOutputStream;
        InputStream errorStream;
        String str;
        long currentTimeMillis = System.currentTimeMillis();
        boolean z = false;
        HttpURLConnection httpURLConnection = null;
        try {
            String format = String.format(valueOf, AppsFlyerLib.getInstance().getHostPrefix(), AFb1wSDK.AFKeystoreWrapper().getHostName());
            o.j(format, "");
            o.k(format, "");
            openConnection = URLConnectionInstrumentation.openConnection(new URL(format).openConnection());
        } catch (Throwable th) {
            th = th;
        }
        if (openConnection != null) {
            HttpURLConnection httpURLConnection2 = (HttpURLConnection) openConnection;
            try {
                httpURLConnection2.setRequestMethod("POST");
                StringBuilder sb = new StringBuilder();
                sb.append(httpURLConnection2.getRequestMethod());
                sb.append(':');
                sb.append(httpURLConnection2.getURL());
                StringBuilder sb2 = new StringBuilder(sb.toString());
                sb2.append("\n length: ");
                sb2.append(new String(this.AFKeystoreWrapper, kotlin.text.d.b).length());
                Map<String, String> map = this.AFInAppEventType;
                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(httpURLConnection2.hashCode());
                sb3.append("] ");
                sb3.append((Object) sb2);
                String obj = sb3.toString();
                o.k(obj, "");
                AFLogger.afRDLog("[Exception Manager]: ".concat(String.valueOf(obj)));
                httpURLConnection2.setInstanceFollowRedirects(false);
                httpURLConnection2.setUseCaches(false);
                httpURLConnection2.setReadTimeout(this.values);
                httpURLConnection2.setConnectTimeout(this.values);
                httpURLConnection2.addRequestProperty("Content-Type", "application/json");
                Map<String, String> map2 = this.AFInAppEventType;
                if (map2 != null) {
                    for (Map.Entry<String, String> entry2 : map2.entrySet()) {
                        httpURLConnection2.addRequestProperty(entry2.getKey(), entry2.getValue());
                    }
                }
                httpURLConnection2.setDoOutput(true);
                httpURLConnection2.setRequestProperty("Content-Length", String.valueOf(this.AFKeystoreWrapper.length));
                OutputStream outputStream = httpURLConnection2.getOutputStream();
                o.j(outputStream, "");
                if (outputStream instanceof BufferedOutputStream) {
                    bufferedOutputStream = (BufferedOutputStream) outputStream;
                } else {
                    bufferedOutputStream = new BufferedOutputStream(outputStream, 8192);
                }
                bufferedOutputStream.write(this.AFKeystoreWrapper);
                bufferedOutputStream.close();
                if (AFc1oSDK.AFa1vSDK.AFInAppEventType(httpURLConnection2)) {
                    errorStream = httpURLConnection2.getInputStream();
                } else {
                    errorStream = httpURLConnection2.getErrorStream();
                }
                if (errorStream != null) {
                    o.j(errorStream, "");
                    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, kotlin.text.d.b), 8192);
                    str = CollectionsKt___CollectionsKt.t0(TextStreamsKt.e(bufferedReader), null, null, null, 0, null, null, 63, null);
                    bufferedReader.close();
                }
                str = "";
                StringBuilder sb4 = new StringBuilder("response code:");
                sb4.append(httpURLConnection2.getResponseCode());
                sb4.append(SafeJsonPrimitive.NULL_CHAR);
                sb4.append(httpURLConnection2.getResponseMessage());
                sb4.append("\n\tbody:");
                sb4.append(str);
                sb4.append("\n\ttook ");
                sb4.append(System.currentTimeMillis() - currentTimeMillis);
                sb4.append("ms");
                String obj2 = sb4.toString();
                StringBuilder sb5 = new StringBuilder("HTTP: [");
                sb5.append(httpURLConnection2.hashCode());
                sb5.append("] ");
                sb5.append(obj2);
                String obj3 = sb5.toString();
                o.k(obj3, "");
                AFLogger.afRDLog("[Exception Manager]: ".concat(String.valueOf(obj3)));
                z = AFc1oSDK.AFa1vSDK.AFInAppEventType(httpURLConnection2);
                httpURLConnection2.disconnect();
            } catch (Throwable th2) {
                th = th2;
                httpURLConnection = httpURLConnection2;
                try {
                    long currentTimeMillis2 = System.currentTimeMillis() - currentTimeMillis;
                    StringBuilder sb6 = new StringBuilder("error: ");
                    sb6.append(th);
                    sb6.append("\n\ttook ");
                    sb6.append(currentTimeMillis2);
                    sb6.append("ms\n\t");
                    sb6.append(th.getMessage());
                    String obj4 = sb6.toString();
                    StringBuilder sb7 = new StringBuilder("HTTP: [");
                    if (httpURLConnection != null) {
                        i = httpURLConnection.hashCode();
                    } else {
                        i = 0;
                    }
                    sb7.append(i);
                    sb7.append("] ");
                    sb7.append(obj4);
                    String obj5 = sb7.toString();
                    o.k(obj5, "");
                    AFLogger.afRDLog("[Exception Manager]: ".concat(String.valueOf(obj5)));
                    if (httpURLConnection != null) {
                        httpURLConnection.disconnect();
                    }
                    return z;
                } finally {
                    if (httpURLConnection != null) {
                        httpURLConnection.disconnect();
                    }
                }
            }
            return z;
        }
        throw new NullPointerException("null cannot be cast to non-null type java.net.HttpURLConnection");
    }
}