package com.appsflyer.internal;

import X.2FV;
import X.2He;
import X.2XJ;
import X.3GY;
import X.7lW;
import X.7s1;
import X.8e1;
import X.8e2;
import X.8eG;
import X.8eL;
import X.8jA;
import X.8n2;
import X.8uQ;
import X.9EH;
import X.9Vv;
import X.9Vw;
import X.9dN;
import X.9dm;
import X.9dq;
import X.AnonymousClass0HH;
import android.app.Activity;
import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.ClipboardManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Pair;
import android.view.WindowManager;
import android.webkit.WebView;
import com.android.billingclient.api.Purchase;
import com.appsflyer.AFLogger;
import com.appsflyer.AFVersionDeclaration;
import com.appsflyer.AppsFlyerConversionListener;
import com.appsflyer.AppsFlyerInAppPurchaseValidatorListener;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerProperties;
import com.appsflyer.attribution.AppsFlyerRequestListener;
import com.appsflyer.attribution.RequestError;
import com.appsflyer.compat.function.Consumer;
import com.appsflyer.compat.function.Function;
import com.appsflyer.deeplink.DeepLinkListener;
import com.appsflyer.deeplink.DeepLinkResult;
import com.appsflyer.internal.ag;
import com.appsflyer.internal.ao;
import com.appsflyer.internal.c;
import com.appsflyer.internal.cl;
import com.appsflyer.internal.l;
import com.appsflyer.internal.u;
import com.appsflyer.internal.y;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.sysoptimizer.ReceiverRegisterCrashOptimizer;
import com.bytedance.sysoptimizer.ReceiverRegisterLancet;
import com.google.android.gms.common.GoogleApiAvailability;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.HttpURLConnection;
import java.net.NetworkInterface;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
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.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public final class ai extends AppsFlyerLib {
    public static final String AFInAppEventParameterName = "119";
    public static AppsFlyerConversionListener AFInAppEventType = null;
    public static AppsFlyerInAppPurchaseValidatorListener AFKeystoreWrapper = null;
    public static ai onAppOpenAttribution = new ai();
    public static String onAttributionFailure;
    public static String onAttributionFailureNative;
    public static String onConversionDataFail;
    public static String onDeepLinking;
    public static final String onDeepLinkingNative;
    public static String onInstallConversionDataLoadedNative;
    public static String onInstallConversionFailureNative = "https://%sstats.%s/stats";
    public static final String valueOf = "6.4";
    public static final String values;
    public au AFLogger$LogLevel;
    public String AFVersionDeclaration;
    public long AppsFlyer2dXConversionCallback;
    public long AppsFlyerConversionListener = TimeUnit.SECONDS.toMillis(5);
    public boolean AppsFlyerInAppPurchaseValidatorListener = false;
    public ScheduledExecutorService AppsFlyerLib = null;
    public final an enableLocationCollection = new an();
    public Map<Long, String> getInstance;
    public String getLevel;
    public String getOutOfStore;
    public String getSdkVersion;
    public cl[] init;
    public l onAppOpenAttributionNative;
    public long onConversionDataSuccess = -1;
    public long onPause;
    public long onValidateInApp = -1;
    public long onValidateInAppFailure;
    public SharedPreferences sendPushNotificationData;
    public final be setAdditionalData;
    public Application setAndroidIdData;
    public final Executor setAppInviteOneLink = INVOKESTATIC_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_thread_ThreadPoolLancet_newSingleThreadExecutor();
    public boolean setCustomerIdAndLogSession = false;
    public Map<String, Object> setCustomerUserId;
    public boolean setDebugLog = false;
    public boolean setImeiData = false;
    public boolean setOaidData;
    public cm setOutOfStore;
    public boolean setPhoneNumber = false;
    public bb setUserEmails;
    public boolean stop;
    public boolean updateServerUninstallToken = false;
    public Map<String, Object> waitForCustomerUserId;

    public static String com_appsflyer_internal_ai_android_provider_Settings$Secure_getString(ContentResolver contentResolver, String str) {
        3GY.LIZ(102004);
        Pair LIZ = 3GY.LIZ((Object) null, Settings.Secure.class, new Object[]{contentResolver, str}, 102004, "java.lang.String", false, -1430178515, 2);
        return ((Boolean) LIZ.first).booleanValue() ? (String) LIZ.second : Settings.Secure.getString(contentResolver, str);
    }

    public static Object com_appsflyer_internal_ai_java_lang_reflect_Method_invoke(Method method, Object obj, Object[] objArr) {
        3GY.LIZ(110000);
        Method method2 = method;
        Pair LIZ = 3GY.LIZ((Object) null, method2, new Object[]{obj, objArr}, 110000, "java.lang.Object", true, -370046946, 2);
        return ((Boolean) LIZ.first).booleanValue() ? LIZ.second : method2.invoke(obj, objArr);
    }

    public static ai valueOf() {
        return onAppOpenAttribution;
    }

    public final boolean isStopped() {
        return this.setImeiData;
    }

    public final void valueOf(Context context, String str, long j) {
        SharedPreferences.Editor edit = values(context).edit();
        edit.putLong(str, j);
        edit.apply();
    }

    public static boolean AFInAppEventParameterName(String str, boolean z) {
        return AppsFlyerProperties.getInstance().getBoolean(str, z);
    }

    private boolean AFInAppEventParameterName(Context context) {
        try {
            Class.forName("com.appsflyer.lvl.AppsFlyerLVL");
            final long currentTimeMillis = System.currentTimeMillis();
            this.waitForCustomerUserId = new ConcurrentHashMap();
            AnonymousClass1 r3 = new y.a() {
                static {
                    Covode.recordClassIndex(2594);
                }

                public final void AFKeystoreWrapper(String str, Exception exc) {
                    String message = exc.getMessage();
                    if (message == null) {
                        message = "unknown";
                    }
                    ai.this.waitForCustomerUserId.put("error", message);
                    AFLogger.values(str, (Throwable) exc);
                }

                public final void AFInAppEventType(String str, String str2) {
                    ai.this.waitForCustomerUserId.put("signedData", str);
                    ai.this.waitForCustomerUserId.put("signature", str2);
                    ai.this.waitForCustomerUserId.put("ttr", Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                    AFLogger.valueOf("Successfully retrieved Google LVL data.");
                }
            };
            try {
                Class<?> cls = Class.forName("com.appsflyer.lvl.AppsFlyerLVL");
                Class<?> cls2 = Class.forName("com.appsflyer.lvl.AppsFlyerLVL$resultListener");
                Method method = cls.getMethod("checkLicense", new Class[]{Long.TYPE, Context.class, cls2});
                y.AnonymousClass5 r6 = new InvocationHandler() {
                    static {
                        /*
                            r0 = 2722(0xaa2, float:3.814E-42)
                            com.bytedance.covode.number.Covode.recordClassIndex(r0)
                            return
                        */
                        throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.y.AnonymousClass5.<clinit>():void");
                    }

                    public final java.lang.Object invoke(
/*
Method generation error in method: com.appsflyer.internal.y.5.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]):java.lang.Object, dex: classes.dex
                    jadx.core.utils.exceptions.JadxRuntimeException: Method args not loaded: com.appsflyer.internal.y.5.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]):java.lang.Object, class status: UNLOADED
                    	at jadx.core.dex.nodes.MethodNode.getArgRegs(MethodNode.java:278)
                    	at jadx.core.codegen.MethodGen.addDefinition(MethodGen.java:116)
                    	at jadx.core.codegen.ClassGen.addMethodCode(ClassGen.java:313)
                    	at jadx.core.codegen.ClassGen.addMethod(ClassGen.java:271)
                    	at jadx.core.codegen.ClassGen.lambda$addInnerClsAndMethods$2(ClassGen.java:240)
                    	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
                    	at java.util.ArrayList.forEach(ArrayList.java:1259)
                    	at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
                    	at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
                    	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483)
                    	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
                    	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
                    	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
                    	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
                    	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
                    	at jadx.core.codegen.ClassGen.addInnerClsAndMethods(ClassGen.java:236)
                    	at jadx.core.codegen.ClassGen.addClassBody(ClassGen.java:227)
                    	at jadx.core.codegen.InsnGen.inlineAnonymousConstructor(InsnGen.java:676)
                    	at jadx.core.codegen.InsnGen.makeConstructor(InsnGen.java:607)
                    	at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:364)
                    	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:250)
                    	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:221)
                    	at jadx.core.codegen.RegionGen.makeSimpleBlock(RegionGen.java:109)
                    	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:55)
                    	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:92)
                    	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:58)
                    	at jadx.core.codegen.RegionGen.makeRegionIndent(RegionGen.java:98)
                    	at jadx.core.codegen.RegionGen.makeTryCatch(RegionGen.java:311)
                    	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:68)
                    	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:92)
                    	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:58)
                    	at jadx.core.codegen.RegionGen.makeRegionIndent(RegionGen.java:98)
                    	at jadx.core.codegen.RegionGen.makeTryCatch(RegionGen.java:311)
                    	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:68)
                    	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:92)
                    	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:58)
                    	at jadx.core.codegen.MethodGen.addRegionInsns(MethodGen.java:211)
                    	at jadx.core.codegen.MethodGen.addInstructions(MethodGen.java:204)
                    	at jadx.core.codegen.ClassGen.addMethodCode(ClassGen.java:318)
                    	at jadx.core.codegen.ClassGen.addMethod(ClassGen.java:271)
                    	at jadx.core.codegen.ClassGen.lambda$addInnerClsAndMethods$2(ClassGen.java:240)
                    	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
                    	at java.util.ArrayList.forEach(ArrayList.java:1259)
                    	at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
                    	at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
                    	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483)
                    	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
                    	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
                    	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
                    	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
                    	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
                    	at jadx.core.codegen.ClassGen.addInnerClsAndMethods(ClassGen.java:236)
                    	at jadx.core.codegen.ClassGen.addClassBody(ClassGen.java:227)
                    	at jadx.core.codegen.ClassGen.addClassCode(ClassGen.java:112)
                    	at jadx.core.codegen.ClassGen.makeClass(ClassGen.java:78)
                    	at jadx.core.codegen.CodeGen.wrapCodeGen(CodeGen.java:44)
                    	at jadx.core.codegen.CodeGen.generateJavaCode(CodeGen.java:33)
                    	at jadx.core.codegen.CodeGen.generate(CodeGen.java:21)
                    	at jadx.core.ProcessClass.generateCode(ProcessClass.java:61)
                    	at jadx.core.dex.nodes.ClassNode.decompile(ClassNode.java:273)
                    
*/
                };
                method.invoke((Object) null, new Object[]{Long.valueOf(currentTimeMillis), context, Proxy.newProxyInstance(cls2.getClassLoader(), new Class[]{cls2}, r6)});
            } catch (ClassNotFoundException e2) {
                r3.AFKeystoreWrapper(e2.getClass().getSimpleName(), e2);
            } catch (NoSuchMethodException e3) {
                r3.AFKeystoreWrapper(e3.getClass().getSimpleName(), e3);
            } catch (IllegalAccessException e4) {
                r3.AFKeystoreWrapper(e4.getClass().getSimpleName(), e4);
            } catch (InvocationTargetException e5) {
                r3.AFKeystoreWrapper(e5.getClass().getSimpleName(), e5);
            }
            return true;
        } catch (ClassNotFoundException unused) {
            return false;
        }
    }

    public final void AFKeystoreWrapper(WeakReference<Context> weakReference) {
        if (weakReference.get() != null) {
            AFLogger.valueOf("app went to background");
            SharedPreferences values2 = values(weakReference.get());
            AppsFlyerProperties.getInstance().saveProperties(values2);
            long j = this.onPause - this.onValidateInAppFailure;
            HashMap hashMap = new HashMap();
            String string = AppsFlyerProperties.getInstance().getString("AppsFlyerKey");
            if (string == null) {
                AFLogger.AFLogger$LogLevel("[callStats] AppsFlyer's SDK cannot send any event without providing DevKey.");
                return;
            }
            String string2 = AppsFlyerProperties.getInstance().getString("KSAppsFlyerId");
            if (AppsFlyerProperties.getInstance().getBoolean("deviceTrackingDisabled", false)) {
                hashMap.put("deviceTrackingDisabled", "true");
            }
            c.d.b AFInAppEventParameterName2 = ad.AFInAppEventParameterName(weakReference.get().getContentResolver());
            if (AFInAppEventParameterName2 != null) {
                hashMap.put("amazon_aid", AFInAppEventParameterName2.values);
                hashMap.put("amazon_aid_limit", String.valueOf(AFInAppEventParameterName2.AFKeystoreWrapper));
            }
            String string3 = AppsFlyerProperties.getInstance().getString("advertiserId");
            if (string3 != null) {
                hashMap.put("advertiserId", string3);
            }
            hashMap.put("app_id", weakReference.get().getPackageName());
            hashMap.put("devkey", string);
            hashMap.put("uid", ak.AFInAppEventParameterName(weakReference));
            hashMap.put("time_in_app", String.valueOf(j / 1000));
            hashMap.put("statType", "user_closed_app");
            hashMap.put("platform", "Android");
            hashMap.put("launch_counter", Integer.toString(AFInAppEventParameterName(values2, "appsFlyerCount", false)));
            hashMap.put("channel", valueOf(weakReference.get()));
            if (string2 == null) {
                string2 = "";
            }
            hashMap.put("originalAppsflyerId", string2);
            if (this.setDebugLog) {
                try {
                    AFLogger.AFInAppEventType("Running callStats task");
                    cg cgVar = new cg();
                    cgVar.onConversionDataSuccess = isStopped();
                    cgVar.AFInAppEventType(hashMap);
                    cgVar.valueOf(AnonymousClass0HH.LIZ(onInstallConversionFailureNative, new Object[]{AppsFlyerLib.getInstance().getHostPrefix(), onAppOpenAttribution.getHostName()}));
                    new Thread(new ah(cgVar)).start();
                } catch (Throwable th) {
                    AFLogger.valueOf("Could not send callStats request", th);
                }
            } else {
                AFLogger.AFInAppEventType("Stats call is disabled, ignore ...");
            }
        }
    }

    public final void valueOf(Context context, Map<String, Object> map, Uri uri) {
        if (!map.containsKey("af_deeplink")) {
            String AFInAppEventParameterName2 = AFInAppEventParameterName(uri.toString());
            i values2 = i.values();
            if (!(values2.AFLogger$LogLevel == null || values2.getLevel == null || !AFInAppEventParameterName2.contains(values2.AFLogger$LogLevel))) {
                Uri.Builder buildUpon = Uri.parse(AFInAppEventParameterName2).buildUpon();
                Uri.Builder buildUpon2 = Uri.EMPTY.buildUpon();
                for (Map.Entry next : values2.getLevel.entrySet()) {
                    buildUpon.appendQueryParameter((String) next.getKey(), (String) next.getValue());
                    buildUpon2.appendQueryParameter((String) next.getKey(), (String) next.getValue());
                }
                AFInAppEventParameterName2 = buildUpon.build().toString();
                map.put("appended_query_params", buildUpon2.build().getEncodedQuery());
            }
            map.put("af_deeplink", AFInAppEventParameterName2);
        }
        final HashMap hashMap = new HashMap();
        hashMap.put("link", uri.toString());
        ao aoVar = new ao(uri, this, context);
        if (aoVar.AFKeystoreWrapper) {
            map.put("isBrandedDomain", Boolean.TRUE);
        }
        ac.values(context, hashMap, uri);
        if (aoVar.AFKeystoreWrapper()) {
            aoVar.AFInAppEventParameterName = new ao.c() {
                static {
                    Covode.recordClassIndex(2602);
                }

                public final void AFKeystoreWrapper(String str) {
                    ap.AFInAppEventParameterName(str, DeepLinkResult.Error.NETWORK);
                }

                public final void valueOf(Map<String, String> map) {
                    for (String next : map.keySet()) {
                        hashMap.put(next, map.get(next));
                    }
                    ap.AFInAppEventParameterName(hashMap);
                }
            };
            if (k.values == null) {
                k.values = new k();
            }
            k.values.AFKeystoreWrapper().execute(aoVar);
            return;
        }
        ap.AFInAppEventParameterName(hashMap);
    }

    public static boolean AFInAppEventParameterName(File file) {
        return file == null || !file.exists();
    }

    public final String valueOf(Context context) {
        String string = AppsFlyerProperties.getInstance().getString("channel");
        if (string == null) {
            if (context == null) {
                return null;
            }
            string = valueOf("CHANNEL", context.getPackageManager(), context.getPackageName());
            if (string == null) {
                return string;
            }
        }
        if (string.equals("")) {
            return null;
        }
        return string;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:4:0x000c, code lost:
        r0 = com.appsflyer.internal.aq.AFInAppEventParameterName(r7);
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void valueOf(com.appsflyer.internal.j r6, android.app.Activity r7) {
        /*
            r5 = this;
            android.app.Application r4 = r6.valueOf
            java.lang.String r3 = ""
            if (r7 == 0) goto L_0x0033
            android.content.Intent r0 = r7.getIntent()
            if (r0 == 0) goto L_0x0033
            android.net.Uri r0 = com.appsflyer.internal.aq.AFInAppEventParameterName(r7)
            if (r0 == 0) goto L_0x0033
            java.lang.String r2 = r0.toString()
        L_0x0016:
            com.appsflyer.AppsFlyerProperties r1 = com.appsflyer.AppsFlyerProperties.getInstance()
            java.lang.String r0 = "AppsFlyerKey"
            java.lang.String r0 = r1.getString(r0)
            if (r0 != 0) goto L_0x0035
            java.lang.String r0 = "[LogEvent/Launch] AppsFlyer's SDK cannot send any event without providing DevKey."
            com.appsflyer.AFLogger.AFLogger$LogLevel(r0)
            com.appsflyer.attribution.AppsFlyerRequestListener r2 = r6.AFInAppEventParameterName
            if (r2 == 0) goto L_0x0032
            int r1 = com.appsflyer.attribution.RequestError.NO_DEV_KEY
            java.lang.String r0 = com.appsflyer.internal.az.AFInAppEventType
            r2.onError(r1, r0)
        L_0x0032:
            return
        L_0x0033:
            r2 = r3
            goto L_0x0016
        L_0x0035:
            com.appsflyer.AppsFlyerProperties r0 = com.appsflyer.AppsFlyerProperties.getInstance()
            java.lang.String r0 = r0.getReferrer(r4)
            if (r0 != 0) goto L_0x0047
        L_0x003f:
            r6.AFVersionDeclaration = r3
            r6.values = r2
            r5.AFInAppEventParameterName((com.appsflyer.internal.j) r6)
            return
        L_0x0047:
            r3 = r0
            goto L_0x003f
        */
        throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.ai.valueOf(com.appsflyer.internal.j, android.app.Activity):void");
    }

    /* access modifiers changed from: private */
    public boolean valueOf(j jVar, SharedPreferences sharedPreferences) {
        int AFInAppEventParameterName2 = AFInAppEventParameterName(sharedPreferences, "appsFlyerCount", false);
        boolean z = AFInAppEventParameterName2 == 1 && !(jVar instanceof bw);
        if ((sharedPreferences.getBoolean("newGPReferrerSent", false) || AFInAppEventParameterName2 != 1) && !z) {
            return false;
        }
        return true;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:290:0x0617, code lost:
        r14 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:292:0x061b, code lost:
        r14 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:294:0x061f, code lost:
        r1 = null;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:296:?, code lost:
        com.appsflyer.AFLogger.AFInAppEventType("use cached IMEI: ".concat(java.lang.String.valueOf(r1)));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:298:0x0634, code lost:
        if (r1 != null) goto L_0x0639;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:300:0x0637, code lost:
        r1 = null;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:302:?, code lost:
        com.appsflyer.AFLogger.AFInAppEventType("use cached IMEI: ".concat(java.lang.String.valueOf(r1)));
     */
    /* JADX WARNING: Code restructure failed: missing block: B:303:0x0646, code lost:
        com.appsflyer.AFLogger.AFLogger$LogLevel("WARNING: READ_PHONE_STATE is missing.");
     */
    /* JADX WARNING: Code restructure failed: missing block: B:305:0x064e, code lost:
        if (r0 != null) goto L_0x0650;
     */
    /* JADX WARNING: Exception block dominator not found, dom blocks: [] */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Missing exception handler attribute for start block: B:84:0x0228 */
    /* JADX WARNING: Removed duplicated region for block: B:103:0x0269 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:106:0x0278 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:127:0x02c6 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:130:0x02df A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:144:0x0340 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:148:0x0353 A[Catch:{ Exception -> 0x0359 }] */
    /* JADX WARNING: Removed duplicated region for block: B:167:0x0393 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:168:0x039b A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:178:0x03d3 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:181:0x03ec A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:211:0x0482 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:214:0x0497 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:215:0x0498 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:221:0x04ad A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:224:0x04bb  */
    /* JADX WARNING: Removed duplicated region for block: B:233:0x04d7 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:236:0x04e8 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:239:0x04f5 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:240:0x04fb A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:244:0x0512 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:247:0x052c A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:250:0x0547 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:256:0x0575 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:259:0x0591 A[SYNTHETIC, Splitter:B:259:0x0591] */
    /* JADX WARNING: Removed duplicated region for block: B:269:0x05ae A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:272:0x05bf A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:273:0x05c8 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:294:0x061f  */
    /* JADX WARNING: Removed duplicated region for block: B:295:0x0621 A[SYNTHETIC, Splitter:B:295:0x0621] */
    /* JADX WARNING: Removed duplicated region for block: B:299:? A[ExcHandler: InvocationTargetException (unused java.lang.reflect.InvocationTargetException), SYNTHETIC, Splitter:B:279:0x05ea] */
    /* JADX WARNING: Removed duplicated region for block: B:309:0x0655 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:310:0x0656 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:316:0x0689 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:331:0x06c7 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:338:0x06d2 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:339:0x06d3 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:343:0x06f4 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:350:0x0720  */
    /* JADX WARNING: Removed duplicated region for block: B:388:0x07d3  */
    /* JADX WARNING: Removed duplicated region for block: B:407:0x0865 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:409:0x086e A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:418:0x08a6 A[SYNTHETIC, Splitter:B:418:0x08a6] */
    /* JADX WARNING: Removed duplicated region for block: B:429:0x08f1 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:436:0x0916 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:439:0x0948 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:440:0x094a A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:443:0x095a A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:465:0x0a04 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:467:0x0a08 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:486:0x0b67 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:87:0x022c A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* JADX WARNING: Removed duplicated region for block: B:91:0x0237 A[SYNTHETIC, Splitter:B:91:0x0237] */
    /* JADX WARNING: Removed duplicated region for block: B:95:0x0243 A[Catch:{ Exception -> 0x00c6, all -> 0x0c39 }] */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final java.util.Map<java.lang.String, java.lang.Object> valueOf(com.appsflyer.internal.j r32) {
        /*
            r31 = this;
            r7 = r31
            java.lang.String r14 = "sdkExtension"
            java.lang.String r11 = "AppsFlyerTimePassedSincePrevLaunch"
            java.lang.String r19 = "yyyy-MM-dd_HHmmssZ"
            java.lang.String r20 = "use cached IMEI: "
            java.lang.String r16 = "uid"
            java.lang.String r21 = "appid"
            java.lang.String r29 = "INSTALL_STORE"
            java.lang.String r3 = "gcd"
            java.lang.String r23 = "prev_event_name"
            java.lang.String r28 = "preInstallName"
            r1 = r32
            android.app.Application r6 = r1.valueOf
            java.lang.String r0 = r1.AppsFlyer2dXConversionCallback
            r27 = r0
            java.lang.String r0 = r1.AFLogger$LogLevel
            r18 = r0
            org.json.JSONObject r2 = new org.json.JSONObject
            java.util.Map<java.lang.String, java.lang.Object> r0 = r1.AFKeystoreWrapper
            if (r0 != 0) goto L_0x0089
            java.util.HashMap r0 = new java.util.HashMap
            r0.<init>()
        L_0x002d:
            r2.<init>(r0)
            java.lang.String r22 = r2.toString()
            java.lang.String r12 = r1.AFVersionDeclaration
            android.content.SharedPreferences r9 = values((android.content.Context) r6)
            boolean r5 = r1.AFKeystoreWrapper()
            java.lang.String r0 = r1.values
            r30 = r0
            java.util.Map<java.lang.String, java.lang.Object> r4 = r1.AFInAppEventType
            com.appsflyer.internal.ad.AFInAppEventType(r6, r4)
            java.lang.Boolean r1 = com.appsflyer.internal.ad.AFKeystoreWrapper
            if (r1 == 0) goto L_0x0065
            boolean r0 = r1.booleanValue()
            if (r0 != 0) goto L_0x0065
            java.util.Map r2 = valueOf((java.util.Map<java.lang.String, java.lang.Object>) r4)
            boolean r1 = r1.booleanValue()
            r0 = 1
            r0 = r1 ^ 1
            java.lang.Boolean r1 = java.lang.Boolean.valueOf(r0)
            java.lang.String r0 = "ad_ids_disabled"
            r2.put(r0, r1)
        L_0x0065:
            java.util.Date r0 = new java.util.Date
            r0.<init>()
            long r0 = r0.getTime()
            java.lang.String r2 = java.lang.Long.toString(r0)
            java.lang.String r17 = "af_timestamp"
            r24 = r4
            r25 = r17
            r26 = r2
            r24.put(r25, r26)
            java.lang.String r1 = com.appsflyer.internal.c.AFKeystoreWrapper(r6, r0)
            if (r1 == 0) goto L_0x008c
            java.lang.String r0 = "cksm_v1"
            r4.put(r0, r1)
            goto L_0x008c
        L_0x0089:
            java.util.Map<java.lang.String, java.lang.Object> r0 = r1.AFKeystoreWrapper
            goto L_0x002d
        L_0x008c:
            boolean r0 = r31.isStopped()     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x009f
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "******* sendTrackingWithEvent: "
            r1.<init>(r0)     // Catch:{ all -> 0x0c39 }
            if (r5 == 0) goto L_0x009c
            goto L_0x00a5
        L_0x009c:
            r0 = r18
            goto L_0x00a7
        L_0x009f:
            java.lang.String r0 = "Reporting has been stopped"
            com.appsflyer.AFLogger.valueOf((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            goto L_0x00b1
        L_0x00a5:
            java.lang.String r0 = "Launch"
        L_0x00a7:
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x0c39 }
            com.appsflyer.AFLogger.valueOf((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
        L_0x00b1:
            com.appsflyer.internal.af.values()     // Catch:{ all -> 0x0c39 }
            java.io.File r0 = com.appsflyer.internal.af.values(r6)     // Catch:{ Exception -> 0x00c6 }
            boolean r0 = r0.exists()     // Catch:{ Exception -> 0x00c6 }
            if (r0 != 0) goto L_0x00cc
            java.io.File r0 = com.appsflyer.internal.af.values(r6)     // Catch:{ Exception -> 0x00c6 }
            r0.mkdir()     // Catch:{ Exception -> 0x00c6 }
            goto L_0x00cc
        L_0x00c6:
            r1 = move-exception
            java.lang.String r0 = "Could not create cache directory"
            com.appsflyer.AFLogger.valueOf(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x00cc:
            android.content.pm.PackageManager r2 = r6.getPackageManager()     // Catch:{ Exception -> 0x0108 }
            java.lang.String r1 = r6.getPackageName()     // Catch:{ Exception -> 0x0108 }
            r0 = 4096(0x1000, float:5.74E-42)
            android.content.pm.PackageInfo r0 = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getPackageInfo(r2, r1, r0)     // Catch:{ Exception -> 0x0108 }
            java.lang.String[] r0 = r0.requestedPermissions     // Catch:{ Exception -> 0x0108 }
            java.util.List r1 = java.util.Arrays.asList(r0)     // Catch:{ Exception -> 0x0108 }
            java.lang.String r0 = "android.permission.INTERNET"
            boolean r0 = r1.contains(r0)     // Catch:{ Exception -> 0x0108 }
            if (r0 != 0) goto L_0x00ed
            java.lang.String r0 = "Permission android.permission.INTERNET is missing in the AndroidManifest.xml"
            com.appsflyer.AFLogger.AFLogger$LogLevel(r0)     // Catch:{ Exception -> 0x0108 }
        L_0x00ed:
            java.lang.String r0 = "android.permission.ACCESS_NETWORK_STATE"
            boolean r0 = r1.contains(r0)     // Catch:{ Exception -> 0x0108 }
            if (r0 != 0) goto L_0x00fa
            java.lang.String r0 = "Permission android.permission.ACCESS_NETWORK_STATE is missing in the AndroidManifest.xml"
            com.appsflyer.AFLogger.AFLogger$LogLevel(r0)     // Catch:{ Exception -> 0x0108 }
        L_0x00fa:
            java.lang.String r0 = "android.permission.ACCESS_WIFI_STATE"
            boolean r0 = r1.contains(r0)     // Catch:{ Exception -> 0x0108 }
            if (r0 != 0) goto L_0x010e
            java.lang.String r0 = "Permission android.permission.ACCESS_WIFI_STATE is missing in the AndroidManifest.xml"
            com.appsflyer.AFLogger.AFLogger$LogLevel(r0)     // Catch:{ Exception -> 0x0108 }
            goto L_0x010e
        L_0x0108:
            r1 = move-exception
            java.lang.String r0 = "Exception while validation permissions. "
            com.appsflyer.AFLogger.valueOf(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x010e:
            java.lang.String r1 = "af_events_api"
            java.lang.String r0 = "1"
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "brand"
            java.lang.String r0 = android.os.Build.BRAND     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "device"
            java.lang.String r0 = android.os.Build.DEVICE     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "product"
            java.lang.String r0 = android.os.Build.PRODUCT     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "sdk"
            int r0 = android.os.Build.VERSION.SDK_INT     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = java.lang.Integer.toString(r0)     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "model"
            java.lang.String r0 = android.os.Build.MODEL     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "deviceType"
            java.lang.String r0 = android.os.Build.TYPE     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            valueOf((android.content.Context) r6, (java.util.Map<java.lang.String, java.lang.Object>) r4)     // Catch:{ all -> 0x0c39 }
            com.appsflyer.AppsFlyerProperties r10 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            com.appsflyer.internal.au r0 = r7.AFLogger$LogLevel     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x0155
            com.appsflyer.internal.au r0 = new com.appsflyer.internal.au     // Catch:{ all -> 0x0c39 }
            r0.<init>(r6)     // Catch:{ all -> 0x0c39 }
            r7.AFLogger$LogLevel = r0     // Catch:{ all -> 0x0c39 }
        L_0x0155:
            com.appsflyer.internal.au r8 = r7.AFLogger$LogLevel     // Catch:{ all -> 0x0c39 }
            java.lang.String r2 = "phone"
            if (r5 == 0) goto L_0x027b
            boolean r0 = AFInAppEventType((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x01ab
            boolean r0 = r10.isOtherSdkStringDisabled()     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x0174
            float r0 = init((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "batteryLevel"
            java.lang.String r0 = java.lang.String.valueOf(r0)     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x0174:
            AFKeystoreWrapper((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            int r1 = android.os.Build.VERSION.SDK_INT     // Catch:{ all -> 0x0c39 }
            r0 = 23
            if (r1 < r0) goto L_0x0186
            java.lang.Class<android.app.UiModeManager> r0 = android.app.UiModeManager.class
            java.lang.Object r0 = r6.getSystemService(r0)     // Catch:{ all -> 0x0c39 }
            android.app.UiModeManager r0 = (android.app.UiModeManager) r0     // Catch:{ all -> 0x0c39 }
            goto L_0x018e
        L_0x0186:
            java.lang.String r0 = "uimode"
            java.lang.Object r0 = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_GetSystemServiceLancet_getSystemService(r6, r0)     // Catch:{ all -> 0x0c39 }
            android.app.UiModeManager r0 = (android.app.UiModeManager) r0     // Catch:{ all -> 0x0c39 }
        L_0x018e:
            if (r0 == 0) goto L_0x019e
            int r1 = r0.getCurrentModeType()     // Catch:{ all -> 0x0c39 }
            r0 = 4
            if (r1 != r0) goto L_0x019e
            java.lang.String r1 = "tv"
            java.lang.Boolean r0 = java.lang.Boolean.TRUE     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x019e:
            boolean r0 = com.appsflyer.internal.bt.values(r6)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x01ab
            java.lang.String r1 = "inst_app"
            java.lang.Boolean r0 = java.lang.Boolean.TRUE     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x01ab:
            java.lang.String r13 = "timepassedsincelastlaunch"
            android.content.SharedPreferences r15 = values((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            r0 = 0
            long r25 = r15.getLong(r11, r0)     // Catch:{ all -> 0x0c39 }
            long r0 = java.lang.System.currentTimeMillis()     // Catch:{ all -> 0x0c39 }
            r7.valueOf((android.content.Context) r6, (java.lang.String) r11, (long) r0)     // Catch:{ all -> 0x0c39 }
            r23 = 0
            int r11 = (r25 > r23 ? 1 : (r25 == r23 ? 0 : -1))
            if (r11 <= 0) goto L_0x01c5
            goto L_0x01c8
        L_0x01c5:
            r0 = -1
            goto L_0x01ce
        L_0x01c8:
            long r0 = r0 - r25
            r23 = 1000(0x3e8, double:4.94E-321)
            long r0 = r0 / r23
        L_0x01ce:
            java.lang.String r0 = java.lang.Long.toString(r0)     // Catch:{ all -> 0x0c39 }
            r4.put(r13, r0)     // Catch:{ all -> 0x0c39 }
            com.appsflyer.AppsFlyerProperties r1 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "oneLinkSlug"
            java.lang.String r11 = r1.getString(r0)     // Catch:{ all -> 0x0c39 }
            com.appsflyer.AppsFlyerProperties r1 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "onelinkVersion"
            java.lang.String r1 = r1.getString(r0)     // Catch:{ all -> 0x0c39 }
            if (r11 == 0) goto L_0x01f0
            java.lang.String r0 = "onelink_id"
            r4.put(r0, r11)     // Catch:{ all -> 0x0c39 }
        L_0x01f0:
            if (r1 == 0) goto L_0x01f7
            java.lang.String r0 = "onelink_ver"
            r4.put(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x01f7:
            com.appsflyer.internal.au r0 = r7.AFLogger$LogLevel     // Catch:{ all -> 0x0c39 }
            android.content.SharedPreferences r1 = r0.values     // Catch:{ all -> 0x0c39 }
            r0 = 0
            java.lang.String r1 = r1.getString(r3, r0)     // Catch:{ all -> 0x0c39 }
            if (r1 == 0) goto L_0x0228
            org.json.JSONObject r0 = new org.json.JSONObject     // Catch:{ JSONException -> 0x0228 }
            r0.<init>(r1)     // Catch:{ JSONException -> 0x0228 }
            java.util.Map r1 = com.appsflyer.internal.o.values(r0)     // Catch:{ JSONException -> 0x0228 }
            boolean r0 = r1.isEmpty()     // Catch:{ JSONException -> 0x0228 }
            if (r0 != 0) goto L_0x0228
            java.util.Map r0 = valueOf((java.util.Map<java.lang.String, java.lang.Object>) r4)     // Catch:{ JSONException -> 0x0228 }
            r0.put(r3, r1)     // Catch:{ JSONException -> 0x0228 }
            com.appsflyer.internal.au r0 = r7.AFLogger$LogLevel     // Catch:{ JSONException -> 0x0228 }
            android.content.SharedPreferences r0 = r0.values     // Catch:{ JSONException -> 0x0228 }
            android.content.SharedPreferences$Editor r1 = r0.edit()     // Catch:{ JSONException -> 0x0228 }
            r0 = 0
            android.content.SharedPreferences$Editor r0 = r1.putString(r3, r0)     // Catch:{ JSONException -> 0x0228 }
            r0.apply()     // Catch:{ JSONException -> 0x0228 }
        L_0x0228:
            java.lang.String r0 = r7.getOutOfStore     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x022f
            r4.put(r2, r0)     // Catch:{ all -> 0x0c39 }
        L_0x022f:
            boolean r0 = android.text.TextUtils.isEmpty(r12)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "referrer"
            if (r0 != 0) goto L_0x023a
            r4.put(r1, r12)     // Catch:{ all -> 0x0c39 }
        L_0x023a:
            java.lang.String r3 = "extraReferrers"
            r0 = 0
            java.lang.String r3 = r9.getString(r3, r0)     // Catch:{ all -> 0x0c39 }
            if (r3 == 0) goto L_0x0248
            java.lang.String r0 = "extraReferrers"
            r4.put(r0, r3)     // Catch:{ all -> 0x0c39 }
        L_0x0248:
            java.lang.String r0 = r10.getReferrer(r6)     // Catch:{ all -> 0x0c39 }
            boolean r3 = android.text.TextUtils.isEmpty(r0)     // Catch:{ all -> 0x0c39 }
            if (r3 != 0) goto L_0x025b
            java.lang.Object r3 = r4.get(r1)     // Catch:{ all -> 0x0c39 }
            if (r3 != 0) goto L_0x025b
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x025b:
            java.lang.String r11 = "prev_session_dur"
            android.content.SharedPreferences r3 = r8.values     // Catch:{ all -> 0x0c39 }
            r0 = 0
            long r11 = r3.getLong(r11, r0)     // Catch:{ all -> 0x0c39 }
            int r3 = (r11 > r0 ? 1 : (r11 == r0 ? 0 : -1))
            if (r3 == 0) goto L_0x0272
            java.lang.String r1 = "prev_session_dur"
            java.lang.Long r0 = java.lang.Long.valueOf(r11)     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x0272:
            java.lang.String r12 = "exception_number"
            android.app.Application r0 = com.appsflyer.internal.ay.AFKeystoreWrapper     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x02c6
            r0 = -1
            goto L_0x02d4
        L_0x027b:
            r5 = 0
            android.content.SharedPreferences r15 = values((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            android.content.SharedPreferences$Editor r11 = r15.edit()     // Catch:{ all -> 0x0c39 }
            r1 = 0
            r0 = r23
            java.lang.String r13 = r15.getString(r0, r1)     // Catch:{ Exception -> 0x02bf }
            java.lang.String r3 = "prev_event_timestamp"
            if (r13 == 0) goto L_0x02a7
            org.json.JSONObject r12 = new org.json.JSONObject     // Catch:{ Exception -> 0x02bd }
            r12.<init>()     // Catch:{ Exception -> 0x02bd }
            r0 = -1
            long r0 = r15.getLong(r3, r0)     // Catch:{ Exception -> 0x02bb }
            r12.put(r3, r0)     // Catch:{ Exception -> 0x02bb }
            r0 = r23
            r12.put(r0, r13)     // Catch:{ Exception -> 0x02bb }
            java.lang.String r0 = "prev_event"
            r4.put(r0, r12)     // Catch:{ Exception -> 0x02bb }
        L_0x02a7:
            r1 = r23
            r0 = r18
            r11.putString(r1, r0)     // Catch:{ Exception -> 0x02b9 }
            long r0 = java.lang.System.currentTimeMillis()     // Catch:{ Exception -> 0x02b9 }
            r11.putLong(r3, r0)     // Catch:{ Exception -> 0x02b9 }
            r11.apply()     // Catch:{ Exception -> 0x02b9 }
            goto L_0x0308
        L_0x02b9:
            r1 = move-exception
            goto L_0x02c0
        L_0x02bb:
            r1 = move-exception
            goto L_0x02c0
        L_0x02bd:
            r1 = move-exception
            goto L_0x02c0
        L_0x02bf:
            r1 = move-exception
        L_0x02c0:
            java.lang.String r0 = "Error while processing previous event."
            com.appsflyer.AFLogger.valueOf(r0, r1)     // Catch:{ all -> 0x0c39 }
            goto L_0x0308
        L_0x02c6:
            android.app.Application r0 = com.appsflyer.internal.ay.AFKeystoreWrapper     // Catch:{ all -> 0x0c39 }
            android.content.SharedPreferences r11 = values((android.content.Context) r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r3 = "exception_number"
            r0 = 0
            long r0 = r11.getLong(r3, r0)     // Catch:{ all -> 0x0c39 }
        L_0x02d4:
            java.lang.Long r0 = java.lang.Long.valueOf(r0)     // Catch:{ all -> 0x0c39 }
            r4.put(r12, r0)     // Catch:{ all -> 0x0c39 }
            com.appsflyer.internal.bb r11 = r7.setUserEmails     // Catch:{ all -> 0x0c39 }
            if (r11 == 0) goto L_0x0308
            java.util.Map<java.lang.String, java.lang.Object> r0 = r11.values     // Catch:{ all -> 0x0c39 }
            boolean r0 = r0.isEmpty()     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x02ee
            java.lang.String r1 = "partner_data"
            java.util.Map<java.lang.String, java.lang.Object> r0 = r11.values     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x02ee:
            java.util.Map<java.lang.String, java.lang.Object> r0 = r11.AFInAppEventType     // Catch:{ all -> 0x0c39 }
            boolean r0 = r0.isEmpty()     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x0308
            java.util.Map r3 = valueOf((java.util.Map<java.lang.String, java.lang.Object>) r4)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "partner_data"
            java.util.Map<java.lang.String, java.lang.Object> r0 = r11.AFInAppEventType     // Catch:{ all -> 0x0c39 }
            r3.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.util.HashMap r0 = new java.util.HashMap     // Catch:{ all -> 0x0c39 }
            r0.<init>()     // Catch:{ all -> 0x0c39 }
            r11.AFInAppEventType = r0     // Catch:{ all -> 0x0c39 }
        L_0x0308:
            java.lang.String r1 = "KSAppsFlyerId"
            com.appsflyer.AppsFlyerProperties r0 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r3 = r0.getString(r1)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "KSAppsFlyerRICounter"
            com.appsflyer.AppsFlyerProperties r0 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = r0.getString(r1)     // Catch:{ all -> 0x0c39 }
            if (r3 == 0) goto L_0x0334
            if (r1 == 0) goto L_0x0334
            java.lang.Integer r0 = java.lang.Integer.valueOf(r1)     // Catch:{ all -> 0x0c39 }
            int r0 = r0.intValue()     // Catch:{ all -> 0x0c39 }
            if (r0 <= 0) goto L_0x0334
            java.lang.String r0 = "reinstallCounter"
            r4.put(r0, r1)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "originalAppsflyerId"
            r4.put(r0, r3)     // Catch:{ all -> 0x0c39 }
        L_0x0334:
            java.lang.String r1 = "additionalCustomData"
            com.appsflyer.AppsFlyerProperties r0 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = r0.getString(r1)     // Catch:{ all -> 0x0c39 }
            if (r1 == 0) goto L_0x0345
            java.lang.String r0 = "customData"
            r4.put(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x0345:
            android.content.pm.PackageManager r1 = r6.getPackageManager()     // Catch:{ Exception -> 0x0359 }
            java.lang.String r0 = r6.getPackageName()     // Catch:{ Exception -> 0x0359 }
            java.lang.String r1 = r1.getInstallerPackageName(r0)     // Catch:{ Exception -> 0x0359 }
            if (r1 == 0) goto L_0x035f
            java.lang.String r0 = "installer_package"
            r4.put(r0, r1)     // Catch:{ Exception -> 0x0359 }
            goto L_0x035f
        L_0x0359:
            r1 = move-exception
            java.lang.String r0 = "Exception while getting the app's installer package. "
            com.appsflyer.AFLogger.valueOf(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x035f:
            java.lang.String r1 = r10.getString(r14)     // Catch:{ all -> 0x0c39 }
            if (r1 == 0) goto L_0x036e
            int r0 = r1.length()     // Catch:{ all -> 0x0c39 }
            if (r0 <= 0) goto L_0x036e
            r4.put(r14, r1)     // Catch:{ all -> 0x0c39 }
        L_0x036e:
            java.lang.String r3 = r7.valueOf((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = r7.values((android.content.Context) r6, (java.lang.String) r3)     // Catch:{ all -> 0x0c39 }
            if (r1 == 0) goto L_0x037e
            boolean r0 = r1.equals(r3)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x0382
        L_0x037e:
            if (r1 != 0) goto L_0x0387
            if (r3 == 0) goto L_0x0387
        L_0x0382:
            java.lang.String r0 = "af_latestchannel"
            r4.put(r0, r3)     // Catch:{ all -> 0x0c39 }
        L_0x0387:
            android.content.SharedPreferences r3 = values((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            r0 = r29
            boolean r0 = r3.contains(r0)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x039b
            r1 = 0
            r0 = r29
            java.lang.String r3 = r3.getString(r0, r1)     // Catch:{ all -> 0x0c39 }
            goto L_0x03d1
        L_0x039b:
            boolean r0 = AFInAppEventType((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x03cf
            com.appsflyer.AppsFlyerProperties r1 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "api_store_value"
            java.lang.String r3 = r1.getString(r0)     // Catch:{ all -> 0x0c39 }
            if (r3 == 0) goto L_0x03be
        L_0x03ad:
            android.content.SharedPreferences r0 = values((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            android.content.SharedPreferences$Editor r1 = r0.edit()     // Catch:{ all -> 0x0c39 }
            r0 = r29
            r1.putString(r0, r3)     // Catch:{ all -> 0x0c39 }
            r1.apply()     // Catch:{ all -> 0x0c39 }
            goto L_0x03d1
        L_0x03be:
            java.lang.String r3 = "AF_STORE"
            if (r6 == 0) goto L_0x03cf
            android.content.pm.PackageManager r1 = r6.getPackageManager()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r6.getPackageName()     // Catch:{ all -> 0x0c39 }
            java.lang.String r3 = valueOf((java.lang.String) r3, (android.content.pm.PackageManager) r1, (java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            goto L_0x03ad
        L_0x03cf:
            r3 = 0
            goto L_0x03ad
        L_0x03d1:
            if (r3 == 0) goto L_0x03dc
            java.lang.String r1 = "af_installstore"
            java.lang.String r0 = r3.toLowerCase()     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x03dc:
            android.content.SharedPreferences r3 = values((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            com.appsflyer.AppsFlyerProperties r1 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            r0 = r28
            java.lang.String r1 = r1.getString(r0)     // Catch:{ all -> 0x0c39 }
            if (r1 != 0) goto L_0x0480
            r0 = r28
            boolean r0 = r3.contains(r0)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x03fc
            r1 = 0
            r0 = r28
            java.lang.String r1 = r3.getString(r0, r1)     // Catch:{ all -> 0x0c39 }
            goto L_0x0475
        L_0x03fc:
            boolean r0 = AFInAppEventType((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x044f
            java.lang.String r0 = "ro.appsflyer.preinstall.path"
            java.lang.String r0 = values((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            java.io.File r1 = AFKeystoreWrapper((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            boolean r0 = AFInAppEventParameterName((java.io.File) r1)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x0424
            java.lang.String r3 = "AF_PRE_INSTALL_PATH"
            android.content.pm.PackageManager r1 = r6.getPackageManager()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r6.getPackageName()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = valueOf((java.lang.String) r3, (android.content.pm.PackageManager) r1, (java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            java.io.File r1 = AFKeystoreWrapper((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
        L_0x0424:
            boolean r0 = AFInAppEventParameterName((java.io.File) r1)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x0430
            java.lang.String r0 = "/data/local/tmp/pre_install.appsflyer"
            java.io.File r1 = AFKeystoreWrapper((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
        L_0x0430:
            boolean r0 = AFInAppEventParameterName((java.io.File) r1)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x043c
            java.lang.String r0 = "/etc/pre_install.appsflyer"
            java.io.File r1 = AFKeystoreWrapper((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
        L_0x043c:
            boolean r0 = AFInAppEventParameterName((java.io.File) r1)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x0443
            goto L_0x044c
        L_0x0443:
            java.lang.String r0 = r6.getPackageName()     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = values((java.io.File) r1, (java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            goto L_0x044d
        L_0x044c:
            r1 = 0
        L_0x044d:
            if (r1 == 0) goto L_0x0452
        L_0x044f:
            if (r1 == 0) goto L_0x0475
            goto L_0x0465
        L_0x0452:
            java.lang.String r3 = "AF_PRE_INSTALL_NAME"
            if (r6 != 0) goto L_0x0458
            r1 = 0
            goto L_0x044f
        L_0x0458:
            android.content.pm.PackageManager r1 = r6.getPackageManager()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r6.getPackageName()     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = valueOf((java.lang.String) r3, (android.content.pm.PackageManager) r1, (java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            goto L_0x044f
        L_0x0465:
            android.content.SharedPreferences r0 = values((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            android.content.SharedPreferences$Editor r3 = r0.edit()     // Catch:{ all -> 0x0c39 }
            r0 = r28
            r3.putString(r0, r1)     // Catch:{ all -> 0x0c39 }
            r3.apply()     // Catch:{ all -> 0x0c39 }
        L_0x0475:
            if (r1 == 0) goto L_0x0480
            com.appsflyer.AppsFlyerProperties r3 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            r0 = r28
            r3.set((java.lang.String) r0, (java.lang.String) r1)     // Catch:{ all -> 0x0c39 }
        L_0x0480:
            if (r1 == 0) goto L_0x048b
            java.lang.String r3 = "af_preinstall_name"
            java.lang.String r0 = r1.toLowerCase()     // Catch:{ all -> 0x0c39 }
            r4.put(r3, r0)     // Catch:{ all -> 0x0c39 }
        L_0x048b:
            com.appsflyer.AppsFlyerProperties r1 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "api_store_value"
            java.lang.String r0 = r1.getString(r0)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x0498
            goto L_0x04ab
        L_0x0498:
            java.lang.String r3 = "AF_STORE"
            if (r6 != 0) goto L_0x049d
            goto L_0x04aa
        L_0x049d:
            android.content.pm.PackageManager r1 = r6.getPackageManager()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r6.getPackageName()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = valueOf((java.lang.String) r3, (android.content.pm.PackageManager) r1, (java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            goto L_0x04ab
        L_0x04aa:
            r0 = 0
        L_0x04ab:
            if (r0 == 0) goto L_0x04b6
            java.lang.String r1 = "af_currentstore"
            java.lang.String r0 = r0.toLowerCase()     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x04b6:
            java.lang.String r11 = "appsflyerKey"
            if (r27 == 0) goto L_0x04bb
            goto L_0x04d1
        L_0x04bb:
            java.lang.String r1 = "AppsFlyerKey"
            com.appsflyer.AppsFlyerProperties r0 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = r0.getString(r1)     // Catch:{ all -> 0x0c39 }
            if (r1 == 0) goto L_0x0c2d
            int r0 = r1.length()     // Catch:{ all -> 0x0c39 }
            if (r0 <= 0) goto L_0x0c2d
            r4.put(r11, r1)     // Catch:{ all -> 0x0c39 }
            goto L_0x04dc
        L_0x04d1:
            int r0 = r27.length()     // Catch:{ all -> 0x0c39 }
            if (r0 <= 0) goto L_0x04bb
            r0 = r27
            r4.put(r11, r0)     // Catch:{ all -> 0x0c39 }
        L_0x04dc:
            java.lang.String r1 = "AppUserId"
            com.appsflyer.AppsFlyerProperties r0 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = r0.getString(r1)     // Catch:{ all -> 0x0c39 }
            if (r1 == 0) goto L_0x04ed
            java.lang.String r0 = "appUserId"
            r4.put(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x04ed:
            java.lang.String r0 = "userEmails"
            java.lang.String r1 = r10.getString(r0)     // Catch:{ all -> 0x0c39 }
            if (r1 == 0) goto L_0x04fb
            java.lang.String r0 = "user_emails"
            r4.put(r0, r1)     // Catch:{ all -> 0x0c39 }
            goto L_0x0510
        L_0x04fb:
            java.lang.String r1 = "userEmail"
            com.appsflyer.AppsFlyerProperties r0 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r0.getString(r1)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x0510
            java.lang.String r1 = "sha1_el"
            java.lang.String r0 = com.appsflyer.internal.ah.AFKeystoreWrapper(r0)     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x0510:
            if (r18 == 0) goto L_0x0520
            java.lang.String r1 = "eventName"
            r0 = r18
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "eventValue"
            r0 = r22
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x0520:
            com.appsflyer.AppsFlyerProperties r1 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            r0 = r21
            java.lang.String r0 = r1.getString(r0)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x053b
            com.appsflyer.AppsFlyerProperties r1 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            r0 = r21
            java.lang.String r1 = r1.getString(r0)     // Catch:{ all -> 0x0c39 }
            r0 = r21
            r4.put(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x053b:
            java.lang.String r1 = "currencyCode"
            com.appsflyer.AppsFlyerProperties r0 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = r0.getString(r1)     // Catch:{ all -> 0x0c39 }
            if (r1 == 0) goto L_0x0569
            int r3 = r1.length()     // Catch:{ all -> 0x0c39 }
            r0 = 3
            if (r3 == r0) goto L_0x0564
            java.lang.StringBuilder r3 = new java.lang.StringBuilder     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "WARNING: currency code should be 3 characters!!! '"
            r3.<init>(r0)     // Catch:{ all -> 0x0c39 }
            r3.append(r1)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "' is not a legal value."
            r3.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r3.toString()     // Catch:{ all -> 0x0c39 }
            com.appsflyer.AFLogger.AFLogger$LogLevel(r0)     // Catch:{ all -> 0x0c39 }
        L_0x0564:
            java.lang.String r0 = "currency"
            r4.put(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x0569:
            java.lang.String r1 = "IS_UPDATE"
            com.appsflyer.AppsFlyerProperties r0 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = r0.getString(r1)     // Catch:{ all -> 0x0c39 }
            if (r1 == 0) goto L_0x057a
            java.lang.String r0 = "isUpdate"
            r4.put(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x057a:
            boolean r0 = r7.isPreInstalledApp(r6)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "af_preinstalled"
            java.lang.String r0 = java.lang.Boolean.toString(r0)     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "collectFacebookAttrId"
            r0 = 1
            boolean r0 = r10.getBoolean(r1, r0)     // Catch:{ all -> 0x0c39 }
            r3 = 0
            if (r0 == 0) goto L_0x05b3
            android.content.pm.PackageManager r1 = r6.getPackageManager()     // Catch:{ NameNotFoundException -> 0x05a6, all -> 0x059f }
            java.lang.String r0 = "com.facebook.katana"
            INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getApplicationInfo(r1, r0, r3)     // Catch:{ NameNotFoundException -> 0x05a6, all -> 0x059f }
            java.lang.String r1 = r7.getAttributionId(r6)     // Catch:{ NameNotFoundException -> 0x05a6, all -> 0x059f }
            goto L_0x05ac
        L_0x059f:
            r1 = move-exception
            java.lang.String r0 = "Exception while collecting facebook's attribution ID. "
            com.appsflyer.AFLogger.valueOf(r0, r1)     // Catch:{ all -> 0x0c39 }
            goto L_0x05ab
        L_0x05a6:
            java.lang.String r0 = "Exception while collecting facebook's attribution ID. "
            com.appsflyer.AFLogger.AFLogger$LogLevel(r0)     // Catch:{ all -> 0x0c39 }
        L_0x05ab:
            r1 = 0
        L_0x05ac:
            if (r1 == 0) goto L_0x05b3
            java.lang.String r0 = "fb"
            r4.put(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x05b3:
            com.appsflyer.AppsFlyerProperties r13 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "deviceTrackingDisabled"
            boolean r0 = r13.getBoolean(r0, r3)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x05c8
            java.lang.String r1 = "deviceTrackingDisabled"
            java.lang.String r0 = "true"
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            goto L_0x0715
        L_0x05c8:
            android.content.SharedPreferences r12 = values((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "collectIMEI"
            r0 = 1
            boolean r14 = r13.getBoolean(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "imeiCached"
            r0 = 0
            java.lang.String r1 = r12.getString(r1, r0)     // Catch:{ all -> 0x0c39 }
            if (r14 == 0) goto L_0x064c
            java.lang.String r0 = r7.AFVersionDeclaration     // Catch:{ all -> 0x0c39 }
            boolean r0 = android.text.TextUtils.isEmpty(r0)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x064c
            boolean r0 = AppsFlyer2dXConversionCallback((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x0652
            java.lang.Object r15 = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_GetSystemServiceLancet_getSystemService(r6, r2)     // Catch:{ InvocationTargetException -> 0x0634, Exception -> 0x0619 }
            android.telephony.TelephonyManager r15 = (android.telephony.TelephonyManager) r15     // Catch:{ InvocationTargetException -> 0x0634, Exception -> 0x0619 }
            java.lang.Class r14 = r15.getClass()     // Catch:{ InvocationTargetException -> 0x0634, Exception -> 0x0619 }
            java.lang.String r2 = "getDeviceId"
            java.lang.Class[] r0 = new java.lang.Class[r3]     // Catch:{ InvocationTargetException -> 0x0634, Exception -> 0x0617 }
            java.lang.reflect.Method r2 = r14.getMethod(r2, r0)     // Catch:{ InvocationTargetException -> 0x0634, Exception -> 0x0617 }
            java.lang.Object[] r0 = new java.lang.Object[r3]     // Catch:{ InvocationTargetException -> 0x0634, Exception -> 0x0617 }
            java.lang.Object r0 = com_appsflyer_internal_ai_java_lang_reflect_Method_invoke(r2, r15, r0)     // Catch:{ InvocationTargetException -> 0x0634, Exception -> 0x0617 }
            java.lang.String r0 = (java.lang.String) r0     // Catch:{ InvocationTargetException -> 0x0634, Exception -> 0x0617 }
            if (r0 == 0) goto L_0x0607
            goto L_0x0650
        L_0x0607:
            if (r1 == 0) goto L_0x0652
            java.lang.String r2 = java.lang.String.valueOf(r1)     // Catch:{ InvocationTargetException -> 0x0634, Exception -> 0x0617 }
            r0 = r20
            java.lang.String r0 = r0.concat(r2)     // Catch:{ InvocationTargetException -> 0x0634, Exception -> 0x061b }
            com.appsflyer.AFLogger.AFInAppEventType(r0)     // Catch:{ InvocationTargetException -> 0x0634, Exception -> 0x061b }
            goto L_0x0653
        L_0x0617:
            r14 = move-exception
            goto L_0x061c
        L_0x0619:
            r14 = move-exception
            goto L_0x061c
        L_0x061b:
            r14 = move-exception
        L_0x061c:
            if (r1 == 0) goto L_0x061f
            goto L_0x0621
        L_0x061f:
            r1 = 0
            goto L_0x062e
        L_0x0621:
            java.lang.String r2 = java.lang.String.valueOf(r1)     // Catch:{ all -> 0x0c39 }
            r0 = r20
            java.lang.String r0 = r0.concat(r2)     // Catch:{ all -> 0x0c39 }
            com.appsflyer.AFLogger.AFInAppEventType(r0)     // Catch:{ all -> 0x0c39 }
        L_0x062e:
            java.lang.String r0 = "WARNING: other reason: "
            com.appsflyer.AFLogger.valueOf(r0, r14)     // Catch:{ all -> 0x0c39 }
            goto L_0x0653
        L_0x0634:
            if (r1 == 0) goto L_0x0637
            goto L_0x0639
        L_0x0637:
            r1 = 0
            goto L_0x0646
        L_0x0639:
            java.lang.String r2 = java.lang.String.valueOf(r1)     // Catch:{ all -> 0x0c39 }
            r0 = r20
            java.lang.String r0 = r0.concat(r2)     // Catch:{ all -> 0x0c39 }
            com.appsflyer.AFLogger.AFInAppEventType(r0)     // Catch:{ all -> 0x0c39 }
        L_0x0646:
            java.lang.String r0 = "WARNING: READ_PHONE_STATE is missing."
            com.appsflyer.AFLogger.AFLogger$LogLevel(r0)     // Catch:{ all -> 0x0c39 }
            goto L_0x0653
        L_0x064c:
            java.lang.String r0 = r7.AFVersionDeclaration     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x0652
        L_0x0650:
            r1 = r0
            goto L_0x0653
        L_0x0652:
            r1 = 0
        L_0x0653:
            if (r1 == 0) goto L_0x0656
            goto L_0x065c
        L_0x0656:
            java.lang.String r0 = "IMEI was not collected."
            com.appsflyer.AFLogger.valueOf((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            goto L_0x0671
        L_0x065c:
            java.lang.String r2 = "imeiCached"
            android.content.SharedPreferences r0 = values((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            android.content.SharedPreferences$Editor r0 = r0.edit()     // Catch:{ all -> 0x0c39 }
            r0.putString(r2, r1)     // Catch:{ all -> 0x0c39 }
            r0.apply()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "imei"
            r4.put(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x0671:
            java.lang.String r1 = "collectAndroidId"
            r0 = 1
            boolean r2 = r13.getBoolean(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "androidIdCached"
            r0 = 0
            java.lang.String r12 = r12.getString(r1, r0)     // Catch:{ all -> 0x0c39 }
            if (r2 == 0) goto L_0x06c7
            java.lang.String r0 = r7.getLevel     // Catch:{ all -> 0x0c39 }
            boolean r0 = android.text.TextUtils.isEmpty(r0)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x06c7
            boolean r0 = AppsFlyer2dXConversionCallback((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x06cc
            android.content.ContentResolver r1 = r6.getContentResolver()     // Catch:{ Exception -> 0x06ac }
            java.lang.String r0 = "android_id"
            java.lang.String r2 = INVOKESTATIC_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AnndroidIdSecureLancet_getString(r1, r0)     // Catch:{ Exception -> 0x06ac }
            if (r2 == 0) goto L_0x069c
            goto L_0x06d0
        L_0x069c:
            if (r12 == 0) goto L_0x06ce
            java.lang.String r1 = "use cached AndroidId: "
            java.lang.String r0 = java.lang.String.valueOf(r12)     // Catch:{ Exception -> 0x06ac }
            java.lang.String r0 = r1.concat(r0)     // Catch:{ Exception -> 0x06ac }
            com.appsflyer.AFLogger.AFInAppEventType(r0)     // Catch:{ Exception -> 0x06ac }
            goto L_0x06cf
        L_0x06ac:
            r2 = move-exception
            if (r12 == 0) goto L_0x06b0
            goto L_0x06b2
        L_0x06b0:
            r12 = 0
            goto L_0x06bf
        L_0x06b2:
            java.lang.String r1 = "use cached AndroidId: "
            java.lang.String r0 = java.lang.String.valueOf(r12)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r1.concat(r0)     // Catch:{ all -> 0x0c39 }
            com.appsflyer.AFLogger.AFInAppEventType(r0)     // Catch:{ all -> 0x0c39 }
        L_0x06bf:
            java.lang.String r0 = r2.getMessage()     // Catch:{ all -> 0x0c39 }
            com.appsflyer.AFLogger.valueOf(r0, r2)     // Catch:{ all -> 0x0c39 }
            goto L_0x06cf
        L_0x06c7:
            java.lang.String r2 = r7.getLevel     // Catch:{ all -> 0x0c39 }
            if (r2 == 0) goto L_0x06cc
            goto L_0x06d0
        L_0x06cc:
            r2 = 0
            goto L_0x06d0
        L_0x06ce:
            r12 = 0
        L_0x06cf:
            r2 = r12
        L_0x06d0:
            if (r2 == 0) goto L_0x06d3
            goto L_0x06d9
        L_0x06d3:
            java.lang.String r0 = "Android ID was not collected."
            com.appsflyer.AFLogger.valueOf((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            goto L_0x06ee
        L_0x06d9:
            java.lang.String r1 = "androidIdCached"
            android.content.SharedPreferences r0 = values((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            android.content.SharedPreferences$Editor r0 = r0.edit()     // Catch:{ all -> 0x0c39 }
            r0.putString(r1, r2)     // Catch:{ all -> 0x0c39 }
            r0.apply()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "android_id"
            r4.put(r0, r2)     // Catch:{ all -> 0x0c39 }
        L_0x06ee:
            com.appsflyer.internal.c$d$b r12 = com.appsflyer.internal.ad.values(r6)     // Catch:{ all -> 0x0c39 }
            if (r12 == 0) goto L_0x0715
            java.util.HashMap r2 = new java.util.HashMap     // Catch:{ all -> 0x0c39 }
            r2.<init>()     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "isManual"
            java.lang.Boolean r0 = r12.valueOf     // Catch:{ all -> 0x0c39 }
            r2.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "val"
            java.lang.String r0 = r12.values     // Catch:{ all -> 0x0c39 }
            r2.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.Boolean r1 = r12.AFKeystoreWrapper     // Catch:{ all -> 0x0c39 }
            if (r1 == 0) goto L_0x0710
            java.lang.String r0 = "isLat"
            r2.put(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x0710:
            java.lang.String r0 = "oaid"
            r4.put(r0, r2)     // Catch:{ all -> 0x0c39 }
        L_0x0715:
            java.lang.ref.WeakReference r0 = new java.lang.ref.WeakReference     // Catch:{ Exception -> 0x0728 }
            r0.<init>(r6)     // Catch:{ Exception -> 0x0728 }
            java.lang.String r1 = com.appsflyer.internal.ak.AFInAppEventParameterName((java.lang.ref.WeakReference<android.content.Context>) r0)     // Catch:{ Exception -> 0x0728 }
            if (r1 == 0) goto L_0x073e
            r0 = r16
            r4.put(r0, r1)     // Catch:{ Exception -> 0x0726 }
            goto L_0x073e
        L_0x0726:
            r2 = move-exception
            goto L_0x0729
        L_0x0728:
            r2 = move-exception
        L_0x0729:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "ERROR: could not get uid "
            r1.<init>(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r2.getMessage()     // Catch:{ all -> 0x0c39 }
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x0c39 }
            com.appsflyer.AFLogger.valueOf(r0, r2)     // Catch:{ all -> 0x0c39 }
        L_0x073e:
            java.lang.String r1 = "lang"
            java.util.Locale r0 = java.util.Locale.getDefault()     // Catch:{ Exception -> 0x074c }
            java.lang.String r0 = r0.getDisplayLanguage()     // Catch:{ Exception -> 0x074c }
            r4.put(r1, r0)     // Catch:{ Exception -> 0x074c }
            goto L_0x0752
        L_0x074c:
            r1 = move-exception
            java.lang.String r0 = "Exception while collecting display language name. "
            com.appsflyer.AFLogger.valueOf(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x0752:
            java.lang.String r1 = "lang_code"
            java.util.Locale r0 = java.util.Locale.getDefault()     // Catch:{ Exception -> 0x0760 }
            java.lang.String r0 = r0.getLanguage()     // Catch:{ Exception -> 0x0760 }
            r4.put(r1, r0)     // Catch:{ Exception -> 0x0760 }
            goto L_0x0766
        L_0x0760:
            r1 = move-exception
            java.lang.String r0 = "Exception while collecting display language code. "
            com.appsflyer.AFLogger.valueOf(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x0766:
            java.lang.String r1 = "country"
            java.util.Locale r0 = java.util.Locale.getDefault()     // Catch:{ Exception -> 0x0774 }
            java.lang.String r0 = r0.getCountry()     // Catch:{ Exception -> 0x0774 }
            r4.put(r1, r0)     // Catch:{ Exception -> 0x0774 }
            goto L_0x077a
        L_0x0774:
            r1 = move-exception
            java.lang.String r0 = "Exception while collecting country name. "
            com.appsflyer.AFLogger.valueOf(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x077a:
            java.lang.String r1 = "platformextension"
            com.appsflyer.internal.an r0 = r7.enableLocationCollection     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r0.AFKeystoreWrapper()     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            AFKeystoreWrapper((android.content.Context) r6, (java.util.Map<java.lang.String, ? super java.lang.String>) r4)     // Catch:{ all -> 0x0c39 }
            java.text.SimpleDateFormat r12 = new java.text.SimpleDateFormat     // Catch:{ all -> 0x0c39 }
            java.util.Locale r1 = java.util.Locale.US     // Catch:{ all -> 0x0c39 }
            r0 = r19
            r12.<init>(r0, r1)     // Catch:{ all -> 0x0c39 }
            android.content.pm.PackageManager r1 = r6.getPackageManager()     // Catch:{ Exception -> 0x07b7 }
            java.lang.String r0 = r6.getPackageName()     // Catch:{ Exception -> 0x07b7 }
            android.content.pm.PackageInfo r0 = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getPackageInfo(r1, r0, r3)     // Catch:{ Exception -> 0x07b7 }
            long r0 = r0.firstInstallTime     // Catch:{ Exception -> 0x07b7 }
            java.lang.String r2 = "installDate"
            java.lang.String r13 = "UTC"
            java.util.TimeZone r13 = java.util.TimeZone.getTimeZone(r13)     // Catch:{ Exception -> 0x07b7 }
            r12.setTimeZone(r13)     // Catch:{ Exception -> 0x07b7 }
            java.util.Date r13 = new java.util.Date     // Catch:{ Exception -> 0x07b7 }
            r13.<init>(r0)     // Catch:{ Exception -> 0x07b7 }
            java.lang.String r0 = r12.format(r13)     // Catch:{ Exception -> 0x07b7 }
            r4.put(r2, r0)     // Catch:{ Exception -> 0x07b7 }
            goto L_0x07bd
        L_0x07b7:
            r1 = move-exception
            java.lang.String r0 = "Exception while collecting install date. "
            com.appsflyer.AFLogger.valueOf(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x07bd:
            android.content.pm.PackageManager r1 = r6.getPackageManager()     // Catch:{ all -> 0x0842 }
            java.lang.String r0 = r6.getPackageName()     // Catch:{ all -> 0x0842 }
            android.content.pm.PackageInfo r13 = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getPackageInfo(r1, r0, r3)     // Catch:{ all -> 0x0842 }
            java.lang.String r0 = "versionCode"
            int r1 = r9.getInt(r0, r3)     // Catch:{ all -> 0x0842 }
            int r0 = r13.versionCode     // Catch:{ all -> 0x0842 }
            if (r0 <= r1) goto L_0x07e8
            java.lang.String r2 = "versionCode"
            int r1 = r13.versionCode     // Catch:{ all -> 0x07e6 }
            android.content.SharedPreferences r0 = values((android.content.Context) r6)     // Catch:{ all -> 0x07e6 }
            android.content.SharedPreferences$Editor r0 = r0.edit()     // Catch:{ all -> 0x07e6 }
            r0.putInt(r2, r1)     // Catch:{ all -> 0x07e6 }
            r0.apply()     // Catch:{ all -> 0x07e6 }
            goto L_0x07e8
        L_0x07e6:
            r1 = move-exception
            goto L_0x0843
        L_0x07e8:
            java.lang.String r1 = "app_version_code"
            int r0 = r13.versionCode     // Catch:{ all -> 0x0842 }
            java.lang.String r0 = java.lang.Integer.toString(r0)     // Catch:{ all -> 0x0842 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0842 }
            java.lang.String r1 = "app_version_name"
            java.lang.String r0 = r13.versionName     // Catch:{ all -> 0x0842 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0842 }
            long r2 = r13.firstInstallTime     // Catch:{ all -> 0x0842 }
            long r0 = r13.lastUpdateTime     // Catch:{ all -> 0x0842 }
            java.lang.String r14 = "date1"
            java.text.SimpleDateFormat r15 = new java.text.SimpleDateFormat     // Catch:{ all -> 0x0840 }
            java.util.Locale r13 = java.util.Locale.US     // Catch:{ all -> 0x083e }
            r20 = r15
            r21 = r19
            r22 = r13
            r20.<init>(r21, r22)     // Catch:{ all -> 0x083e }
            java.util.Date r13 = new java.util.Date     // Catch:{ all -> 0x083e }
            r13.<init>(r2)     // Catch:{ all -> 0x083e }
            java.lang.String r2 = r15.format(r13)     // Catch:{ all -> 0x083e }
            r4.put(r14, r2)     // Catch:{ all -> 0x083e }
            java.lang.String r13 = "date2"
            java.text.SimpleDateFormat r3 = new java.text.SimpleDateFormat     // Catch:{ all -> 0x083e }
            java.util.Locale r2 = java.util.Locale.US     // Catch:{ all -> 0x083e }
            r20 = r3
            r21 = r19
            r22 = r2
            r20.<init>(r21, r22)     // Catch:{ all -> 0x083e }
            java.util.Date r2 = new java.util.Date     // Catch:{ all -> 0x083e }
            r2.<init>(r0)     // Catch:{ all -> 0x083e }
            java.lang.String r0 = r3.format(r2)     // Catch:{ all -> 0x083e }
            r4.put(r13, r0)     // Catch:{ all -> 0x083e }
            java.lang.String r1 = r7.AFInAppEventType(r12, r6)     // Catch:{ all -> 0x083e }
            java.lang.String r0 = "firstLaunchDate"
            r4.put(r0, r1)     // Catch:{ all -> 0x083e }
            goto L_0x0848
        L_0x083e:
            r1 = move-exception
            goto L_0x0843
        L_0x0840:
            r1 = move-exception
            goto L_0x0843
        L_0x0842:
            r1 = move-exception
        L_0x0843:
            java.lang.String r0 = "Exception while collecting app version data "
            com.appsflyer.AFLogger.valueOf(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x0848:
            boolean r0 = com.appsflyer.internal.bq.values((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            r7.stop = r0     // Catch:{ all -> 0x0c39 }
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "didConfigureTokenRefreshService="
            r1.<init>(r0)     // Catch:{ all -> 0x0c39 }
            boolean r0 = r7.stop     // Catch:{ all -> 0x0c39 }
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x0c39 }
            com.appsflyer.AFLogger.AFInAppEventType(r0)     // Catch:{ all -> 0x0c39 }
            boolean r0 = r7.stop     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x086c
            java.lang.String r1 = "tokenRefreshConfigured"
            java.lang.Boolean r0 = java.lang.Boolean.FALSE     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x086c:
            if (r5 == 0) goto L_0x08a2
            java.lang.String r0 = r7.getSdkVersion     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x087f
            java.lang.String r0 = "af_deeplink"
            java.lang.Object r0 = r4.get(r0)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x088a
            java.lang.String r0 = "Skip 'af' payload as deeplink was found by path"
            com.appsflyer.AFLogger.AFInAppEventType(r0)     // Catch:{ all -> 0x0c39 }
        L_0x087f:
            r0 = 0
            r7.getSdkVersion = r0     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "open_referrer"
            r0 = r30
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            goto L_0x08a2
        L_0x088a:
            org.json.JSONObject r2 = new org.json.JSONObject     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r7.getSdkVersion     // Catch:{ all -> 0x0c39 }
            r2.<init>(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "isPush"
            java.lang.String r0 = "true"
            r2.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "af_deeplink"
            java.lang.String r0 = r2.toString()     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            goto L_0x087f
        L_0x08a2:
            java.lang.String r12 = "sensors"
            if (r5 != 0) goto L_0x08e5
            com.appsflyer.internal.ab r0 = com.appsflyer.internal.ab.AFKeystoreWrapper((android.content.Context) r6)     // Catch:{ Exception -> 0x08cf }
            java.util.concurrent.ConcurrentHashMap r2 = new java.util.concurrent.ConcurrentHashMap     // Catch:{ Exception -> 0x08cf }
            r2.<init>()     // Catch:{ Exception -> 0x08cf }
            java.util.List r1 = r0.AFInAppEventType()     // Catch:{ Exception -> 0x08cf }
            boolean r0 = r1.isEmpty()     // Catch:{ Exception -> 0x08cf }
            if (r0 != 0) goto L_0x08c9
            com.appsflyer.internal.h r0 = new com.appsflyer.internal.h     // Catch:{ Exception -> 0x08cf }
            r0.<init>()     // Catch:{ Exception -> 0x08cf }
            java.util.Map r0 = r0.AFInAppEventParameterName(r1)     // Catch:{ Exception -> 0x08cf }
            r2.put(r12, r0)     // Catch:{ Exception -> 0x08cf }
        L_0x08c5:
            r4.putAll(r2)     // Catch:{ Exception -> 0x08cf }
            goto L_0x08e5
        L_0x08c9:
            java.lang.String r0 = "na"
            r2.put(r12, r0)     // Catch:{ Exception -> 0x08cf }
            goto L_0x08c5
        L_0x08cf:
            r2 = move-exception
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "Unexpected exception from AFSensorManager: "
            r1.<init>(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r2.getMessage()     // Catch:{ all -> 0x0c39 }
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x0c39 }
            com.appsflyer.AFLogger.AFInAppEventParameterName((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
        L_0x08e5:
            java.lang.String r1 = "advertiserId"
            com.appsflyer.AppsFlyerProperties r0 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r0.getString(r1)     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x090c
            com.appsflyer.internal.ad.AFInAppEventType(r6, r4)     // Catch:{ all -> 0x0c39 }
            java.lang.String r2 = "GAID_retry"
            java.lang.String r1 = "advertiserId"
            com.appsflyer.AppsFlyerProperties r0 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r0.getString(r1)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x0904
            r0 = 1
            goto L_0x0905
        L_0x0904:
            r0 = 0
        L_0x0905:
            java.lang.String r0 = java.lang.String.valueOf(r0)     // Catch:{ all -> 0x0c39 }
            r4.put(r2, r0)     // Catch:{ all -> 0x0c39 }
        L_0x090c:
            android.content.ContentResolver r0 = r6.getContentResolver()     // Catch:{ all -> 0x0c39 }
            com.appsflyer.internal.c$d$b r2 = com.appsflyer.internal.ad.AFInAppEventParameterName(r0)     // Catch:{ all -> 0x0c39 }
            if (r2 == 0) goto L_0x0928
            java.lang.String r1 = "amazon_aid"
            java.lang.String r0 = r2.values     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "amazon_aid_limit"
            java.lang.Boolean r0 = r2.AFKeystoreWrapper     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = java.lang.String.valueOf(r0)     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x0928:
            boolean r0 = com.appsflyer.internal.bq.values((android.content.SharedPreferences) r9)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "registeredUninstall"
            java.lang.Boolean r0 = java.lang.Boolean.valueOf(r0)     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "appsFlyerCount"
            int r2 = AFInAppEventParameterName(r9, r0, r5)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "counter"
            java.lang.String r0 = java.lang.Integer.toString(r2)     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r3 = "iaecounter"
            if (r18 == 0) goto L_0x094a
            r1 = 1
            goto L_0x094b
        L_0x094a:
            r1 = 0
        L_0x094b:
            java.lang.String r0 = "appsFlyerInAppEventCount"
            int r0 = AFInAppEventParameterName(r9, r0, r1)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = java.lang.Integer.toString(r0)     // Catch:{ all -> 0x0c39 }
            r4.put(r3, r0)     // Catch:{ all -> 0x0c39 }
            if (r5 == 0) goto L_0x0960
            r0 = 1
            if (r2 == r0) goto L_0x0979
            r0 = 2
            if (r2 == r0) goto L_0x0962
        L_0x0960:
            r3 = 1
            goto L_0x09c3
        L_0x0962:
            java.util.Map r3 = valueOf((java.util.Map<java.lang.String, java.lang.Object>) r4)     // Catch:{ all -> 0x0c39 }
            java.util.HashMap r1 = new java.util.HashMap     // Catch:{ all -> 0x0c39 }
            java.util.Map<java.lang.String, java.lang.Object> r0 = r8.AFKeystoreWrapper     // Catch:{ all -> 0x0c39 }
            r1.<init>(r0)     // Catch:{ all -> 0x0c39 }
            boolean r0 = r1.isEmpty()     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x0960
            java.lang.String r0 = "first_launch"
            r3.put(r0, r1)     // Catch:{ all -> 0x0c39 }
            goto L_0x0960
        L_0x0979:
            r3 = 1
            r10.valueOf = r3     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "waitForCustomerId"
            r0 = 0
            boolean r0 = AFInAppEventParameterName((java.lang.String) r1, (boolean) r0)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x098e
            java.lang.String r1 = "wait_cid"
            java.lang.String r0 = java.lang.Boolean.toString(r3)     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x098e:
            java.util.Map r10 = valueOf((java.util.Map<java.lang.String, java.lang.Object>) r4)     // Catch:{ all -> 0x0c39 }
            java.lang.String r13 = "ddl"
            android.content.SharedPreferences r1 = r8.values     // Catch:{ all -> 0x0c39 }
            r0 = 0
            java.lang.String r1 = r1.getString(r13, r0)     // Catch:{ all -> 0x0c39 }
            if (r1 == 0) goto L_0x09b1
            org.json.JSONObject r0 = new org.json.JSONObject     // Catch:{ all -> 0x0c39 }
            r0.<init>(r1)     // Catch:{ all -> 0x0c39 }
            java.util.Map r1 = com.appsflyer.internal.o.values(r0)     // Catch:{ all -> 0x0c39 }
            boolean r0 = r1.isEmpty()     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x09b1
            java.lang.String r0 = "ddl"
            r10.put(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x09b1:
            java.util.HashMap r1 = new java.util.HashMap     // Catch:{ all -> 0x0c39 }
            java.util.Map<java.lang.String, java.lang.Object> r0 = r8.AFKeystoreWrapper     // Catch:{ all -> 0x0c39 }
            r1.<init>(r0)     // Catch:{ all -> 0x0c39 }
            boolean r0 = r1.isEmpty()     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x09c3
            java.lang.String r0 = "first_launch"
            r10.put(r0, r1)     // Catch:{ all -> 0x0c39 }
        L_0x09c3:
            java.lang.String r1 = "isFirstCall"
            boolean r0 = valueOf((android.content.SharedPreferences) r9)     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x0a04
        L_0x09cb:
            java.lang.String r0 = java.lang.Boolean.toString(r3)     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.util.HashMap r3 = new java.util.HashMap     // Catch:{ all -> 0x0c39 }
            r3.<init>()     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "cpu_abi"
            java.lang.String r0 = "ro.product.cpu.abi"
            java.lang.String r0 = values((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            r3.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "cpu_abi2"
            java.lang.String r0 = "ro.product.cpu.abi2"
            java.lang.String r0 = values((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            r3.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "arch"
            java.lang.String r0 = "os.arch"
            java.lang.String r0 = values((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            r3.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "build_display_id"
            java.lang.String r0 = "ro.build.display.id"
            java.lang.String r0 = values((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            r3.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            goto L_0x0a06
        L_0x0a04:
            r3 = 0
            goto L_0x09cb
        L_0x0a06:
            if (r5 == 0) goto L_0x0a84
            boolean r0 = r7.updateServerUninstallToken     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x0a4c
            com.appsflyer.internal.x r0 = com.appsflyer.internal.x.d.AFInAppEventType     // Catch:{ all -> 0x0c39 }
            android.location.Location r13 = r0.AFInAppEventType(r6)     // Catch:{ all -> 0x0c39 }
            java.util.HashMap r10 = new java.util.HashMap     // Catch:{ all -> 0x0c39 }
            r0 = 3
            r10.<init>(r0)     // Catch:{ all -> 0x0c39 }
            if (r13 == 0) goto L_0x0a41
            java.lang.String r5 = "lat"
            double r0 = r13.getLatitude()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = java.lang.String.valueOf(r0)     // Catch:{ all -> 0x0c39 }
            r10.put(r5, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r5 = "lon"
            double r0 = r13.getLongitude()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = java.lang.String.valueOf(r0)     // Catch:{ all -> 0x0c39 }
            r10.put(r5, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r5 = "ts"
            long r0 = r13.getTime()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = java.lang.String.valueOf(r0)     // Catch:{ all -> 0x0c39 }
            r10.put(r5, r0)     // Catch:{ all -> 0x0c39 }
        L_0x0a41:
            boolean r0 = r10.isEmpty()     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x0a4c
            java.lang.String r0 = "loc"
            r3.put(r0, r10)     // Catch:{ all -> 0x0c39 }
        L_0x0a4c:
            com.appsflyer.internal.e r0 = com.appsflyer.internal.e.C0001e.AFInAppEventParameterName     // Catch:{ all -> 0x0c39 }
            com.appsflyer.internal.e$b r5 = r0.AFInAppEventType(r6)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "btl"
            float r0 = r5.AFInAppEventParameterName     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = java.lang.Float.toString(r0)     // Catch:{ all -> 0x0c39 }
            r3.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r5.AFKeystoreWrapper     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x0a68
            java.lang.String r1 = "btch"
            java.lang.String r0 = r5.AFKeystoreWrapper     // Catch:{ all -> 0x0c39 }
            r3.put(r1, r0)     // Catch:{ all -> 0x0c39 }
        L_0x0a68:
            r0 = 2
            if (r2 > r0) goto L_0x0a84
            com.appsflyer.internal.ab r5 = com.appsflyer.internal.ab.AFKeystoreWrapper((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            java.util.concurrent.ConcurrentHashMap r2 = new java.util.concurrent.ConcurrentHashMap     // Catch:{ all -> 0x0c39 }
            r2.<init>()     // Catch:{ all -> 0x0c39 }
            java.util.List r1 = r5.values()     // Catch:{ all -> 0x0c39 }
            boolean r0 = r1.isEmpty()     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x0c1e
            r2.put(r12, r1)     // Catch:{ all -> 0x0c39 }
        L_0x0a81:
            r3.putAll(r2)     // Catch:{ all -> 0x0c39 }
        L_0x0a84:
            java.util.Map r1 = com.appsflyer.internal.v.values(r6)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "dim"
            r3.put(r0, r1)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "deviceData"
            r4.put(r0, r3)     // Catch:{ all -> 0x0c39 }
            java.lang.Object r12 = r4.get(r11)     // Catch:{ all -> 0x0c39 }
            java.lang.String r12 = (java.lang.String) r12     // Catch:{ all -> 0x0c39 }
            r0 = r17
            java.lang.Object r10 = r4.get(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r10 = (java.lang.String) r10     // Catch:{ all -> 0x0c39 }
            r0 = r16
            java.lang.Object r5 = r4.get(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r5 = (java.lang.String) r5     // Catch:{ all -> 0x0c39 }
            java.lang.StringBuilder r3 = new java.lang.StringBuilder     // Catch:{ all -> 0x0c39 }
            r3.<init>()     // Catch:{ all -> 0x0c39 }
            r2 = 7
            r1 = 0
            java.lang.String r0 = r12.substring(r1, r2)     // Catch:{ all -> 0x0c39 }
            r3.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r5.substring(r1, r2)     // Catch:{ all -> 0x0c39 }
            r3.append(r0)     // Catch:{ all -> 0x0c39 }
            int r0 = r10.length()     // Catch:{ all -> 0x0c39 }
            int r0 = r0 - r2
            java.lang.String r0 = r10.substring(r0)     // Catch:{ all -> 0x0c39 }
            r3.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r3.toString()     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = com.appsflyer.internal.ah.AFKeystoreWrapper(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "af_v"
            r4.put(r0, r1)     // Catch:{ all -> 0x0c39 }
            java.lang.Object r0 = r4.get(r11)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = (java.lang.String) r0     // Catch:{ all -> 0x0c39 }
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x0c39 }
            r1.<init>()     // Catch:{ all -> 0x0c39 }
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            r0 = r17
            java.lang.Object r0 = r4.get(r0)     // Catch:{ all -> 0x0c39 }
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x0c39 }
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x0c39 }
            r1.<init>()     // Catch:{ all -> 0x0c39 }
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            r0 = r16
            java.lang.Object r0 = r4.get(r0)     // Catch:{ all -> 0x0c39 }
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x0c39 }
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x0c39 }
            r1.<init>()     // Catch:{ all -> 0x0c39 }
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "installDate"
            java.lang.Object r0 = r4.get(r0)     // Catch:{ all -> 0x0c39 }
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x0c39 }
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x0c39 }
            r1.<init>()     // Catch:{ all -> 0x0c39 }
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "counter"
            java.lang.Object r0 = r4.get(r0)     // Catch:{ all -> 0x0c39 }
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x0c39 }
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x0c39 }
            r1.<init>()     // Catch:{ all -> 0x0c39 }
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "iaecounter"
            java.lang.Object r0 = r4.get(r0)     // Catch:{ all -> 0x0c39 }
            r1.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = com.appsflyer.internal.ah.AFInAppEventType(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = com.appsflyer.internal.ah.AFKeystoreWrapper(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "af_v2"
            r4.put(r0, r1)     // Catch:{ all -> 0x0c39 }
            boolean r0 = getLevel((android.content.Context) r6)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "ivc"
            java.lang.Boolean r0 = java.lang.Boolean.valueOf(r0)     // Catch:{ all -> 0x0c39 }
            r4.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "is_stop_tracking_used"
            boolean r0 = r9.contains(r0)     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x0b77
            java.lang.String r2 = "istu"
            java.lang.String r1 = "is_stop_tracking_used"
            r0 = 0
            boolean r0 = r9.getBoolean(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = java.lang.String.valueOf(r0)     // Catch:{ all -> 0x0c39 }
            r4.put(r2, r0)     // Catch:{ all -> 0x0c39 }
        L_0x0b77:
            java.util.HashMap r2 = new java.util.HashMap     // Catch:{ all -> 0x0c39 }
            r2.<init>()     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "mcc"
            android.content.res.Resources r0 = r6.getResources()     // Catch:{ all -> 0x0c39 }
            android.content.res.Configuration r0 = r0.getConfiguration()     // Catch:{ all -> 0x0c39 }
            int r0 = r0.mcc     // Catch:{ all -> 0x0c39 }
            java.lang.Integer r0 = java.lang.Integer.valueOf(r0)     // Catch:{ all -> 0x0c39 }
            r2.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r1 = "mnc"
            android.content.res.Resources r0 = r6.getResources()     // Catch:{ all -> 0x0c39 }
            android.content.res.Configuration r0 = r0.getConfiguration()     // Catch:{ all -> 0x0c39 }
            int r0 = r0.mnc     // Catch:{ all -> 0x0c39 }
            java.lang.Integer r0 = java.lang.Integer.valueOf(r0)     // Catch:{ all -> 0x0c39 }
            r2.put(r1, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "cell"
            r4.put(r0, r2)     // Catch:{ all -> 0x0c39 }
            java.lang.String r2 = "sig"
            android.app.Application r0 = r8.valueOf     // Catch:{ all -> 0x0c39 }
            android.content.pm.PackageManager r1 = r0.getPackageManager()     // Catch:{ all -> 0x0c39 }
            android.app.Application r0 = r8.valueOf     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r0.getPackageName()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = com.appsflyer.internal.ac.values((android.content.pm.PackageManager) r1, (java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            r4.put(r2, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r5 = "last_boot_time"
            long r2 = java.lang.System.currentTimeMillis()     // Catch:{ all -> 0x0c39 }
            long r0 = android.os.SystemClock.elapsedRealtime()     // Catch:{ all -> 0x0c39 }
            long r2 = r2 - r0
            java.lang.Long r0 = java.lang.Long.valueOf(r2)     // Catch:{ all -> 0x0c39 }
            r4.put(r5, r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r10 = "disk"
            android.os.StatFs r2 = new android.os.StatFs     // Catch:{ all -> 0x0c39 }
            java.io.File r0 = android.os.Environment.getDataDirectory()     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r0.getAbsolutePath()     // Catch:{ all -> 0x0c39 }
            r2.<init>(r0)     // Catch:{ all -> 0x0c39 }
            long r0 = r2.getBlockSizeLong()     // Catch:{ all -> 0x0c39 }
            long r5 = r2.getAvailableBlocksLong()     // Catch:{ all -> 0x0c39 }
            long r5 = r5 * r0
            long r8 = r2.getBlockCountLong()     // Catch:{ all -> 0x0c39 }
            long r8 = r8 * r0
            r2 = 4611686018427387904(0x4000000000000000, double:2.0)
            r0 = 4626322717216342016(0x4034000000000000, double:20.0)
            double r11 = java.lang.Math.pow(r2, r0)     // Catch:{ all -> 0x0c39 }
            double r0 = (double) r5     // Catch:{ all -> 0x0c39 }
            double r0 = r0 / r11
            long r5 = (long) r0     // Catch:{ all -> 0x0c39 }
            double r2 = (double) r8     // Catch:{ all -> 0x0c39 }
            double r2 = r2 / r11
            long r0 = (long) r2     // Catch:{ all -> 0x0c39 }
            java.lang.StringBuilder r3 = new java.lang.StringBuilder     // Catch:{ all -> 0x0c39 }
            r3.<init>()     // Catch:{ all -> 0x0c39 }
            r3.append(r5)     // Catch:{ all -> 0x0c39 }
            java.lang.String r2 = "/"
            r3.append(r2)     // Catch:{ all -> 0x0c39 }
            r3.append(r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = r3.toString()     // Catch:{ all -> 0x0c39 }
            r4.put(r10, r0)     // Catch:{ all -> 0x0c39 }
            com.appsflyer.internal.l r0 = r7.onAppOpenAttributionNative     // Catch:{ all -> 0x0c39 }
            if (r0 == 0) goto L_0x0c41
            java.lang.String[] r1 = r0.valueOf     // Catch:{ all -> 0x0c39 }
            if (r1 == 0) goto L_0x0c41
            java.lang.String r0 = "sharing_filter"
            r4.put(r0, r1)     // Catch:{ all -> 0x0c39 }
            goto L_0x0c41
        L_0x0c1e:
            java.util.List r1 = r5.AFInAppEventType()     // Catch:{ all -> 0x0c39 }
            boolean r0 = r1.isEmpty()     // Catch:{ all -> 0x0c39 }
            if (r0 != 0) goto L_0x0a81
            r2.put(r12, r1)     // Catch:{ all -> 0x0c39 }
            goto L_0x0a81
        L_0x0c2d:
            java.lang.String r0 = "AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. "
            com.appsflyer.AFLogger.valueOf((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            java.lang.String r0 = "AppsFlyer will not track this event."
            com.appsflyer.AFLogger.valueOf((java.lang.String) r0)     // Catch:{ all -> 0x0c39 }
            r0 = 0
            return r0
        L_0x0c39:
            r1 = move-exception
            java.lang.String r0 = r1.getLocalizedMessage()
            com.appsflyer.AFLogger.values((java.lang.String) r0, (java.lang.Throwable) r1)
        L_0x0c41:
            return r4
        */
        throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.ai.valueOf(com.appsflyer.internal.j):java.util.Map");
    }

    public class b implements Runnable {
        public final j AFInAppEventType;

        static {
            Covode.recordClassIndex(2603);
        }

        public final void run() {
            ai.values(ai.this, this.AFInAppEventType);
        }

        public b(j jVar) {
            this.AFInAppEventType = jVar;
        }

        public /* synthetic */ b(ai aiVar, j jVar, byte b) {
            this(jVar);
        }
    }

    private boolean AFInAppEventParameterName() {
        Map<String, Object> map = this.setCustomerUserId;
        if (map == null || map.isEmpty()) {
            return false;
        }
        return true;
    }

    private boolean AFLogger$LogLevel() {
        Map<String, Object> map = this.waitForCustomerUserId;
        if (map == null || map.isEmpty()) {
            return false;
        }
        return true;
    }

    public final String getHostName() {
        String string = AppsFlyerProperties.getInstance().getString("custom_host");
        if (string != null) {
            return string;
        }
        return "appsflyer.com";
    }

    public final String getHostPrefix() {
        String string = AppsFlyerProperties.getInstance().getString("custom_host_prefix");
        if (string != null) {
            return string;
        }
        return "";
    }

    public final void setSharingFilterForAllPartners() {
        setSharingFilterForPartners("all");
    }

    public static ExecutorService INVOKESTATIC_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_thread_ThreadPoolLancet_newSingleThreadExecutor() {
        8e1 LIZ = 8e2.LIZ(8eG.FIXED);
        LIZ.LIZJ = 1;
        return 8eL.LIZ(LIZ.LIZ());
    }

    public final boolean AFInAppEventType() {
        if (!AFInAppEventParameterName("waitForCustomerId", false) || AppsFlyerProperties.getInstance().getString("AppUserId") != null) {
            return false;
        }
        return true;
    }

    public final void unregisterConversionListener() {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "unregisterConversionListener", new String[0]);
        AFInAppEventType = null;
    }

    /* renamed from: com.appsflyer.internal.ai$7  reason: invalid class name */
    public static /* synthetic */ class AnonymousClass7 {
        public static final /* synthetic */ int[] AFInAppEventParameterName;
        public static final /* synthetic */ int[] values;

        /* JADX WARNING: Can't wrap try/catch for region: R(11:0|1|2|3|(2:5|6)|7|9|10|11|12|14) */
        /* JADX WARNING: Code restructure failed: missing block: B:15:?, code lost:
            return;
         */
        /* JADX WARNING: Failed to process nested try/catch */
        /* JADX WARNING: Missing exception handler attribute for start block: B:11:0x0033 */
        static {
            /*
                r0 = 2601(0xa29, float:3.645E-42)
                com.bytedance.covode.number.Covode.recordClassIndex(r0)
                com.appsflyer.internal.cl$a[] r0 = com.appsflyer.internal.cl.a.values()
                int r0 = r0.length
                int[] r1 = new int[r0]
                AFInAppEventParameterName = r1
                r3 = 1
                com.appsflyer.internal.cl$a r0 = com.appsflyer.internal.cl.a.FINISHED     // Catch:{ NoSuchFieldError -> 0x0017 }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0017 }
                r1[r0] = r3     // Catch:{ NoSuchFieldError -> 0x0017 }
            L_0x0017:
                r2 = 2
                int[] r1 = AFInAppEventParameterName     // Catch:{ NoSuchFieldError -> 0x0022 }
                com.appsflyer.internal.cl$a r0 = com.appsflyer.internal.cl.a.STARTED     // Catch:{ NoSuchFieldError -> 0x0022 }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0022 }
                r1[r0] = r2     // Catch:{ NoSuchFieldError -> 0x0022 }
            L_0x0022:
                com.appsflyer.AppsFlyerProperties$EmailsCryptType[] r0 = com.appsflyer.AppsFlyerProperties.EmailsCryptType.values()
                int r0 = r0.length
                int[] r1 = new int[r0]
                values = r1
                com.appsflyer.AppsFlyerProperties$EmailsCryptType r0 = com.appsflyer.AppsFlyerProperties.EmailsCryptType.SHA256     // Catch:{ NoSuchFieldError -> 0x0033 }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0033 }
                r1[r0] = r3     // Catch:{ NoSuchFieldError -> 0x0033 }
            L_0x0033:
                int[] r1 = values     // Catch:{ NoSuchFieldError -> 0x003d }
                com.appsflyer.AppsFlyerProperties$EmailsCryptType r0 = com.appsflyer.AppsFlyerProperties.EmailsCryptType.NONE     // Catch:{ NoSuchFieldError -> 0x003d }
                int r0 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x003d }
                r1[r0] = r2     // Catch:{ NoSuchFieldError -> 0x003d }
            L_0x003d:
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.ai.AnonymousClass7.<clinit>():void");
        }
    }

    public ai() {
        AFVersionDeclaration.init();
        this.setAdditionalData = new be();
    }

    public final String getSdkVersion() {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "getSdkVersion", new String[0]);
        StringBuilder sb = new StringBuilder("version: 6.4.0 (build ");
        sb.append(AFInAppEventParameterName);
        sb.append(")");
        return sb.toString();
    }

    public class e implements Runnable {
        public final Application valueOf;

        static {
            Covode.recordClassIndex(2605);
        }

        public final void run() {
            if (!ai.this.AppsFlyerInAppPurchaseValidatorListener) {
                ai.this.AppsFlyer2dXConversionCallback = System.currentTimeMillis();
                boolean unused = ai.this.AppsFlyerInAppPurchaseValidatorListener = true;
                try {
                    String valueOf2 = ai.valueOf("AppsFlyerKey");
                    af.values();
                    for (f next : af.valueOf((Context) this.valueOf)) {
                        StringBuilder sb = new StringBuilder("resending request: ");
                        sb.append(next.valueOf);
                        AFLogger.valueOf(sb.toString());
                        try {
                            long currentTimeMillis = System.currentTimeMillis();
                            long parseLong = Long.parseLong(next.AFKeystoreWrapper, 10);
                            ai aiVar = ai.this;
                            ca caVar = new ca();
                            StringBuilder sb2 = new StringBuilder();
                            sb2.append(next.valueOf);
                            sb2.append("&isCachedRequest=true&timeincache=");
                            sb2.append((currentTimeMillis - parseLong) / 1000);
                            caVar.valueOf(sb2.toString());
                            caVar.init = next.values();
                            caVar.AppsFlyer2dXConversionCallback = valueOf2;
                            Application application = this.valueOf;
                            if (application != null) {
                                caVar.valueOf = (Application) INVOKEVIRTUAL_com_appsflyer_internal_ai$e_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(application);
                            }
                            caVar.getLevel = next.AFKeystoreWrapper;
                            caVar.onDeepLinkingNative = false;
                            ai.AFInAppEventParameterName(aiVar, (j) caVar);
                        } catch (Exception e) {
                            AFLogger.valueOf("Failed to resend cached request", e);
                        }
                    }
                } catch (Exception e2) {
                    AFLogger.valueOf("failed to check cache. ", e2);
                } catch (Throwable th) {
                    boolean unused2 = ai.this.AppsFlyerInAppPurchaseValidatorListener = false;
                    throw th;
                }
                boolean unused3 = ai.this.AppsFlyerInAppPurchaseValidatorListener = false;
                ai.this.AppsFlyerLib.shutdown();
                ScheduledExecutorService unused4 = ai.this.AppsFlyerLib = null;
            }
        }

        public static Context INVOKEVIRTUAL_com_appsflyer_internal_ai$e_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(Context context) {
            Context applicationContext = context.getApplicationContext();
            if (7lW.LIZJ && applicationContext == null) {
                return 7lW.LIZ;
            }
            return applicationContext;
        }

        public e(Context context) {
            this.valueOf = (Application) INVOKEVIRTUAL_com_appsflyer_internal_ai$e_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context);
        }
    }

    static {
        Covode.recordClassIndex(2593);
        StringBuilder sb = new StringBuilder();
        sb.append("6.4");
        sb.append("/androidevent?buildnumber=6.4.0&app_id=");
        values = sb.toString();
        StringBuilder sb2 = new StringBuilder("https://%sadrevenue.%s/api/v");
        sb2.append("6.4");
        sb2.append("/android?buildnumber=6.4.0&app_id=");
        onAttributionFailureNative = sb2.toString();
        StringBuilder sb3 = new StringBuilder();
        sb3.append("6.4");
        sb3.append("/androidevent?app_id=");
        String obj = sb3.toString();
        onDeepLinkingNative = obj;
        StringBuilder sb4 = new StringBuilder("https://%sconversions.%s/api/v");
        sb4.append(obj);
        onInstallConversionDataLoadedNative = sb4.toString();
        StringBuilder sb5 = new StringBuilder("https://%slaunches.%s/api/v");
        sb5.append(obj);
        onConversionDataFail = sb5.toString();
        StringBuilder sb6 = new StringBuilder("https://%sinapps.%s/api/v");
        sb6.append(obj);
        onAttributionFailure = sb6.toString();
        StringBuilder sb7 = new StringBuilder("https://%sattr.%s/api/v");
        sb7.append(obj);
        onDeepLinking = sb7.toString();
    }

    public final Map<String, Object> values() {
        HashMap hashMap = new HashMap();
        if (AFLogger$LogLevel()) {
            hashMap.put("lvl", this.waitForCustomerUserId);
        } else if (this.setCustomerIdAndLogSession) {
            HashMap hashMap2 = new HashMap();
            this.waitForCustomerUserId = hashMap2;
            hashMap2.put("error", "operation timed out.");
            hashMap.put("lvl", this.waitForCustomerUserId);
        }
        return hashMap;
    }

    public class d implements Runnable {
        public final j valueOf;

        static {
            Covode.recordClassIndex(2604);
        }

        /* JADX WARNING: Code restructure failed: missing block: B:100:0x01f9, code lost:
            com.appsflyer.AFLogger.valueOf("reached cache limit, not caching request");
         */
        /* JADX WARNING: Code restructure failed: missing block: B:101:0x0200, code lost:
            com.appsflyer.AFLogger.valueOf("caching request...");
            r9 = new java.io.File(com.appsflyer.internal.af.values(r4), java.lang.Long.toString(java.lang.System.currentTimeMillis()));
            r9.createNewFile();
            r2 = new java.io.OutputStreamWriter(new java.io.FileOutputStream(r9.getPath(), true));
         */
        /* JADX WARNING: Code restructure failed: missing block: B:104:?, code lost:
            r2.write("version=");
            r2.write(r6.AFInAppEventParameterName);
            r2.write(10);
            r2.write("url=");
            r2.write(r6.valueOf);
            r2.write(10);
            r2.write("data=");
            r2.write(android.util.Base64.encodeToString(r6.values(), 2));
            r2.write(10);
            r2.flush();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:106:?, code lost:
            r2.close();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:107:0x025d, code lost:
            r1 = th;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:108:0x025e, code lost:
            r8 = r2;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:109:0x0260, code lost:
            r1 = e;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:110:0x0261, code lost:
            r8 = r2;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:117:?, code lost:
            r8.close();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:119:0x0270, code lost:
            if (r8 == null) goto L_0x027a;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:121:?, code lost:
            r8.close();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:122:0x0276, code lost:
            r0 = move-exception;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:123:0x0277, code lost:
            com.appsflyer.AFLogger.valueOf((java.lang.Throwable) r0);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:124:0x027a, code lost:
            com.bytedance.frameworks.apm.trace.MethodCollector.o(18271);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:125:0x027f, code lost:
            throw r1;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:126:0x0280, code lost:
            r0 = move-exception;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:127:0x0281, code lost:
            com.appsflyer.AFLogger.valueOf((java.lang.Throwable) r0);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:131:0x0291, code lost:
            r2.onError(com.appsflyer.attribution.RequestError.NETWORK_FAILURE, r3.getMessage());
         */
        /* JADX WARNING: Code restructure failed: missing block: B:79:0x01a6, code lost:
            r3 = move-exception;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:80:0x01a7, code lost:
            com.appsflyer.AFLogger.values(r3.getMessage(), r3);
            r2 = r5.valueOf.AFInAppEventParameterName;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:81:0x01b2, code lost:
            if (r2 != null) goto L_0x01b4;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:82:0x01b4, code lost:
            r2.onError(com.appsflyer.attribution.RequestError.NETWORK_FAILURE, r3.getMessage());
         */
        /* JADX WARNING: Code restructure failed: missing block: B:83:0x01bd, code lost:
            com.bytedance.frameworks.apm.trace.MethodCollector.o(18271);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:84:0x01c2, code lost:
            return;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:85:0x01c3, code lost:
            r3 = e;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:95:0x01e9, code lost:
            r1.mkdir();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:96:0x01ee, code lost:
            r0 = r1.listFiles();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:97:0x01f2, code lost:
            if (r0 == null) goto L_0x0200;
         */
        /* JADX WARNING: Failed to process nested try/catch */
        /* JADX WARNING: Removed duplicated region for block: B:116:0x026b A[SYNTHETIC, Splitter:B:116:0x026b] */
        /* JADX WARNING: Removed duplicated region for block: B:131:0x0291  */
        /* JADX WARNING: Removed duplicated region for block: B:79:0x01a6 A[ExcHandler: all (r3v3 'th' java.lang.Throwable A[CUSTOM_DECLARE]), Splitter:B:44:0x0123] */
        /* JADX WARNING: Removed duplicated region for block: B:95:0x01e9 A[Catch:{ Exception -> 0x0263 }] */
        /* JADX WARNING: Removed duplicated region for block: B:96:0x01ee A[Catch:{ Exception -> 0x0263 }] */
        /* Code decompiled incorrectly, please refer to instructions dump. */
        public final void run() {
            /*
                r18 = this;
                r5 = r18
                r3 = 18271(0x475f, float:2.5603E-41)
                com.bytedance.frameworks.apm.trace.MethodCollector.i(r3)
                com.appsflyer.internal.j r0 = r5.valueOf
                java.util.Map r11 = r0.AFInAppEventParameterName()
                com.appsflyer.internal.j r0 = r5.valueOf
                boolean r1 = r0.AFKeystoreWrapper()
                com.appsflyer.internal.j r0 = r5.valueOf
                java.lang.String r9 = r0.onAppOpenAttributionNative
                com.appsflyer.internal.j r0 = r5.valueOf
                int r12 = r0.onAttributionFailureNative
                com.appsflyer.internal.j r0 = r5.valueOf
                android.app.Application r4 = r0.valueOf
                com.appsflyer.internal.ai r0 = com.appsflyer.internal.ai.this
                boolean r0 = r0.isStopped()
                if (r0 == 0) goto L_0x0038
                com.appsflyer.internal.j r0 = r5.valueOf
                com.appsflyer.attribution.AppsFlyerRequestListener r2 = r0.AFInAppEventParameterName
                if (r2 == 0) goto L_0x0034
                int r1 = com.appsflyer.attribution.RequestError.STOP_TRACKING
                java.lang.String r0 = com.appsflyer.internal.az.valueOf
                r2.onError(r1, r0)
            L_0x0034:
                com.bytedance.frameworks.apm.trace.MethodCollector.o(r3)
                return
            L_0x0038:
                r13 = 0
                byte[] r2 = new byte[r13]
                r7 = 2
                r10 = 1
                if (r1 == 0) goto L_0x00fe
                if (r12 > r7) goto L_0x00fe
                java.util.ArrayList r6 = new java.util.ArrayList
                r6.<init>()
                com.appsflyer.internal.ai r0 = com.appsflyer.internal.ai.this
                com.appsflyer.internal.cl[] r0 = r0.init
                if (r0 == 0) goto L_0x00b5
                com.appsflyer.internal.ai r0 = com.appsflyer.internal.ai.this
                com.appsflyer.internal.cl[] r8 = r0.init
                int r3 = r8.length
                r1 = 0
            L_0x0056:
                if (r1 >= r3) goto L_0x00b5
                r14 = r8[r1]
                boolean r15 = r14 instanceof com.appsflyer.internal.cj
                int[] r16 = com.appsflyer.internal.ai.AnonymousClass7.AFInAppEventParameterName
                com.appsflyer.internal.cl$a r0 = r14.valueOf
                int r0 = r0.ordinal()
                r0 = r16[r0]
                if (r0 == r10) goto L_0x0092
                if (r0 == r7) goto L_0x006f
            L_0x006a:
                int r1 = r1 + 1
                r0 = 18271(0x475f, float:2.5603E-41)
                goto L_0x0056
            L_0x006f:
                if (r12 != r7) goto L_0x006a
                if (r15 != 0) goto L_0x006a
                java.util.HashMap r15 = new java.util.HashMap
                r15.<init>()
                java.lang.String r0 = "source"
                java.lang.String r14 = r14.AFInAppEventType
                r15.put(r0, r14)
                java.lang.String r14 = "response"
                java.lang.String r0 = "TIMEOUT"
                r15.put(r14, r0)
                com.appsflyer.internal.ci r0 = new com.appsflyer.internal.ci
                r0.<init>()
                r15.putAll(r0)
                r6.add(r15)
                goto L_0x006a
            L_0x0092:
                if (r15 == 0) goto L_0x00af
                java.lang.String r15 = "rfr"
                r0 = r14
                com.appsflyer.internal.cj r0 = (com.appsflyer.internal.cj) r0
                java.util.Map<java.lang.String, java.lang.Object> r0 = r0.AFInAppEventParameterName
                r11.put(r15, r0)
                android.content.SharedPreferences r0 = com.appsflyer.internal.ai.values((android.content.Context) r4)
                android.content.SharedPreferences$Editor r15 = r0.edit()
                java.lang.String r0 = "newGPReferrerSent"
                android.content.SharedPreferences$Editor r0 = r15.putBoolean(r0, r10)
                r0.apply()
            L_0x00af:
                java.util.Map<java.lang.String, java.lang.Object> r0 = r14.values
                r6.add(r0)
                goto L_0x006a
            L_0x00b5:
                boolean r0 = r6.isEmpty()
                if (r0 != 0) goto L_0x00c0
                java.lang.String r0 = "referrers"
                r11.put(r0, r6)
            L_0x00c0:
                com.appsflyer.internal.ai r0 = com.appsflyer.internal.ai.this
                java.util.Map r0 = r0.setCustomerUserId
                if (r0 == 0) goto L_0x00d3
                java.lang.String r1 = "fb_ddl"
                com.appsflyer.internal.ai r0 = com.appsflyer.internal.ai.this
                java.util.Map r0 = r0.setCustomerUserId
                r11.put(r1, r0)
            L_0x00d3:
                com.appsflyer.internal.ai r0 = com.appsflyer.internal.ai.this
                com.appsflyer.internal.cm r0 = r0.setOutOfStore
                if (r0 == 0) goto L_0x00fe
                com.appsflyer.internal.ai r0 = com.appsflyer.internal.ai.this
                com.appsflyer.internal.cm r0 = r0.setOutOfStore
                boolean r0 = r0.AFKeystoreWrapper()
                if (r0 == 0) goto L_0x0117
                com.appsflyer.internal.ai r0 = com.appsflyer.internal.ai.this
                com.appsflyer.internal.cm r0 = r0.setOutOfStore
                java.util.List r1 = r0.AFInAppEventParameterName()
                if (r1 == 0) goto L_0x00fe
                boolean r0 = r1.isEmpty()
                if (r0 != 0) goto L_0x00fe
                java.lang.String r0 = "preload_id"
                r11.put(r0, r1)
            L_0x00fe:
                com.appsflyer.internal.j r0 = r5.valueOf
                boolean r0 = r0 instanceof com.appsflyer.internal.bs
                if (r0 != 0) goto L_0x0115
                com.appsflyer.internal.c$d r0 = new com.appsflyer.internal.c$d
                r0.<init>(r11, r4)
                r11.putAll(r0)
                com.appsflyer.internal.ai r0 = com.appsflyer.internal.ai.this
                java.util.Map r0 = r0.values()
                r11.putAll(r0)
            L_0x0115:
                r8 = 0
                goto L_0x0123
            L_0x0117:
                java.lang.String r1 = "preload_id"
                java.lang.String r0 = "timeout"
                java.util.List r0 = java.util.Collections.singletonList(r0)
                r11.put(r1, r0)
                goto L_0x00fe
            L_0x0123:
                com.appsflyer.internal.j r1 = r5.valueOf     // Catch:{ IOException -> 0x01c3, all -> 0x01a6 }
                boolean r0 = r1 instanceof com.appsflyer.internal.bs     // Catch:{ IOException -> 0x01c3, all -> 0x01a6 }
                if (r0 == 0) goto L_0x0135
                java.lang.String r0 = "af_key"
                java.lang.Object r0 = r11.get(r0)     // Catch:{ IOException -> 0x01c3, all -> 0x01a6 }
                java.lang.String r0 = (java.lang.String) r0     // Catch:{ IOException -> 0x01c3, all -> 0x01a6 }
            L_0x0131:
                r1.AppsFlyer2dXConversionCallback = r0     // Catch:{ IOException -> 0x01c3, all -> 0x01a6 }
                monitor-enter(r11)     // Catch:{ IOException -> 0x01c3, all -> 0x01a6 }
                goto L_0x013e
            L_0x0135:
                java.lang.String r0 = "appsflyerKey"
                java.lang.Object r0 = r11.get(r0)     // Catch:{ IOException -> 0x01c3, all -> 0x01a6 }
                java.lang.String r0 = (java.lang.String) r0     // Catch:{ IOException -> 0x01c3, all -> 0x01a6 }
                goto L_0x0131
            L_0x013e:
                com.appsflyer.internal.j r0 = r5.valueOf     // Catch:{ all -> 0x019e }
                java.lang.Object[] r12 = new java.lang.Object[r10]     // Catch:{ all -> 0x018d }
                r12[r13] = r0     // Catch:{ all -> 0x018d }
                r1 = 47184(0xb850, float:6.6119E-41)
                r16 = 0
                int r0 = android.widget.ExpandableListView.getPackedPositionGroup(r16)     // Catch:{ all -> 0x018d }
                int r0 = r0 + r1
                char r3 = (char) r0     // Catch:{ all -> 0x018d }
                int r0 = android.view.ViewConfiguration.getMaximumFlingVelocity()     // Catch:{ all -> 0x018d }
                int r0 = r0 >> 16
                int r1 = r0 + 48
                long r14 = android.widget.ExpandableListView.getPackedPositionForChild(r13, r13)     // Catch:{ all -> 0x018d }
                int r0 = (r14 > r16 ? 1 : (r14 == r16 ? 0 : -1))
                int r0 = r0 + 25
                java.lang.Object r6 = com.appsflyer.internal.d.values(r3, r1, r0)     // Catch:{ all -> 0x018d }
                java.lang.Class r6 = (java.lang.Class) r6     // Catch:{ all -> 0x018d }
                java.lang.String r3 = "AFKeystoreWrapper"
                java.lang.Class[] r1 = new java.lang.Class[r10]     // Catch:{ all -> 0x018d }
                java.lang.Class<com.appsflyer.internal.j> r0 = com.appsflyer.internal.j.class
                r1[r13] = r0     // Catch:{ all -> 0x018d }
                java.lang.reflect.Method r0 = r6.getDeclaredMethod(r3, r1)     // Catch:{ all -> 0x018d }
                java.lang.Object r6 = r0.invoke(r8, r12)     // Catch:{ all -> 0x018d }
                byte[] r6 = (byte[]) r6     // Catch:{ all -> 0x018d }
                monitor-exit(r11)     // Catch:{ all -> 0x018a }
                com.appsflyer.internal.ai r1 = com.appsflyer.internal.ai.this     // Catch:{ IOException -> 0x0187, all -> 0x01a6 }
                com.appsflyer.internal.j r0 = r5.valueOf     // Catch:{ IOException -> 0x0187, all -> 0x01a6 }
                r0.init = r6     // Catch:{ IOException -> 0x0187, all -> 0x01a6 }
                com.appsflyer.internal.ai.AFInAppEventParameterName((com.appsflyer.internal.ai) r1, (com.appsflyer.internal.j) r0)     // Catch:{ IOException -> 0x0187, all -> 0x01a6 }
                r0 = 18271(0x475f, float:2.5603E-41)
                com.bytedance.frameworks.apm.trace.MethodCollector.o(r0)
                return
            L_0x0187:
                r3 = move-exception
                r2 = r6
                goto L_0x01c4
            L_0x018a:
                r1 = move-exception
                r2 = r6
                goto L_0x019f
            L_0x018d:
                r3 = move-exception
                java.lang.Throwable r1 = r3.getCause()     // Catch:{ all -> 0x019e }
                r0 = 18271(0x475f, float:2.5603E-41)
                if (r1 == 0) goto L_0x019a
                com.bytedance.frameworks.apm.trace.MethodCollector.o(r0)     // Catch:{ all -> 0x019e }
                throw r1     // Catch:{ all -> 0x019e }
            L_0x019a:
                com.bytedance.frameworks.apm.trace.MethodCollector.o(r0)     // Catch:{ all -> 0x019e }
                throw r3     // Catch:{ all -> 0x019e }
            L_0x019e:
                r1 = move-exception
            L_0x019f:
                monitor-exit(r11)     // Catch:{ IOException -> 0x01c3, all -> 0x01a6 }
                r0 = 18271(0x475f, float:2.5603E-41)
                com.bytedance.frameworks.apm.trace.MethodCollector.o(r0)     // Catch:{ IOException -> 0x01c3, all -> 0x01a6 }
                throw r1     // Catch:{ IOException -> 0x01c3, all -> 0x01a6 }
            L_0x01a6:
                r3 = move-exception
                java.lang.String r0 = r3.getMessage()
                com.appsflyer.AFLogger.values((java.lang.String) r0, (java.lang.Throwable) r3)
                com.appsflyer.internal.j r0 = r5.valueOf
                com.appsflyer.attribution.AppsFlyerRequestListener r2 = r0.AFInAppEventParameterName
                if (r2 == 0) goto L_0x01bd
                int r1 = com.appsflyer.attribution.RequestError.NETWORK_FAILURE
                java.lang.String r0 = r3.getMessage()
                r2.onError(r1, r0)
            L_0x01bd:
                r0 = 18271(0x475f, float:2.5603E-41)
                com.bytedance.frameworks.apm.trace.MethodCollector.o(r0)
                return
            L_0x01c3:
                r3 = move-exception
            L_0x01c4:
                java.lang.String r0 = "Exception while sending request to server. "
                com.appsflyer.AFLogger.valueOf(r0, r3)
                if (r2 == 0) goto L_0x028b
                if (r4 == 0) goto L_0x028b
                java.lang.String r0 = "&isCachedRequest=true&timeincache="
                boolean r0 = r9.contains(r0)
                if (r0 != 0) goto L_0x028b
                com.appsflyer.internal.af.values()
                com.appsflyer.internal.f r6 = new com.appsflyer.internal.f
                java.lang.String r0 = "6.4.0"
                r6.<init>(r9, r2, r0)
                java.io.File r1 = com.appsflyer.internal.af.values(r4)     // Catch:{ Exception -> 0x0263 }
                boolean r0 = r1.exists()     // Catch:{ Exception -> 0x0263 }
                if (r0 != 0) goto L_0x01ee
                r1.mkdir()     // Catch:{ Exception -> 0x0263 }
                goto L_0x0284
            L_0x01ee:
                java.io.File[] r0 = r1.listFiles()     // Catch:{ Exception -> 0x0263 }
                if (r0 == 0) goto L_0x0200
                int r1 = r0.length     // Catch:{ Exception -> 0x0263 }
                r0 = 40
                if (r1 <= r0) goto L_0x0200
                java.lang.String r0 = "reached cache limit, not caching request"
                com.appsflyer.AFLogger.valueOf((java.lang.String) r0)     // Catch:{ Exception -> 0x0263 }
                goto L_0x0284
            L_0x0200:
                java.lang.String r0 = "caching request..."
                com.appsflyer.AFLogger.valueOf((java.lang.String) r0)     // Catch:{ Exception -> 0x0263 }
                java.io.File r9 = new java.io.File     // Catch:{ Exception -> 0x0263 }
                java.io.File r2 = com.appsflyer.internal.af.values(r4)     // Catch:{ Exception -> 0x0263 }
                long r0 = java.lang.System.currentTimeMillis()     // Catch:{ Exception -> 0x0263 }
                java.lang.String r0 = java.lang.Long.toString(r0)     // Catch:{ Exception -> 0x0263 }
                r9.<init>(r2, r0)     // Catch:{ Exception -> 0x0263 }
                r9.createNewFile()     // Catch:{ Exception -> 0x0263 }
                java.io.OutputStreamWriter r2 = new java.io.OutputStreamWriter     // Catch:{ Exception -> 0x0263 }
                java.io.FileOutputStream r1 = new java.io.FileOutputStream     // Catch:{ Exception -> 0x0263 }
                java.lang.String r0 = r9.getPath()     // Catch:{ Exception -> 0x0263 }
                r1.<init>(r0, r10)     // Catch:{ Exception -> 0x0263 }
                r2.<init>(r1)     // Catch:{ Exception -> 0x0263 }
                java.lang.String r0 = "version="
                r2.write(r0)     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                java.lang.String r0 = r6.AFInAppEventParameterName     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                r2.write(r0)     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                r1 = 10
                r2.write(r1)     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                java.lang.String r0 = "url="
                r2.write(r0)     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                java.lang.String r0 = r6.valueOf     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                r2.write(r0)     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                r2.write(r1)     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                java.lang.String r0 = "data="
                r2.write(r0)     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                byte[] r0 = r6.values()     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                java.lang.String r0 = android.util.Base64.encodeToString(r0, r7)     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                r2.write(r0)     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                r2.write(r1)     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                r2.flush()     // Catch:{ Exception -> 0x0260, all -> 0x025d }
                r2.close()     // Catch:{ IOException -> 0x0280 }
                goto L_0x0284
            L_0x025d:
                r1 = move-exception
                r8 = r2
                goto L_0x0272
            L_0x0260:
                r1 = move-exception
                r8 = r2
                goto L_0x0264
            L_0x0263:
                r1 = move-exception
            L_0x0264:
                java.lang.String r0 = "Could not cache request"
                com.appsflyer.AFLogger.valueOf(r0, r1)     // Catch:{ all -> 0x026f }
                if (r8 == 0) goto L_0x0284
                r8.close()     // Catch:{ IOException -> 0x0280 }
                goto L_0x0284
            L_0x026f:
                r1 = move-exception
                if (r8 == 0) goto L_0x027a
            L_0x0272:
                r8.close()     // Catch:{ IOException -> 0x0276 }
                goto L_0x027a
            L_0x0276:
                r0 = move-exception
                com.appsflyer.AFLogger.valueOf((java.lang.Throwable) r0)
            L_0x027a:
                r0 = 18271(0x475f, float:2.5603E-41)
                com.bytedance.frameworks.apm.trace.MethodCollector.o(r0)
                throw r1
            L_0x0280:
                r0 = move-exception
                com.appsflyer.AFLogger.valueOf((java.lang.Throwable) r0)
            L_0x0284:
                java.lang.String r0 = r3.getMessage()
                com.appsflyer.AFLogger.valueOf(r0, r3)
            L_0x028b:
                com.appsflyer.internal.j r0 = r5.valueOf
                com.appsflyer.attribution.AppsFlyerRequestListener r2 = r0.AFInAppEventParameterName
                if (r2 == 0) goto L_0x029a
                int r1 = com.appsflyer.attribution.RequestError.NETWORK_FAILURE
                java.lang.String r0 = r3.getMessage()
                r2.onError(r1, r0)
            L_0x029a:
                com.appsflyer.internal.ai r6 = com.appsflyer.internal.ai.this
                com.appsflyer.internal.j r7 = r5.valueOf
                java.lang.String r0 = r7.AppsFlyer2dXConversionCallback
                android.content.SharedPreferences r10 = com.appsflyer.internal.ai.values((android.content.Context) r4)
                r11 = 0
                r8 = r0
                r9 = r4
                r12 = r3
                com.appsflyer.internal.bo.values(r6, r7, r8, r9, r10, r11, r12)
                r0 = 18271(0x475f, float:2.5603E-41)
                com.bytedance.frameworks.apm.trace.MethodCollector.o(r0)
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.ai.d.run():void");
        }

        public d(j jVar) {
            this.valueOf = jVar;
        }

        public /* synthetic */ d(ai aiVar, j jVar, byte b) {
            this(jVar);
        }
    }

    private boolean AFKeystoreWrapper() {
        if (this.onConversionDataSuccess > 0) {
            long currentTimeMillis = System.currentTimeMillis() - this.onConversionDataSuccess;
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS Z", Locale.US);
            long j = this.onConversionDataSuccess;
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
            String format = simpleDateFormat.format(new Date(j));
            long j2 = this.onValidateInApp;
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
            String format2 = simpleDateFormat.format(new Date(j2));
            if (currentTimeMillis < this.AppsFlyerConversionListener && !isStopped()) {
                AFLogger.valueOf(AnonymousClass0HH.LIZ(Locale.US, "Last Launch attempt: %s;\nLast successful Launch event: %s;\nThis launch is blocked: %s ms < %s ms", new Object[]{format, format2, Long.valueOf(currentTimeMillis), Long.valueOf(this.AppsFlyerConversionListener)}));
                return true;
            } else if (!isStopped()) {
                AFLogger.valueOf(AnonymousClass0HH.LIZ(Locale.US, "Last Launch attempt: %s;\nLast successful Launch event: %s;\nSending launch (+%s ms)", new Object[]{format, format2, Long.valueOf(currentTimeMillis)}));
            }
        } else if (!isStopped()) {
            AFLogger.valueOf("Sending first launch for this session!");
        }
        return false;
    }

    public final void enableFacebookDeferredApplinks(boolean z) {
        this.setPhoneNumber = z;
    }

    public final AppsFlyerLib enableLocationCollection(boolean z) {
        this.updateServerUninstallToken = z;
        return this;
    }

    public final void setSharingFilter(String... strArr) {
        setSharingFilterForPartners(strArr);
    }

    public static Bundle INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getExtras(Intent intent) {
        try {
            return intent.getExtras();
        } catch (Exception unused) {
            return null;
        }
    }

    public final void setPhoneNumber(String str) {
        this.getOutOfStore = ah.AFInAppEventParameterName(str);
    }

    public final void setSharingFilterForPartners(String... strArr) {
        this.onAppOpenAttributionNative = new l(strArr);
    }

    public final void start(Context context) {
        start(context, (String) null);
    }

    public static boolean AFInAppEventType(Context context) {
        if (!values(context).contains("appsFlyerCount")) {
            return true;
        }
        return false;
    }

    public static Context INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(Context context) {
        Context applicationContext = context.getApplicationContext();
        if (7lW.LIZJ && applicationContext == null) {
            return 7lW.LIZ;
        }
        return applicationContext;
    }

    public static String valueOf(String str) {
        return AppsFlyerProperties.getInstance().getString(str);
    }

    public final void onPause(Context context) {
        if (ag.valueOf != null) {
            ag.valueOf.valueOf(context);
        }
    }

    public final void setDebugLog(boolean z) {
        AFLogger.LogLevel logLevel;
        if (z) {
            logLevel = AFLogger.LogLevel.DEBUG;
        } else {
            logLevel = AFLogger.LogLevel.NONE;
        }
        setLogLevel(logLevel);
    }

    public final void setMinTimeBetweenSessions(int i) {
        this.AppsFlyerConversionListener = TimeUnit.SECONDS.toMillis((long) i);
    }

    public final void subscribeForDeepLink(DeepLinkListener deepLinkListener) {
        subscribeForDeepLink(deepLinkListener, TimeUnit.SECONDS.toMillis(3));
    }

    public static File AFKeystoreWrapper(String str) {
        if (str == null) {
            return null;
        }
        try {
            if (str.trim().length() > 0) {
                return new File(str.trim());
            }
            return null;
        } catch (Throwable th) {
            AFLogger.valueOf(th.getMessage(), th);
            return null;
        }
    }

    public static ScheduledExecutorService INVOKESTATIC_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_thread_ThreadPoolLancet_newSingleThreadScheduledExecutor(ThreadFactory threadFactory) {
        8e1 LIZ = 8e2.LIZ(8eG.SCHEDULED);
        LIZ.LIZJ = 1;
        LIZ.LJI = threadFactory;
        return (ScheduledExecutorService) 8eL.LIZ(LIZ.LIZ());
    }

    public static Map<String, Object> valueOf(Map<String, Object> map) {
        if (map.containsKey("meta")) {
            return (Map) map.get("meta");
        }
        HashMap hashMap = new HashMap();
        map.put("meta", hashMap);
        return hashMap;
    }

    public static SharedPreferences values(Context context) {
        ai aiVar = onAppOpenAttribution;
        if (aiVar.sendPushNotificationData == null) {
            aiVar.sendPushNotificationData = 8uQ.LIZ(INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context), "appsflyer-data", 0);
        }
        return onAppOpenAttribution.sendPushNotificationData;
    }

    public final void addPushNotificationDeepLinkPath(String... strArr) {
        List asList = Arrays.asList(strArr);
        List<List<String>> list = i.values().init;
        if (!list.contains(asList)) {
            list.add(asList);
        }
    }

    public final void anonymizeUser(boolean z) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "anonymizeUser", String.valueOf(z));
        AppsFlyerProperties.getInstance().set("deviceTrackingDisabled", z);
    }

    public final String getAppsFlyerUID(Context context) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "getAppsFlyerUID", new String[0]);
        return ak.AFInAppEventParameterName((WeakReference<Context>) new WeakReference(this.setAdditionalData.AFInAppEventType().valueOf));
    }

    public final String getAttributionId(Context context) {
        try {
            return new ae(context).AFInAppEventType();
        } catch (Throwable th) {
            AFLogger.valueOf("Could not collect facebook attribution id. ", th);
            return null;
        }
    }

    public final boolean isPreInstalledApp(Context context) {
        try {
            if ((INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getApplicationInfo(context.getPackageManager(), context.getPackageName(), 0).flags & 1) != 0) {
                return true;
            }
            return false;
        } catch (PackageManager.NameNotFoundException e2) {
            AFLogger.valueOf("Could not check if app is pre installed", e2);
        }
    }

    public final void logSession(Context context) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "logSession", new String[0]);
        aj.AFInAppEventParameterName().values = false;
        valueOf(context, (String) null, (Map<String, Object>) null);
    }

    public final void setAndroidIdData(String str) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setAndroidIdData", str);
        this.getLevel = str;
    }

    public final void setAppId(String str) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setAppId", str);
        AppsFlyerProperties.getInstance().set("appid", str);
    }

    public final void setCurrencyCode(String str) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setCurrencyCode", str);
        AppsFlyerProperties.getInstance().set("currencyCode", str);
    }

    public final void setExtension(String str) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setExtension", str);
        AppsFlyerProperties.getInstance().set("sdkExtension", str);
    }

    public final void setImeiData(String str) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setImeiData", str);
        this.AFVersionDeclaration = str;
    }

    public final void setIsUpdate(boolean z) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setIsUpdate", String.valueOf(z));
        AppsFlyerProperties.getInstance().set("IS_UPDATE", z);
    }

    public final void setOaidData(String str) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setOaidData", str);
        ad.AFInAppEventParameterName = str;
    }

    public final void setOneLinkCustomDomain(String... strArr) {
        AFLogger.AFInAppEventType(AnonymousClass0HH.LIZ("setOneLinkCustomDomain %s", new Object[]{Arrays.toString(strArr)}));
        i.AppsFlyer2dXConversionCallback = strArr;
    }

    public final void setResolveDeepLinkURLs(String... strArr) {
        AFLogger.AFInAppEventType(AnonymousClass0HH.LIZ("setResolveDeepLinkURLs %s", new Object[]{Arrays.toString(strArr)}));
        i.AFKeystoreWrapper = strArr;
    }

    public final void setUserEmails(String... strArr) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setUserEmails", strArr);
        setUserEmails(AppsFlyerProperties.EmailsCryptType.NONE, strArr);
    }

    public final void waitForCustomerUserId(boolean z) {
        AFLogger.values("initAfterCustomerUserID: ".concat(String.valueOf(z)), true);
        AppsFlyerProperties.getInstance().set("waitForCustomerId", z);
    }

    public static String AFInAppEventType(Activity activity) {
        Intent intent;
        String str = null;
        if (!(activity == null || (intent = activity.getIntent()) == null)) {
            try {
                Bundle INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getExtras = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getExtras(intent);
                if (!(INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getExtras == null || (str = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getExtras.getString("af")) == null)) {
                    AFLogger.valueOf("Push Notification received af payload = ".concat(String.valueOf(str)));
                    INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getExtras.remove("af");
                    activity.setIntent(intent.putExtras(INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getExtras));
                }
            } catch (Throwable th) {
                AFLogger.valueOf(th.getMessage(), th);
            }
        }
        return str;
    }

    public static boolean AFVersionDeclaration(Context context) {
        try {
            if (INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_isGooglePlayServicesAvailable(GoogleApiAvailability.getInstance(), context) == 0) {
                return true;
            }
        } catch (Throwable th) {
            AFLogger.valueOf("WARNING:  Google play services is unavailable. ", th);
        }
        try {
            INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getPackageInfo(context.getPackageManager(), "com.google.android.gms", 0);
            return true;
        } catch (PackageManager.NameNotFoundException e2) {
            AFLogger.valueOf("WARNING:  Google Play Services is unavailable. ", e2);
            return false;
        }
    }

    public static boolean AppsFlyer2dXConversionCallback(Context context) {
        if (AppsFlyerProperties.getInstance().getBoolean("collectAndroidIdForceByUser", false) || AppsFlyerProperties.getInstance().getBoolean("collectIMEIForceByUser", false) || !AFVersionDeclaration(context)) {
            return true;
        }
        return false;
    }

    public static float init(Context context) {
        try {
            Intent INVOKEVIRTUAL_com_appsflyer_internal_ai_com_bytedance_sysoptimizer_ReceiverRegisterLancet_registerReceiver = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_bytedance_sysoptimizer_ReceiverRegisterLancet_registerReceiver(INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context), (BroadcastReceiver) null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
            int intExtra = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_bytedance_sysoptimizer_ReceiverRegisterLancet_registerReceiver.getIntExtra("level", -1);
            int intExtra2 = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_bytedance_sysoptimizer_ReceiverRegisterLancet_registerReceiver.getIntExtra("scale", -1);
            if (intExtra == -1 || intExtra2 == -1) {
                return 50.0f;
            }
            return (((float) intExtra) / ((float) intExtra2)) * 100.0f;
        } catch (Throwable th) {
            AFLogger.valueOf(th.getMessage(), th);
            return 1.0f;
        }
    }

    public static String values(String str) {
        String str2 = null;
        try {
            str2 = (String) Class.forName("android.os.SystemProperties").getMethod("get", new Class[]{String.class}).invoke((Object) null, new Object[]{str});
            return str2;
        } catch (Throwable th) {
            AFLogger.valueOf(th.getMessage(), th);
            return str2;
        }
    }

    public final String getOutOfStore(Context context) {
        String valueOf2;
        String string = AppsFlyerProperties.getInstance().getString("api_store_value");
        if (string != null) {
            return string;
        }
        if (context != null && (valueOf2 = valueOf("AF_STORE", context.getPackageManager(), context.getPackageName())) != null) {
            return valueOf2;
        }
        AFLogger.valueOf("No out-of-store value set");
        return null;
    }

    public final void setAdditionalData(Map<String, Object> map) {
        if (map != null) {
            aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setAdditionalData", map.toString());
            AppsFlyerProperties.getInstance().setCustomData(new JSONObject(map).toString());
        }
    }

    public final void setCollectAndroidID(boolean z) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setCollectAndroidID", String.valueOf(z));
        AppsFlyerProperties.getInstance().set("collectAndroidId", Boolean.toString(z));
        AppsFlyerProperties.getInstance().set("collectAndroidIdForceByUser", Boolean.toString(z));
    }

    public final void setCollectIMEI(boolean z) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setCollectIMEI", String.valueOf(z));
        AppsFlyerProperties.getInstance().set("collectIMEI", Boolean.toString(z));
        AppsFlyerProperties.getInstance().set("collectIMEIForceByUser", Boolean.toString(z));
    }

    public final void setCollectOaid(boolean z) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setCollectOaid", String.valueOf(z));
        AppsFlyerProperties.getInstance().set("collectOAID", Boolean.toString(z));
    }

    public final void setCustomerUserId(String str) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setCustomerUserId", str);
        AFLogger.valueOf("setCustomerUserId = ".concat(String.valueOf(str)));
        AppsFlyerProperties.getInstance().set("AppUserId", str);
        AppsFlyerProperties.getInstance().set("waitForCustomerId", false);
    }

    public final void setDisableAdvertisingIdentifiers(boolean z) {
        AFLogger.AFInAppEventType("setDisableAdvertisingIdentifiers: ".concat(String.valueOf(z)));
        ad.AFKeystoreWrapper = Boolean.valueOf(!z);
        AppsFlyerProperties.getInstance().remove("advertiserIdEnabled");
        AppsFlyerProperties.getInstance().remove("advertiserId");
    }

    public final void setLogLevel(AFLogger.LogLevel logLevel) {
        boolean z;
        if (logLevel.getLevel() > AFLogger.LogLevel.NONE.getLevel()) {
            z = true;
        } else {
            z = false;
        }
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "log", String.valueOf(z));
        AppsFlyerProperties.getInstance().set("logLevel", logLevel.getLevel());
    }

    public final void setOutOfStore(String str) {
        if (str != null) {
            String lowerCase = str.toLowerCase();
            AppsFlyerProperties.getInstance().set("api_store_value", lowerCase);
            AFLogger.values("Store API set with value: ".concat(String.valueOf(lowerCase)), true);
            return;
        }
        AFLogger.values("Cannot set setOutOfStore with null");
    }

    private void AFInAppEventParameterName(j jVar) {
        boolean z;
        if (jVar.AFLogger$LogLevel == null) {
            z = true;
        } else {
            z = false;
        }
        if (AFInAppEventType()) {
            AFLogger.values("CustomerUserId not set, reporting is disabled", true);
            return;
        }
        if (z) {
            if (!AppsFlyerProperties.getInstance().getBoolean("launchProtectEnabled", true)) {
                AFLogger.valueOf("Allowing multiple launches within a 5 second time window.");
            } else if (AFKeystoreWrapper()) {
                AppsFlyerRequestListener appsFlyerRequestListener = jVar.AFInAppEventParameterName;
                if (appsFlyerRequestListener != null) {
                    appsFlyerRequestListener.onError(RequestError.EVENT_TIMEOUT, az.AFKeystoreWrapper);
                    return;
                }
                return;
            }
            this.onConversionDataSuccess = System.currentTimeMillis();
        }
        if (k.values == null) {
            k.values = new k();
        }
        AFInAppEventParameterName(k.values.AFInAppEventType(), new b(this, jVar, (byte) 0), 0, TimeUnit.MILLISECONDS);
    }

    public static URLConnection INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_net_lancet_UrlConnectionLancet_openConnection(URL url) {
        9dq r0;
        9dq r02;
        9Vv LJIIL = 9dN.LJ.LJIIL(new 9Vv(url, (WebView) null, (JSONObject) null, 9Vw.CONTINUE));
        if (LJIIL.LJFF == 9Vw.INTERCEPT && LJIIL.LIZIZ != null) {
            URLConnection uRLConnection = (URLConnection) LJIIL.LIZIZ;
            if (uRLConnection instanceof HttpsURLConnection) {
                r02 = new 9dq((HttpsURLConnection) uRLConnection);
            } else if (!(uRLConnection instanceof HttpURLConnection)) {
                return uRLConnection;
            } else {
                r02 = new 9dm((HttpURLConnection) uRLConnection);
            }
            return r02;
        } else if (LJIIL.LJFF != 9Vw.EXCEPTION || LJIIL.LJ == null) {
            URLConnection openConnection = url.openConnection();
            if (openConnection instanceof HttpsURLConnection) {
                r0 = new 9dq((HttpsURLConnection) openConnection);
            } else if (!(openConnection instanceof HttpURLConnection)) {
                return openConnection;
            } else {
                r0 = new 9dm((HttpURLConnection) openConnection);
            }
            return r0;
        } else {
            throw LJIIL.LJ;
        }
    }

    public static boolean getLevel(Context context) {
        if (context != null) {
            if (Build.VERSION.SDK_INT >= 23) {
                try {
                    ConnectivityManager connectivityManager = (ConnectivityManager) INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_GetSystemServiceLancet_getSystemService(context, "connectivity");
                    for (Network networkCapabilities : connectivityManager.getAllNetworks()) {
                        NetworkCapabilities networkCapabilities2 = connectivityManager.getNetworkCapabilities(networkCapabilities);
                        if (networkCapabilities2.hasTransport(4) && !networkCapabilities2.hasCapability(15)) {
                            return true;
                        }
                    }
                    return false;
                } catch (Exception e2) {
                    AFLogger.valueOf("Failed collecting ivc data", e2);
                }
            } else {
                ArrayList arrayList = new ArrayList();
                try {
                    Iterator<T> it = Collections.list(NetworkInterface.getNetworkInterfaces()).iterator();
                    while (it.hasNext()) {
                        NetworkInterface networkInterface = (NetworkInterface) it.next();
                        if (networkInterface.isUp()) {
                            arrayList.add(networkInterface.getName());
                        }
                    }
                    return arrayList.contains("tun0");
                } catch (Exception e3) {
                    AFLogger.valueOf("Failed collecting ivc data", e3);
                }
            }
        }
        return false;
    }

    public final void setAppInviteOneLink(String str) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setAppInviteOneLink", str);
        AFLogger.valueOf("setAppInviteOneLink = ".concat(String.valueOf(str)));
        if (str == null || !str.equals(AppsFlyerProperties.getInstance().getString("oneLinkSlug"))) {
            AppsFlyerProperties.getInstance().remove("onelinkDomain");
            AppsFlyerProperties.getInstance().remove("onelinkVersion");
            AppsFlyerProperties.getInstance().remove("onelinkScheme");
        }
        AppsFlyerProperties.getInstance().set("oneLinkSlug", str);
    }

    public static String AFInAppEventParameterName(String str) {
        String substring;
        if (str == null) {
            return null;
        }
        if (!str.matches("fb\\d*?://authorize.*") || !str.contains("access_token")) {
            return str;
        }
        int indexOf = str.indexOf(63);
        if (indexOf == -1) {
            substring = "";
        } else {
            substring = str.substring(indexOf);
        }
        if (substring.length() == 0) {
            return str;
        }
        ArrayList arrayList = new ArrayList();
        if (substring.contains("&")) {
            arrayList = new ArrayList(Arrays.asList(substring.split("&")));
        } else {
            arrayList.add(substring);
        }
        StringBuilder sb = new StringBuilder();
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            String str2 = (String) it.next();
            if (str2.contains("access_token")) {
                it.remove();
            } else {
                if (sb.length() != 0) {
                    sb.append("&");
                } else if (!str2.startsWith("?")) {
                    sb.append("?");
                }
                sb.append(str2);
            }
        }
        return str.replace(substring, sb.toString());
    }

    public static void AFInAppEventType(JSONObject jSONObject) {
        String str;
        ArrayList arrayList = new ArrayList();
        Iterator<String> keys = jSONObject.keys();
        while (true) {
            if (!keys.hasNext()) {
                break;
            }
            try {
                JSONArray jSONArray = new JSONArray((String) jSONObject.get(keys.next()));
                for (int i = 0; i < jSONArray.length(); i++) {
                    arrayList.add(Long.valueOf(jSONArray.getLong(i)));
                }
            } catch (JSONException unused) {
            }
        }
        Collections.sort(arrayList);
        Iterator<String> keys2 = jSONObject.keys();
        loop2:
        while (true) {
            str = null;
            while (true) {
                if (keys2.hasNext()) {
                    if (str != null) {
                        break loop2;
                    }
                    String next = keys2.next();
                    try {
                        JSONArray jSONArray2 = new JSONArray((String) jSONObject.get(next));
                        int i2 = 0;
                        while (i2 < jSONArray2.length()) {
                            if (jSONArray2.getLong(i2) == ((Number) arrayList.get(0)).longValue() || jSONArray2.getLong(i2) == ((Number) arrayList.get(1)).longValue()) {
                                break;
                            } else if (jSONArray2.getLong(i2) == ((Number) arrayList.get(arrayList.size() - 1)).longValue()) {
                                break;
                            } else {
                                i2++;
                                str = next;
                            }
                        }
                        continue;
                    } catch (JSONException unused2) {
                    }
                } else if (str == null) {
                    return;
                }
            }
        }
        jSONObject.remove(str);
    }

    /*  JADX ERROR: IndexOutOfBoundsException in pass: RegionMakerVisitor
        java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        	at java.util.ArrayList.rangeCheck(ArrayList.java:659)
        	at java.util.ArrayList.get(ArrayList.java:435)
        	at jadx.core.dex.nodes.InsnNode.getArg(InsnNode.java:101)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:611)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverseMonitorExits(RegionMaker.java:619)
        	at jadx.core.dex.visitors.regions.RegionMaker.processMonitorEnter(RegionMaker.java:561)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:133)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:86)
        	at jadx.core.dex.visitors.regions.RegionMaker.processMonitorEnter(RegionMaker.java:598)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:133)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:86)
        	at jadx.core.dex.visitors.regions.RegionMaker.processIf(RegionMaker.java:698)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:123)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:86)
        	at jadx.core.dex.visitors.regions.RegionMaker.processIf(RegionMaker.java:698)
        	at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:123)
        	at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:86)
        	at jadx.core.dex.visitors.regions.RegionMakerVisitor.visit(RegionMakerVisitor.java:49)
        */
    public static void AFKeystoreWrapper(android.content.Context r7) {
        /*
            r6 = 10771(0x2a13, float:1.5093E-41)
            com.bytedance.frameworks.apm.trace.MethodCollector.i(r6)
            boolean r0 = com.appsflyer.internal.ac.AFInAppEventParameterName()
            if (r0 == 0) goto L_0x00c6
            r1 = 23
            java.lang.String r0 = "OPPO device found"
            com.appsflyer.AFLogger.AFInAppEventParameterName((java.lang.String) r0)
        L_0x0012:
            int r0 = android.os.Build.VERSION.SDK_INT
            if (r0 < r1) goto L_0x00d0
            java.lang.String r0 = "keyPropDisableAFKeystore"
            r5 = 1
            boolean r0 = AFInAppEventParameterName((java.lang.String) r0, (boolean) r5)
            if (r0 != 0) goto L_0x00d0
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "OS SDK is="
            r1.<init>(r0)
            int r0 = android.os.Build.VERSION.SDK_INT
            r1.append(r0)
            java.lang.String r0 = "; use KeyStore"
            r1.append(r0)
            java.lang.String r0 = r1.toString()
            com.appsflyer.AFLogger.AFInAppEventParameterName((java.lang.String) r0)
            com.appsflyer.AFKeystoreWrapper r3 = new com.appsflyer.AFKeystoreWrapper
            r3.<init>(r7)
            boolean r0 = r3.values()
            if (r0 != 0) goto L_0x0079
            java.lang.ref.WeakReference r0 = new java.lang.ref.WeakReference
            r0.<init>(r7)
            java.lang.String r0 = com.appsflyer.internal.ak.AFInAppEventParameterName((java.lang.ref.WeakReference<android.content.Context>) r0)
            r3.valueOf = r0
            r0 = 0
            r3.values = r0
            java.lang.String r0 = r3.AFInAppEventType()
            r3.AFKeystoreWrapper(r0)
        L_0x0057:
            java.lang.String r2 = "KSAppsFlyerId"
            java.lang.String r1 = r3.AFInAppEventParameterName()
            com.appsflyer.AppsFlyerProperties r0 = com.appsflyer.AppsFlyerProperties.getInstance()
            r0.set((java.lang.String) r2, (java.lang.String) r1)
            java.lang.String r2 = "KSAppsFlyerRICounter"
            int r0 = r3.valueOf()
            java.lang.String r1 = java.lang.String.valueOf(r0)
            com.appsflyer.AppsFlyerProperties r0 = com.appsflyer.AppsFlyerProperties.getInstance()
            r0.set((java.lang.String) r2, (java.lang.String) r1)
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r6)
            return
        L_0x0079:
            java.lang.String r2 = r3.AFInAppEventType()
            java.lang.Object r4 = r3.AFInAppEventParameterName
            monitor-enter(r4)
            int r0 = r3.values     // Catch:{ all -> 0x00ca }
            int r0 = r0 + r5
            r3.values = r0     // Catch:{ all -> 0x00ca }
            java.lang.String r1 = "Deleting key with alias: "
            java.lang.String r0 = java.lang.String.valueOf(r2)     // Catch:{ all -> 0x00ca }
            java.lang.String r0 = r1.concat(r0)     // Catch:{ all -> 0x00ca }
            com.appsflyer.AFLogger.valueOf((java.lang.String) r0)     // Catch:{ all -> 0x00ca }
            java.lang.Object r1 = r3.AFInAppEventParameterName     // Catch:{ KeyStoreException -> 0x00a2 }
            monitor-enter(r1)     // Catch:{ KeyStoreException -> 0x00a2 }
            java.security.KeyStore r0 = r3.AFKeystoreWrapper     // Catch:{ all -> 0x009c }
            r0.deleteEntry(r2)     // Catch:{ all -> 0x009c }
            monitor-exit(r1)     // Catch:{ all -> 0x009c }
            goto L_0x00bd
        L_0x009c:
            r0 = move-exception
            monitor-exit(r1)     // Catch:{ KeyStoreException -> 0x00a2 }
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r6)     // Catch:{ KeyStoreException -> 0x00a2 }
            throw r0     // Catch:{ KeyStoreException -> 0x00a2 }
        L_0x00a2:
            r2 = move-exception
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x00ca }
            java.lang.String r0 = "Exception "
            r1.<init>(r0)     // Catch:{ all -> 0x00ca }
            java.lang.String r0 = r2.getMessage()     // Catch:{ all -> 0x00ca }
            r1.append(r0)     // Catch:{ all -> 0x00ca }
            java.lang.String r0 = " occurred"
            r1.append(r0)     // Catch:{ all -> 0x00ca }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x00ca }
            com.appsflyer.AFLogger.valueOf(r0, r2)     // Catch:{ all -> 0x00ca }
        L_0x00bd:
            monitor-exit(r4)     // Catch:{ all -> 0x00ca }
            java.lang.String r0 = r3.AFInAppEventType()
            r3.AFKeystoreWrapper(r0)
            goto L_0x0057
        L_0x00c6:
            r1 = 18
            goto L_0x0012
        L_0x00ca:
            r0 = move-exception
            monitor-exit(r4)
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r6)
            throw r0
        L_0x00d0:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "OS SDK is="
            r1.<init>(r0)
            int r0 = android.os.Build.VERSION.SDK_INT
            r1.append(r0)
            java.lang.String r0 = "; no KeyStore usage"
            r1.append(r0)
            java.lang.String r0 = r1.toString()
            com.appsflyer.AFLogger.AFInAppEventParameterName((java.lang.String) r0)
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r6)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.ai.AFKeystoreWrapper(android.content.Context):void");
    }

    /* JADX WARNING: Removed duplicated region for block: B:26:0x0063 A[SYNTHETIC, Splitter:B:26:0x0063] */
    /* JADX WARNING: Removed duplicated region for block: B:29:0x0068 A[Catch:{ all -> 0x006c }] */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public static java.lang.String AFInAppEventParameterName(java.net.HttpURLConnection r8) {
        /*
            r7 = 10747(0x29fb, float:1.506E-41)
            com.bytedance.frameworks.apm.trace.MethodCollector.i(r7)
            java.lang.StringBuilder r6 = new java.lang.StringBuilder
            r6.<init>()
            r5 = 0
            java.io.InputStream r0 = r8.getErrorStream()     // Catch:{ all -> 0x0046 }
            if (r0 != 0) goto L_0x0015
            java.io.InputStream r0 = r8.getInputStream()     // Catch:{ all -> 0x0046 }
        L_0x0015:
            java.io.InputStreamReader r4 = new java.io.InputStreamReader     // Catch:{ all -> 0x0046 }
            r4.<init>(r0)     // Catch:{ all -> 0x0046 }
            java.io.BufferedReader r3 = new java.io.BufferedReader     // Catch:{ all -> 0x0044 }
            r3.<init>(r4)     // Catch:{ all -> 0x0044 }
            r0 = 0
        L_0x0020:
            java.lang.String r1 = r3.readLine()     // Catch:{ all -> 0x0041 }
            if (r1 == 0) goto L_0x003a
            if (r0 == 0) goto L_0x0029
            goto L_0x002c
        L_0x0029:
            java.lang.String r0 = ""
            goto L_0x0032
        L_0x002c:
            r0 = 10
            java.lang.Character r0 = java.lang.Character.valueOf(r0)     // Catch:{ all -> 0x0041 }
        L_0x0032:
            r6.append(r0)     // Catch:{ all -> 0x0041 }
            r6.append(r1)     // Catch:{ all -> 0x0041 }
            r0 = 1
            goto L_0x0020
        L_0x003a:
            r3.close()     // Catch:{ all -> 0x006c }
            r4.close()     // Catch:{ all -> 0x006c }
            goto L_0x0070
        L_0x0041:
            r2 = move-exception
            r5 = r3
            goto L_0x0048
        L_0x0044:
            r2 = move-exception
            goto L_0x0048
        L_0x0046:
            r2 = move-exception
            r4 = r5
        L_0x0048:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x009c }
            java.lang.String r0 = "Could not read connection response from: "
            r1.<init>(r0)     // Catch:{ all -> 0x009c }
            java.net.URL r0 = r8.getURL()     // Catch:{ all -> 0x009c }
            java.lang.String r0 = r0.toString()     // Catch:{ all -> 0x009c }
            r1.append(r0)     // Catch:{ all -> 0x009c }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x009c }
            com.appsflyer.AFLogger.valueOf(r0, r2)     // Catch:{ all -> 0x009c }
            if (r5 == 0) goto L_0x0066
            r5.close()     // Catch:{ all -> 0x006c }
        L_0x0066:
            if (r4 == 0) goto L_0x0070
            r4.close()     // Catch:{ all -> 0x006c }
            goto L_0x0070
        L_0x006c:
            r0 = move-exception
            com.appsflyer.AFLogger.valueOf((java.lang.Throwable) r0)
        L_0x0070:
            java.lang.String r2 = r6.toString()
            org.json.JSONObject r0 = new org.json.JSONObject     // Catch:{ JSONException -> 0x007d }
            r0.<init>(r2)     // Catch:{ JSONException -> 0x007d }
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r7)
            return r2
        L_0x007d:
            org.json.JSONObject r1 = new org.json.JSONObject
            r1.<init>()
            java.lang.String r0 = "string_response"
            r1.put(r0, r2)     // Catch:{ JSONException -> 0x008f }
            java.lang.String r0 = r1.toString()     // Catch:{ JSONException -> 0x008f }
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r7)
            return r0
        L_0x008f:
            org.json.JSONObject r0 = new org.json.JSONObject
            r0.<init>()
            java.lang.String r0 = r0.toString()
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r7)
            return r0
        L_0x009c:
            r1 = move-exception
            if (r5 == 0) goto L_0x00a2
            r5.close()     // Catch:{ all -> 0x00a8 }
        L_0x00a2:
            if (r4 == 0) goto L_0x00ac
            r4.close()     // Catch:{ all -> 0x00a8 }
            goto L_0x00ac
        L_0x00a8:
            r0 = move-exception
            com.appsflyer.AFLogger.valueOf((java.lang.Throwable) r0)
        L_0x00ac:
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r7)
            throw r1
        */
        throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.ai.AFInAppEventParameterName(java.net.HttpURLConnection):java.lang.String");
    }

    private void AFKeystoreWrapper(j jVar) {
        boolean z;
        long j;
        String str;
        DataOutputStream dataOutputStream;
        MethodCollector.i(12772);
        j jVar2 = jVar;
        URL url = new URL(jVar2.onAppOpenAttributionNative);
        byte[] valueOf2 = jVar2.valueOf();
        String str2 = jVar2.AppsFlyer2dXConversionCallback;
        String str3 = jVar2.getLevel;
        boolean AFKeystoreWrapper2 = jVar2.AFKeystoreWrapper();
        Application application = jVar2.valueOf;
        AppsFlyerRequestListener appsFlyerRequestListener = jVar2.AFInAppEventParameterName;
        if (!AFKeystoreWrapper2 || jVar2.onAttributionFailureNative != 1) {
            z = false;
        } else {
            z = true;
        }
        if (this.AFLogger$LogLevel == null) {
            this.AFLogger$LogLevel = new au(application);
        }
        au auVar = this.AFLogger$LogLevel;
        if (z) {
            auVar.AFKeystoreWrapper.put("from_fg", Long.valueOf(System.currentTimeMillis() - this.onValidateInAppFailure));
            j = System.currentTimeMillis();
        } else {
            j = 0;
        }
        try {
            HttpURLConnection httpURLConnection = (HttpURLConnection) INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_net_lancet_UrlConnectionLancet_openConnection(url);
            try {
                httpURLConnection.setRequestMethod("POST");
                httpURLConnection.setRequestProperty("Content-Length", String.valueOf(valueOf2.length));
                if (jVar2.AFInAppEventType()) {
                    str = "application/octet-stream";
                } else {
                    str = "application/json";
                }
                httpURLConnection.setRequestProperty("Content-Type", str);
                httpURLConnection.setConnectTimeout(10000);
                httpURLConnection.setDoOutput(true);
                if (!AppsFlyerProperties.getInstance().getBoolean("http_cache", true)) {
                    httpURLConnection.setUseCaches(false);
                }
                try {
                    dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream());
                    dataOutputStream.write(valueOf2);
                    dataOutputStream.close();
                    int responseCode = httpURLConnection.getResponseCode();
                    if (z) {
                        auVar.AFKeystoreWrapper.put("net", Long.valueOf(System.currentTimeMillis() - j));
                    }
                    String AFInAppEventParameterName2 = AFInAppEventParameterName(httpURLConnection);
                    aj.AFInAppEventParameterName().AFInAppEventType("server_response", url.toString(), String.valueOf(responseCode), AFInAppEventParameterName2);
                    AFLogger.valueOf("response code: ".concat(String.valueOf(responseCode)));
                    SharedPreferences values2 = values((Context) application);
                    if (responseCode == 200) {
                        if (application != null && AFKeystoreWrapper2) {
                            this.onValidateInApp = System.currentTimeMillis();
                            av valueOf3 = this.setAdditionalData.valueOf();
                            if (valueOf3.AFKeystoreWrapper.AFInAppEventType()) {
                                valueOf3.values.submit(valueOf3);
                            }
                        }
                        if (appsFlyerRequestListener != null) {
                            appsFlyerRequestListener.onSuccess();
                        }
                        if (str3 != null) {
                            af.values();
                            af.AFKeystoreWrapper(str3, application);
                        } else {
                            SharedPreferences.Editor edit = values((Context) application).edit();
                            edit.putString("sentSuccessfully", "true");
                            edit.apply();
                            if (!this.AppsFlyerInAppPurchaseValidatorListener && System.currentTimeMillis() - this.AppsFlyer2dXConversionCallback >= 15000 && this.AppsFlyerLib == null) {
                                if (k.values == null) {
                                    k.values = new k();
                                }
                                this.AppsFlyerLib = k.values.AFInAppEventType();
                                AFInAppEventParameterName(this.AppsFlyerLib, new e(application), 1, TimeUnit.SECONDS);
                            }
                        }
                        bq bqVar = new bq(application);
                        aa values3 = bqVar.values();
                        if (values3 != null && values3.valueOf()) {
                            String str4 = values3.AFKeystoreWrapper;
                            AFLogger.AFInAppEventType("Resending Uninstall token to AF servers: ".concat(String.valueOf(str4)));
                            bqVar.AFInAppEventType(str4);
                        }
                        this.setDebugLog = as.valueOf(AFInAppEventParameterName2).optBoolean("send_background", false);
                    } else if (appsFlyerRequestListener != null) {
                        int i = RequestError.RESPONSE_CODE_FAILURE;
                        StringBuilder sb = new StringBuilder();
                        sb.append(az.AFInAppEventParameterName);
                        sb.append(" ");
                        sb.append(responseCode);
                        appsFlyerRequestListener.onError(i, sb.toString());
                    }
                    String str5 = str2;
                    j jVar3 = jVar2;
                    bo.values(this, jVar3, str5, application, values2, Integer.valueOf(responseCode), (Throwable) null);
                    httpURLConnection.disconnect();
                    MethodCollector.o(12772);
                } catch (Throwable th) {
                    th = th;
                    MethodCollector.o(12772);
                    throw th;
                }
            } catch (Throwable th2) {
                th = th2;
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
                MethodCollector.o(12772);
                throw th;
            }
        } catch (Throwable th3) {
            th = th3;
            MethodCollector.o(12772);
            throw th;
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:12:0x0072  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void sendPushNotificationData(android.app.Activity r19) {
        /*
            r18 = this;
            r4 = r18
            r4 = r4
            java.lang.String r6 = "c"
            java.lang.String r3 = "pid"
            r11 = 1
            r10 = 0
            r1 = 2
            java.lang.String r8 = "public_api_call"
            java.lang.String r7 = "sendPushNotificationData"
            r5 = r19
            if (r5 == 0) goto L_0x0164
            android.content.Intent r0 = r5.getIntent()
            if (r0 == 0) goto L_0x014f
            com.appsflyer.internal.aj r9 = com.appsflyer.internal.aj.AFInAppEventParameterName()
            java.lang.String[] r2 = new java.lang.String[r1]
            java.lang.String r0 = r5.getLocalClassName()
            r2[r10] = r0
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r0 = "activity_intent_"
            r1.<init>(r0)
            android.content.Intent r0 = r5.getIntent()
            java.lang.String r0 = r0.toString()
            r1.append(r0)
            java.lang.String r0 = r1.toString()
            r2[r11] = r0
            r9.AFInAppEventType(r8, r7, r2)
        L_0x003f:
            java.lang.String r0 = AFInAppEventType((android.app.Activity) r5)
            r4.getSdkVersion = r0
            if (r0 == 0) goto L_0x009d
            long r16 = java.lang.System.currentTimeMillis()
            java.util.Map<java.lang.Long, java.lang.String> r0 = r4.getInstance
            java.lang.String r7 = ")"
            if (r0 != 0) goto L_0x009e
            java.lang.String r0 = "pushes: initializing pushes history.."
            com.appsflyer.AFLogger.valueOf((java.lang.String) r0)
            java.util.concurrent.ConcurrentHashMap r0 = new java.util.concurrent.ConcurrentHashMap
            r0.<init>()
            r4.getInstance = r0
            r1 = r16
        L_0x005f:
            com.appsflyer.AppsFlyerProperties r6 = com.appsflyer.AppsFlyerProperties.getInstance()
            java.lang.String r3 = "pushPayloadHistorySize"
            r0 = 2
            int r3 = r6.getInt(r3, r0)
            java.util.Map<java.lang.Long, java.lang.String> r0 = r4.getInstance
            int r0 = r0.size()
            if (r0 != r3) goto L_0x008f
            java.lang.StringBuilder r3 = new java.lang.StringBuilder
            java.lang.String r0 = "pushes: removing oldest overflowing push (oldest push:"
            r3.<init>(r0)
            r3.append(r1)
            r3.append(r7)
            java.lang.String r0 = r3.toString()
            com.appsflyer.AFLogger.valueOf((java.lang.String) r0)
            java.util.Map<java.lang.Long, java.lang.String> r3 = r4.getInstance
            java.lang.Long r0 = java.lang.Long.valueOf(r1)
            r3.remove(r0)
        L_0x008f:
            java.util.Map<java.lang.Long, java.lang.String> r2 = r4.getInstance
            java.lang.Long r1 = java.lang.Long.valueOf(r16)
            java.lang.String r0 = r4.getSdkVersion
            r2.put(r1, r0)
            r4.start(r5)
        L_0x009d:
            return
        L_0x009e:
            com.appsflyer.AppsFlyerProperties r8 = com.appsflyer.AppsFlyerProperties.getInstance()     // Catch:{ all -> 0x0131 }
            java.lang.String r2 = "pushPayloadMaxAging"
            r0 = 1800000(0x1b7740, double:8.89318E-318)
            long r14 = r8.getLong(r2, r0)     // Catch:{ all -> 0x0131 }
            java.util.Map<java.lang.Long, java.lang.String> r0 = r4.getInstance     // Catch:{ all -> 0x0131 }
            java.util.Set r0 = r0.keySet()     // Catch:{ all -> 0x0131 }
            java.util.Iterator r13 = r0.iterator()     // Catch:{ all -> 0x0131 }
            r1 = r16
        L_0x00b7:
            boolean r0 = r13.hasNext()     // Catch:{ all -> 0x012f }
            if (r0 == 0) goto L_0x005f
            java.lang.Object r10 = r13.next()     // Catch:{ all -> 0x012f }
            java.lang.Long r10 = (java.lang.Long) r10     // Catch:{ all -> 0x012f }
            org.json.JSONObject r9 = new org.json.JSONObject     // Catch:{ all -> 0x012f }
            java.lang.String r0 = r4.getSdkVersion     // Catch:{ all -> 0x012f }
            r9.<init>(r0)     // Catch:{ all -> 0x012f }
            org.json.JSONObject r11 = new org.json.JSONObject     // Catch:{ all -> 0x012f }
            java.util.Map<java.lang.Long, java.lang.String> r0 = r4.getInstance     // Catch:{ all -> 0x012f }
            java.lang.Object r0 = r0.get(r10)     // Catch:{ all -> 0x012f }
            java.lang.String r0 = (java.lang.String) r0     // Catch:{ all -> 0x012f }
            r11.<init>(r0)     // Catch:{ all -> 0x012f }
            java.lang.Object r8 = r9.opt(r3)     // Catch:{ all -> 0x012f }
            java.lang.Object r0 = r11.opt(r3)     // Catch:{ all -> 0x012f }
            boolean r0 = r8.equals(r0)     // Catch:{ all -> 0x012f }
            if (r0 == 0) goto L_0x0113
            java.lang.Object r8 = r9.opt(r6)     // Catch:{ all -> 0x012f }
            java.lang.Object r0 = r11.opt(r6)     // Catch:{ all -> 0x012f }
            boolean r0 = r8.equals(r0)     // Catch:{ all -> 0x012f }
            if (r0 == 0) goto L_0x0113
            java.lang.StringBuilder r3 = new java.lang.StringBuilder     // Catch:{ all -> 0x012f }
            java.lang.String r0 = "PushNotificationMeasurement: A previous payload with same PID and campaign was already acknowledged! (old: "
            r3.<init>(r0)     // Catch:{ all -> 0x012f }
            r3.append(r11)     // Catch:{ all -> 0x012f }
            java.lang.String r0 = ", new: "
            r3.append(r0)     // Catch:{ all -> 0x012f }
            r3.append(r9)     // Catch:{ all -> 0x012f }
            r3.append(r7)     // Catch:{ all -> 0x012f }
            java.lang.String r0 = r3.toString()     // Catch:{ all -> 0x012f }
            com.appsflyer.AFLogger.valueOf((java.lang.String) r0)     // Catch:{ all -> 0x012f }
            r0 = 0
            r4.getSdkVersion = r0     // Catch:{ all -> 0x012f }
            goto L_0x0173
        L_0x0113:
            long r11 = r10.longValue()     // Catch:{ all -> 0x012f }
            long r8 = r16 - r11
            int r0 = (r8 > r14 ? 1 : (r8 == r14 ? 0 : -1))
            if (r0 <= 0) goto L_0x0122
            java.util.Map<java.lang.Long, java.lang.String> r0 = r4.getInstance     // Catch:{ all -> 0x012f }
            r0.remove(r10)     // Catch:{ all -> 0x012f }
        L_0x0122:
            long r8 = r10.longValue()     // Catch:{ all -> 0x012f }
            int r0 = (r8 > r1 ? 1 : (r8 == r1 ? 0 : -1))
            if (r0 > 0) goto L_0x00b7
            long r1 = r10.longValue()     // Catch:{ all -> 0x012f }
            goto L_0x00b7
        L_0x012f:
            r6 = move-exception
            goto L_0x0134
        L_0x0131:
            r6 = move-exception
            r1 = r16
        L_0x0134:
            java.lang.StringBuilder r3 = new java.lang.StringBuilder
            java.lang.String r0 = "Error while handling push notification measurement: "
            r3.<init>(r0)
            java.lang.Class r0 = r6.getClass()
            java.lang.String r0 = r0.getSimpleName()
            r3.append(r0)
            java.lang.String r0 = r3.toString()
            com.appsflyer.AFLogger.valueOf(r0, r6)
            goto L_0x005f
        L_0x014f:
            com.appsflyer.internal.aj r2 = com.appsflyer.internal.aj.AFInAppEventParameterName()
            java.lang.String[] r1 = new java.lang.String[r1]
            java.lang.String r0 = r5.getLocalClassName()
            r1[r10] = r0
            java.lang.String r0 = "activity_intent_null"
            r1[r11] = r0
            r2.AFInAppEventType(r8, r7, r1)
            goto L_0x003f
        L_0x0164:
            com.appsflyer.internal.aj r1 = com.appsflyer.internal.aj.AFInAppEventParameterName()
            java.lang.String r0 = "activity_null"
            java.lang.String[] r0 = new java.lang.String[]{r0}
            r1.AFInAppEventType(r8, r7, r0)
            goto L_0x003f
        L_0x0173:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.ai.sendPushNotificationData(android.app.Activity):void");
    }

    public static boolean valueOf(SharedPreferences sharedPreferences) {
        return Boolean.parseBoolean(sharedPreferences.getString("sentSuccessfully", (String) null));
    }

    public static Object INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_get(Bundle bundle, String str) {
        try {
            return bundle.get(str);
        } catch (Exception | OutOfMemoryError unused) {
            return null;
        }
    }

    public static String INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra(Intent intent, String str) {
        try {
            return intent.getStringExtra(str);
        } catch (Exception unused) {
            return null;
        }
    }

    public final void appendParametersToDeepLinkingURL(String str, Map<String, String> map) {
        i values2 = i.values();
        values2.AFLogger$LogLevel = str;
        values2.getLevel = map;
    }

    public final void start(Context context, String str) {
        start(context, str, (AppsFlyerRequestListener) null);
    }

    public final void updateServerUninstallToken(Context context, String str) {
        new bq(context).values(str);
    }

    public static String AFInAppEventParameterName(SimpleDateFormat simpleDateFormat, long j) {
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        return simpleDateFormat.format(new Date(j));
    }

    public static String INVOKESTATIC_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AnndroidIdSecureLancet_getString(ContentResolver contentResolver, String str) {
        if (!TextUtils.equals(str, "android_id")) {
            return com_appsflyer_internal_ai_android_provider_Settings$Secure_getString(contentResolver, str);
        }
        if (TextUtils.isEmpty(2XJ.LIZ)) {
            2XJ.LIZ = com_appsflyer_internal_ai_android_provider_Settings$Secure_getString(contentResolver, str);
        }
        return 2XJ.LIZ;
    }

    public static int INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_isGooglePlayServicesAvailable(GoogleApiAvailability googleApiAvailability, Context context) {
        if (8n2.LJIIIZ && 8n2.LJI >= 0) {
            return 8n2.LJI;
        }
        int isGooglePlayServicesAvailable = googleApiAvailability.isGooglePlayServicesAvailable(context);
        8n2.LJI = isGooglePlayServicesAvailable;
        return isGooglePlayServicesAvailable;
    }

    public final void registerConversionListener(Context context, AppsFlyerConversionListener appsFlyerConversionListener) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "registerConversionListener", new String[0]);
        if (appsFlyerConversionListener != null) {
            AFInAppEventType = appsFlyerConversionListener;
        }
    }

    public final void registerValidatorListener(Context context, AppsFlyerInAppPurchaseValidatorListener appsFlyerInAppPurchaseValidatorListener) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "registerValidatorListener", new String[0]);
        AFLogger.AFInAppEventType("registerValidatorListener called");
        if (appsFlyerInAppPurchaseValidatorListener == null) {
            AFLogger.AFInAppEventType("registerValidatorListener null listener");
        } else {
            AFKeystoreWrapper = appsFlyerInAppPurchaseValidatorListener;
        }
    }

    public final void subscribeForDeepLink(DeepLinkListener deepLinkListener, long j) {
        i.values().valueOf = deepLinkListener;
        ar.onInstallConversionDataLoadedNative = j;
    }

    public static void AFKeystoreWrapper(Context context, Map<String, ? super String> map) {
        u.a valueOf2 = u.valueOf(context);
        map.put("network", valueOf2.AFInAppEventParameterName);
        if (valueOf2.values != null) {
            map.put("operator", valueOf2.values);
        }
        if (valueOf2.AFKeystoreWrapper != null) {
            map.put("carrier", valueOf2.AFKeystoreWrapper);
        }
    }

    public final void performOnDeepLinking(final Intent intent, Context context) {
        if (intent == null) {
            ap.AFInAppEventParameterName("performOnDeepLinking was called with null intent", DeepLinkResult.Error.DEVELOPER_ERROR);
        } else if (context == null) {
            ap.AFInAppEventParameterName("performOnDeepLinking was called with null context", DeepLinkResult.Error.DEVELOPER_ERROR);
        } else {
            final Context INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context);
            this.setAppInviteOneLink.execute(new Runnable() {
                static {
                    Covode.recordClassIndex(2599);
                }

                public final void run() {
                    boolean z;
                    i.values();
                    Intent intent = intent;
                    Context context = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext;
                    ai aiVar = ai.this;
                    if (aiVar.AFLogger$LogLevel == null) {
                        aiVar.AFLogger$LogLevel = new au(context);
                    }
                    au auVar = aiVar.AFLogger$LogLevel;
                    Uri AFKeystoreWrapper2 = i.AFKeystoreWrapper(intent);
                    if (AFKeystoreWrapper2 == null || AFKeystoreWrapper2.toString().isEmpty()) {
                        z = false;
                    } else {
                        z = true;
                    }
                    if (!ai.values(context).getBoolean("ddl_sent", false) || z) {
                        i.values().AFKeystoreWrapper(new HashMap(), auVar, intent, context);
                    } else {
                        ap.AFInAppEventParameterName("No direct deep link", (DeepLinkResult.Error) null);
                    }
                }
            });
        }
    }

    public final void setHost(String str, String str2) {
        if (str != null) {
            AppsFlyerProperties.getInstance().set("custom_host_prefix", str);
        }
        if (str2 == null || str2.isEmpty()) {
            AFLogger.AFLogger$LogLevel("hostName cannot be null or empty");
        } else {
            AppsFlyerProperties.getInstance().set("custom_host", str2);
        }
    }

    private String AFInAppEventType(SimpleDateFormat simpleDateFormat, Context context) {
        String string = values(context).getString("appsFlyerFirstInstall", (String) null);
        if (string == null) {
            if (AFInAppEventType(context)) {
                AFLogger.AFInAppEventType("AppsFlyer: first launch detected");
                string = simpleDateFormat.format(new Date());
            } else {
                string = "";
            }
            SharedPreferences.Editor edit = values(context).edit();
            edit.putString("appsFlyerFirstInstall", string);
            edit.apply();
        }
        AFLogger.valueOf("AppsFlyer: first launch date: ".concat(String.valueOf(string)));
        return string;
    }

    public static Object INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_GetSystemServiceLancet_getSystemService(Context context, String str) {
        Object obj;
        MethodCollector.i(16557);
        if (Build.VERSION.SDK_INT > 27 || !"clipboard".equals(str)) {
            if (!2FV.LIZIZ && "connectivity".equals(str)) {
                try {
                    new 7s1().LIZ();
                    2FV.LIZIZ = true;
                    obj = context.getSystemService(str);
                } catch (Throwable unused) {
                }
            }
            obj = context.getSystemService(str);
        } else if (2FV.LIZ) {
            synchronized (ClipboardManager.class) {
                try {
                    obj = context.getSystemService(str);
                    if (Thread.currentThread() != Looper.getMainLooper().getThread()) {
                        Field declaredField = ClipboardManager.class.getDeclaredField("mHandler");
                        declaredField.setAccessible(true);
                        declaredField.set(obj, new 2He((Handler) declaredField.get(obj)));
                    }
                } catch (Exception e2) {
                    8jA.LIZ(e2, "ClipboardManager Handler Reflect Fail");
                } catch (Throwable th) {
                    MethodCollector.o(16557);
                    throw th;
                }
                2FV.LIZ = false;
            }
        } else {
            obj = context.getSystemService(str);
        }
        MethodCollector.o(16557);
        return obj;
    }

    public static void valueOf(Context context, String str) {
        SharedPreferences.Editor edit = values(context).edit();
        edit.putBoolean(str, true);
        edit.apply();
    }

    /* JADX WARNING: Missing exception handler attribute for start block: B:20:0x0036 */
    /* JADX WARNING: Removed duplicated region for block: B:16:0x0031 A[SYNTHETIC, Splitter:B:16:0x0031] */
    /* JADX WARNING: Unknown top exception splitter block from list: {B:20:0x0036=Splitter:B:20:0x0036, B:13:0x0028=Splitter:B:13:0x0028} */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public static java.lang.String values(java.io.File r4, java.lang.String r5) {
        /*
            r2 = 0
            java.util.Properties r1 = new java.util.Properties     // Catch:{ FileNotFoundException -> 0x0035, all -> 0x0026 }
            r1.<init>()     // Catch:{ FileNotFoundException -> 0x0035, all -> 0x0026 }
            java.io.FileReader r3 = new java.io.FileReader     // Catch:{ FileNotFoundException -> 0x0035, all -> 0x0026 }
            r3.<init>(r4)     // Catch:{ FileNotFoundException -> 0x0035, all -> 0x0026 }
            r1.load(r3)     // Catch:{ FileNotFoundException -> 0x0036, all -> 0x0024 }
            java.lang.String r0 = "Found PreInstall property!"
            com.appsflyer.AFLogger.valueOf((java.lang.String) r0)     // Catch:{ FileNotFoundException -> 0x0036, all -> 0x0024 }
            java.lang.String r2 = r1.getProperty(r5)     // Catch:{ FileNotFoundException -> 0x0036, all -> 0x0024 }
            r3.close()     // Catch:{ all -> 0x001b }
            goto L_0x0023
        L_0x001b:
            r1 = move-exception
            java.lang.String r0 = r1.getMessage()
            com.appsflyer.AFLogger.valueOf(r0, r1)
        L_0x0023:
            return r2
        L_0x0024:
            r1 = move-exception
            goto L_0x0028
        L_0x0026:
            r1 = move-exception
            r3 = r2
        L_0x0028:
            java.lang.String r0 = r1.getMessage()     // Catch:{ all -> 0x005a }
            com.appsflyer.AFLogger.valueOf(r0, r1)     // Catch:{ all -> 0x005a }
            if (r3 == 0) goto L_0x0059
            r3.close()     // Catch:{ all -> 0x0051 }
            goto L_0x0059
        L_0x0035:
            r3 = r2
        L_0x0036:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder     // Catch:{ all -> 0x005a }
            java.lang.String r0 = "PreInstall file wasn't found: "
            r1.<init>(r0)     // Catch:{ all -> 0x005a }
            java.lang.String r0 = r4.getAbsolutePath()     // Catch:{ all -> 0x005a }
            r1.append(r0)     // Catch:{ all -> 0x005a }
            java.lang.String r0 = r1.toString()     // Catch:{ all -> 0x005a }
            com.appsflyer.AFLogger.AFInAppEventType(r0)     // Catch:{ all -> 0x005a }
            if (r3 == 0) goto L_0x0059
            r3.close()     // Catch:{ all -> 0x0051 }
            goto L_0x0059
        L_0x0051:
            r1 = move-exception
            java.lang.String r0 = r1.getMessage()
            com.appsflyer.AFLogger.valueOf(r0, r1)
        L_0x0059:
            return r2
        L_0x005a:
            r2 = move-exception
            if (r3 == 0) goto L_0x0069
            r3.close()     // Catch:{ all -> 0x0061 }
            goto L_0x0069
        L_0x0061:
            r1 = move-exception
            java.lang.String r0 = r1.getMessage()
            com.appsflyer.AFLogger.valueOf(r0, r1)
        L_0x0069:
            throw r2
        */
        throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.ai.values(java.io.File, java.lang.String):java.lang.String");
    }

    public final void performOnAppAttribution(Context context, URI uri) {
        if (uri == null || uri.toString().isEmpty()) {
            StringBuilder sb = new StringBuilder("Link is \"");
            sb.append(uri);
            sb.append("\"");
            ap.AFInAppEventParameterName(sb.toString(), DeepLinkResult.Error.NETWORK);
        } else if (context == null) {
            StringBuilder sb2 = new StringBuilder("Context is \"");
            sb2.append(context);
            sb2.append("\"");
            ap.AFInAppEventParameterName(sb2.toString(), DeepLinkResult.Error.NETWORK);
        } else {
            i.values().AFKeystoreWrapper(context, new HashMap(), Uri.parse(uri.toString()));
        }
    }

    public final void setCustomerIdAndLogSession(String str, Context context) {
        if (context == null) {
            return;
        }
        if (AFInAppEventType()) {
            setCustomerUserId(str);
            StringBuilder sb = new StringBuilder("CustomerUserId set: ");
            sb.append(str);
            sb.append(" - Initializing AppsFlyer Tacking");
            AFLogger.values(sb.toString(), true);
            String referrer = AppsFlyerProperties.getInstance().getReferrer(context);
            String string = AppsFlyerProperties.getInstance().getString("AppsFlyerKey");
            if (referrer == null) {
                referrer = "";
            }
            if (context instanceof Activity) {
                ((Activity) context).getIntent();
            }
            by byVar = new by();
            byVar.valueOf = (Application) INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context);
            byVar.AFLogger$LogLevel = null;
            byVar.AppsFlyer2dXConversionCallback = string;
            byVar.AFKeystoreWrapper = null;
            byVar.AFVersionDeclaration = referrer;
            byVar.values = null;
            AFInAppEventParameterName((j) byVar);
            return;
        }
        setCustomerUserId(str);
        AFLogger.values("waitForCustomerUserId is false; setting CustomerUserID: ".concat(String.valueOf(str)), true);
    }

    public final void setUserEmails(AppsFlyerProperties.EmailsCryptType emailsCryptType, String... strArr) {
        ArrayList arrayList = new ArrayList(strArr.length + 1);
        arrayList.add(emailsCryptType.toString());
        arrayList.addAll(Arrays.asList(strArr));
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "setUserEmails", (String[]) arrayList.toArray(new String[(strArr.length + 1)]));
        AppsFlyerProperties.getInstance().set("userEmailsCryptType", emailsCryptType.getValue());
        HashMap hashMap = new HashMap();
        ArrayList arrayList2 = new ArrayList();
        String str = null;
        for (String str2 : strArr) {
            if (AnonymousClass7.values[emailsCryptType.ordinal()] != 2) {
                arrayList2.add(ah.AFInAppEventParameterName(str2));
                str = "sha256_el_arr";
            } else {
                arrayList2.add(str2);
                str = "plain_el_arr";
            }
        }
        hashMap.put(str, arrayList2);
        AppsFlyerProperties.getInstance().setUserEmails(new JSONObject(hashMap).toString());
    }

    public final void stop(boolean z, Context context) {
        this.setImeiData = z;
        af.values();
        try {
            File values2 = af.values(context);
            if (!values2.exists()) {
                values2.mkdir();
            } else {
                for (File file : values2.listFiles()) {
                    StringBuilder sb = new StringBuilder("Found cached request");
                    sb.append(file.getName());
                    AFLogger.valueOf(sb.toString());
                    af.AFKeystoreWrapper(af.valueOf(file).AFKeystoreWrapper, context);
                }
            }
        } catch (Exception e2) {
            AFLogger.valueOf("Could not cache request", e2);
        }
        if (this.setImeiData) {
            SharedPreferences.Editor edit = values(context).edit();
            edit.putBoolean("is_stop_tracking_used", true);
            edit.apply();
        }
    }

    public final void setPartnerData(String str, Map<String, Object> map) {
        String concat;
        if (this.setUserEmails == null) {
            this.setUserEmails = new bb();
        }
        bb bbVar = this.setUserEmails;
        if (str == null || str.isEmpty()) {
            AFLogger.AFLogger$LogLevel("Partner ID is missing or `null`");
        } else if (map == null || map.isEmpty()) {
            if (bbVar.values.remove(str) == null) {
                concat = "Partner data is missing or `null`";
            } else {
                concat = "Cleared partner data for ".concat(String.valueOf(str));
            }
            AFLogger.AFLogger$LogLevel(concat);
        } else {
            StringBuilder sb = new StringBuilder("Setting partner data for ");
            sb.append(str);
            sb.append(": ");
            sb.append(map);
            AFLogger.AFInAppEventType(sb.toString());
            int length = new JSONObject(map).toString().length();
            if (length > 1000) {
                AFLogger.AFLogger$LogLevel("Partner data 1000 characters limit exceeded");
                HashMap hashMap = new HashMap();
                hashMap.put("error", "limit exceeded: ".concat(String.valueOf(length)));
                bbVar.AFInAppEventType.put(str, hashMap);
                return;
            }
            bbVar.values.put(str, map);
            bbVar.AFInAppEventType.remove(str);
        }
    }

    public final String values(Context context, String str) {
        SharedPreferences values2 = values(context);
        if (values2.contains("CACHED_CHANNEL")) {
            return values2.getString("CACHED_CHANNEL", (String) null);
        }
        SharedPreferences.Editor edit = values(context).edit();
        edit.putString("CACHED_CHANNEL", str);
        edit.apply();
        return str;
    }

    public static void valueOf(Context context, Map<String, Object> map) {
        String str;
        WindowManager windowManager = (WindowManager) INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_GetSystemServiceLancet_getSystemService(context, "window");
        if (windowManager != null) {
            int rotation = windowManager.getDefaultDisplay().getRotation();
            if (rotation == 0) {
                str = "p";
            } else if (rotation == 1) {
                str = "l";
            } else if (rotation == 2) {
                str = "pr";
            } else if (rotation != 3) {
                str = "";
            } else {
                str = "lr";
            }
            map.put("sc_o", str);
        }
    }

    public final void sendAdRevenue(Context context, Map<String, Object> map) {
        bs bsVar = new bs();
        if (context != null) {
            bsVar.valueOf = (Application) INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context);
        }
        bsVar.AFKeystoreWrapper = map;
        Application application = bsVar.valueOf;
        String LIZ = AnonymousClass0HH.LIZ(onAttributionFailureNative, new Object[]{AppsFlyerLib.getInstance().getHostPrefix(), onAppOpenAttribution.getHostName()});
        StringBuilder sb = new StringBuilder();
        sb.append(LIZ);
        sb.append(application.getPackageName());
        String obj = sb.toString();
        SharedPreferences values2 = values((Context) application);
        int AFInAppEventParameterName2 = AFInAppEventParameterName(values2, "appsFlyerCount", false);
        int AFInAppEventParameterName3 = AFInAppEventParameterName(values2, "appsFlyerAdRevenueCount", true);
        HashMap hashMap = new HashMap();
        hashMap.put("ad_network", bsVar.AFKeystoreWrapper);
        hashMap.put("adrevenue_counter", Integer.valueOf(AFInAppEventParameterName3));
        String string = AppsFlyerProperties.getInstance().getString("AppsFlyerKey");
        hashMap.put("af_key", string);
        hashMap.put("launch_counter", Integer.valueOf(AFInAppEventParameterName2));
        hashMap.put("af_timestamp", Long.toString(new Date().getTime()));
        hashMap.put("uid", ak.AFInAppEventParameterName((WeakReference<Context>) new WeakReference(application)));
        String string2 = AppsFlyerProperties.getInstance().getString("advertiserId");
        String string3 = AppsFlyerProperties.getInstance().getString("advertiserIdEnabled");
        if (string3 != null) {
            hashMap.put("advertiserIdEnabled", string3);
        }
        if (string2 != null) {
            hashMap.put("advertiserId", string2);
        }
        hashMap.put("device", Build.DEVICE);
        valueOf((Context) application, (Map<String, Object>) hashMap);
        try {
            PackageInfo INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getPackageInfo = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getPackageInfo(application.getPackageManager(), application.getPackageName(), 0);
            hashMap.put("app_version_code", Integer.toString(INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getPackageInfo.versionCode));
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
            long j = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getPackageInfo.firstInstallTime;
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
            hashMap.put("install_date", simpleDateFormat.format(new Date(j)));
            String string4 = values2.getString("appsFlyerFirstInstall", (String) null);
            if (string4 == null) {
                string4 = AFInAppEventType(simpleDateFormat, application);
            }
            hashMap.put("first_launch_date", string4);
        } catch (Throwable th) {
            AFLogger.valueOf("AdRevenue - Exception while collecting app version data ", th);
        }
        bsVar.valueOf(obj);
        bsVar.AFInAppEventType(hashMap);
        bsVar.onAttributionFailureNative = AFInAppEventParameterName2;
        bsVar.AppsFlyer2dXConversionCallback = string;
        d dVar = new d(this, bsVar, (byte) 0);
        if (k.values == null) {
            k.values = new k();
        }
        AFInAppEventParameterName(k.values.AFInAppEventType(), dVar, 1, TimeUnit.MILLISECONDS);
    }

    public static /* synthetic */ void AFInAppEventParameterName(ai aiVar, j jVar) {
        String jSONObject;
        StringBuilder sb = new StringBuilder("url: ");
        sb.append(jVar.onAppOpenAttributionNative);
        AFLogger.valueOf(sb.toString());
        if (jVar.getLevel != null) {
            jSONObject = Base64.encodeToString(jVar.valueOf(), 2);
            AFLogger.valueOf("cached data: ".concat(String.valueOf(jSONObject)));
        } else {
            jSONObject = new JSONObject(jVar.AFInAppEventParameterName()).toString();
            String replaceAll = jSONObject.replaceAll("\\p{C}", "*Non-printing character*");
            if (!replaceAll.equals(jSONObject)) {
                AFLogger.AFLogger$LogLevel("Payload contains non-printing characters");
                jSONObject = replaceAll;
            }
            al.values("data: ".concat(String.valueOf(jSONObject)));
        }
        aj.AFInAppEventParameterName().AFInAppEventType("server_request", jVar.onAppOpenAttributionNative, jSONObject);
        try {
            aiVar.AFKeystoreWrapper(jVar);
        } catch (IOException e2) {
            AFLogger.valueOf("Exception in sendRequestToServer. ", e2);
            if (AppsFlyerProperties.getInstance().getBoolean("useHttpFallback", false)) {
                jVar.valueOf(jVar.onAppOpenAttributionNative.replace("https:", "http:"));
                aiVar.AFKeystoreWrapper(jVar);
                return;
            }
            StringBuilder sb2 = new StringBuilder("failed to send request to server. ");
            sb2.append(e2.getLocalizedMessage());
            AFLogger.valueOf(sb2.toString());
            throw e2;
        }
    }

    public static /* synthetic */ void values(ai aiVar, j jVar) {
        boolean z;
        String str;
        ScheduledExecutorService AFInAppEventType2;
        long j;
        Application application = jVar.valueOf;
        String str2 = jVar.AFLogger$LogLevel;
        if (application == null) {
            AFLogger.AFInAppEventType("sendWithEvent - got null context. skipping event/launch.");
            return;
        }
        SharedPreferences values2 = values((Context) application);
        AppsFlyerProperties.getInstance().saveProperties(values2);
        if (!aiVar.isStopped()) {
            StringBuilder sb = new StringBuilder("sendWithEvent from activity: ");
            sb.append(application.getClass().getName());
            AFLogger.valueOf(sb.toString());
        }
        int i = 1;
        int i2 = 0;
        if (str2 == null) {
            z = true;
        } else {
            z = false;
        }
        boolean z2 = jVar instanceof bx;
        boolean z3 = jVar instanceof bw;
        jVar.onDeepLinkingNative = z;
        Map<String, Object> valueOf2 = aiVar.valueOf(jVar);
        String str3 = (String) valueOf2.get("appsflyerKey");
        if (str3 == null || str3.length() == 0) {
            AFLogger.AFInAppEventType("Not sending data yet, waiting for dev key");
            AppsFlyerRequestListener appsFlyerRequestListener = jVar.AFInAppEventParameterName;
            if (appsFlyerRequestListener != null) {
                appsFlyerRequestListener.onError(RequestError.NO_DEV_KEY, az.AFInAppEventType);
                return;
            }
            return;
        }
        if (!aiVar.isStopped()) {
            AFLogger.valueOf("AppsFlyerLib.sendWithEvent");
        }
        int AFInAppEventParameterName2 = AFInAppEventParameterName(values2, "appsFlyerCount", false);
        if (z3 || z2) {
            str = AnonymousClass0HH.LIZ(onDeepLinking, new Object[]{AppsFlyerLib.getInstance().getHostPrefix(), onAppOpenAttribution.getHostName()});
        } else if (!z) {
            str = AnonymousClass0HH.LIZ(onAttributionFailure, new Object[]{AppsFlyerLib.getInstance().getHostPrefix(), onAppOpenAttribution.getHostName()});
        } else if (AFInAppEventParameterName2 < 2) {
            str = AnonymousClass0HH.LIZ(onInstallConversionDataLoadedNative, new Object[]{AppsFlyerLib.getInstance().getHostPrefix(), onAppOpenAttribution.getHostName()});
        } else {
            str = AnonymousClass0HH.LIZ(onConversionDataFail, new Object[]{AppsFlyerLib.getInstance().getHostPrefix(), onAppOpenAttribution.getHostName()});
        }
        StringBuilder sb2 = new StringBuilder();
        sb2.append(str);
        sb2.append(application.getPackageName());
        String obj = sb2.toString();
        StringBuilder sb3 = new StringBuilder();
        sb3.append(obj);
        sb3.append("&buildnumber=6.4.0");
        String obj2 = sb3.toString();
        String valueOf3 = aiVar.valueOf((Context) application);
        if (valueOf3 != null) {
            StringBuilder sb4 = new StringBuilder();
            sb4.append(obj2);
            sb4.append("&channel=");
            sb4.append(valueOf3);
            obj2 = sb4.toString();
        }
        if (!AppsFlyerProperties.getInstance().getBoolean("collectAndroidIdForceByUser", false) && !AppsFlyerProperties.getInstance().getBoolean("collectIMEIForceByUser", false) && valueOf2.get("advertiserId") != null) {
            try {
                if (TextUtils.isEmpty(aiVar.getLevel) && valueOf2.remove("android_id") != null) {
                    AFLogger.valueOf("validateGaidAndIMEI :: removing: android_id");
                }
                if (TextUtils.isEmpty(aiVar.AFVersionDeclaration) && valueOf2.remove("imei") != null) {
                    AFLogger.valueOf("validateGaidAndIMEI :: removing: imei");
                }
            } catch (Exception e2) {
                AFLogger.valueOf("failed to remove IMEI or AndroidID key from params; ", e2);
            }
        }
        jVar.valueOf(obj2);
        jVar.AFInAppEventType(valueOf2);
        jVar.onAttributionFailureNative = AFInAppEventParameterName2;
        d dVar = new d(aiVar, jVar, (byte) 0);
        if (z) {
            cl[] clVarArr = aiVar.init;
            if (clVarArr != null) {
                int length = clVarArr.length;
                int i3 = 0;
                while (i2 < length) {
                    cl clVar = clVarArr[i2];
                    if (clVar.valueOf == cl.a.STARTED) {
                        StringBuilder sb5 = new StringBuilder("Failed to get ");
                        sb5.append(clVar.AFInAppEventType);
                        sb5.append(" referrer, wait ...");
                        AFLogger.AFInAppEventType(sb5.toString());
                        i3 = 1;
                    }
                    i2++;
                }
                i2 = i3;
            }
            if (aiVar.setPhoneNumber && !aiVar.AFInAppEventParameterName()) {
                AFLogger.AFInAppEventType("fetching Facebook deferred AppLink data, wait ...");
                i2 = 1;
            }
            if (!aiVar.setCustomerIdAndLogSession || aiVar.AFLogger$LogLevel()) {
                i = i2;
            }
        } else {
            i = 0;
        }
        if (i.values) {
            AFLogger.AFInAppEventParameterName("ESP deeplink: execute launch on SerialExecutor");
            if (k.values == null) {
                k.values = new k();
            }
            k kVar = k.values;
            if (kVar.AFInAppEventParameterName == null) {
                kVar.AFInAppEventParameterName = INVOKESTATIC_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_thread_ThreadPoolLancet_newSingleThreadScheduledExecutor(kVar.AFInAppEventType);
            }
            AFInAppEventType2 = kVar.AFInAppEventParameterName;
        } else {
            if (k.values == null) {
                k.values = new k();
            }
            AFInAppEventType2 = k.values.AFInAppEventType();
        }
        if (i != 0) {
            j = 500;
        } else {
            j = 0;
        }
        AFInAppEventParameterName(AFInAppEventType2, dVar, j, TimeUnit.MILLISECONDS);
    }

    public final void AFKeystoreWrapper(Context context, String str) {
        JSONObject jSONObject;
        JSONArray jSONArray;
        AFLogger.AFInAppEventType("received a new (extra) referrer: ".concat(String.valueOf(str)));
        try {
            long currentTimeMillis = System.currentTimeMillis();
            String string = values(context).getString("extraReferrers", (String) null);
            if (string == null) {
                jSONObject = new JSONObject();
                jSONArray = new JSONArray();
            } else {
                jSONObject = new JSONObject(string);
                if (jSONObject.has(str)) {
                    jSONArray = new JSONArray((String) jSONObject.get(str));
                } else {
                    jSONArray = new JSONArray();
                }
            }
            if (((long) jSONArray.length()) < 5) {
                jSONArray.put(currentTimeMillis);
            }
            if (((long) jSONObject.length()) >= 4) {
                AFInAppEventType(jSONObject);
            }
            jSONObject.put(str, jSONArray.toString());
            String jSONObject2 = jSONObject.toString();
            SharedPreferences.Editor edit = values(context).edit();
            edit.putString("extraReferrers", jSONObject2);
            edit.apply();
        } catch (JSONException unused) {
        } catch (Throwable th) {
            StringBuilder sb = new StringBuilder("Couldn't save referrer - ");
            sb.append(str);
            sb.append(": ");
            AFLogger.valueOf(sb.toString(), th);
        }
    }

    public final void values(Context context, Intent intent) {
        if (INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra(intent, "appsflyer_preinstall") != null) {
            String INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra(intent, "appsflyer_preinstall");
            try {
                if (new JSONObject(INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra).has("pid")) {
                    AppsFlyerProperties.getInstance().set("preInstallName", INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra);
                } else {
                    AFLogger.AFLogger$LogLevel("Cannot set preinstall attribution data without a media source");
                }
            } catch (JSONException e2) {
                AFLogger.valueOf("Error parsing JSON for preinstall", e2);
            }
        }
        AFLogger.valueOf("****** onReceive called *******");
        AppsFlyerProperties.getInstance();
        String INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra2 = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra(intent, "referrer");
        AFLogger.valueOf("Play store referrer: ".concat(String.valueOf(INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra2)));
        if (INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra2 != null) {
            SharedPreferences.Editor edit = values(context).edit();
            edit.putString("referrer", INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra2);
            edit.apply();
            AppsFlyerProperties instance = AppsFlyerProperties.getInstance();
            instance.set("AF_REFERRER", INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra2);
            instance.AFKeystoreWrapper = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra2;
            if (AppsFlyerProperties.getInstance().values()) {
                AFLogger.valueOf("onReceive: isLaunchCalled");
                bx bxVar = new bx();
                if (context != null) {
                    bxVar.valueOf = (Application) INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context);
                }
                bxVar.AFVersionDeclaration = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra2;
                if (INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_getStringExtra2.length() > 5 && valueOf((j) bxVar, values(context))) {
                    if (k.values == null) {
                        k.values = new k();
                    }
                    AFInAppEventParameterName(k.values.AFInAppEventType(), new b(this, bxVar, (byte) 0), 5, TimeUnit.MILLISECONDS);
                }
            }
        }
    }

    public final void logEvent(Context context, String str, Map<String, Object> map) {
        logEvent(context, str, map, (AppsFlyerRequestListener) null);
    }

    public static void values(Context context, String str, String str2) {
        SharedPreferences.Editor edit = values(context).edit();
        edit.putString(str, str2);
        edit.apply();
    }

    public static int AFInAppEventParameterName(SharedPreferences sharedPreferences, String str, boolean z) {
        int i = sharedPreferences.getInt(str, 0);
        if (z) {
            i++;
            SharedPreferences.Editor edit = sharedPreferences.edit();
            edit.putInt(str, i);
            edit.apply();
        }
        if (aj.AFInAppEventParameterName().getLevel()) {
            aj.AFInAppEventParameterName().AFInAppEventType(String.valueOf(i));
        }
        return i;
    }

    public static Intent INVOKEVIRTUAL_com_appsflyer_internal_ai_com_bytedance_sysoptimizer_ReceiverRegisterLancet_registerReceiver(Context context, BroadcastReceiver broadcastReceiver, IntentFilter intentFilter) {
        if (ReceiverRegisterCrashOptimizer.fixedOpen()) {
            ReceiverRegisterCrashOptimizer.doHWReceiverFix();
        }
        try {
            if (ReceiverRegisterCrashOptimizer.doRegisterHandler()) {
                return context.registerReceiver(broadcastReceiver, intentFilter, (String) null, ReceiverRegisterLancet.sReceiverHandler);
            }
            return context.registerReceiver(broadcastReceiver, intentFilter);
        } catch (Exception e2) {
            if (ReceiverRegisterCrashOptimizer.fixedOpen()) {
                return ReceiverRegisterCrashOptimizer.registerReceiver(broadcastReceiver, intentFilter);
            }
            throw e2;
        }
    }

    public static String valueOf(String str, PackageManager packageManager, String str2) {
        Object INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_get;
        try {
            Bundle bundle = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getApplicationInfo(packageManager, str2, 128).metaData;
            if (bundle == null || (INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_get = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_get(bundle, str)) == null) {
                return null;
            }
            return INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_IntentLancet_get.toString();
        } catch (Throwable th) {
            StringBuilder sb = new StringBuilder("Could not find ");
            sb.append(str);
            sb.append(" value in the manifest");
            AFLogger.valueOf(sb.toString(), th);
            return null;
        }
    }

    public final void logLocation(Context context, double d2, double d3) {
        aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "logLocation", String.valueOf(d2), String.valueOf(d3));
        HashMap hashMap = new HashMap();
        hashMap.put("af_long", Double.toString(d3));
        hashMap.put("af_lat", Double.toString(d2));
        valueOf(context, "af_location_coordinates", (Map<String, Object>) hashMap);
    }

    public static ApplicationInfo INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getApplicationInfo(PackageManager packageManager, String str, int i) {
        Context LIZ = 9EH.LJJIFFI.LIZ();
        if (8n2.LJIIIZ && TextUtils.equals(str, LIZ.getPackageName()) && i == 128) {
            if (8n2.LIZ == null) {
                8n2.LIZ = packageManager.getApplicationInfo(str, i);
            }
            return 8n2.LIZ;
        } else if (!8n2.LJIIIZ || !TextUtils.equals(str, LIZ.getPackageName()) || i != 0) {
            return packageManager.getApplicationInfo(str, i);
        } else {
            if (8n2.LIZJ == null) {
                8n2.LIZJ = packageManager.getApplicationInfo(str, i);
            }
            return 8n2.LIZJ;
        }
    }

    public final void setPreinstallAttribution(String str, String str2, String str3) {
        AFLogger.AFInAppEventType("setPreinstallAttribution API called");
        JSONObject jSONObject = new JSONObject();
        if (str != null) {
            try {
                jSONObject.put("pid", str);
            } catch (JSONException e2) {
                AFLogger.valueOf(e2.getMessage(), e2);
            }
        }
        if (str2 != null) {
            jSONObject.put("c", str2);
        }
        if (str3 != null) {
            jSONObject.put("af_siteid", str3);
        }
        if (jSONObject.has("pid")) {
            AppsFlyerProperties.getInstance().set("preInstallName", jSONObject.toString());
            return;
        }
        AFLogger.AFLogger$LogLevel("Cannot set preinstall attribution data without a media source");
    }

    public static PackageInfo INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getPackageInfo(PackageManager packageManager, String str, int i) {
        Context LIZ = 9EH.LJJIFFI.LIZ();
        if (8n2.LJIIIZ && TextUtils.equals(str, LIZ.getPackageName()) && i == 128) {
            if (8n2.LIZIZ == null) {
                8n2.LIZIZ = packageManager.getPackageInfo(str, i);
            }
            return 8n2.LIZIZ;
        } else if (8n2.LJIIIZ && TextUtils.equals(str, LIZ.getPackageName()) && i == 0) {
            if (8n2.LIZLLL == null) {
                8n2.LIZLLL = packageManager.getPackageInfo(str, i);
            }
            return 8n2.LIZLLL;
        } else if (8n2.LJIIIZ && TextUtils.equals(str, LIZ.getPackageName()) && i == 64) {
            if (8n2.LJ == null) {
                8n2.LJ = packageManager.getPackageInfo(str, i);
            }
            return 8n2.LJ;
        } else if (!8n2.LJIIIZ || !TextUtils.equals(str, LIZ.getPackageName()) || i != 8) {
            return packageManager.getPackageInfo(str, i);
        } else {
            if (8n2.LJFF == null) {
                8n2.LJFF = packageManager.getPackageInfo(str, i);
            }
            return 8n2.LJFF;
        }
    }

    private void valueOf(Context context, String str, Map<String, Object> map) {
        Activity activity;
        cb cbVar = new cb();
        if (context != null) {
            cbVar.valueOf = (Application) INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context);
        }
        cbVar.AFLogger$LogLevel = str;
        cbVar.AFKeystoreWrapper = map;
        if (context instanceof Activity) {
            activity = (Activity) context;
        } else {
            activity = null;
        }
        valueOf((j) cbVar, activity);
    }

    public final AppsFlyerLib init(String str, AppsFlyerConversionListener appsFlyerConversionListener, Context context) {
        String str2;
        if (this.setOaidData) {
            return this;
        }
        this.setOaidData = true;
        if (context != null) {
            if (this.AFLogger$LogLevel == null) {
                this.AFLogger$LogLevel = new au(context);
            }
            au auVar = this.AFLogger$LogLevel;
            if (auVar.valueOf()) {
                auVar.values.edit().putLong("init_ts", System.currentTimeMillis()).apply();
            }
            this.setAndroidIdData = (Application) INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context);
            this.setAdditionalData.AFKeystoreWrapper = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context);
            final cj cjVar = new cj(new Runnable() {
                static {
                    Covode.recordClassIndex(2596);
                }

                public final void run() {
                    if (k.values == null) {
                        k.values = new k();
                    }
                    ai.AFInAppEventParameterName(k.values.AFInAppEventType(), new Runnable() {
                        static {
                            Covode.recordClassIndex(2597);
                        }

                        public final void run() {
                            try {
                                bw bwVar = new bw();
                                Application values = ai.this.setAndroidIdData;
                                if (values != null) {
                                    bwVar.valueOf = (Application) INVOKEVIRTUAL_com_appsflyer_internal_ai$2$3_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(values);
                                }
                                if (ai.this.valueOf((j) bwVar, ai.values((Context) ai.this.setAndroidIdData))) {
                                    ai.values(ai.this, (j) bwVar);
                                }
                            } catch (Throwable th) {
                                AFLogger.valueOf(th.getMessage(), th);
                            }
                        }

                        public static Context INVOKEVIRTUAL_com_appsflyer_internal_ai$2$3_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(Context context) {
                            Context applicationContext = context.getApplicationContext();
                            if (7lW.LIZJ && applicationContext == null) {
                                return 7lW.LIZ;
                            }
                            return applicationContext;
                        }
                    }, 0, TimeUnit.MILLISECONDS);
                }
            });
            AnonymousClass3 r1 = new Runnable() {
                static {
                    Covode.recordClassIndex(2598);
                }

                public final void run() {
                    SharedPreferences values2 = ai.values((Context) ai.this.setAndroidIdData);
                    boolean z = false;
                    int AFInAppEventParameterName = ai.AFInAppEventParameterName(values2, "appsFlyerCount", false);
                    boolean z2 = values2.getBoolean("newGPReferrerSent", false);
                    if (cjVar.valueOf == cl.a.NOT_STARTED) {
                        z = true;
                    }
                    if (AFInAppEventParameterName != 1) {
                        return;
                    }
                    if (z || z2) {
                        ai aiVar = ai.this;
                        bw bwVar = new bw();
                        Application values3 = ai.this.setAndroidIdData;
                        if (values3 != null) {
                            bwVar.valueOf = (Application) INVOKEVIRTUAL_com_appsflyer_internal_ai$3_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(values3);
                        }
                        ai.values(aiVar, (j) bwVar);
                    }
                }

                public static Context INVOKEVIRTUAL_com_appsflyer_internal_ai$3_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(Context context) {
                    Context applicationContext = context.getApplicationContext();
                    if (7lW.LIZJ && applicationContext == null) {
                        return 7lW.LIZ;
                    }
                    return applicationContext;
                }
            };
            cl[] clVarArr = {cjVar, new ch(r1), new ck(r1)};
            this.init = clVarArr;
            for (cl AFKeystoreWrapper2 : clVarArr) {
                AFKeystoreWrapper2.AFKeystoreWrapper(this.setAndroidIdData);
            }
            this.setCustomerIdAndLogSession = AFInAppEventParameterName(context);
            ay.AFKeystoreWrapper = this.setAndroidIdData;
            if (AFInAppEventParameterName(values(context), "appsFlyerCount", false) == 0 && Build.VERSION.SDK_INT >= 29) {
                cm cmVar = new cm(context);
                this.setOutOfStore = cmVar;
                new Thread(cmVar.valueOf).start();
            }
        } else {
            AFLogger.AFLogger$LogLevel("context is null, Google Install Referrer will be not initialized");
        }
        aj AFInAppEventParameterName2 = aj.AFInAppEventParameterName();
        String[] strArr = new String[2];
        strArr[0] = str;
        if (appsFlyerConversionListener == null) {
            str2 = "null";
        } else {
            str2 = "conversionDataListener";
        }
        strArr[1] = str2;
        AFInAppEventParameterName2.AFInAppEventType("public_api_call", "init", strArr);
        AFLogger.AFKeystoreWrapper(AnonymousClass0HH.LIZ("Initializing AppsFlyer SDK: (v%s.%s)", new Object[]{"6.4.0", AFInAppEventParameterName}));
        AppsFlyerProperties.getInstance().set("AppsFlyerKey", str);
        al.AFInAppEventParameterName(str);
        AFInAppEventType = appsFlyerConversionListener;
        return this;
    }

    public final void start(Context context, String str, AppsFlyerRequestListener appsFlyerRequestListener) {
        String str2;
        if (ag.valueOf == null) {
            final AppsFlyerRequestListener appsFlyerRequestListener2 = appsFlyerRequestListener;
            final String str3 = str;
            if (!this.setOaidData) {
                AFLogger.AFLogger$LogLevel("ERROR: AppsFlyer SDK is not initialized! The API call 'start()' must be called after the 'init(String, AppsFlyerConversionListener)' API method, which should be called on the Application's onCreate.");
                if (str3 == null) {
                    if (appsFlyerRequestListener2 != null) {
                        appsFlyerRequestListener2.onError(RequestError.NO_DEV_KEY, az.AFInAppEventType);
                        return;
                    }
                    return;
                }
            }
            Context context2 = context;
            this.setAdditionalData.AFKeystoreWrapper = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context2);
            if (this.AFLogger$LogLevel == null) {
                this.AFLogger$LogLevel = new au(context2);
            }
            final au auVar = this.AFLogger$LogLevel;
            if (context2 instanceof Activity) {
                str2 = "activity";
            } else if (context2 instanceof Application) {
                str2 = "application";
            } else {
                str2 = "other";
            }
            auVar.AFKeystoreWrapper.put("start_with", str2);
            this.setAndroidIdData = (Application) INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context2);
            aj.AFInAppEventParameterName().AFInAppEventType("public_api_call", "start", str3);
            String str4 = AFInAppEventParameterName;
            AFLogger.valueOf(AnonymousClass0HH.LIZ("Starting AppsFlyer: (v%s.%s)", new Object[]{"6.4.0", str4}));
            StringBuilder sb = new StringBuilder("Build Number: ");
            sb.append(str4);
            AFLogger.valueOf(sb.toString());
            AppsFlyerProperties.getInstance().loadProperties(INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(this.setAndroidIdData));
            if (!TextUtils.isEmpty(str3)) {
                AppsFlyerProperties.getInstance().set("AppsFlyerKey", str3);
                al.AFInAppEventParameterName(str3);
            } else if (TextUtils.isEmpty(AppsFlyerProperties.getInstance().getString("AppsFlyerKey"))) {
                AFLogger.AFLogger$LogLevel("ERROR: AppsFlyer SDK is not initialized! You must provide AppsFlyer Dev-Key either in the 'init' API method (should be called on Application's onCreate),or in the start() API (should be called on Activity's onCreate).");
                if (appsFlyerRequestListener2 != null) {
                    appsFlyerRequestListener2.onError(RequestError.NO_DEV_KEY, az.AFInAppEventType);
                    return;
                }
                return;
            }
            Context baseContext = this.setAndroidIdData.getBaseContext();
            try {
                if ((INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_process_AwemeMetaDataLancet_getPackageInfo(baseContext.getPackageManager(), baseContext.getPackageName(), 0).applicationInfo.flags & 32768) != 0) {
                    if (baseContext.getResources().getIdentifier("appsflyer_backup_rules", "xml", baseContext.getPackageName()) != 0) {
                        AFLogger.values("appsflyer_backup_rules.xml detected, using AppsFlyer defined backup rules for AppsFlyer SDK data", true);
                    } else {
                        AFLogger.values("'allowBackup' is set to true; appsflyer_backup_rules.xml not detected.\nAppsFlyer shared preferences should be excluded from auto backup by adding: <exclude domain=\"sharedpref\" path=\"appsflyer-data\"/> to the Application's <full-backup-content> rules");
                    }
                }
            } catch (Exception e2) {
                StringBuilder sb2 = new StringBuilder("checkBackupRules Exception: ");
                sb2.append(e2.toString());
                AFLogger.AFInAppEventParameterName(sb2.toString());
            }
            if (this.setPhoneNumber) {
                Context INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(this.setAndroidIdData);
                this.setCustomerUserId = new HashMap();
                final long currentTimeMillis = System.currentTimeMillis();
                AnonymousClass5 r7 = new l.c() {
                    static {
                        Covode.recordClassIndex(2600);
                    }

                    public final void AFKeystoreWrapper(String str) {
                        ai.this.setCustomerUserId.put("error", str);
                    }

                    public final void values(String str, String str2, String str3) {
                        if (str != null) {
                            AFLogger.valueOf("Facebook Deferred AppLink data received: ".concat(String.valueOf(str)));
                            ai.this.setCustomerUserId.put("link", str);
                            if (str2 != null) {
                                ai.this.setCustomerUserId.put("target_url", str2);
                            }
                            if (str3 != null) {
                                HashMap hashMap = new HashMap();
                                HashMap hashMap2 = new HashMap();
                                hashMap2.put("promo_code", str3);
                                hashMap.put("deeplink_context", hashMap2);
                                ai.this.setCustomerUserId.put("extras", hashMap);
                            }
                        } else {
                            ai.this.setCustomerUserId.put("link", "");
                        }
                        ai.this.setCustomerUserId.put("ttr", String.valueOf(System.currentTimeMillis() - currentTimeMillis));
                    }
                };
                try {
                    Class.forName("com.facebook.s").getMethod("LIZ", new Class[]{Context.class}).invoke((Object) null, new Object[]{INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext});
                    Class<?> cls = Class.forName("com.facebook.applinks.a");
                    Class<?> cls2 = Class.forName("com.facebook.applinks.a$a");
                    Method method = cls.getMethod("fetchDeferredAppLinkData", new Class[]{Context.class, String.class, cls2});
                    l.AnonymousClass3 r8 = new InvocationHandler(cls, r7) {
                        public /* synthetic */ Class AFInAppEventType;
                        public /* synthetic */ c AFKeystoreWrapper;

                        static {
                            /*
                                r0 = 2708(0xa94, float:3.795E-42)
                                com.bytedance.covode.number.Covode.recordClassIndex(r0)
                                return
                            */
                            throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.l.AnonymousClass3.<clinit>():void");
                        }

                        public final java.lang.Object invoke(
/*
Method generation error in method: com.appsflyer.internal.l.3.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]):java.lang.Object, dex: classes.dex
                        jadx.core.utils.exceptions.JadxRuntimeException: Method args not loaded: com.appsflyer.internal.l.3.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]):java.lang.Object, class status: UNLOADED
                        	at jadx.core.dex.nodes.MethodNode.getArgRegs(MethodNode.java:278)
                        	at jadx.core.codegen.MethodGen.addDefinition(MethodGen.java:116)
                        	at jadx.core.codegen.ClassGen.addMethodCode(ClassGen.java:313)
                        	at jadx.core.codegen.ClassGen.addMethod(ClassGen.java:271)
                        	at jadx.core.codegen.ClassGen.lambda$addInnerClsAndMethods$2(ClassGen.java:240)
                        	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
                        	at java.util.ArrayList.forEach(ArrayList.java:1259)
                        	at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
                        	at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
                        	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483)
                        	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
                        	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
                        	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
                        	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
                        	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
                        	at jadx.core.codegen.ClassGen.addInnerClsAndMethods(ClassGen.java:236)
                        	at jadx.core.codegen.ClassGen.addClassBody(ClassGen.java:227)
                        	at jadx.core.codegen.InsnGen.inlineAnonymousConstructor(InsnGen.java:676)
                        	at jadx.core.codegen.InsnGen.makeConstructor(InsnGen.java:607)
                        	at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:364)
                        	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:250)
                        	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:221)
                        	at jadx.core.codegen.RegionGen.makeSimpleBlock(RegionGen.java:109)
                        	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:55)
                        	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:92)
                        	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:58)
                        	at jadx.core.codegen.RegionGen.makeRegionIndent(RegionGen.java:98)
                        	at jadx.core.codegen.RegionGen.makeTryCatch(RegionGen.java:311)
                        	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:68)
                        	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:92)
                        	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:58)
                        	at jadx.core.codegen.RegionGen.makeRegionIndent(RegionGen.java:98)
                        	at jadx.core.codegen.RegionGen.makeIf(RegionGen.java:142)
                        	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:62)
                        	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:92)
                        	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:58)
                        	at jadx.core.codegen.RegionGen.makeRegionIndent(RegionGen.java:98)
                        	at jadx.core.codegen.RegionGen.makeIf(RegionGen.java:142)
                        	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:62)
                        	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:92)
                        	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:58)
                        	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:92)
                        	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:58)
                        	at jadx.core.codegen.MethodGen.addRegionInsns(MethodGen.java:211)
                        	at jadx.core.codegen.MethodGen.addInstructions(MethodGen.java:204)
                        	at jadx.core.codegen.ClassGen.addMethodCode(ClassGen.java:318)
                        	at jadx.core.codegen.ClassGen.addMethod(ClassGen.java:271)
                        	at jadx.core.codegen.ClassGen.lambda$addInnerClsAndMethods$2(ClassGen.java:240)
                        	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
                        	at java.util.ArrayList.forEach(ArrayList.java:1259)
                        	at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
                        	at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
                        	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483)
                        	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
                        	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
                        	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
                        	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
                        	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
                        	at jadx.core.codegen.ClassGen.addInnerClsAndMethods(ClassGen.java:236)
                        	at jadx.core.codegen.ClassGen.addClassBody(ClassGen.java:227)
                        	at jadx.core.codegen.ClassGen.addClassCode(ClassGen.java:112)
                        	at jadx.core.codegen.ClassGen.makeClass(ClassGen.java:78)
                        	at jadx.core.codegen.CodeGen.wrapCodeGen(CodeGen.java:44)
                        	at jadx.core.codegen.CodeGen.generateJavaCode(CodeGen.java:33)
                        	at jadx.core.codegen.CodeGen.generate(CodeGen.java:21)
                        	at jadx.core.ProcessClass.generateCode(ProcessClass.java:61)
                        	at jadx.core.dex.nodes.ClassNode.decompile(ClassNode.java:273)
                        
*/
                    };
                    Object newProxyInstance = Proxy.newProxyInstance(cls2.getClassLoader(), new Class[]{cls2}, r8);
                    String string = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext.getString(INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext.getResources().getIdentifier("facebook_app_id", "string", INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext.getPackageName()));
                    if (TextUtils.isEmpty(string)) {
                        r7.AFKeystoreWrapper("Facebook app id not defined in resources");
                    } else {
                        method.invoke((Object) null, new Object[]{INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext, string, newProxyInstance});
                    }
                } catch (NoSuchMethodException e3) {
                    r7.AFKeystoreWrapper(e3.toString());
                } catch (InvocationTargetException e4) {
                    r7.AFKeystoreWrapper(e4.toString());
                } catch (ClassNotFoundException e5) {
                    r7.AFKeystoreWrapper(e5.toString());
                } catch (IllegalAccessException e6) {
                    r7.AFKeystoreWrapper(e6.toString());
                }
            }
            ag.AFKeystoreWrapper(context2, new ag.b() {
                static {
                    Covode.recordClassIndex(2595);
                }

                public static Context INVOKEVIRTUAL_com_appsflyer_internal_ai$10_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(Context context) {
                    Context applicationContext = context.getApplicationContext();
                    if (7lW.LIZJ && applicationContext == null) {
                        return 7lW.LIZ;
                    }
                    return applicationContext;
                }

                public final void AFKeystoreWrapper(Activity activity) {
                    long unused = ai.this.onValidateInAppFailure = System.currentTimeMillis();
                    au auVar = auVar;
                    if (auVar.valueOf()) {
                        auVar.values.edit().putLong("fg_ts", System.currentTimeMillis()).apply();
                    }
                    int AFInAppEventParameterName2 = ai.AFInAppEventParameterName(ai.values((Context) activity), "appsFlyerCount", false);
                    if (AFInAppEventParameterName2 == 0) {
                        au auVar2 = auVar;
                        auVar2.AFKeystoreWrapper.put("init_to_fg", Long.valueOf(ai.this.onValidateInAppFailure - auVar.values.getLong("init_ts", 0)));
                    }
                    AFLogger.valueOf("onBecameForeground");
                    if (AFInAppEventParameterName2 < 2) {
                        ab AFKeystoreWrapper2 = ab.AFKeystoreWrapper((Context) activity);
                        AFKeystoreWrapper2.AFInAppEventType.post(AFKeystoreWrapper2.getLevel);
                        AFKeystoreWrapper2.AFInAppEventType.post(AFKeystoreWrapper2.valueOf);
                    }
                    by byVar = new by();
                    i.values().AFKeystoreWrapper(byVar.AFInAppEventParameterName(), auVar, activity.getIntent(), activity.getApplication());
                    ai aiVar = ai.this;
                    byVar.valueOf = (Application) INVOKEVIRTUAL_com_appsflyer_internal_ai$10_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(activity);
                    byVar.AppsFlyer2dXConversionCallback = str3;
                    byVar.AFInAppEventParameterName = appsFlyerRequestListener2;
                    aiVar.valueOf((j) byVar, activity);
                }

                public final void valueOf(Context context) {
                    AFLogger.valueOf("onBecameBackground");
                    long unused = ai.this.onPause = System.currentTimeMillis();
                    long AFInAppEventParameterName2 = ai.this.onPause - ai.this.onValidateInAppFailure;
                    if (AFInAppEventParameterName2 > 0 && AFInAppEventParameterName2 < 1000) {
                        AFInAppEventParameterName2 = 1000;
                    }
                    ai aiVar = ai.this;
                    if (aiVar.AFLogger$LogLevel == null) {
                        aiVar.AFLogger$LogLevel = new au(context);
                    }
                    au auVar = aiVar.AFLogger$LogLevel;
                    auVar.values.edit().putLong("prev_session_dur", TimeUnit.MILLISECONDS.toSeconds(AFInAppEventParameterName2)).apply();
                    AFLogger.valueOf("callStatsBackground background call");
                    ai.this.AFKeystoreWrapper((WeakReference<Context>) new WeakReference(context));
                    aj AFInAppEventParameterName3 = aj.AFInAppEventParameterName();
                    if (AFInAppEventParameterName3.getLevel()) {
                        AFInAppEventParameterName3.values();
                        if (context != null) {
                            aj.AFInAppEventParameterName(context.getPackageName(), context.getPackageManager());
                        }
                        AFInAppEventParameterName3.AFKeystoreWrapper();
                    } else {
                        AFLogger.AFInAppEventType("RD status is OFF");
                    }
                    if (k.values == null) {
                        k.values = new k();
                    }
                    k kVar = k.values;
                    try {
                        k.valueOf(kVar.valueOf);
                        if (kVar.AFKeystoreWrapper instanceof ThreadPoolExecutor) {
                            k.valueOf((ThreadPoolExecutor) kVar.AFKeystoreWrapper);
                        }
                    } catch (Throwable th) {
                        AFLogger.valueOf("failed to stop Executors", th);
                    }
                    ab AFKeystoreWrapper2 = ab.AFKeystoreWrapper(context);
                    AFKeystoreWrapper2.AFInAppEventType.post(AFKeystoreWrapper2.getLevel);
                }
            }, this.setAppInviteOneLink);
        }
    }

    public final void autoLogSubscriptionsRevenue(Function<List<Purchase>, Map<String, String>> function, Consumer<String> consumer, Consumer<String> consumer2, Boolean bool) {
        boolean z;
        if (bool == null || !bool.booleanValue()) {
            z = false;
        } else {
            z = true;
        }
        this.setAdditionalData.AFInAppEventParameterName().valueOf(new ad(function, consumer, consumer2, z));
    }

    public final void logEvent(Context context, String str, Map<String, Object> map, AppsFlyerRequestListener appsFlyerRequestListener) {
        HashMap hashMap;
        Map map2;
        cb cbVar = new cb();
        if (context != null) {
            cbVar.valueOf = (Application) INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context);
        }
        cbVar.AFLogger$LogLevel = str;
        Activity activity = null;
        if (map == null) {
            hashMap = null;
        } else {
            hashMap = new HashMap(map);
        }
        cbVar.AFKeystoreWrapper = hashMap;
        cbVar.AFInAppEventParameterName = appsFlyerRequestListener;
        aj AFInAppEventParameterName2 = aj.AFInAppEventParameterName();
        String[] strArr = new String[2];
        strArr[0] = str;
        if (cbVar.AFKeystoreWrapper == null) {
            map2 = new HashMap();
        } else {
            map2 = cbVar.AFKeystoreWrapper;
        }
        strArr[1] = new JSONObject(map2).toString();
        AFInAppEventParameterName2.AFInAppEventType("public_api_call", "logEvent", strArr);
        if (str != null) {
            ab.AFKeystoreWrapper(context).valueOf();
        }
        if (context instanceof Activity) {
            activity = (Activity) context;
        }
        valueOf((j) cbVar, activity);
    }

    public static void AFInAppEventParameterName(ScheduledExecutorService scheduledExecutorService, Runnable runnable, long j, TimeUnit timeUnit) {
        if (scheduledExecutorService != null) {
            try {
                if (!scheduledExecutorService.isShutdown() && !scheduledExecutorService.isTerminated()) {
                    scheduledExecutorService.schedule(runnable, j, timeUnit);
                    return;
                }
            } catch (RejectedExecutionException e2) {
                AFLogger.valueOf("scheduleJob failed with RejectedExecutionException Exception", e2);
                return;
            } catch (Throwable th) {
                AFLogger.valueOf("scheduleJob failed with Exception", th);
                return;
            }
        }
        AFLogger.AFLogger$LogLevel("scheduler is null, shut downed or terminated");
    }

    public final void validateAndLogInAppPurchase(Context context, String str, String str2, String str3, String str4, String str5, Map<String, String> map) {
        String obj;
        aj AFInAppEventParameterName2 = aj.AFInAppEventParameterName();
        String[] strArr = new String[6];
        String str6 = str;
        strArr[0] = str6;
        String str7 = str2;
        strArr[1] = str7;
        String str8 = str3;
        strArr[2] = str8;
        String str9 = str4;
        strArr[3] = str9;
        String str10 = str5;
        strArr[4] = str10;
        Map<String, String> map2 = map;
        if (map2 == null) {
            obj = "";
        } else {
            obj = map2.toString();
        }
        strArr[5] = obj;
        AFInAppEventParameterName2.AFInAppEventType("public_api_call", "validateAndTrackInAppPurchase", strArr);
        if (!isStopped()) {
            StringBuilder sb = new StringBuilder("Validate in app called with parameters: ");
            sb.append(str8);
            sb.append(" ");
            sb.append(str9);
            sb.append(" ");
            sb.append(str10);
            AFLogger.valueOf(sb.toString());
        }
        if (str6 == null || str9 == null || str7 == null || str10 == null || str8 == null) {
            AppsFlyerInAppPurchaseValidatorListener appsFlyerInAppPurchaseValidatorListener = AFKeystoreWrapper;
            if (appsFlyerInAppPurchaseValidatorListener != null) {
                appsFlyerInAppPurchaseValidatorListener.onValidateInAppFailure("Please provide purchase parameters");
                return;
            }
            return;
        }
        Context INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext = INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext(context);
        String string = AppsFlyerProperties.getInstance().getString("AppsFlyerKey");
        if (context instanceof Activity) {
            ((Activity) context).getIntent();
        }
        new Thread(new z(INVOKEVIRTUAL_com_appsflyer_internal_ai_com_ss_android_ugc_aweme_lancet_launch_ApplicationContextLancet_getApplicationContext, string, str6, str7, str8, str9, str10, map2)).start();
    }
}
