package com.appsflyer;

import android.app.Activity;
import android.app.Application;
import android.app.UiModeManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
import android.location.Location;
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.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.view.WindowManager;
import androidx.recyclerview.widget.RecyclerView;
import com.appsflyer.AFExecutor;
import com.appsflyer.AFFacebookDeferredDeeplink;
import com.appsflyer.AFLogger;
import com.appsflyer.AppsFlyerProperties;
import com.appsflyer.OneLinkHttpTask;
import com.appsflyer.internal.aa;
import com.appsflyer.internal.ab;
import com.appsflyer.internal.ac;
import com.appsflyer.internal.ad;
import com.appsflyer.internal.ae;
import com.appsflyer.internal.af;
import com.appsflyer.internal.ag;
import com.appsflyer.internal.ah;
import com.appsflyer.internal.ai;
import com.appsflyer.internal.c;
import com.appsflyer.internal.d;
import com.appsflyer.internal.g;
import com.appsflyer.internal.i;
import com.appsflyer.internal.instant.AFInstantApps;
import com.appsflyer.internal.j;
import com.appsflyer.internal.m;
import com.appsflyer.internal.r;
import com.appsflyer.internal.s;
import com.appsflyer.internal.t;
import com.appsflyer.internal.u;
import com.appsflyer.internal.v;
import com.appsflyer.internal.w;
import com.appsflyer.internal.y;
import com.appsflyer.internal.z;
import com.appsflyer.share.Constants;
import com.facebook.FacebookRequestError;
import com.facebook.FacebookSdk;
import com.facebook.GraphRequest;
import com.facebook.LegacyTokenHelper;
import com.facebook.appevents.AppEventsConstants;
import com.facebook.appevents.AppEventsLoggerImpl;
import com.facebook.appevents.UserDataStore;
import com.facebook.applinks.AppLinkData;
import com.facebook.devicerequests.internal.DeviceRequestsHelper;
import com.facebook.internal.NativeProtocol;
import com.facebook.internal.ServerProtocol;
import com.facebook.places.model.PlaceFields;
import com.google.android.gms.common.GoogleApiAvailability;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.lang.ref.WeakReference;
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.URL;
import java.security.KeyStoreException;
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.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import ඓ.K.K.K.C1293;
import ῲ.ᨨ.K.C1826;

public class AppsFlyerLibCore extends AppsFlyerLib implements m {
    public static final String AF_PRE_INSTALL_PATH = "AF_PRE_INSTALL_PATH";
    public static final String IS_STOP_TRACKING_USED = "is_stop_tracking_used";
    public static final String LOG_TAG = "AppsFlyer_5.0.0";
    public static final String PRE_INSTALL_SYSTEM_DEFAULT = "/data/local/tmp/pre_install.appsflyer";
    public static final String PRE_INSTALL_SYSTEM_DEFAULT_ETC = "/etc/pre_install.appsflyer";
    public static final String PRE_INSTALL_SYSTEM_RO_PROP = "ro.appsflyer.preinstall.path";

    /* renamed from: ʽ  reason: contains not printable characters */
    public static String f1870 = "https://%sconversions.%s/api/v4.11/androidevent?app_id=";

    /* renamed from: ˊ  reason: contains not printable characters */
    public static AppsFlyerInAppPurchaseValidatorListener f1871 = null;

    /* renamed from: ˋॱ  reason: contains not printable characters */
    public static AppsFlyerLibCore f1872 = new AppsFlyerLibCore();

    /* renamed from: ˏॱ  reason: contains not printable characters */
    public static AppsFlyerConversionListener f1873 = null;

    /* renamed from: ॱॱ  reason: contains not printable characters */
    public static String f1874 = "https://%slaunches.%s/api/v4.11/androidevent?app_id=";

    /* renamed from: ᐝ  reason: contains not printable characters */
    public static final List<String> f1875 = Arrays.asList("is_cache");
    public Uri latestDeepLink = null;

    /* renamed from: ʻ  reason: contains not printable characters */
    public long f1876;

    /* renamed from: ʻॱ  reason: contains not printable characters */
    public long f1877 = TimeUnit.SECONDS.toMillis(5);

    /* renamed from: ʼ  reason: contains not printable characters */
    public boolean f1878 = false;

    /* renamed from: ʼॱ  reason: contains not printable characters */
    public String f1879;

    /* renamed from: ʽॱ  reason: contains not printable characters */
    public boolean f1880 = false;

    /* renamed from: ʾ  reason: contains not printable characters */
    public ac.b f1881;

    /* renamed from: ʿ  reason: contains not printable characters */
    public long f1882;

    /* renamed from: ˈ  reason: contains not printable characters */
    public boolean f1883 = false;

    /* renamed from: ˉ  reason: contains not printable characters */
    public Map<Long, String> f1884;

    /* renamed from: ˊˊ  reason: contains not printable characters */
    public boolean f1885;

    /* renamed from: ˊˋ  reason: contains not printable characters */
    public boolean f1886 = false;

    /* renamed from: ˊॱ  reason: contains not printable characters */
    public long f1887 = -1;

    /* renamed from: ˊᐝ  reason: contains not printable characters */
    public boolean f1888;

    /* renamed from: ˋ  reason: contains not printable characters */
    public long f1889;

    /* renamed from: ˋˊ  reason: contains not printable characters */
    public ah f1890 = new ah();

    /* renamed from: ˋˋ  reason: contains not printable characters */
    public Map<String, Object> f1891;

    /* renamed from: ˋᐝ  reason: contains not printable characters */
    public boolean f1892 = false;

    /* renamed from: ˌ  reason: contains not printable characters */
    public String f1893;

    /* renamed from: ˍ  reason: contains not printable characters */
    public Application f1894;

    /* renamed from: ˎ  reason: contains not printable characters */
    public String f1895;

    /* renamed from: ˏ  reason: contains not printable characters */
    public String f1896;

    /* renamed from: ͺ  reason: contains not printable characters */
    public String f1897;

    /* renamed from: ॱ  reason: contains not printable characters */
    public long f1898;

    /* renamed from: ॱˊ  reason: contains not printable characters */
    public long f1899 = -1;

    /* renamed from: ॱˋ  reason: contains not printable characters */
    public i f1900 = null;

    /* renamed from: ॱˎ  reason: contains not printable characters */
    public ScheduledExecutorService f1901 = null;

    /* renamed from: ॱᐝ  reason: contains not printable characters */
    public Map<String, String> f1902;

    /* renamed from: ᐝॱ  reason: contains not printable characters */
    public boolean f1903 = false;

    /* renamed from: com.appsflyer.AppsFlyerLibCore$1  reason: invalid class name */
    public static /* synthetic */ class AnonymousClass1 {

        /* renamed from: ˎ  reason: contains not printable characters */
        public static final /* synthetic */ int[] f1904 = new int[AppsFlyerProperties.EmailsCryptType.values().length];

        /* JADX WARNING: Can't wrap try/catch for region: R(6:0|1|2|3|4|6) */
        /* JADX WARNING: Code restructure failed: missing block: B:7:?, code lost:
            return;
         */
        /* JADX WARNING: Failed to process nested try/catch */
        /* JADX WARNING: Missing exception handler attribute for start block: B:3:0x0014 */
        static {
            f1904[AppsFlyerProperties.EmailsCryptType.SHA256.ordinal()] = 1;
            f1904[AppsFlyerProperties.EmailsCryptType.NONE.ordinal()] = 2;
        }
    }

    public static class a implements Runnable {

        /* renamed from: ˎ  reason: contains not printable characters */
        public static String f1914 = "https://%sgcdsdk.%s/install_data/v4.0/";

        /* renamed from: ॱ  reason: contains not printable characters */
        public static final List<String> f1915 = Arrays.asList("googleplay", "playstore", "googleplaystore");

        /* renamed from: ʼ  reason: contains not printable characters */
        public final AtomicInteger f1916;

        /* renamed from: ʽ  reason: contains not printable characters */
        public AppsFlyerLibCore f1917;

        /* renamed from: ˊ  reason: contains not printable characters */
        public final String f1918;

        /* renamed from: ˋ  reason: contains not printable characters */
        public final Application f1919;

        /* renamed from: ˏ  reason: contains not printable characters */
        public final ScheduledExecutorService f1920;

        /* renamed from: ᐝ  reason: contains not printable characters */
        public final int f1921;

        public /* synthetic */ a(AppsFlyerLibCore appsFlyerLibCore, Application application, String str, byte b) {
            this(appsFlyerLibCore, application, str);
        }

        /* renamed from: ˊ  reason: contains not printable characters */
        private void m1151(String str, int i) {
            if (500 > i || i >= 600) {
                AFLogger.afDebugLog("Calling onConversionFailure with:\n".concat(String.valueOf(str)));
                AppsFlyerLibCore.f1873.onConversionDataFail(str);
            } else if (this.f1921 == 2) {
                AFLogger.afDebugLog("Calling onConversionFailure with:\n".concat(String.valueOf(str)));
                AppsFlyerLibCore.f1873.onConversionDataFail(str);
            } else {
                a aVar = new a(this);
                AppsFlyerLibCore.m1107(aVar.f1920, aVar, 10, TimeUnit.MILLISECONDS);
            }
        }

        /* JADX DEBUG: Multi-variable search result rejected for r0v10, resolved type: com.appsflyer.AppsFlyerConversionListener */
        /* JADX WARN: Multi-variable type inference failed */
        /* JADX WARNING: Removed duplicated region for block: B:22:0x00a4  */
        /* JADX WARNING: Removed duplicated region for block: B:27:0x00ee A[Catch:{ all -> 0x0268 }] */
        /* JADX WARNING: Removed duplicated region for block: B:30:0x010d A[Catch:{ all -> 0x0268 }] */
        /* JADX WARNING: Removed duplicated region for block: B:38:0x015d A[Catch:{ all -> 0x0268 }] */
        /* JADX WARNING: Removed duplicated region for block: B:77:0x0272 A[Catch:{ all -> 0x0290 }] */
        public final void run() {
            HttpURLConnection httpURLConnection;
            Throwable th;
            String str;
            int responseCode;
            String r9;
            Map map;
            String str2 = this.f1918;
            if (str2 != null && str2.length() != 0 && !this.f1917.isTrackingStopped()) {
                this.f1916.incrementAndGet();
                try {
                    if (this.f1919 == null) {
                        this.f1916.decrementAndGet();
                        return;
                    }
                    long currentTimeMillis = System.currentTimeMillis();
                    String r6 = AppsFlyerLibCore.m1139(this.f1919, AppsFlyerLibCore.m1103(new WeakReference(this.f1919)));
                    if (r6 != null) {
                        if (!f1915.contains(r6.toLowerCase())) {
                            str = "-".concat(r6);
                            StringBuilder sb = new StringBuilder();
                            sb.append(ServerConfigHandler.getUrl(f1914));
                            sb.append(this.f1919.getPackageName());
                            sb.append(str);
                            sb.append("?devkey=");
                            sb.append(this.f1918);
                            sb.append("&device_id=");
                            sb.append(af.m1186(new WeakReference(this.f1919)));
                            String obj = sb.toString();
                            if (ae.f1979 == null) {
                                ae.f1979 = new ae();
                            }
                            ae.f1979.m1180("server_request", obj, "");
                            AFFacebookDeferredDeeplink.AnonymousClass3.m1075("Calling server for attribution url: ".concat(String.valueOf(obj)));
                            httpURLConnection = (HttpURLConnection) new URL(obj).openConnection();
                            httpURLConnection.setRequestMethod("GET");
                            httpURLConnection.setConnectTimeout(10000);
                            httpURLConnection.setRequestProperty("Connection", "close");
                            httpURLConnection.connect();
                            responseCode = httpURLConnection.getResponseCode();
                            r9 = AppsFlyerLibCore.m1128(httpURLConnection);
                            if (ae.f1979 == null) {
                                ae.f1979 = new ae();
                            }
                            ae.f1979.m1180("server_response", obj, String.valueOf(responseCode), r9);
                            if (responseCode != 200) {
                                if (responseCode != 404) {
                                    if (AppsFlyerLibCore.f1873 != null) {
                                        m1151("Error connection to server: ".concat(String.valueOf(responseCode)), responseCode);
                                    }
                                    StringBuilder sb2 = new StringBuilder("AttributionIdFetcher response code: ");
                                    sb2.append(responseCode);
                                    sb2.append("  url: ");
                                    sb2.append(obj);
                                    AFFacebookDeferredDeeplink.AnonymousClass3.m1075(sb2.toString());
                                    this.f1916.decrementAndGet();
                                    this.f1920.shutdown();
                                }
                            }
                            AppsFlyerLibCore.m1098(this.f1919, "appsflyerGetConversionDataTiming", System.currentTimeMillis() - currentTimeMillis);
                            AFFacebookDeferredDeeplink.AnonymousClass3.m1075("Attribution data: ".concat(String.valueOf(r9)));
                            if (r9.length() > 0) {
                                Map r4 = AppsFlyerLibCore.m1132(r9);
                                Boolean bool = (Boolean) r4.get("iscache");
                                if (responseCode == 404) {
                                    r4.remove(FacebookRequestError.ERROR_REASON_KEY);
                                    r4.remove("status_code");
                                    r4.put("af_status", "Organic");
                                    r4.put("af_message", "organic install");
                                }
                                if (bool != null && !bool.booleanValue()) {
                                    AppsFlyerLibCore.m1098(this.f1919, "appsflyerConversionDataCacheExpiration", System.currentTimeMillis());
                                }
                                if (r4.containsKey(Constants.URL_SITE_ID)) {
                                    if (r4.containsKey("af_channel")) {
                                        StringBuilder sb3 = new StringBuilder(Constants.LOG_INVITE_DETECTED_APP_INVITE_VIA_CHANNEL);
                                        sb3.append(r4.get("af_channel"));
                                        AFLogger.afDebugLog(sb3.toString());
                                    } else {
                                        AFLogger.afDebugLog(String.format(Constants.LOG_CROSS_PROMOTION_APP_INSTALLED_FROM_CROSS_PROMOTION, r4.get(Constants.URL_SITE_ID)));
                                    }
                                }
                                if (r4.containsKey(Constants.URL_SITE_ID)) {
                                    StringBuilder sb4 = new StringBuilder(Constants.LOG_INVITE_DETECTED_APP_INVITE_VIA_CHANNEL);
                                    sb4.append(r4.get("af_channel"));
                                    AFLogger.afDebugLog(sb4.toString());
                                }
                                r4.put("is_first_launch", Boolean.FALSE);
                                String jSONObject = new JSONObject(r4).toString();
                                if (jSONObject != null) {
                                    AppsFlyerLibCore.m1112(this.f1919, "attributionId", jSONObject);
                                } else {
                                    AppsFlyerLibCore.m1112(this.f1919, "attributionId", r9);
                                }
                                StringBuilder sb5 = new StringBuilder("iscache=");
                                sb5.append(bool);
                                sb5.append(" caching conversion data");
                                AFLogger.afDebugLog(sb5.toString());
                                if (AppsFlyerLibCore.f1873 != null && this.f1916.intValue() <= 1) {
                                    try {
                                        map = AppsFlyerLibCore.m1129(this.f1919);
                                        if (!AppsFlyerLibCore.m1100(this.f1919).getBoolean("sixtyDayConversionData", false)) {
                                            map.put("is_first_launch", Boolean.TRUE);
                                        }
                                    } catch (w e) {
                                        AFLogger.afErrorLog("Exception while trying to fetch attribution data. ", e);
                                        map = r4;
                                    }
                                    StringBuilder sb6 = new StringBuilder("Calling onInstallConversionDataLoaded with:\n");
                                    sb6.append(map.toString());
                                    AFLogger.afDebugLog(sb6.toString());
                                    AppsFlyerLibCore.f1873.onConversionDataSuccess(map);
                                }
                            }
                            this.f1916.decrementAndGet();
                            this.f1920.shutdown();
                        }
                        AFLogger.afWarnLog(String.format("AF detected using redundant Google-Play channel for attribution - %s. Using without channel postfix.", r6));
                    }
                    str = "";
                    StringBuilder sb7 = new StringBuilder();
                    sb7.append(ServerConfigHandler.getUrl(f1914));
                    sb7.append(this.f1919.getPackageName());
                    sb7.append(str);
                    sb7.append("?devkey=");
                    sb7.append(this.f1918);
                    sb7.append("&device_id=");
                    sb7.append(af.m1186(new WeakReference(this.f1919)));
                    String obj2 = sb7.toString();
                    if (ae.f1979 == null) {
                    }
                    ae.f1979.m1180("server_request", obj2, "");
                    AFFacebookDeferredDeeplink.AnonymousClass3.m1075("Calling server for attribution url: ".concat(String.valueOf(obj2)));
                    httpURLConnection = (HttpURLConnection) new URL(obj2).openConnection();
                    try {
                        httpURLConnection.setRequestMethod("GET");
                        httpURLConnection.setConnectTimeout(10000);
                        httpURLConnection.setRequestProperty("Connection", "close");
                        httpURLConnection.connect();
                        responseCode = httpURLConnection.getResponseCode();
                        r9 = AppsFlyerLibCore.m1128(httpURLConnection);
                        if (ae.f1979 == null) {
                        }
                        ae.f1979.m1180("server_response", obj2, String.valueOf(responseCode), r9);
                        if (responseCode != 200) {
                        }
                        AppsFlyerLibCore.m1098(this.f1919, "appsflyerGetConversionDataTiming", System.currentTimeMillis() - currentTimeMillis);
                        AFFacebookDeferredDeeplink.AnonymousClass3.m1075("Attribution data: ".concat(String.valueOf(r9)));
                        if (r9.length() > 0) {
                        }
                        this.f1916.decrementAndGet();
                    } catch (Throwable th2) {
                        th = th2;
                        try {
                            if (AppsFlyerLibCore.f1873 != null) {
                                m1151(th.getMessage(), 0);
                            }
                            AFLogger.afErrorLog(th.getMessage(), th);
                        } finally {
                            this.f1916.decrementAndGet();
                            if (httpURLConnection != null) {
                                httpURLConnection.disconnect();
                            }
                        }
                    }
                    this.f1920.shutdown();
                } catch (Throwable th3) {
                    th = th3;
                    httpURLConnection = null;
                    if (AppsFlyerLibCore.f1873 != null) {
                    }
                    AFLogger.afErrorLog(th.getMessage(), th);
                }
            }
        }

        public a(AppsFlyerLibCore appsFlyerLibCore, Application application, String str) {
            this.f1920 = AFExecutor.getInstance().m1071();
            this.f1916 = new AtomicInteger(0);
            this.f1917 = appsFlyerLibCore;
            this.f1919 = application;
            this.f1918 = str;
            this.f1921 = 0;
        }

        public a(a aVar) {
            this.f1920 = AFExecutor.getInstance().m1071();
            this.f1916 = new AtomicInteger(0);
            this.f1917 = aVar.f1917;
            this.f1919 = aVar.f1919;
            this.f1918 = aVar.f1918;
            this.f1921 = aVar.f1921 + 1;
        }
    }

    public class b implements Runnable {

        /* renamed from: ˏ  reason: contains not printable characters */
        public final j f1923;

        public /* synthetic */ b(AppsFlyerLibCore appsFlyerLibCore, j jVar, byte b) {
            this(jVar);
        }

        /* JADX WARNING: Code restructure failed: missing block: B:50:0x00cd, code lost:
            r0 = move-exception;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:51:0x00ce, code lost:
            com.appsflyer.AFLogger.afErrorLog(r0.getMessage(), r0);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:52:0x00d5, code lost:
            return;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:53:0x00d6, code lost:
            r1 = e;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:59:0x00e8, code lost:
            com.appsflyer.internal.z.m1255();
            r0 = new com.appsflyer.AFFacebookDeferredDeeplink(r3, r7, com.appsflyer.BuildConfig.VERSION_NAME);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:61:?, code lost:
            r2 = com.appsflyer.internal.z.m1256(r5);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:62:0x00fa, code lost:
            if (r2.exists() == false) goto L_0x00fc;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:63:0x00fc, code lost:
            r2.mkdir();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:64:0x0101, code lost:
            r2 = r2.listFiles();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:65:0x0105, code lost:
            if (r2 == null) goto L_0x0115;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:68:0x010c, code lost:
            android.util.Log.i(com.appsflyer.AppsFlyerLibCore.LOG_TAG, "reached cache limit, not caching request");
         */
        /* JADX WARNING: Code restructure failed: missing block: B:69:0x0115, code lost:
            android.util.Log.i(com.appsflyer.AppsFlyerLibCore.LOG_TAG, "caching request...");
            r2 = new java.io.File(com.appsflyer.internal.z.m1256(r5), java.lang.Long.toString(java.lang.System.currentTimeMillis()));
            r2.createNewFile();
            r3 = new java.io.OutputStreamWriter(new java.io.FileOutputStream(r2.getPath(), true));
         */
        /* JADX WARNING: Code restructure failed: missing block: B:72:?, code lost:
            r3.write("version=");
            r3.write(r0.f1857);
            r3.write(10);
            r3.write("url=");
            r3.write(r0.f1854);
            r3.write(10);
            r3.write("data=");
            r3.write(android.util.Base64.encodeToString(r0.f1855, 2));
            r3.write(10);
            r3.flush();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:74:?, code lost:
            r3.close();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:75:0x0172, code lost:
            r0 = th;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:76:0x0173, code lost:
            r6 = r3;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:77:0x0175, code lost:
            r6 = r3;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:79:0x0177, code lost:
            r0 = th;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:83:?, code lost:
            android.util.Log.i(com.appsflyer.AppsFlyerLibCore.LOG_TAG, "Could not cache request");
         */
        /* JADX WARNING: Code restructure failed: missing block: B:84:0x0180, code lost:
            if (r6 != null) goto L_0x0182;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:85:0x0182, code lost:
            r6.close();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:86:0x0185, code lost:
            com.appsflyer.AFLogger.afErrorLog(r1.getMessage(), r1);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:88:0x018d, code lost:
            if (r6 != null) goto L_0x018f;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:90:?, code lost:
            r6.close();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:91:0x0192, code lost:
            throw r0;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:95:?, code lost:
            return;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:96:?, code lost:
            return;
         */
        /* JADX WARNING: Failed to process nested try/catch */
        /* JADX WARNING: Removed duplicated region for block: B:50:0x00cd A[ExcHandler: all (r0v16 'th' java.lang.Throwable A[CUSTOM_DECLARE]), Splitter:B:26:0x0081] */
        /* JADX WARNING: Removed duplicated region for block: B:85:0x0182  */
        /* JADX WARNING: Removed duplicated region for block: B:89:0x018f A[SYNTHETIC, Splitter:B:89:0x018f] */
        public final void run() {
            Throwable th;
            byte[] bArr;
            Context context;
            j jVar = this.f1923;
            Map<String, Object> map = jVar.f2093;
            boolean z = jVar.f2098;
            String str = jVar.f2095;
            int i = jVar.f2091;
            Context context2 = jVar.f2090;
            OutputStreamWriter outputStreamWriter = null;
            if (context2 == null) {
                WeakReference<Context> weakReference = jVar.f2088;
                context2 = weakReference != null ? weakReference.get() : null;
            }
            if (!AppsFlyerLibCore.this.isTrackingStopped()) {
                byte[] bArr2 = new byte[0];
                if (z && i <= 2) {
                    if (AppsFlyerLibCore.m1118(AppsFlyerLibCore.this)) {
                        map.put("rfr", AppsFlyerLibCore.this.f1902);
                        j jVar2 = this.f1923;
                        Context context3 = jVar2.f2090;
                        if (context3 != null) {
                            context = context3;
                        } else {
                            WeakReference<Context> weakReference2 = jVar2.f2088;
                            context = weakReference2 != null ? weakReference2.get() : null;
                        }
                        SharedPreferences.Editor edit = AppsFlyerLibCore.m1100(context).edit();
                        edit.putBoolean(AppsFlyerProperties.NEW_REFERRER_SENT, true);
                        edit.apply();
                    }
                    if (AppsFlyerLibCore.this.f1891 != null) {
                        map.put("fb_ddl", AppsFlyerLibCore.this.f1891);
                    }
                }
                map.putAll(new d.C0329d(map, context2));
                try {
                    this.f1923.f2085 = (String) map.get("appsflyerKey");
                    synchronized (map) {
                        try {
                            try {
                                bArr = (byte[]) ((Class) com.appsflyer.internal.b.m1207(48, 24, 0)).getMethod("ˏ", j.class).invoke(null, this.f1923);
                                try {
                                    AppsFlyerLibCore appsFlyerLibCore = AppsFlyerLibCore.this;
                                    j jVar3 = this.f1923;
                                    jVar3.f2097 = bArr;
                                    AppsFlyerLibCore.m1125(appsFlyerLibCore, jVar3);
                                } catch (Throwable th2) {
                                    th = th2;
                                    throw th;
                                }
                            } catch (Throwable th3) {
                                Throwable cause = th3.getCause();
                                if (cause != null) {
                                    throw cause;
                                }
                                throw th3;
                            }
                        } catch (Throwable th4) {
                            th = th4;
                            throw th;
                        }
                    }
                } catch (IOException e) {
                    IOException e2 = e;
                    bArr2 = bArr;
                    AFLogger.afErrorLog("Exception while sending request to server. ", e2);
                    if (bArr2 == null) {
                    }
                } catch (Throwable th5) {
                }
            }
        }

        public b(j jVar) {
            jVar.f2088 = new WeakReference<>(jVar.f2090);
            jVar.f2090 = null;
            this.f1923 = jVar;
        }
    }

    public class c implements Runnable {

        /* renamed from: ˏ  reason: contains not printable characters */
        public j f1925;

        public /* synthetic */ c(AppsFlyerLibCore appsFlyerLibCore, j jVar, byte b) {
            this(jVar);
        }

        public final void run() {
            AppsFlyerLibCore appsFlyerLibCore = AppsFlyerLibCore.this;
            j jVar = this.f1925;
            jVar.f2090 = jVar.f2088.get();
            appsFlyerLibCore.m1126((AppsFlyerLibCore) jVar);
        }

        public c(j jVar) {
            this.f1925 = jVar;
        }
    }

    public class e implements Runnable {

        /* renamed from: ˋ  reason: contains not printable characters */
        public WeakReference<Context> f1926 = null;

        public e(Context context) {
            this.f1926 = new WeakReference<>(context);
        }

        public final void run() {
            if (!AppsFlyerLibCore.this.f1903) {
                AppsFlyerLibCore.this.f1889 = System.currentTimeMillis();
                if (this.f1926 != null) {
                    AppsFlyerLibCore.this.f1903 = true;
                    try {
                        String r1 = AppsFlyerLibCore.m1109(AppsFlyerProperties.AF_KEY);
                        synchronized (this.f1926) {
                            z.m1255();
                            for (AFFacebookDeferredDeeplink aFFacebookDeferredDeeplink : z.m1254(this.f1926.get())) {
                                StringBuilder sb = new StringBuilder("resending request: ");
                                sb.append(aFFacebookDeferredDeeplink.f1854);
                                AFLogger.afInfoLog(sb.toString());
                                try {
                                    long currentTimeMillis = System.currentTimeMillis();
                                    long parseLong = Long.parseLong(aFFacebookDeferredDeeplink.f1856, 10);
                                    AppsFlyerLibCore appsFlyerLibCore = AppsFlyerLibCore.this;
                                    j jVar = new j();
                                    StringBuilder sb2 = new StringBuilder();
                                    sb2.append(aFFacebookDeferredDeeplink.f1854);
                                    sb2.append("&isCachedRequest=true&timeincache=");
                                    sb2.append(Long.toString((currentTimeMillis - parseLong) / 1000));
                                    jVar.f2095 = sb2.toString();
                                    jVar.f2097 = aFFacebookDeferredDeeplink.f1855;
                                    jVar.f2085 = r1;
                                    jVar.f2088 = this.f1926;
                                    jVar.f2086 = aFFacebookDeferredDeeplink.f1856;
                                    jVar.f2098 = false;
                                    AppsFlyerLibCore.m1125(appsFlyerLibCore, jVar);
                                } catch (Exception e) {
                                    AFLogger.afErrorLog("Failed to resend cached request", e);
                                }
                            }
                        }
                    } catch (Exception e2) {
                        AFLogger.afErrorLog("failed to check cache. ", e2);
                    } catch (Throwable th) {
                        AppsFlyerLibCore.this.f1903 = false;
                        throw th;
                    }
                    AppsFlyerLibCore.this.f1903 = false;
                    AppsFlyerLibCore.this.f1901.shutdown();
                    AppsFlyerLibCore.this.f1901 = null;
                }
            }
        }
    }

    public AppsFlyerLibCore() {
        AFVersionDeclaration.init();
    }

    public static AppsFlyerLibCore getInstance() {
        return f1872;
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    public static String m1088(Context context) {
        String string = AppsFlyerProperties.getInstance().getString("api_store_value");
        if (string != null) {
            return string;
        }
        String r2 = m1095(new WeakReference(context), "AF_STORE");
        if (r2 != null) {
            return r2;
        }
        return null;
    }

    /* renamed from: ʽ  reason: contains not printable characters */
    public static boolean m1091(Context context) {
        try {
            if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) == 0) {
                return true;
            }
        } catch (Throwable th) {
            AFLogger.afErrorLog("WARNING:  Google play services is unavailable. ", th);
        }
        try {
            context.getPackageManager().getPackageInfo("com.google.android.gms", 0);
            return true;
        } catch (PackageManager.NameNotFoundException e2) {
            AFLogger.afErrorLog("WARNING:  Google Play Services is unavailable. ", e2);
            return false;
        }
    }

    /* renamed from: ॱॱ  reason: contains not printable characters */
    public static float m1138(Context context) {
        try {
            Intent registerReceiver = context.getApplicationContext().registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
            int intExtra = registerReceiver.getIntExtra("level", -1);
            int intExtra2 = registerReceiver.getIntExtra("scale", -1);
            if (intExtra == -1 || intExtra2 == -1) {
                return 50.0f;
            }
            return (((float) intExtra) / ((float) intExtra2)) * 100.0f;
        } catch (Throwable th) {
            AFLogger.afErrorLog(th.getMessage(), th);
            return 1.0f;
        }
    }

    /* renamed from: ᐝ  reason: contains not printable characters */
    public static boolean m1141(Context context) {
        if ((AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID_FORCE_BY_USER, false) || AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_IMEI_FORCE_BY_USER, false)) || !m1091(context)) {
            return true;
        }
        return false;
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void enableFacebookDeferredApplinks(boolean z) {
        this.f1892 = z;
    }

    @Override // com.appsflyer.AppsFlyerLib
    public AppsFlyerLib enableLocationCollection(boolean z) {
        this.f1883 = z;
        return this;
    }

    @Override // com.appsflyer.AppsFlyerLib
    public String getAppsFlyerUID(Context context) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "getAppsFlyerUID", new String[0]);
        return af.m1186(new WeakReference(context));
    }

    @Override // com.appsflyer.AppsFlyerLib
    public String getAttributionId(Context context) {
        try {
            return new aa(context).m1162();
        } catch (Throwable th) {
            AFLogger.afErrorLog("Could not collect facebook attribution id. ", th);
            return null;
        }
    }

    public void getConversionData(Context context, final ConversionDataListener conversionDataListener) {
        f1873 = new AppsFlyerConversionListener() {
            /* class com.appsflyer.AppsFlyerLibCore.AnonymousClass3 */

            @Override // com.appsflyer.AppsFlyerConversionListener
            public final void onAppOpenAttribution(Map<String, String> map) {
            }

            @Override // com.appsflyer.AppsFlyerConversionListener
            public final void onAttributionFailure(String str) {
            }

            @Override // com.appsflyer.AppsFlyerConversionListener
            public final void onConversionDataFail(String str) {
                AFLogger.afDebugLog("Calling onConversionFailure with:\n".concat(String.valueOf(str)));
                conversionDataListener.onConversionFailure(str);
            }

            @Override // com.appsflyer.AppsFlyerConversionListener
            public final void onConversionDataSuccess(Map<String, Object> map) {
                StringBuilder sb = new StringBuilder("Calling onConversionDataLoaded with:\n");
                sb.append(map.toString());
                AFLogger.afDebugLog(sb.toString());
                conversionDataListener.onConversionDataLoaded(map);
            }
        };
    }

    @Override // com.appsflyer.AppsFlyerLib
    public String getHostName() {
        String string = AppsFlyerProperties.getInstance().getString("custom_host");
        return string != null ? string : ServerParameters.DEFAULT_HOST;
    }

    @Override // com.appsflyer.AppsFlyerLib
    public String getHostPrefix() {
        String string = AppsFlyerProperties.getInstance().getString("custom_host_prefix");
        return string != null ? string : "";
    }

    @Override // com.appsflyer.AppsFlyerLib
    public String getOutOfStore(Context context) {
        String string = AppsFlyerProperties.getInstance().getString("api_store_value");
        if (string != null) {
            return string;
        }
        String r3 = m1095(new WeakReference(context), "AF_STORE");
        if (r3 != null) {
            return r3;
        }
        AFLogger.afInfoLog("No out-of-store value set");
        return null;
    }

    @Override // com.appsflyer.AppsFlyerLib
    public String getSdkVersion() {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "getSdkVersion", new String[0]);
        return "version: 5.0.0 (build 260)";
    }

    public void handleDeepLinkCallback(Context context, Map<String, Object> map, Uri uri) {
        final Map map2;
        String str;
        String obj = uri.toString();
        if (obj == null) {
            obj = null;
        } else if (obj.matches("fb\\d*?://authorize.*") && obj.contains("access_token")) {
            int indexOf = obj.indexOf(63);
            if (indexOf == -1) {
                str = "";
            } else {
                str = obj.substring(indexOf);
            }
            if (str.length() != 0) {
                ArrayList arrayList = new ArrayList();
                if (str.contains("&")) {
                    arrayList = new ArrayList(Arrays.asList(str.split("&")));
                } else {
                    arrayList.add(str);
                }
                StringBuilder sb = new StringBuilder();
                Iterator it2 = arrayList.iterator();
                while (it2.hasNext()) {
                    String str2 = (String) it2.next();
                    if (str2.contains("access_token")) {
                        it2.remove();
                    } else {
                        if (sb.length() != 0) {
                            sb.append("&");
                        } else if (!str2.startsWith("?")) {
                            sb.append("?");
                        }
                        sb.append(str2);
                    }
                }
                obj = obj.replace(str, sb.toString());
            }
        }
        if (!map.containsKey("af_deeplink")) {
            map.put("af_deeplink", obj);
        }
        boolean z = true;
        if (uri.getQueryParameter("af_deeplink") != null) {
            this.f1880 = "AppsFlyer_Test".equals(uri.getQueryParameter("media_source")) && Boolean.parseBoolean(uri.getQueryParameter("is_retargeting"));
            map2 = m1130(context, uri.getQuery());
            String path = uri.getPath();
            if (path != null) {
                map2.put("path", path);
            }
            String scheme = uri.getScheme();
            if (scheme != null) {
                map2.put("scheme", scheme);
            }
            String host = uri.getHost();
            if (host != null) {
                map2.put("host", host);
            }
        } else {
            map2 = new HashMap();
            map2.put("link", uri.toString());
        }
        final WeakReference weakReference = new WeakReference(context);
        ad adVar = new ad(uri, this);
        adVar.setConnProvider(new OneLinkHttpTask.HttpsUrlConnectionProvider());
        if (TextUtils.isEmpty(adVar.f1943) || TextUtils.isEmpty(adVar.f1977)) {
            z = false;
        }
        if (z) {
            adVar.f1978 = new ad.a() {
                /* class com.appsflyer.AppsFlyerLibCore.AnonymousClass5 */

                /* renamed from: ˋ  reason: contains not printable characters */
                private void m1148(Map<String, String> map) {
                    if (weakReference.get() != null) {
                        AppsFlyerLibCore.m1112((Context) weakReference.get(), "deeplinkAttribution", new JSONObject(map).toString());
                    }
                }

                @Override // com.appsflyer.internal.ad.a
                /* renamed from: ˏ  reason: contains not printable characters */
                public final void m1149(String str) {
                    if (AppsFlyerLibCore.f1873 != null) {
                        m1148(map2);
                        AFLogger.afDebugLog("Calling onAttributionFailure with:\n".concat(String.valueOf(str)));
                        AppsFlyerLibCore.f1873.onAttributionFailure(str);
                    }
                }

                @Override // com.appsflyer.internal.ad.a
                /* renamed from: ˏ  reason: contains not printable characters */
                public final void m1150(Map<String, String> map) {
                    for (String str : map.keySet()) {
                        map2.put(str, map.get(str));
                    }
                    m1148(map2);
                    AppsFlyerLibCore.m1114(map2);
                }
            };
            AFExecutor.getInstance().getThreadPoolExecutor().execute(adVar);
            return;
        }
        m1114(map2);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public AppsFlyerLib init(String str, AppsFlyerConversionListener appsFlyerConversionListener, Context context) {
        if (context != null) {
            this.f1894 = (Application) context.getApplicationContext();
            if (m1117(context)) {
                if (this.f1900 == null) {
                    this.f1900 = new i();
                    this.f1900.m1231(context, this);
                } else {
                    AFLogger.afWarnLog("AFInstallReferrer instance already created");
                }
            }
        } else {
            AFLogger.afWarnLog("init :: context is null, Google Install Referrer will be not initialized!");
        }
        return init(str, appsFlyerConversionListener);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public boolean isPreInstalledApp(Context context) {
        try {
            if ((context.getPackageManager().getApplicationInfo(context.getPackageName(), 0).flags & 1) != 0) {
                return true;
            }
            return false;
        } catch (PackageManager.NameNotFoundException e2) {
            AFLogger.afErrorLog("Could not check if app is pre installed", e2);
        }
    }

    @Override // com.appsflyer.AppsFlyerLib
    public boolean isTrackingStopped() {
        return this.f1886;
    }

    @Override // com.appsflyer.AppsFlyerLib, com.appsflyer.internal.m
    public void onHandleReferrer(Map<String, String> map) {
        this.f1902 = map;
        Map<String, String> map2 = this.f1902;
        if (map2 != null && map2.size() > 0) {
            j jVar = new j();
            jVar.f2087 = map;
            jVar.f2090 = this.f1894;
            m1126(jVar);
        }
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void onPause(Context context) {
        g.AnonymousClass1.m1230(context);
        t r2 = t.m1243(context);
        r2.f2131.post(r2.f2134);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void registerConversionListener(Context context, AppsFlyerConversionListener appsFlyerConversionListener) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "registerConversionListener", new String[0]);
        if (appsFlyerConversionListener != null) {
            f1873 = appsFlyerConversionListener;
        }
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void registerValidatorListener(Context context, AppsFlyerInAppPurchaseValidatorListener appsFlyerInAppPurchaseValidatorListener) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "registerValidatorListener", new String[0]);
        AFLogger.afDebugLog("registerValidatorListener called");
        if (appsFlyerInAppPurchaseValidatorListener == null) {
            AFLogger.afDebugLog("registerValidatorListener null listener");
        } else {
            f1871 = appsFlyerInAppPurchaseValidatorListener;
        }
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void reportTrackSession(Context context) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "reportTrackSession", new String[0]);
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.f2001 = false;
        j jVar = new j();
        jVar.f2090 = context;
        jVar.f2089 = null;
        jVar.f2099 = null;
        m1144(jVar);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void sendDeepLinkData(Activity activity) {
        if (activity != null && activity.getIntent() != null) {
            if (ae.f1979 == null) {
                ae.f1979 = new ae();
            }
            ae aeVar = ae.f1979;
            StringBuilder sb = new StringBuilder("activity_intent_");
            sb.append(activity.getIntent().toString());
            aeVar.m1180("public_api_call", "sendDeepLinkData", activity.getLocalClassName(), sb.toString());
        } else if (activity != null) {
            if (ae.f1979 == null) {
                ae.f1979 = new ae();
            }
            ae.f1979.m1180("public_api_call", "sendDeepLinkData", activity.getLocalClassName(), "activity_intent_null");
        } else {
            if (ae.f1979 == null) {
                ae.f1979 = new ae();
            }
            ae.f1979.m1180("public_api_call", "sendDeepLinkData", "activity_null");
        }
        try {
            Application application = activity.getApplication();
            j jVar = new j();
            jVar.f2090 = application;
            m1113(jVar);
            StringBuilder sb2 = new StringBuilder("getDeepLinkData with activity ");
            sb2.append(activity.getIntent().getDataString());
            AFLogger.afInfoLog(sb2.toString());
        } catch (Exception e2) {
            AFLogger.afInfoLog("getDeepLinkData Exception: ".concat(String.valueOf(e2)));
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:57:0x018d  */
    @Override // com.appsflyer.AppsFlyerLib
    public void sendPushNotificationData(Activity activity) {
        String str;
        long j;
        Throwable th;
        Intent intent;
        Bundle extras;
        if (activity != null && activity.getIntent() != null) {
            if (ae.f1979 == null) {
                ae.f1979 = new ae();
            }
            ae aeVar = ae.f1979;
            StringBuilder sb = new StringBuilder("activity_intent_");
            sb.append(activity.getIntent().toString());
            aeVar.m1180("public_api_call", "sendPushNotificationData", activity.getLocalClassName(), sb.toString());
        } else if (activity != null) {
            if (ae.f1979 == null) {
                ae.f1979 = new ae();
            }
            ae.f1979.m1180("public_api_call", "sendPushNotificationData", activity.getLocalClassName(), "activity_intent_null");
        } else {
            if (ae.f1979 == null) {
                ae.f1979 = new ae();
            }
            ae.f1979.m1180("public_api_call", "sendPushNotificationData", "activity_null");
        }
        if (!(activity instanceof Activity) || (intent = activity.getIntent()) == null || (extras = intent.getExtras()) == null) {
            str = null;
        } else {
            str = extras.getString("af");
            if (str != null) {
                AFLogger.afInfoLog("Push Notification received af payload = ".concat(str));
                extras.remove("af");
                activity.setIntent(intent.putExtras(extras));
            }
        }
        this.f1879 = str;
        if (this.f1879 != null) {
            long currentTimeMillis = System.currentTimeMillis();
            if (this.f1884 == null) {
                AFLogger.afInfoLog("pushes: initializing pushes history..");
                this.f1884 = new ConcurrentHashMap();
                j = currentTimeMillis;
            } else {
                try {
                    long j2 = AppsFlyerProperties.getInstance().getLong("pushPayloadMaxAging", 1800000);
                    j = currentTimeMillis;
                    for (Long l : this.f1884.keySet()) {
                        try {
                            JSONObject jSONObject = new JSONObject(this.f1879);
                            JSONObject jSONObject2 = new JSONObject(this.f1884.get(l));
                            if (!jSONObject.get(Constants.URL_MEDIA_SOURCE).equals(jSONObject2.get(Constants.URL_MEDIA_SOURCE)) || !jSONObject.get(Constants.URL_CAMPAIGN).equals(jSONObject2.get(Constants.URL_CAMPAIGN))) {
                                if (currentTimeMillis - l.longValue() > j2) {
                                    this.f1884.remove(l);
                                }
                                if (l.longValue() <= j) {
                                    j = l.longValue();
                                }
                            } else {
                                StringBuilder sb2 = new StringBuilder("PushNotificationMeasurement: A previous payload with same PID and campaign was already acknowledged! (old: ");
                                sb2.append(jSONObject2);
                                sb2.append(", new: ");
                                sb2.append(jSONObject);
                                sb2.append(")");
                                AFLogger.afInfoLog(sb2.toString());
                                this.f1879 = null;
                                return;
                            }
                        } catch (Throwable th2) {
                            th = th2;
                            StringBuilder sb3 = new StringBuilder("Error while handling push notification measurement: ");
                            sb3.append(th.getClass().getSimpleName());
                            AFLogger.afErrorLog(sb3.toString(), th);
                            if (this.f1884.size() == AppsFlyerProperties.getInstance().getInt("pushPayloadHistorySize", 2)) {
                            }
                            this.f1884.put(Long.valueOf(currentTimeMillis), this.f1879);
                            Application application = activity.getApplication();
                            j jVar = new j();
                            jVar.f2090 = application;
                            m1113(jVar);
                        }
                    }
                } catch (Throwable th3) {
                    th = th3;
                    j = currentTimeMillis;
                    StringBuilder sb32 = new StringBuilder("Error while handling push notification measurement: ");
                    sb32.append(th.getClass().getSimpleName());
                    AFLogger.afErrorLog(sb32.toString(), th);
                    if (this.f1884.size() == AppsFlyerProperties.getInstance().getInt("pushPayloadHistorySize", 2)) {
                    }
                    this.f1884.put(Long.valueOf(currentTimeMillis), this.f1879);
                    Application application2 = activity.getApplication();
                    j jVar2 = new j();
                    jVar2.f2090 = application2;
                    m1113(jVar2);
                }
            }
            if (this.f1884.size() == AppsFlyerProperties.getInstance().getInt("pushPayloadHistorySize", 2)) {
                StringBuilder sb4 = new StringBuilder("pushes: removing oldest overflowing push (oldest push:");
                sb4.append(j);
                sb4.append(")");
                AFLogger.afInfoLog(sb4.toString());
                this.f1884.remove(Long.valueOf(j));
            }
            this.f1884.put(Long.valueOf(currentTimeMillis), this.f1879);
            Application application22 = activity.getApplication();
            j jVar22 = new j();
            jVar22.f2090 = application22;
            m1113(jVar22);
        }
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setAdditionalData(HashMap<String, Object> hashMap) {
        if (hashMap != null) {
            if (ae.f1979 == null) {
                ae.f1979 = new ae();
            }
            ae.f1979.m1180("public_api_call", "setAdditionalData", hashMap.toString());
            AppsFlyerProperties.getInstance().setCustomData(new JSONObject(hashMap).toString());
        }
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setAndroidIdData(String str) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setAndroidIdData", str);
        this.f1895 = str;
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setAppId(String str) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setAppId", str);
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.APP_ID, str);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setAppInviteOneLink(String str) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setAppInviteOneLink", str);
        AFLogger.afInfoLog("setAppInviteOneLink = ".concat(String.valueOf(str)));
        if (str == null || !str.equals(AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ONELINK_ID))) {
            AppsFlyerProperties.getInstance().remove(AppsFlyerProperties.ONELINK_DOMAIN);
            AppsFlyerProperties.getInstance().remove("onelinkVersion");
            AppsFlyerProperties.getInstance().remove(AppsFlyerProperties.ONELINK_SCHEME);
        }
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.ONELINK_ID, str);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setCollectAndroidID(boolean z) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setCollectAndroidID", String.valueOf(z));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.COLLECT_ANDROID_ID, Boolean.toString(z));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.COLLECT_ANDROID_ID_FORCE_BY_USER, Boolean.toString(z));
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setCollectIMEI(boolean z) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setCollectIMEI", String.valueOf(z));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.COLLECT_IMEI, Boolean.toString(z));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.COLLECT_IMEI_FORCE_BY_USER, Boolean.toString(z));
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setCollectOaid(boolean z) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setCollectOaid", String.valueOf(z));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.COLLECT_OAID, Boolean.toString(z));
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setConsumeAFDeepLinks(boolean z) {
        AppsFlyerProperties.getInstance().set("consumeAfDeepLink", z);
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setConsumeAFDeepLinks: ".concat(String.valueOf(z)), new String[0]);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setCurrencyCode(String str) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setCurrencyCode", str);
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.CURRENCY_CODE, str);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setCustomerIdAndTrack(String str, Context context) {
        if (context != null) {
            if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false) && AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_USER_ID) == null) {
                setCustomerUserId(str);
                AppsFlyerProperties.getInstance().set(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false);
                StringBuilder sb = new StringBuilder("CustomerUserId set: ");
                sb.append(str);
                sb.append(" - Initializing AppsFlyer Tacking");
                AFLogger.afInfoLog(sb.toString(), true);
                String referrer = AppsFlyerProperties.getInstance().getReferrer(context);
                String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                if (referrer == null) {
                    referrer = "";
                }
                m1124(context, string, referrer, context instanceof Activity ? ((Activity) context).getIntent() : null);
                if (AppsFlyerProperties.getInstance().getString("afUninstallToken") != null) {
                    m1143(context, AppsFlyerProperties.getInstance().getString("afUninstallToken"));
                    return;
                }
                return;
            }
            setCustomerUserId(str);
            AFLogger.afInfoLog("waitForCustomerUserId is false; setting CustomerUserID: ".concat(String.valueOf(str)), true);
        }
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setCustomerUserId(String str) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setCustomerUserId", str);
        AFLogger.afInfoLog("setCustomerUserId = ".concat(String.valueOf(str)));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.APP_USER_ID, str);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setDebugLog(boolean z) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setDebugLog", String.valueOf(z));
        AppsFlyerProperties.getInstance().set("shouldLog", z);
        AppsFlyerProperties.getInstance().set("logLevel", (z ? AFLogger.LogLevel.DEBUG : AFLogger.LogLevel.NONE).getLevel());
    }

    public void setDeepLinkData(Intent intent) {
        if (intent != null) {
            try {
                if ("android.intent.action.VIEW".equals(intent.getAction())) {
                    this.latestDeepLink = intent.getData();
                    StringBuilder sb = new StringBuilder("Unity setDeepLinkData = ");
                    sb.append(this.latestDeepLink);
                    AFLogger.afDebugLog(sb.toString());
                }
            } catch (Throwable th) {
                AFLogger.afErrorLog("Exception while setting deeplink data (unity). ", th);
            }
        }
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setDeviceTrackingDisabled(boolean z) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setDeviceTrackingDisabled", String.valueOf(z));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, z);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setExtension(String str) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setExtension", str);
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.EXTENSION, str);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setHost(String str, String str2) {
        if (str != null) {
            AppsFlyerProperties.getInstance().set("custom_host_prefix", str);
        }
        if (str2 == null || str2.isEmpty()) {
            AFLogger.afWarnLog("hostName cannot be null or empty");
        } else {
            AppsFlyerProperties.getInstance().set("custom_host", str2);
        }
    }

    @Override // com.appsflyer.AppsFlyerLib
    @Deprecated
    public void setHostName(String str) {
        AppsFlyerProperties.getInstance().set("custom_host", str);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setImeiData(String str) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setImeiData", str);
        this.f1896 = str;
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setIsUpdate(boolean z) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setIsUpdate", String.valueOf(z));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.IS_UPDATE, z);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setLogLevel(AFLogger.LogLevel logLevel) {
        AppsFlyerProperties.getInstance().set("logLevel", logLevel.getLevel());
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setMinTimeBetweenSessions(int i) {
        this.f1877 = TimeUnit.SECONDS.toMillis((long) i);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setOaidData(String str) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setOaidData", str);
        this.f1897 = str;
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setOneLinkCustomDomain(String... strArr) {
        AFLogger.afDebugLog(String.format("setOneLinkCustomDomain %s", Arrays.toString(strArr)));
        g.f2074 = strArr;
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setOutOfStore(String str) {
        if (str != null) {
            String lowerCase = str.toLowerCase();
            AppsFlyerProperties.getInstance().set("api_store_value", lowerCase);
            AFLogger.afInfoLog("Store API set with value: ".concat(String.valueOf(lowerCase)), true);
            return;
        }
        AFLogger.m1081("Cannot set setOutOfStore with null");
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setPhoneNumber(String str) {
        this.f1893 = ai.m1196(str);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setPluginDeepLinkData(Intent intent) {
        setDeepLinkData(intent);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setPreinstallAttribution(String str, String str2, String str3) {
        AFLogger.afDebugLog("setPreinstallAttribution API called");
        JSONObject jSONObject = new JSONObject();
        if (str != null) {
            try {
                jSONObject.put(Constants.URL_MEDIA_SOURCE, str);
            } catch (JSONException e2) {
                AFLogger.afErrorLog(e2.getMessage(), e2);
            }
        }
        if (str2 != null) {
            jSONObject.put(Constants.URL_CAMPAIGN, str2);
        }
        if (str3 != null) {
            jSONObject.put(Constants.URL_SITE_ID, str3);
        }
        if (jSONObject.has(Constants.URL_MEDIA_SOURCE)) {
            AppsFlyerProperties.getInstance().set("preInstallName", jSONObject.toString());
            return;
        }
        AFLogger.afWarnLog("Cannot set preinstall attribution data without a media source");
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setResolveDeepLinkURLs(String... strArr) {
        AFLogger.afDebugLog(String.format("setResolveDeepLinkURLs %s", Arrays.toString(strArr)));
        g.f2078 = strArr;
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setUserEmails(AppsFlyerProperties.EmailsCryptType emailsCryptType, String... strArr) {
        ArrayList arrayList = new ArrayList(strArr.length + 1);
        arrayList.add(emailsCryptType.toString());
        arrayList.addAll(Arrays.asList(strArr));
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setUserEmails", (String[]) arrayList.toArray(new String[(strArr.length + 1)]));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.EMAIL_CRYPT_TYPE, emailsCryptType.getValue());
        HashMap hashMap = new HashMap();
        String str = null;
        ArrayList arrayList2 = new ArrayList();
        for (String str2 : strArr) {
            if (AnonymousClass1.f1904[emailsCryptType.ordinal()] != 2) {
                arrayList2.add(ai.m1196(str2));
                str = "sha256_el_arr";
            } else {
                arrayList2.add(str2);
                str = "plain_el_arr";
            }
        }
        hashMap.put(str, arrayList2);
        AppsFlyerProperties.getInstance().setUserEmails(new JSONObject(hashMap).toString());
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void startTracking(Application application) {
        if (!this.f1885) {
            AFLogger.afWarnLog("ERROR: AppsFlyer SDK is not initialized! The API call 'startTracking(Application)' must be called after the 'init(String, AppsFlyerConversionListener)' API method, which should be called on the Application's onCreate.");
        } else {
            startTracking(application, null);
        }
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void stopTracking(boolean z, Context context) {
        this.f1886 = z;
        z.m1255();
        try {
            File r1 = z.m1256(context);
            if (!r1.exists()) {
                r1.mkdir();
            } else {
                File[] listFiles = r1.listFiles();
                for (File file : listFiles) {
                    StringBuilder sb = new StringBuilder("Found cached request");
                    sb.append(file.getName());
                    Log.i(LOG_TAG, sb.toString());
                    z.m1257(z.m1258(file).f1856, context);
                }
            }
        } catch (Exception unused) {
            Log.i(LOG_TAG, "Could not cache request");
        }
        if (this.f1886) {
            SharedPreferences.Editor edit = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0).edit();
            edit.putBoolean(IS_STOP_TRACKING_USED, true);
            edit.apply();
        }
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void trackAppLaunch(Context context, String str) {
        if (m1117(context)) {
            if (this.f1900 == null) {
                this.f1900 = new i();
                this.f1900.m1231(context, this);
            } else {
                AFLogger.afWarnLog("AFInstallReferrer instance already created");
            }
        }
        m1124(context, str, "", null);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void trackEvent(Context context, String str, Map<String, Object> map, AppsFlyerTrackingRequestListener appsFlyerTrackingRequestListener) {
        JSONObject jSONObject = new JSONObject(map == null ? new HashMap<>() : map);
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "trackEvent", str, jSONObject.toString());
        j jVar = new j();
        jVar.f2090 = context;
        jVar.f2089 = str;
        jVar.f2099 = map;
        jVar.f2092 = appsFlyerTrackingRequestListener;
        m1144(jVar);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void trackLocation(Context context, double d, double d2) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "trackLocation", String.valueOf(d), String.valueOf(d2));
        HashMap hashMap = new HashMap();
        hashMap.put(AFInAppEventParameterName.LONGTITUDE, Double.toString(d2));
        hashMap.put(AFInAppEventParameterName.LATITUDE, Double.toString(d));
        j jVar = new j();
        jVar.f2090 = context;
        jVar.f2089 = AFInAppEventType.LOCATION_COORDINATES;
        jVar.f2099 = hashMap;
        m1144(jVar);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void unregisterConversionListener() {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "unregisterConversionListener", new String[0]);
        f1873 = null;
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void updateServerUninstallToken(Context context, String str) {
        s.d.m1241(context, str);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void validateAndTrackInAppPurchase(Context context, String str, String str2, String str3, String str4, String str5, Map<String, String> map) {
        String str6;
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae aeVar = ae.f1979;
        String[] strArr = new String[6];
        strArr[0] = str;
        strArr[1] = str2;
        strArr[2] = str3;
        strArr[3] = str4;
        strArr[4] = str5;
        if (map == null) {
            str6 = "";
        } else {
            str6 = map.toString();
        }
        strArr[5] = str6;
        aeVar.m1180("public_api_call", "validateAndTrackInAppPurchase", strArr);
        if (!isTrackingStopped()) {
            StringBuilder sb = new StringBuilder("Validate in app called with parameters: ");
            sb.append(str3);
            sb.append(" ");
            sb.append(str4);
            sb.append(" ");
            sb.append(str5);
            AFLogger.afInfoLog(sb.toString());
        }
        if (str == null || str4 == null || str2 == null || str5 == null || str3 == null) {
            AppsFlyerInAppPurchaseValidatorListener appsFlyerInAppPurchaseValidatorListener = f1871;
            if (appsFlyerInAppPurchaseValidatorListener != null) {
                appsFlyerInAppPurchaseValidatorListener.onValidateInAppFailure("Please provide purchase parameters");
                return;
            }
            return;
        }
        m1107(AFExecutor.getInstance().m1071(), new y(context.getApplicationContext(), AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY), str, str2, str3, str4, str5, map, context instanceof Activity ? ((Activity) context).getIntent() : null), 10, TimeUnit.MILLISECONDS);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void waitForCustomerUserId(boolean z) {
        AFLogger.afInfoLog("initAfterCustomerUserID: ".concat(String.valueOf(z)), true);
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, z);
    }

    /* renamed from: ʼ  reason: contains not printable characters */
    public static boolean m1090(Context context) {
        if (context != null) {
            if (Build.VERSION.SDK_INT >= 23) {
                try {
                    ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
                    for (Network network : connectivityManager.getAllNetworks()) {
                        NetworkCapabilities networkCapabilities = connectivityManager.getNetworkCapabilities(network);
                        if (networkCapabilities.hasTransport(4) && !networkCapabilities.hasCapability(15)) {
                            return true;
                        }
                    }
                    return false;
                } catch (Exception e2) {
                    AFLogger.afErrorLog("Failed collecting ivc data", e2);
                }
            } else {
                ArrayList arrayList = new ArrayList();
                try {
                    Iterator it2 = Collections.list(NetworkInterface.getNetworkInterfaces()).iterator();
                    while (it2.hasNext()) {
                        NetworkInterface networkInterface = (NetworkInterface) it2.next();
                        if (networkInterface.isUp()) {
                            arrayList.add(networkInterface.getName());
                        }
                    }
                    return arrayList.contains("tun0");
                } catch (Exception e3) {
                    AFLogger.afErrorLog("Failed collecting ivc data", e3);
                }
            }
        }
        return false;
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    public static File m1087(String str) {
        if (str == null) {
            return null;
        }
        try {
            if (str.trim().length() > 0) {
                return new File(str.trim());
            }
            return null;
        } catch (Throwable th) {
            AFLogger.afErrorLog(th.getMessage(), th);
            return null;
        }
    }

    /* renamed from: ˊ  reason: contains not printable characters */
    public final void m1142(Context context, Intent intent) {
        if (intent.getStringExtra("appsflyer_preinstall") != null) {
            getInstance();
            String stringExtra = intent.getStringExtra("appsflyer_preinstall");
            try {
                if (new JSONObject(stringExtra).has(Constants.URL_MEDIA_SOURCE)) {
                    AppsFlyerProperties.getInstance().set("preInstallName", stringExtra);
                } else {
                    AFLogger.afWarnLog("Cannot set preinstall attribution data without a media source");
                }
            } catch (JSONException e2) {
                AFLogger.afErrorLog("Error parsing JSON for preinstall", e2);
            }
        }
        AFLogger.afInfoLog("****** onReceive called *******");
        AppsFlyerProperties.getInstance().setOnReceiveCalled();
        String stringExtra2 = intent.getStringExtra(com.adjust.sdk.Constants.REFERRER);
        AFLogger.afInfoLog("Play store referrer: ".concat(String.valueOf(stringExtra2)));
        if (stringExtra2 != null) {
            if ("AppsFlyer_Test".equals(intent.getStringExtra("TestIntegrationMode"))) {
                SharedPreferences.Editor edit = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0).edit();
                edit.clear();
                edit.apply();
                AppsFlyerProperties.getInstance().setFirstLaunchCalled(false);
                AFLogger.afInfoLog("Test mode started..");
                this.f1882 = System.currentTimeMillis();
            }
            SharedPreferences.Editor edit2 = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0).edit();
            edit2.putString(com.adjust.sdk.Constants.REFERRER, stringExtra2);
            edit2.apply();
            AppsFlyerProperties.getInstance().setReferrer(stringExtra2);
            if (AppsFlyerProperties.getInstance().isFirstLaunchCalled()) {
                AFLogger.afInfoLog("onReceive: isLaunchCalled");
                if (stringExtra2.length() > 5) {
                    ScheduledThreadPoolExecutor r0 = AFExecutor.getInstance().m1071();
                    j jVar = new j();
                    jVar.f2090 = context;
                    j r8 = jVar.m1232();
                    r8.f2088 = new WeakReference<>(r8.f2090);
                    r8.f2090 = null;
                    r8.f2094 = stringExtra2;
                    r8.f2101 = true;
                    r8.f2096 = intent;
                    m1107(r0, new c(this, r8, (byte) 0), 5, TimeUnit.MILLISECONDS);
                }
            }
        }
    }

    /* renamed from: ˋ  reason: contains not printable characters */
    public static String m1102(String str) {
        return AppsFlyerProperties.getInstance().getString(str);
    }

    /* renamed from: ˎ  reason: contains not printable characters */
    public static void m1111(Context context, String str) {
        JSONObject jSONObject;
        JSONArray jSONArray;
        AFLogger.afDebugLog("received a new (extra) referrer: ".concat(String.valueOf(str)));
        try {
            long currentTimeMillis = System.currentTimeMillis();
            String string = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0).getString("extraReferrers", 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) {
                m1099(jSONObject);
            }
            jSONObject.put(str, jSONArray.toString());
            String jSONObject2 = jSONObject.toString();
            SharedPreferences.Editor edit = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0).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.afErrorLog(sb.toString(), th);
        }
    }

    /* renamed from: ˏ  reason: contains not printable characters */
    public static void m1123(Context context, String str) {
        Intent intent = new Intent("com.appsflyer.testIntgrationBroadcast");
        intent.putExtra(NativeProtocol.WEB_DIALOG_PARAMS, str);
        if (Build.VERSION.SDK_INT < 26) {
            context.sendBroadcast(intent);
        } else if (context.getPackageManager().queryBroadcastReceivers(intent, 0).toString().contains("com.appsflyer.referrerSender")) {
            Intent intent2 = new Intent(intent);
            intent2.setComponent(new ComponentName("com.appsflyer.referrerSender", "com.appsflyer.referrerSender.Receiver"));
            context.sendBroadcast(intent2);
        }
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void startTracking(Application application, String str) {
        startTracking(application, str, null);
    }

    /* renamed from: ˋ  reason: contains not printable characters */
    private void m1106(j jVar) {
        jVar.m1232();
        boolean z = jVar.f2089 == null;
        if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false) && AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_USER_ID) == null) {
            AFLogger.afInfoLog("CustomerUserId not set, Tracking is disabled", true);
            return;
        }
        if (z) {
            if (!AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.LAUNCH_PROTECT_ENABLED, true)) {
                AFLogger.afInfoLog("Allowing multiple launches within a 5 second time window.");
            } else if (m1116()) {
                return;
            }
            this.f1887 = System.currentTimeMillis();
        }
        ScheduledThreadPoolExecutor r0 = AFExecutor.getInstance().m1071();
        jVar.f2088 = new WeakReference<>(jVar.f2090);
        jVar.f2090 = null;
        jVar.f2101 = false;
        m1107(r0, new c(this, jVar, (byte) 0), 150, TimeUnit.MILLISECONDS);
    }

    /* renamed from: ॱ  reason: contains not printable characters */
    public static Map<String, String> m1130(Context context, String str) {
        String str2;
        int i;
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        String[] split = str.split("&");
        int length = split.length;
        int i2 = 0;
        boolean z = false;
        while (true) {
            str2 = "media_source";
            if (i2 < length) {
                String str3 = split[i2];
                int indexOf = str3.indexOf("=");
                String substring = indexOf > 0 ? str3.substring(0, indexOf) : str3;
                if (!linkedHashMap.containsKey(substring)) {
                    if (substring.equals(Constants.URL_CAMPAIGN)) {
                        str2 = AppEventsLoggerImpl.PUSH_PAYLOAD_CAMPAIGN_KEY;
                    } else if (!substring.equals(Constants.URL_MEDIA_SOURCE)) {
                        if (substring.equals("af_prt")) {
                            z = true;
                            str2 = "agency";
                        }
                        linkedHashMap.put(substring, "");
                    }
                    substring = str2;
                    linkedHashMap.put(substring, "");
                }
                linkedHashMap.put(substring, (indexOf <= 0 || str3.length() <= (i = indexOf + 1)) ? null : str3.substring(i));
                i2++;
            } else {
                try {
                    break;
                } catch (Exception e2) {
                    AFLogger.afErrorLog("Could not fetch install time. ", e2);
                }
            }
        }
        if (!linkedHashMap.containsKey("install_time")) {
            PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
            long j = packageInfo.firstInstallTime;
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
            linkedHashMap.put("install_time", simpleDateFormat.format(new Date(j)));
        }
        if (!linkedHashMap.containsKey("af_status")) {
            linkedHashMap.put("af_status", "Non-organic");
        }
        if (z) {
            linkedHashMap.remove(str2);
        }
        return linkedHashMap;
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void startTracking(Application application, String str, AppsFlyerTrackingRequestListener appsFlyerTrackingRequestListener) {
        this.f1894 = application;
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "startTracking", str);
        AFLogger.afInfoLog(String.format("Starting AppsFlyer Tracking: (v%s.%s)", BuildConfig.VERSION_NAME, "260"));
        AFLogger.afInfoLog("Build Number: 260");
        AppsFlyerProperties.getInstance().loadProperties(application.getApplicationContext());
        if (!TextUtils.isEmpty(str)) {
            AppsFlyerProperties.getInstance().set(AppsFlyerProperties.AF_KEY, str);
            AFFacebookDeferredDeeplink.AnonymousClass3.m1074(str);
        } else if (TextUtils.isEmpty(AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY))) {
            AFLogger.afWarnLog("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 startTracking API method (should be called on Activity's onCreate).");
            return;
        }
        Context baseContext = application.getBaseContext();
        try {
            if ((baseContext.getPackageManager().getPackageInfo(baseContext.getPackageName(), 0).applicationInfo.flags & 32768) != 0) {
                if (baseContext.getResources().getIdentifier("appsflyer_backup_rules", "xml", baseContext.getPackageName()) != 0) {
                    AFLogger.afInfoLog("appsflyer_backup_rules.xml detected, using AppsFlyer defined backup rules for AppsFlyer SDK data", true);
                } else {
                    AFLogger.m1081("'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 sb = new StringBuilder("checkBackupRules Exception: ");
            sb.append(e2.toString());
            AFLogger.afRDLog(sb.toString());
        }
        if (this.f1892) {
            Context applicationContext = application.getApplicationContext();
            this.f1891 = new HashMap();
            final long currentTimeMillis = System.currentTimeMillis();
            AnonymousClass4 r9 = new AFFacebookDeferredDeeplink.AppLinkFetchEvents() {
                /* class com.appsflyer.AppsFlyerLibCore.AnonymousClass4 */

                @Override // com.appsflyer.AFFacebookDeferredDeeplink.AppLinkFetchEvents
                public final void onAppLinkFetchFailed(String str) {
                    AppsFlyerLibCore.this.f1891.put("error", str);
                }

                @Override // com.appsflyer.AFFacebookDeferredDeeplink.AppLinkFetchEvents
                public final void onAppLinkFetchFinished(String str, String str2, String str3) {
                    if (str != null) {
                        AFLogger.afInfoLog("Facebook Deferred AppLink data received: ".concat(str));
                        AppsFlyerLibCore.this.f1891.put("link", str);
                        if (str2 != null) {
                            AppsFlyerLibCore.this.f1891.put(AppLinkData.METHOD_ARGS_TARGET_URL_KEY, str2);
                        }
                        if (str3 != null) {
                            HashMap hashMap = new HashMap();
                            HashMap hashMap2 = new HashMap();
                            hashMap2.put("promo_code", str3);
                            hashMap.put("deeplink_context", hashMap2);
                            AppsFlyerLibCore.this.f1891.put(AppLinkData.ARGUMENTS_EXTRAS_KEY, hashMap);
                        }
                    } else {
                        AppsFlyerLibCore.this.f1891.put("link", "");
                    }
                    AppsFlyerLibCore.this.f1891.put("ttr", String.valueOf(System.currentTimeMillis() - currentTimeMillis));
                }
            };
            try {
                Class.forName(FacebookSdk.TAG).getMethod("sdkInitialize", Context.class).invoke(null, applicationContext);
                Class<?> cls = Class.forName(AppLinkData.TAG);
                Class<?> cls2 = Class.forName("com.facebook.applinks.AppLinkData$CompletionHandler");
                Method method = cls.getMethod("fetchDeferredAppLinkData", Context.class, String.class, cls2);
                AFFacebookDeferredDeeplink.AnonymousClass3 r13 = new AFFacebookDeferredDeeplink.AnonymousClass3(cls, r9);
                Object newProxyInstance = Proxy.newProxyInstance(cls2.getClassLoader(), new Class[]{cls2}, r13);
                String string = applicationContext.getString(applicationContext.getResources().getIdentifier("facebook_app_id", LegacyTokenHelper.TYPE_STRING, applicationContext.getPackageName()));
                if (TextUtils.isEmpty(string)) {
                    r9.onAppLinkFetchFailed("Facebook app id not defined in resources");
                } else {
                    method.invoke(null, applicationContext, string, newProxyInstance);
                }
            } catch (NoSuchMethodException e3) {
                r9.onAppLinkFetchFailed(e3.toString());
            } catch (InvocationTargetException e4) {
                r9.onAppLinkFetchFailed(e4.toString());
            } catch (ClassNotFoundException e5) {
                r9.onAppLinkFetchFailed(e5.toString());
            } catch (IllegalAccessException e6) {
                r9.onAppLinkFetchFailed(e6.toString());
            }
        }
        j jVar = new j();
        jVar.f2090 = application;
        jVar.f2085 = str;
        jVar.f2092 = appsFlyerTrackingRequestListener;
        m1113(jVar);
    }

    /* renamed from: ᐝ  reason: contains not printable characters */
    public static String m1139(Context context, String str) {
        SharedPreferences sharedPreferences = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0);
        if (sharedPreferences.contains("CACHED_CHANNEL")) {
            return sharedPreferences.getString("CACHED_CHANNEL", null);
        }
        m1112(context, "CACHED_CHANNEL", str);
        return str;
    }

    @Override // com.appsflyer.AppsFlyerLib
    public AppsFlyerLib init(String str, AppsFlyerConversionListener appsFlyerConversionListener) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae aeVar = ae.f1979;
        String[] strArr = new String[2];
        strArr[0] = str;
        strArr[1] = appsFlyerConversionListener == null ? "null" : "conversionDataListener";
        aeVar.m1180("public_api_call", "init", strArr);
        AFLogger.m1083(String.format("Initializing AppsFlyer SDK: (v%s.%s)", BuildConfig.VERSION_NAME, "260"));
        this.f1885 = true;
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.AF_KEY, str);
        AFFacebookDeferredDeeplink.AnonymousClass3.m1074(str);
        f1873 = appsFlyerConversionListener;
        return this;
    }

    /* JADX WARNING: Removed duplicated region for block: B:100:0x0222  */
    /* JADX WARNING: Removed duplicated region for block: B:90:0x020a  */
    /* JADX WARNING: Removed duplicated region for block: B:92:0x0212  */
    /* renamed from: ᐝ  reason: contains not printable characters */
    private void m1140(j jVar) throws IOException {
        HttpURLConnection httpURLConnection;
        Throwable th;
        DataOutputStream dataOutputStream;
        Throwable th2;
        URL url = new URL(jVar.f2095);
        byte[] bArr = jVar.f2097;
        String str = jVar.f2085;
        String str2 = jVar.f2086;
        boolean z = jVar.f2098;
        Context context = jVar.f2090;
        if (context == null) {
            WeakReference<Context> weakReference = jVar.f2088;
            context = weakReference != null ? weakReference.get() : null;
        }
        AppsFlyerTrackingRequestListener appsFlyerTrackingRequestListener = jVar.f2092;
        boolean z2 = z && f1873 != null;
        try {
            HttpURLConnection httpURLConnection2 = (HttpURLConnection) url.openConnection();
            try {
                httpURLConnection2.setRequestMethod("POST");
                httpURLConnection2.setRequestProperty("Content-Length", String.valueOf(bArr.length));
                httpURLConnection2.setRequestProperty(GraphRequest.CONTENT_TYPE_HEADER, "application/octet-stream");
                httpURLConnection2.setConnectTimeout(10000);
                httpURLConnection2.setDoOutput(true);
                try {
                    DataOutputStream dataOutputStream2 = new DataOutputStream(httpURLConnection2.getOutputStream());
                    try {
                        dataOutputStream2.write(bArr);
                        dataOutputStream2.close();
                        int responseCode = httpURLConnection2.getResponseCode();
                        String r11 = m1128(httpURLConnection2);
                        if (ae.f1979 == null) {
                            ae.f1979 = new ae();
                        }
                        httpURLConnection = httpURLConnection2;
                        try {
                            ae.f1979.m1180("server_response", url.toString(), String.valueOf(responseCode), r11);
                            AFLogger.afInfoLog("response code: ".concat(String.valueOf(responseCode)));
                            SharedPreferences sharedPreferences = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0);
                            if (responseCode == 200) {
                                if (z) {
                                    this.f1899 = System.currentTimeMillis();
                                }
                                if (appsFlyerTrackingRequestListener != null) {
                                    appsFlyerTrackingRequestListener.onTrackingRequestSuccess();
                                }
                                if (str2 != null) {
                                    z.m1255();
                                    z.m1257(str2, context);
                                } else {
                                    m1112(context, "sentSuccessfully", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
                                    if (!this.f1903) {
                                        if (System.currentTimeMillis() - this.f1889 >= 15000) {
                                            if (this.f1901 == null) {
                                                this.f1901 = AFExecutor.getInstance().m1071();
                                                m1107(this.f1901, new e(context), 1, TimeUnit.SECONDS);
                                            }
                                        }
                                    }
                                }
                                String string = AppsFlyerProperties.getInstance().getString("afUninstallToken");
                                if (string != null) {
                                    AFLogger.afDebugLog("Uninstall Token exists: ".concat(string));
                                    if (!sharedPreferences.getBoolean("sentRegisterRequestToAF", false)) {
                                        AFLogger.afDebugLog("Resending Uninstall token to AF servers: ".concat(string));
                                        s.d.m1241(context, string);
                                    }
                                }
                                if (this.latestDeepLink != null) {
                                    this.latestDeepLink = null;
                                }
                                this.f1878 = ServerConfigHandler.m1161(r11).optBoolean("send_background", false);
                            } else if (appsFlyerTrackingRequestListener != null) {
                                appsFlyerTrackingRequestListener.onTrackingRequestFailure("Failure: ".concat(String.valueOf(responseCode)));
                            }
                            long j = sharedPreferences.getLong("appsflyerConversionDataCacheExpiration", 0);
                            if (j != 0 && System.currentTimeMillis() - j > 5184000000L) {
                                SharedPreferences.Editor edit = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0).edit();
                                edit.putBoolean("sixtyDayConversionData", true);
                                edit.apply();
                                m1112(context, "attributionId", (String) null);
                                m1098(context, "appsflyerConversionDataCacheExpiration", 0);
                            }
                            if (sharedPreferences.getString("attributionId", null) == null && str != null && z2) {
                                a aVar = new a(this, (Application) context.getApplicationContext(), str, (byte) 0);
                                m1107(aVar.f1920, aVar, 10, TimeUnit.MILLISECONDS);
                            } else if (str == null) {
                                AFLogger.afWarnLog("AppsFlyer dev key is missing.");
                            } else if (z2 && sharedPreferences.getString("attributionId", null) != null && m1108(sharedPreferences, "appsFlyerCount", false) > 1) {
                                try {
                                    Map<String, Object> r0 = m1129(context);
                                    if (r0 != null) {
                                        try {
                                            if (!r0.containsKey("is_first_launch")) {
                                                r0.put("is_first_launch", Boolean.FALSE);
                                            }
                                            StringBuilder sb = new StringBuilder("Calling onInstallConversionDataLoaded with:\n");
                                            sb.append(r0.toString());
                                            AFLogger.afDebugLog(sb.toString());
                                            f1873.onConversionDataSuccess(r0);
                                        } catch (Throwable th3) {
                                            AFLogger.afErrorLog(th3.getLocalizedMessage(), th3);
                                        }
                                    }
                                } catch (w e2) {
                                    AFLogger.afErrorLog(e2.getMessage(), e2);
                                }
                            }
                            httpURLConnection.disconnect();
                        } catch (Throwable th4) {
                            th = th4;
                            if (httpURLConnection != null) {
                                httpURLConnection.disconnect();
                            }
                            throw th;
                        }
                    } catch (Throwable th5) {
                        th2 = th5;
                        dataOutputStream = dataOutputStream2;
                        if (dataOutputStream == null) {
                        }
                        throw th2;
                    }
                } catch (Throwable th6) {
                    th2 = th6;
                    dataOutputStream = null;
                    if (dataOutputStream == null) {
                        dataOutputStream.close();
                    } else if (appsFlyerTrackingRequestListener != null) {
                        appsFlyerTrackingRequestListener.onTrackingRequestFailure("No Connectivity");
                    }
                    throw th2;
                }
            } catch (Throwable th7) {
                th = th7;
                httpURLConnection = httpURLConnection2;
                if (httpURLConnection != null) {
                }
                throw th;
            }
        } catch (Throwable th8) {
            th = th8;
            httpURLConnection = null;
            if (httpURLConnection != null) {
            }
            throw th;
        }
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void trackEvent(Context context, String str, Map<String, Object> map) {
        trackEvent(context, str, map, null);
    }

    /* renamed from: ˏ  reason: contains not printable characters */
    private void m1124(Context context, String str, String str2, Intent intent) {
        j jVar = new j();
        jVar.f2090 = context;
        jVar.f2089 = null;
        jVar.f2085 = str;
        jVar.f2099 = null;
        jVar.f2094 = str2;
        jVar.f2096 = intent;
        jVar.f2100 = null;
        m1106(jVar);
    }

    @Override // com.appsflyer.AppsFlyerLib
    public void setUserEmails(String... strArr) {
        if (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae.f1979.m1180("public_api_call", "setUserEmails", strArr);
        setUserEmails(AppsFlyerProperties.EmailsCryptType.NONE, strArr);
    }

    /* renamed from: ˋ  reason: contains not printable characters */
    public static String m1103(WeakReference<Context> weakReference) {
        String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.CHANNEL);
        if (string == null) {
            string = m1095(weakReference, "CHANNEL");
        }
        if (string == null || !string.equals("")) {
            return string;
        }
        return null;
    }

    /* renamed from: ˏ  reason: contains not printable characters */
    public static void m1122(Context context) {
        int i;
        if ("OPPO".equals(Build.BRAND)) {
            i = 23;
            AFLogger.afRDLog("OPPO device found");
        } else {
            i = 18;
        }
        if (Build.VERSION.SDK_INT < i || AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.DISABLE_KEYSTORE, false)) {
            StringBuilder sb = new StringBuilder("OS SDK is=");
            sb.append(Build.VERSION.SDK_INT);
            sb.append("; no KeyStore usage");
            AFLogger.afRDLog(sb.toString());
            return;
        }
        StringBuilder sb2 = new StringBuilder("OS SDK is=");
        sb2.append(Build.VERSION.SDK_INT);
        sb2.append("; use KeyStore");
        AFLogger.afRDLog(sb2.toString());
        AFKeystoreWrapper aFKeystoreWrapper = new AFKeystoreWrapper(context);
        if (!aFKeystoreWrapper.m1079()) {
            aFKeystoreWrapper.f1863 = af.m1186(new WeakReference(context));
            aFKeystoreWrapper.f1864 = 0;
            aFKeystoreWrapper.m1077(aFKeystoreWrapper.m1076());
        } else {
            String r4 = aFKeystoreWrapper.m1076();
            synchronized (aFKeystoreWrapper.f1866) {
                aFKeystoreWrapper.f1864++;
                AFLogger.afInfoLog("Deleting key with alias: ".concat(String.valueOf(r4)));
                try {
                    synchronized (aFKeystoreWrapper.f1866) {
                        aFKeystoreWrapper.f1865.deleteEntry(r4);
                    }
                } catch (KeyStoreException e2) {
                    StringBuilder sb3 = new StringBuilder("Exception ");
                    sb3.append(e2.getMessage());
                    sb3.append(" occurred");
                    AFLogger.afErrorLog(sb3.toString(), e2);
                }
            }
            aFKeystoreWrapper.m1077(aFKeystoreWrapper.m1076());
        }
        AppsFlyerProperties.getInstance().set("KSAppsFlyerId", aFKeystoreWrapper.m1080());
        AppsFlyerProperties.getInstance().set("KSAppsFlyerRICounter", String.valueOf(aFKeystoreWrapper.m1078()));
    }

    /* renamed from: ˋ  reason: contains not printable characters */
    public static SharedPreferences m1100(Context context) {
        return context.getApplicationContext().getSharedPreferences("appsflyer-data", 0);
    }

    /* renamed from: ˋ  reason: contains not printable characters */
    public static void m1107(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.afErrorLog("scheduleJob failed with RejectedExecutionException Exception", e2);
                return;
            } catch (Throwable th) {
                AFLogger.afErrorLog("scheduleJob failed with Exception", th);
                return;
            }
        }
        AFLogger.afWarnLog("scheduler is null, shut downed or terminated");
    }

    /* renamed from: ˎ  reason: contains not printable characters */
    private boolean m1116() {
        if (this.f1887 > 0) {
            long currentTimeMillis = System.currentTimeMillis() - this.f1887;
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS Z", Locale.US);
            long j = this.f1887;
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
            String format = simpleDateFormat.format(new Date(j));
            long j2 = this.f1899;
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
            String format2 = simpleDateFormat.format(new Date(j2));
            if (currentTimeMillis < this.f1877 && !isTrackingStopped()) {
                AFLogger.afInfoLog(String.format(Locale.US, "Last Launch attempt: %s;\nLast successful Launch event: %s;\nThis launch is blocked: %s ms < %s ms", format, format2, Long.valueOf(currentTimeMillis), Long.valueOf(this.f1877)));
                return true;
            } else if (!isTrackingStopped()) {
                AFLogger.afInfoLog(String.format(Locale.US, "Last Launch attempt: %s;\nLast successful Launch event: %s;\nSending launch (+%s ms)", format, format2, Long.valueOf(currentTimeMillis)));
            }
        } else if (!isTrackingStopped()) {
            AFLogger.afInfoLog("Sending first launch for this session!");
        }
        return false;
    }

    /* renamed from: ॱ  reason: contains not printable characters */
    public static Map<String, Object> m1132(String str) {
        HashMap hashMap = new HashMap();
        try {
            JSONObject jSONObject = new JSONObject(str);
            Iterator<String> keys = jSONObject.keys();
            while (keys.hasNext()) {
                String next = keys.next();
                if (!f1875.contains(next)) {
                    hashMap.put(next, jSONObject.isNull(next) ? null : jSONObject.get(next));
                }
            }
            return hashMap;
        } catch (JSONException e2) {
            AFLogger.afErrorLog(e2.getMessage(), e2);
            return null;
        }
    }

    /* renamed from: ॱ  reason: contains not printable characters */
    public static boolean m1137(SharedPreferences sharedPreferences) {
        return Boolean.parseBoolean(sharedPreferences.getString("sentSuccessfully", null));
    }

    /* JADX WARNING: Code restructure failed: missing block: B:24:0x0057, code lost:
        if (r3 != null) goto L_0x002c;
     */
    /* JADX WARNING: Removed duplicated region for block: B:23:0x0054  */
    /* renamed from: ॱ  reason: contains not printable characters */
    public static String m1128(HttpURLConnection httpURLConnection) {
        InputStreamReader inputStreamReader;
        Throwable th;
        StringBuilder sb = new StringBuilder();
        BufferedReader bufferedReader = null;
        try {
            InputStream errorStream = httpURLConnection.getErrorStream();
            if (errorStream == null) {
                errorStream = httpURLConnection.getInputStream();
            }
            inputStreamReader = new InputStreamReader(errorStream);
            try {
                BufferedReader bufferedReader2 = new BufferedReader(inputStreamReader);
                while (true) {
                    try {
                        String readLine = bufferedReader2.readLine();
                        if (readLine != null) {
                            sb.append(readLine);
                            sb.append('\n');
                        } else {
                            try {
                                break;
                            } catch (Throwable unused) {
                            }
                        }
                    } catch (Throwable th2) {
                        th = th2;
                        bufferedReader = bufferedReader2;
                        try {
                            StringBuilder sb2 = new StringBuilder("Could not read connection response from: ");
                            sb2.append(httpURLConnection.getURL().toString());
                            AFLogger.afErrorLog(sb2.toString(), th);
                            if (bufferedReader != null) {
                                bufferedReader.close();
                            }
                        } catch (Throwable unused2) {
                            throw th;
                        }
                    }
                }
                bufferedReader2.close();
            } catch (Throwable th3) {
                th = th3;
                StringBuilder sb22 = new StringBuilder("Could not read connection response from: ");
                sb22.append(httpURLConnection.getURL().toString());
                AFLogger.afErrorLog(sb22.toString(), th);
                if (bufferedReader != null) {
                }
            }
        } catch (Throwable th4) {
            th = th4;
            inputStreamReader = null;
            StringBuilder sb222 = new StringBuilder("Could not read connection response from: ");
            sb222.append(httpURLConnection.getURL().toString());
            AFLogger.afErrorLog(sb222.toString(), th);
            if (bufferedReader != null) {
            }
        }
        inputStreamReader.close();
        String obj = sb.toString();
        try {
            new JSONObject(obj);
            return obj;
        } catch (JSONException unused3) {
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put("string_response", obj);
                return jSONObject.toString();
            } catch (JSONException unused4) {
                return new JSONObject().toString();
            }
        }
    }

    /* renamed from: ˎ  reason: contains not printable characters */
    public static void m1114(Map<String, String> map) {
        if (f1873 != null) {
            try {
                StringBuilder sb = new StringBuilder("Calling onAppOpenAttribution with:\n");
                sb.append(map.toString());
                AFLogger.afDebugLog(sb.toString());
                f1873.onAppOpenAttribution(map);
            } catch (Throwable th) {
                AFLogger.afErrorLog(th.getLocalizedMessage(), th);
            }
        }
    }

    /* renamed from: ˊ  reason: contains not printable characters */
    public static void m1099(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 (keys2.hasNext() && str == null) {
                String next = keys2.next();
                try {
                    JSONArray jSONArray2 = new JSONArray((String) jSONObject.get(next));
                    String str2 = str;
                    int i2 = 0;
                    while (i2 < jSONArray2.length()) {
                        try {
                            if (jSONArray2.getLong(i2) != ((Long) arrayList.get(0)).longValue() && jSONArray2.getLong(i2) != ((Long) arrayList.get(1)).longValue() && jSONArray2.getLong(i2) != ((Long) arrayList.get(arrayList.size() - 1)).longValue()) {
                                i2++;
                                str2 = next;
                            }
                        } catch (JSONException unused2) {
                        }
                    }
                    str = str2;
                } catch (JSONException unused3) {
                }
            }
        }
        if (str != null) {
            jSONObject.remove(str);
        }
    }

    /* renamed from: ˎ  reason: contains not printable characters */
    public static int m1108(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 (ae.f1979 == null) {
            ae.f1979 = new ae();
        }
        ae aeVar = ae.f1979;
        if (aeVar.f1994) {
            if (aeVar == null) {
                ae.f1979 = new ae();
            }
            ae.f1979.m1182(String.valueOf(i));
        }
        return i;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    /* JADX WARNING: Removed duplicated region for block: B:105:0x01ac  */
    /* JADX WARNING: Removed duplicated region for block: B:109:0x01b7  */
    /* JADX WARNING: Removed duplicated region for block: B:113:0x01cf  */
    /* renamed from: ˏ  reason: contains not printable characters */
    private void m1126(j jVar) {
        String str;
        int i;
        ScheduledExecutorService scheduledExecutorService;
        Context context = jVar.f2090;
        if (context == null) {
            WeakReference<Context> weakReference = jVar.f2088;
            context = weakReference != null ? weakReference.get() : null;
        }
        String str2 = jVar.f2089;
        if (context == null) {
            AFLogger.afDebugLog("sendTrackingWithEvent - got null context. skipping event/launch.");
            return;
        }
        boolean z = false;
        SharedPreferences sharedPreferences = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0);
        AppsFlyerProperties.getInstance().saveProperties(sharedPreferences);
        if (!isTrackingStopped()) {
            StringBuilder sb = new StringBuilder("sendTrackingWithEvent from activity: ");
            sb.append(context.getClass().getName());
            AFLogger.afInfoLog(sb.toString());
        }
        boolean z2 = str2 == null;
        boolean z3 = jVar.f2101;
        boolean z4 = jVar.f2087 != null;
        if (z4 || z3) {
            int r8 = m1108(sharedPreferences, "appsFlyerCount", false);
            if (!((!sharedPreferences.getBoolean(AppsFlyerProperties.NEW_REFERRER_SENT, false) && r8 == 1) || (r8 == 1 && jVar.f2087 == null))) {
                return;
            }
        }
        jVar.f2098 = z2;
        Map<String, Object> r4 = m1145(jVar);
        String str3 = (String) r4.get("appsflyerKey");
        if (str3 == null || str3.length() == 0) {
            AFLogger.afDebugLog("Not sending data yet, waiting for dev key");
            return;
        }
        if (!isTrackingStopped()) {
            AFLogger.afInfoLog("AppsFlyerLib.sendTrackingWithEvent");
        }
        int r2 = m1108(sharedPreferences, "appsFlyerCount", false);
        if (z4 || z3) {
            str = ServerConfigHandler.getUrl("https://%sattr.%s/api/v4.11/androidevent?app_id=");
        } else if (!z2) {
            str = ServerConfigHandler.getUrl("https://%sinapps.%s/api/v4.11/androidevent?app_id=");
        } else if (r2 < 2) {
            str = ServerConfigHandler.getUrl(f1870);
        } else {
            str = ServerConfigHandler.getUrl(f1874);
        }
        StringBuilder r5 = C1293.m3416(str);
        r5.append(context.getPackageName());
        String obj = r5.toString();
        StringBuilder sb2 = new StringBuilder();
        sb2.append(obj);
        sb2.append("&buildnumber=5.0.0");
        String obj2 = sb2.toString();
        String r6 = m1103(new WeakReference(context));
        if (r6 != null) {
            StringBuilder sb3 = new StringBuilder();
            sb3.append(obj2);
            sb3.append("&channel=");
            sb3.append(r6);
            obj2 = sb3.toString();
        }
        if (!(AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID_FORCE_BY_USER, false) || AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_IMEI_FORCE_BY_USER, false)) && r4.get(ServerParameters.ADVERTISING_ID_PARAM) != null) {
            try {
                if (TextUtils.isEmpty(this.f1895) && r4.remove("android_id") != null) {
                    AFLogger.afInfoLog("validateGaidAndIMEI :: removing: android_id");
                }
                if (TextUtils.isEmpty(this.f1896) && r4.remove("imei") != null) {
                    AFLogger.afInfoLog("validateGaidAndIMEI :: removing: imei");
                }
            } catch (Exception e2) {
                AFLogger.afErrorLog("failed to remove IMEI or AndroidID key from params; ", e2);
            }
        }
        jVar.f2095 = obj2;
        jVar.f2093 = r4;
        j r12 = jVar.m1232();
        r12.f2091 = r2;
        b bVar = new b(this, r12, (byte) 0);
        int i2 = 500;
        if (z2 && m1117(context)) {
            Map<String, String> map = this.f1902;
            if (!(map != null && map.size() > 0)) {
                AFLogger.afDebugLog("Failed to get new referrer, wait ...");
                i = 500;
                if (z2 && this.f1892) {
                    Map<String, Object> map2 = this.f1891;
                    if (map2 != null && !map2.isEmpty()) {
                        z = true;
                    }
                    if (!z) {
                        AFLogger.afDebugLog("fetching Facebook deferred AppLink data, wait ...");
                        if (g.f2076) {
                            AFLogger.afRDLog("ESP deeplink: execute launch on SerialExecutor");
                            AFExecutor instance = AFExecutor.getInstance();
                            if (instance.f1848 == null) {
                                instance.f1848 = Executors.newSingleThreadScheduledExecutor(instance.f1849);
                            }
                            scheduledExecutorService = instance.f1848;
                        } else {
                            scheduledExecutorService = AFExecutor.getInstance().m1071();
                        }
                        m1107(scheduledExecutorService, bVar, (long) i2, TimeUnit.MILLISECONDS);
                    }
                }
                i2 = i;
                if (g.f2076) {
                }
                m1107(scheduledExecutorService, bVar, (long) i2, TimeUnit.MILLISECONDS);
            }
        }
        i = 0;
        Map<String, Object> map22 = this.f1891;
        z = true;
        if (!z) {
        }
        i2 = i;
        if (g.f2076) {
        }
        m1107(scheduledExecutorService, bVar, (long) i2, TimeUnit.MILLISECONDS);
    }

    /* renamed from: ॱ  reason: contains not printable characters */
    public static Map<String, Object> m1129(Context context) throws w {
        String string = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0).getString("attributionId", null);
        if (string != null && string.length() > 0) {
            return m1132(string);
        }
        throw new w();
    }

    /* renamed from: ˎ  reason: contains not printable characters */
    private void m1113(final j jVar) {
        Context context = jVar.f2090;
        if (context == null) {
            WeakReference<Context> weakReference = jVar.f2088;
            context = weakReference != null ? weakReference.get() : null;
        }
        Application application = (Application) context;
        AppsFlyerProperties.getInstance().loadProperties(application.getApplicationContext());
        if (this.f1881 == null) {
            if (ac.f1970 == null) {
                ac.f1970 = new ac();
            }
            this.f1881 = new ac.b() {
                /* class com.appsflyer.AppsFlyerLibCore.AnonymousClass2 */

                @Override // com.appsflyer.internal.ac.b
                /* renamed from: ॱ  reason: contains not printable characters */
                public final void m1146(Activity activity) {
                    if (2 > AppsFlyerLibCore.m1108(AppsFlyerLibCore.m1100(activity), "appsFlyerCount", false)) {
                        t r0 = t.m1243(activity);
                        r0.f2131.post(r0.f2134);
                        r0.f2131.post(r0.f2125);
                    }
                    j jVar = jVar;
                    jVar.f2090 = activity;
                    AFLogger.afInfoLog("onBecameForeground");
                    AppsFlyerLibCore.getInstance().f1898 = System.currentTimeMillis();
                    AppsFlyerLibCore.getInstance().m1144(jVar);
                    AFLogger.resetDeltaTime();
                }

                @Override // com.appsflyer.internal.ac.b
                /* renamed from: ॱ  reason: contains not printable characters */
                public final void m1147(WeakReference<Context> weakReference) {
                    g.AnonymousClass1.m1230(weakReference.get());
                    t r2 = t.m1243(weakReference.get());
                    r2.f2131.post(r2.f2134);
                }
            };
            ac acVar = ac.f1970;
            if (acVar != null) {
                acVar.f1973 = this.f1881;
                application.registerActivityLifecycleCallbacks(acVar);
                return;
            }
            throw new IllegalStateException("Foreground is not initialised - invoke at least once with parameter init/get");
        }
    }

    /* renamed from: ˊ  reason: contains not printable characters */
    public static String m1093(String str) {
        try {
            return (String) Class.forName("android.os.SystemProperties").getMethod("get", String.class).invoke(null, str);
        } catch (Throwable th) {
            AFLogger.afErrorLog(th.getMessage(), th);
            return null;
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:133:0x0342  */
    /* JADX WARNING: Removed duplicated region for block: B:137:0x0355 A[Catch:{ Exception -> 0x035b }] */
    /* JADX WARNING: Removed duplicated region for block: B:154:0x03a6  */
    /* JADX WARNING: Removed duplicated region for block: B:155:0x03b0  */
    /* JADX WARNING: Removed duplicated region for block: B:161:0x03d0  */
    /* JADX WARNING: Removed duplicated region for block: B:164:0x03ee  */
    /* JADX WARNING: Removed duplicated region for block: B:208:0x0498  */
    /* JADX WARNING: Removed duplicated region for block: B:211:0x04a7  */
    /* JADX WARNING: Removed duplicated region for block: B:214:0x04b4  */
    /* JADX WARNING: Removed duplicated region for block: B:219:0x04cc  */
    /* JADX WARNING: Removed duplicated region for block: B:257:0x05a7  */
    /* JADX WARNING: Removed duplicated region for block: B:260:0x05bb  */
    /* JADX WARNING: Removed duplicated region for block: B:261:0x05c4  */
    /* JADX WARNING: Removed duplicated region for block: B:283:0x0627  */
    /* JADX WARNING: Removed duplicated region for block: B:284:0x0631  */
    /* JADX WARNING: Removed duplicated region for block: B:289:0x063c  */
    /* JADX WARNING: Removed duplicated region for block: B:290:0x0646  */
    /* JADX WARNING: Removed duplicated region for block: B:299:0x065d  */
    /* JADX WARNING: Removed duplicated region for block: B:300:0x0668  */
    /* JADX WARNING: Removed duplicated region for block: B:303:0x0681  */
    /* JADX WARNING: Removed duplicated region for block: B:323:0x06c6  */
    /* JADX WARNING: Removed duplicated region for block: B:326:0x06cc  */
    /* JADX WARNING: Removed duplicated region for block: B:327:0x06d7  */
    /* JADX WARNING: Removed duplicated region for block: B:330:0x06f2  */
    /* JADX WARNING: Removed duplicated region for block: B:331:0x06f5 A[ADDED_TO_REGION] */
    /* JADX WARNING: Removed duplicated region for block: B:339:0x0718  */
    /* JADX WARNING: Removed duplicated region for block: B:343:0x072d A[Catch:{ Exception -> 0x0733 }] */
    /* JADX WARNING: Removed duplicated region for block: B:372:0x07e7 A[Catch:{ all -> 0x089a }] */
    /* JADX WARNING: Removed duplicated region for block: B:381:0x085a A[Catch:{ all -> 0x0894 }] */
    /* JADX WARNING: Removed duplicated region for block: B:398:0x08ca  */
    /* JADX WARNING: Removed duplicated region for block: B:400:0x08d3  */
    /* JADX WARNING: Removed duplicated region for block: B:406:0x0903  */
    /* JADX WARNING: Removed duplicated region for block: B:409:0x092e A[ADDED_TO_REGION] */
    /* JADX WARNING: Removed duplicated region for block: B:415:0x093d  */
    /* JADX WARNING: Removed duplicated region for block: B:418:0x0968  */
    /* JADX WARNING: Removed duplicated region for block: B:424:0x098e  */
    /* JADX WARNING: Removed duplicated region for block: B:427:0x09c5  */
    /* JADX WARNING: Removed duplicated region for block: B:428:0x09c7  */
    /* JADX WARNING: Removed duplicated region for block: B:435:0x09ea  */
    /* JADX WARNING: Removed duplicated region for block: B:439:0x0a06  */
    /* JADX WARNING: Removed duplicated region for block: B:442:0x0a41  */
    /* JADX WARNING: Removed duplicated region for block: B:460:0x0ba4  */
    /* JADX WARNING: Removed duplicated region for block: B:463:0x0bbe  */
    /* renamed from: ॱ  reason: contains not printable characters */
    public final Map<String, Object> m1145(j jVar) {
        AppsFlyerProperties instance;
        String str;
        String str2;
        SharedPreferences sharedPreferences;
        String str3;
        String str4;
        Object obj;
        String str5;
        String string;
        String string2;
        String string3;
        String string4;
        String r3;
        SharedPreferences sharedPreferences2;
        String str6;
        String str7;
        String string5;
        String r32;
        Object obj2;
        SimpleDateFormat simpleDateFormat;
        String str8;
        AppsFlyerProperties appsFlyerProperties;
        String referrer;
        u r2;
        boolean z;
        Throwable th;
        PackageInfo packageInfo;
        String string6;
        String r33;
        boolean z2;
        String str9;
        String string7;
        String str10;
        Exception e2;
        String str11;
        String string8;
        String r34;
        String installerPackageName;
        Exception exc;
        Exception e3;
        Exception e4;
        JSONObject jSONObject;
        UiModeManager uiModeManager;
        Context context = jVar.f2090;
        if (context == null) {
            WeakReference<Context> weakReference = jVar.f2088;
            context = weakReference != null ? weakReference.get() : null;
        }
        String str12 = jVar.f2085;
        String str13 = jVar.f2089;
        Map map = jVar.f2099;
        if (map == null) {
            map = new HashMap();
        }
        String jSONObject2 = new JSONObject(map).toString();
        String str14 = jVar.f2094;
        SharedPreferences sharedPreferences3 = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0);
        boolean z3 = jVar.f2098;
        Intent intent = jVar.f2096;
        String str15 = jVar.f2100;
        HashMap hashMap = new HashMap();
        v.m1247(context, hashMap);
        long time = new Date().getTime();
        hashMap.put("af_timestamp", Long.toString(time));
        String r22 = d.m1215(context, time);
        if (r22 != null) {
            hashMap.put("cksm_v1", r22);
        }
        try {
            if (!isTrackingStopped()) {
                StringBuilder sb = new StringBuilder("******* sendTrackingWithEvent: ");
                sb.append(z3 ? "Launch" : str13);
                AFLogger.afInfoLog(sb.toString());
            } else {
                AFLogger.afInfoLog("SDK tracking has been stopped");
            }
            z.m1255();
            try {
                if (!z.m1256(context).exists()) {
                    z.m1256(context).mkdir();
                }
            } catch (Exception unused) {
                Log.i(LOG_TAG, "Could not create cache directory");
            }
            try {
                List asList = Arrays.asList(context.getPackageManager().getPackageInfo(context.getPackageName(), RecyclerView.AbstractC0269.FLAG_APPEARED_IN_PRE_LAYOUT).requestedPermissions);
                if (!asList.contains("android.permission.INTERNET")) {
                    AFLogger.afWarnLog("Permission android.permission.INTERNET is missing in the AndroidManifest.xml");
                }
                if (!asList.contains("android.permission.ACCESS_NETWORK_STATE")) {
                    AFLogger.afWarnLog("Permission android.permission.ACCESS_NETWORK_STATE is missing in the AndroidManifest.xml");
                }
                if (!asList.contains("android.permission.ACCESS_WIFI_STATE")) {
                    AFLogger.afWarnLog("Permission android.permission.ACCESS_WIFI_STATE is missing in the AndroidManifest.xml");
                }
            } catch (Exception e5) {
                AFLogger.afErrorLog("Exception while validation permissions. ", e5);
            }
            hashMap.put("af_events_api", AppEventsConstants.EVENT_PARAM_VALUE_YES);
            hashMap.put("brand", Build.BRAND);
            hashMap.put(DeviceRequestsHelper.DEVICE_INFO_DEVICE, Build.DEVICE);
            hashMap.put("product", Build.PRODUCT);
            hashMap.put("sdk", Integer.toString(Build.VERSION.SDK_INT));
            hashMap.put(DeviceRequestsHelper.DEVICE_INFO_MODEL, Build.MODEL);
            hashMap.put("deviceType", Build.TYPE);
            WindowManager windowManager = (WindowManager) context.getSystemService("window");
            if (windowManager != null) {
                String str16 = "";
                int rotation = windowManager.getDefaultDisplay().getRotation();
                if (rotation == 0) {
                    str16 = "p";
                } else if (rotation == 1) {
                    str16 = "l";
                } else if (rotation == 2) {
                    str16 = "pr";
                } else if (rotation == 3) {
                    str16 = "lr";
                }
                hashMap.put("sc_o", str16);
            }
            instance = AppsFlyerProperties.getInstance();
            if (z3) {
                if (!context.getApplicationContext().getSharedPreferences("appsflyer-data", 0).contains("appsFlyerCount")) {
                    if (!instance.isOtherSdkStringDisabled()) {
                        hashMap.put("batteryLevel", String.valueOf(m1138(context)));
                    }
                    m1122(context);
                    if (Build.VERSION.SDK_INT >= 23) {
                        uiModeManager = (UiModeManager) context.getSystemService(UiModeManager.class);
                    } else {
                        uiModeManager = (UiModeManager) context.getSystemService("uimode");
                    }
                    if (uiModeManager != null && uiModeManager.getCurrentModeType() == 4) {
                        hashMap.put("tv", Boolean.TRUE);
                    }
                    if (AFInstantApps.isInstantApp(context)) {
                        hashMap.put("inst_app", Boolean.TRUE);
                    }
                }
                obj = "af_timestamp";
                str4 = str12;
                long j = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0).getLong("AppsFlyerTimePassedSincePrevLaunch", 0);
                long currentTimeMillis = System.currentTimeMillis();
                str3 = "preInstallName";
                m1098(context, "AppsFlyerTimePassedSincePrevLaunch", currentTimeMillis);
                hashMap.put("timepassedsincelastlaunch", Long.toString(j > 0 ? (currentTimeMillis - j) / 1000 : -1));
                String string9 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ONELINK_ID);
                if (string9 != null) {
                    hashMap.put("onelink_id", string9);
                    hashMap.put("ol_ver", AppsFlyerProperties.getInstance().getString("onelinkVersion"));
                }
                long j2 = sharedPreferences3.getLong("appsflyerGetConversionDataTiming", 0);
                if (j2 > 0) {
                    hashMap.put("gcd_timing", Long.toString(j2));
                    SharedPreferences.Editor edit = sharedPreferences3.edit();
                    edit.putLong("appsflyerGetConversionDataTiming", 0);
                    edit.apply();
                }
                if (this.f1893 != null) {
                    hashMap.put(PlaceFields.PHONE, this.f1893);
                }
                if (!TextUtils.isEmpty(str14)) {
                    hashMap.put(com.adjust.sdk.Constants.REFERRER, str14);
                }
                String string10 = sharedPreferences3.getString("extraReferrers", null);
                if (string10 != null) {
                    hashMap.put("extraReferrers", string10);
                }
                String referrer2 = instance.getReferrer(context);
                if (!TextUtils.isEmpty(referrer2) && hashMap.get(com.adjust.sdk.Constants.REFERRER) == null) {
                    hashMap.put(com.adjust.sdk.Constants.REFERRER, referrer2);
                }
                sharedPreferences = sharedPreferences3;
                str2 = "appsflyer-data";
                str = "appsFlyerCount";
                str5 = str13;
            } else {
                str3 = "preInstallName";
                str4 = str12;
                obj = "af_timestamp";
                SharedPreferences sharedPreferences4 = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0);
                SharedPreferences.Editor edit2 = sharedPreferences4.edit();
                try {
                    String string11 = sharedPreferences4.getString("prev_event_name", null);
                    if (string11 != null) {
                        try {
                            jSONObject = new JSONObject();
                            sharedPreferences = sharedPreferences3;
                        } catch (Exception e6) {
                            e4 = e6;
                            sharedPreferences = sharedPreferences3;
                            str2 = "appsflyer-data";
                            str = "appsFlyerCount";
                            exc = e4;
                            str5 = str13;
                            AFLogger.afErrorLog("Error while processing previous event.", exc);
                            string = AppsFlyerProperties.getInstance().getString("KSAppsFlyerId");
                            string2 = AppsFlyerProperties.getInstance().getString("KSAppsFlyerRICounter");
                            hashMap.put("reinstallCounter", string2);
                            hashMap.put("originalAppsflyerId", string);
                            string3 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ADDITIONAL_CUSTOM_DATA);
                            if (string3 != null) {
                            }
                            installerPackageName = context.getPackageManager().getInstallerPackageName(context.getPackageName());
                            if (installerPackageName != null) {
                            }
                            string4 = instance.getString(AppsFlyerProperties.EXTENSION);
                            hashMap.put(AppsFlyerProperties.EXTENSION, string4);
                            r3 = m1103(new WeakReference(context));
                            String r7 = m1139(context, r3);
                            hashMap.put("af_latestchannel", r3);
                            sharedPreferences2 = context.getApplicationContext().getSharedPreferences(str2, 0);
                            if (!sharedPreferences2.contains("INSTALL_STORE")) {
                            }
                            if (str7 != null) {
                            }
                            SharedPreferences sharedPreferences5 = context.getApplicationContext().getSharedPreferences(str2, 0);
                            string5 = AppsFlyerProperties.getInstance().getString(str3);
                            if (string5 == null) {
                            }
                            if (string5 != null) {
                            }
                            r32 = m1088(context);
                            if (r32 != null) {
                            }
                            if (str4 != null) {
                            }
                            string8 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                            if (string8 != null) {
                            }
                            AFLogger.afInfoLog("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                            AFLogger.afInfoLog("AppsFlyer will not track this event.");
                            return null;
                        }
                        try {
                            StringBuilder sb2 = new StringBuilder();
                            str2 = "appsflyer-data";
                            str = "appsFlyerCount";
                            try {
                                sb2.append(sharedPreferences4.getLong("prev_event_timestamp", -1));
                                jSONObject.put("prev_event_timestamp", sb2.toString());
                                jSONObject.put("prev_event_value", sharedPreferences4.getString("prev_event_value", null));
                                jSONObject.put("prev_event_name", string11);
                                hashMap.put("prev_event", jSONObject.toString());
                            } catch (Exception e7) {
                                e4 = e7;
                            }
                        } catch (Exception e8) {
                            e4 = e8;
                            str2 = "appsflyer-data";
                            str = "appsFlyerCount";
                            exc = e4;
                            str5 = str13;
                            AFLogger.afErrorLog("Error while processing previous event.", exc);
                            string = AppsFlyerProperties.getInstance().getString("KSAppsFlyerId");
                            string2 = AppsFlyerProperties.getInstance().getString("KSAppsFlyerRICounter");
                            hashMap.put("reinstallCounter", string2);
                            hashMap.put("originalAppsflyerId", string);
                            string3 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ADDITIONAL_CUSTOM_DATA);
                            if (string3 != null) {
                            }
                            installerPackageName = context.getPackageManager().getInstallerPackageName(context.getPackageName());
                            if (installerPackageName != null) {
                            }
                            string4 = instance.getString(AppsFlyerProperties.EXTENSION);
                            hashMap.put(AppsFlyerProperties.EXTENSION, string4);
                            r3 = m1103(new WeakReference(context));
                            String r72 = m1139(context, r3);
                            hashMap.put("af_latestchannel", r3);
                            sharedPreferences2 = context.getApplicationContext().getSharedPreferences(str2, 0);
                            if (!sharedPreferences2.contains("INSTALL_STORE")) {
                            }
                            if (str7 != null) {
                            }
                            SharedPreferences sharedPreferences52 = context.getApplicationContext().getSharedPreferences(str2, 0);
                            string5 = AppsFlyerProperties.getInstance().getString(str3);
                            if (string5 == null) {
                            }
                            if (string5 != null) {
                            }
                            r32 = m1088(context);
                            if (r32 != null) {
                            }
                            if (str4 != null) {
                            }
                            string8 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                            if (string8 != null) {
                            }
                            AFLogger.afInfoLog("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                            AFLogger.afInfoLog("AppsFlyer will not track this event.");
                            return null;
                        }
                    } else {
                        sharedPreferences = sharedPreferences3;
                        str2 = "appsflyer-data";
                        str = "appsFlyerCount";
                    }
                    str5 = str13;
                    try {
                        edit2.putString("prev_event_name", str5);
                        edit2.putString("prev_event_value", jSONObject2);
                        edit2.putLong("prev_event_timestamp", System.currentTimeMillis());
                        edit2.apply();
                    } catch (Exception e9) {
                        e3 = e9;
                    }
                } catch (Exception e10) {
                    e3 = e10;
                    sharedPreferences = sharedPreferences3;
                    str2 = "appsflyer-data";
                    str = "appsFlyerCount";
                    str5 = str13;
                    exc = e3;
                    AFLogger.afErrorLog("Error while processing previous event.", exc);
                    string = AppsFlyerProperties.getInstance().getString("KSAppsFlyerId");
                    string2 = AppsFlyerProperties.getInstance().getString("KSAppsFlyerRICounter");
                    hashMap.put("reinstallCounter", string2);
                    hashMap.put("originalAppsflyerId", string);
                    string3 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ADDITIONAL_CUSTOM_DATA);
                    if (string3 != null) {
                    }
                    installerPackageName = context.getPackageManager().getInstallerPackageName(context.getPackageName());
                    if (installerPackageName != null) {
                    }
                    string4 = instance.getString(AppsFlyerProperties.EXTENSION);
                    hashMap.put(AppsFlyerProperties.EXTENSION, string4);
                    r3 = m1103(new WeakReference(context));
                    String r722 = m1139(context, r3);
                    hashMap.put("af_latestchannel", r3);
                    sharedPreferences2 = context.getApplicationContext().getSharedPreferences(str2, 0);
                    if (!sharedPreferences2.contains("INSTALL_STORE")) {
                    }
                    if (str7 != null) {
                    }
                    SharedPreferences sharedPreferences522 = context.getApplicationContext().getSharedPreferences(str2, 0);
                    string5 = AppsFlyerProperties.getInstance().getString(str3);
                    if (string5 == null) {
                    }
                    if (string5 != null) {
                    }
                    r32 = m1088(context);
                    if (r32 != null) {
                    }
                    if (str4 != null) {
                    }
                    string8 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                    if (string8 != null) {
                    }
                    AFLogger.afInfoLog("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                    AFLogger.afInfoLog("AppsFlyer will not track this event.");
                    return null;
                }
            }
            string = AppsFlyerProperties.getInstance().getString("KSAppsFlyerId");
            string2 = AppsFlyerProperties.getInstance().getString("KSAppsFlyerRICounter");
            if (!(string == null || string2 == null || Integer.valueOf(string2).intValue() <= 0)) {
                hashMap.put("reinstallCounter", string2);
                hashMap.put("originalAppsflyerId", string);
            }
            string3 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ADDITIONAL_CUSTOM_DATA);
            if (string3 != null) {
                hashMap.put("customData", string3);
            }
            try {
                installerPackageName = context.getPackageManager().getInstallerPackageName(context.getPackageName());
                if (installerPackageName != null) {
                    hashMap.put("installer_package", installerPackageName);
                }
            } catch (Exception e11) {
                AFLogger.afErrorLog("Exception while getting the app's installer package. ", e11);
            }
            string4 = instance.getString(AppsFlyerProperties.EXTENSION);
            if (string4 != null && string4.length() > 0) {
                hashMap.put(AppsFlyerProperties.EXTENSION, string4);
            }
            r3 = m1103(new WeakReference(context));
            String r7222 = m1139(context, r3);
            if ((r7222 != null && !r7222.equals(r3)) || (r7222 == null && r3 != null)) {
                hashMap.put("af_latestchannel", r3);
            }
            sharedPreferences2 = context.getApplicationContext().getSharedPreferences(str2, 0);
            if (!sharedPreferences2.contains("INSTALL_STORE")) {
                str7 = sharedPreferences2.getString("INSTALL_STORE", null);
                str6 = str;
            } else {
                str6 = str;
                str7 = context.getApplicationContext().getSharedPreferences(str2, 0).contains(str6) ^ true ? m1088(context) : null;
                m1112(context, "INSTALL_STORE", str7);
            }
            if (str7 != null) {
                hashMap.put("af_installstore", str7.toLowerCase());
            }
            SharedPreferences sharedPreferences5222 = context.getApplicationContext().getSharedPreferences(str2, 0);
            string5 = AppsFlyerProperties.getInstance().getString(str3);
            if (string5 == null) {
                if (sharedPreferences5222.contains(str3)) {
                    string5 = sharedPreferences5222.getString(str3, null);
                } else {
                    if (!context.getApplicationContext().getSharedPreferences(str2, 0).contains(str6)) {
                        File r35 = m1087(m1093(PRE_INSTALL_SYSTEM_RO_PROP));
                        if (r35 == null || !r35.exists()) {
                            r35 = m1087(m1094(AF_PRE_INSTALL_PATH, context.getPackageManager(), context.getPackageName()));
                        }
                        if (r35 == null || !r35.exists()) {
                            r35 = m1087(PRE_INSTALL_SYSTEM_DEFAULT);
                        }
                        if (r35 == null || !r35.exists()) {
                            r35 = m1087(PRE_INSTALL_SYSTEM_DEFAULT_ETC);
                        }
                        string5 = ((r35 == null || !r35.exists()) || (r34 = m1092(r35, context.getPackageName())) == null) ? null : r34;
                        if (string5 == null) {
                            string5 = m1095(new WeakReference(context), "AF_PRE_INSTALL_NAME");
                        }
                    }
                    if (string5 != null) {
                        m1112(context, str3, string5);
                    }
                }
                if (string5 != null) {
                    AppsFlyerProperties.getInstance().set(str3, string5);
                }
            }
            if (string5 != null) {
                hashMap.put("af_preinstall_name", string5.toLowerCase());
            }
            r32 = m1088(context);
            if (r32 != null) {
                hashMap.put("af_currentstore", r32.toLowerCase());
            }
            if (str4 != null || str4.length() <= 0) {
                string8 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                if (string8 != null || string8.length() <= 0) {
                    AFLogger.afInfoLog("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                    AFLogger.afInfoLog("AppsFlyer will not track this event.");
                    return null;
                }
                hashMap.put("appsflyerKey", string8);
            } else {
                hashMap.put("appsflyerKey", str4);
            }
            String string12 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_USER_ID);
            if (string12 != null) {
                hashMap.put("appUserId", string12);
            }
            String string13 = instance.getString(AppsFlyerProperties.USER_EMAILS);
            if (string13 != null) {
                hashMap.put("user_emails", string13);
            } else {
                String string14 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.USER_EMAIL);
                if (string14 != null) {
                    hashMap.put("sha1_el", ai.m1197(string14));
                }
            }
            if (str5 != null) {
                hashMap.put("eventName", str5);
                if (jSONObject2 != null) {
                    hashMap.put("eventValue", jSONObject2);
                }
            }
            if (AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_ID) != null) {
                hashMap.put(AppsFlyerProperties.APP_ID, AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_ID));
            }
            String string15 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.CURRENCY_CODE);
            if (string15 != null) {
                if (string15.length() != 3) {
                    StringBuilder sb3 = new StringBuilder("WARNING: currency code should be 3 characters!!! '");
                    sb3.append(string15);
                    sb3.append("' is not a legal value.");
                    AFLogger.afWarnLog(sb3.toString());
                }
                hashMap.put("currency", string15);
            }
            String string16 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.IS_UPDATE);
            if (string16 != null) {
                hashMap.put("isUpdate", string16);
            }
            hashMap.put("af_preinstalled", Boolean.toString(isPreInstalledApp(context)));
            if (instance.getBoolean(AppsFlyerProperties.COLLECT_FACEBOOK_ATTR_ID, true)) {
                try {
                    context.getPackageManager().getApplicationInfo("com.facebook.katana", 0);
                    str11 = getAttributionId(context);
                } catch (PackageManager.NameNotFoundException unused2) {
                    AFLogger.afWarnLog("Exception while collecting facebook's attribution ID. ");
                } catch (Throwable th2) {
                    AFLogger.afErrorLog("Exception while collecting facebook's attribution ID. ", th2);
                }
                if (str11 != null) {
                    hashMap.put("fb", str11);
                }
            }
            if (!AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, false)) {
                hashMap.put(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
                obj2 = "appsflyerKey";
            } else {
                SharedPreferences sharedPreferences6 = context.getApplicationContext().getSharedPreferences(str2, 0);
                boolean z4 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_IMEI, true);
                String string17 = sharedPreferences6.getString("imeiCached", null);
                if (!z4 || !TextUtils.isEmpty(this.f1896)) {
                    obj2 = "appsflyerKey";
                    if (this.f1896 != null) {
                        str10 = this.f1896;
                    }
                    string17 = null;
                    if (string17 == null) {
                        m1112(context, "imeiCached", string17);
                        hashMap.put("imei", string17);
                    } else {
                        AFLogger.afInfoLog("IMEI was not collected.");
                    }
                    z2 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                    String string18 = sharedPreferences6.getString("androidIdCached", null);
                    if (z2 || !TextUtils.isEmpty(this.f1895)) {
                        if (this.f1895 != null) {
                            str9 = this.f1895;
                            if (str9 != null) {
                                m1112(context, "androidIdCached", str9);
                                hashMap.put("android_id", str9);
                            } else {
                                AFLogger.afInfoLog("Android ID was not collected.");
                            }
                            boolean z5 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_OAID, false);
                            string7 = sharedPreferences6.getString("oaidCached", null);
                            if (this.f1897 != null) {
                                string7 = this.f1897;
                            } else if (z5 && string7 == null && ag.m1188() && !ag.m1189(context)) {
                                string7 = ag.m1187(context);
                                AFLogger.afDebugLog("OAID was collected: ".concat(String.valueOf(string7)));
                            }
                            if (string7 != null) {
                                m1112(context, "oaidCached", string7);
                                hashMap.put("oaid", string7);
                            }
                        }
                    } else if (m1141(context)) {
                        try {
                            str9 = Settings.Secure.getString(context.getContentResolver(), "android_id");
                            if (str9 != null) {
                                if (str9 != null) {
                                }
                                boolean z52 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_OAID, false);
                                string7 = sharedPreferences6.getString("oaidCached", null);
                                if (this.f1897 != null) {
                                }
                                if (string7 != null) {
                                }
                            } else {
                                if (string18 != null) {
                                    AFLogger.afDebugLog("use cached AndroidId: ".concat(string18));
                                } else {
                                    string18 = null;
                                }
                                str9 = string18;
                                if (str9 != null) {
                                }
                                boolean z522 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_OAID, false);
                                string7 = sharedPreferences6.getString("oaidCached", null);
                                if (this.f1897 != null) {
                                }
                                if (string7 != null) {
                                }
                            }
                        } catch (Exception e12) {
                            if (string18 != null) {
                                AFLogger.afDebugLog("use cached AndroidId: ".concat(string18));
                            } else {
                                string18 = null;
                            }
                            AFLogger.afErrorLog(e12.getMessage(), e12);
                        }
                    }
                    str9 = null;
                    if (str9 != null) {
                    }
                    boolean z5222 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_OAID, false);
                    string7 = sharedPreferences6.getString("oaidCached", null);
                    if (this.f1897 != null) {
                    }
                    if (string7 != null) {
                    }
                } else {
                    if (m1141(context)) {
                        try {
                            TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(PlaceFields.PHONE);
                            obj2 = "appsflyerKey";
                            try {
                                str10 = (String) telephonyManager.getClass().getMethod("getDeviceId", new Class[0]).invoke(telephonyManager, new Object[0]);
                                if (str10 == null) {
                                    if (string17 != null) {
                                        AFLogger.afDebugLog("use cached IMEI: ".concat(string17));
                                        if (string17 == null) {
                                        }
                                        z2 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                                        String string182 = sharedPreferences6.getString("androidIdCached", null);
                                        if (z2) {
                                        }
                                        if (this.f1895 != null) {
                                        }
                                        str9 = null;
                                        if (str9 != null) {
                                        }
                                        boolean z52222 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_OAID, false);
                                        string7 = sharedPreferences6.getString("oaidCached", null);
                                        if (this.f1897 != null) {
                                        }
                                        if (string7 != null) {
                                        }
                                    }
                                }
                            } catch (InvocationTargetException unused3) {
                                if (string17 == null) {
                                }
                                AFLogger.afWarnLog("WARNING: READ_PHONE_STATE is missing.");
                                if (string17 == null) {
                                }
                                z2 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                                String string1822 = sharedPreferences6.getString("androidIdCached", null);
                                if (z2) {
                                }
                                if (this.f1895 != null) {
                                }
                                str9 = null;
                                if (str9 != null) {
                                }
                                boolean z522222 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_OAID, false);
                                string7 = sharedPreferences6.getString("oaidCached", null);
                                if (this.f1897 != null) {
                                }
                                if (string7 != null) {
                                }
                                r33 = af.m1186(new WeakReference(context));
                                if (r33 != null) {
                                }
                                hashMap.put("lang", Locale.getDefault().getDisplayLanguage());
                                hashMap.put("lang_code", Locale.getDefault().getLanguage());
                                hashMap.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                                hashMap.put("platformextension", this.f1890.m1192());
                                m1134(context, hashMap);
                                simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                                long j3 = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).firstInstallTime;
                                simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
                                hashMap.put("installDate", simpleDateFormat.format(new Date(j3)));
                                packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
                                try {
                                    if (packageInfo.versionCode > sharedPreferences.getInt("versionCode", 0)) {
                                    }
                                    hashMap.put("app_version_code", Integer.toString(packageInfo.versionCode));
                                    hashMap.put("app_version_name", packageInfo.versionName);
                                    long j4 = packageInfo.firstInstallTime;
                                    long j5 = packageInfo.lastUpdateTime;
                                    appsFlyerProperties = instance;
                                    str8 = str5;
                                } catch (Throwable th3) {
                                    th = th3;
                                    appsFlyerProperties = instance;
                                    str8 = str5;
                                    sharedPreferences = sharedPreferences;
                                    AFLogger.afErrorLog("Exception while collecting app version data ", th);
                                    this.f1888 = s.d.m1242(context);
                                    StringBuilder sb4 = new StringBuilder("didConfigureTokenRefreshService=");
                                    sb4.append(this.f1888);
                                    AFLogger.afDebugLog(sb4.toString());
                                    if (!this.f1888) {
                                    }
                                    if (z3) {
                                    }
                                    if (this.f1880) {
                                    }
                                    referrer = AppsFlyerProperties.getInstance().getReferrer(context);
                                    if (System.currentTimeMillis() - this.f1882 > 30000 && referrer != null && referrer.contains("AppsFlyer_Test")) {
                                    }
                                    if (AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM) == null) {
                                    }
                                    r2 = v.m1248(context.getContentResolver());
                                    if (r2 != null) {
                                    }
                                    hashMap.put("registeredUninstall", Boolean.valueOf(sharedPreferences.getBoolean("sentRegisterRequestToAF", false)));
                                    int r4 = m1108(sharedPreferences, str6, z3);
                                    hashMap.put("counter", Integer.toString(r4));
                                    hashMap.put("iaecounter", Integer.toString(m1108(sharedPreferences, "appsFlyerInAppEventCount", str8 == null)));
                                    appsFlyerProperties.setFirstLaunchCalled();
                                    if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
                                    }
                                    z = true;
                                    if (Boolean.parseBoolean(sharedPreferences.getString("sentSuccessfully", null))) {
                                    }
                                    hashMap.put("isFirstCall", Boolean.toString(z));
                                    HashMap hashMap2 = new HashMap();
                                    hashMap2.put("cpu_abi", m1093("ro.product.cpu.abi"));
                                    hashMap2.put("cpu_abi2", m1093("ro.product.cpu.abi2"));
                                    hashMap2.put("arch", m1093("os.arch"));
                                    hashMap2.put("build_display_id", m1093("ro.build.display.id"));
                                    if (z3) {
                                    }
                                    hashMap2.put("dim", AFExecutor.AnonymousClass4.m1072(context));
                                    hashMap.put("deviceData", hashMap2);
                                    new ai();
                                    String str17 = (String) hashMap.get(obj);
                                    StringBuilder sb5 = new StringBuilder();
                                    sb5.append(((String) hashMap.get(obj2)).substring(0, 7));
                                    sb5.append(((String) hashMap.get("uid")).substring(0, 7));
                                    sb5.append(str17.substring(str17.length() - 7));
                                    hashMap.put("af_v", ai.m1197(sb5.toString()));
                                    new ai();
                                    StringBuilder sb6 = new StringBuilder();
                                    sb6.append((String) hashMap.get(obj2));
                                    sb6.append(hashMap.get(obj));
                                    String obj3 = sb6.toString();
                                    StringBuilder sb7 = new StringBuilder();
                                    sb7.append(obj3);
                                    sb7.append(hashMap.get("uid"));
                                    String obj4 = sb7.toString();
                                    StringBuilder sb8 = new StringBuilder();
                                    sb8.append(obj4);
                                    sb8.append(hashMap.get("installDate"));
                                    String obj5 = sb8.toString();
                                    StringBuilder sb9 = new StringBuilder();
                                    sb9.append(obj5);
                                    sb9.append(hashMap.get("counter"));
                                    String obj6 = sb9.toString();
                                    StringBuilder sb10 = new StringBuilder();
                                    sb10.append(obj6);
                                    sb10.append(hashMap.get("iaecounter"));
                                    hashMap.put("af_v2", ai.m1197(ai.m1199(sb10.toString())));
                                    hashMap.put("ivc", Boolean.valueOf(m1090(context)));
                                    if (sharedPreferences.contains(IS_STOP_TRACKING_USED)) {
                                    }
                                    if (appsFlyerProperties.getObject("consumeAfDeepLink") != null) {
                                    }
                                    HashMap hashMap3 = new HashMap();
                                    hashMap3.put("mcc", Integer.valueOf(context.getResources().getConfiguration().mcc));
                                    hashMap3.put("mnc", Integer.valueOf(context.getResources().getConfiguration().mnc));
                                    hashMap.put("cell", hashMap3);
                                    return hashMap;
                                }
                                try {
                                    sharedPreferences = sharedPreferences;
                                    hashMap.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j4)));
                                    hashMap.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j5)));
                                    string6 = context.getApplicationContext().getSharedPreferences(str2, 0).getString("appsFlyerFirstInstall", null);
                                    if (string6 == null) {
                                    }
                                    AFLogger.afInfoLog("AppsFlyer: first launch date: ".concat(String.valueOf(string6)));
                                    hashMap.put("firstLaunchDate", string6);
                                } catch (Throwable th4) {
                                    th = th4;
                                    sharedPreferences = sharedPreferences;
                                    AFLogger.afErrorLog("Exception while collecting app version data ", th);
                                    this.f1888 = s.d.m1242(context);
                                    StringBuilder sb42 = new StringBuilder("didConfigureTokenRefreshService=");
                                    sb42.append(this.f1888);
                                    AFLogger.afDebugLog(sb42.toString());
                                    if (!this.f1888) {
                                    }
                                    if (z3) {
                                    }
                                    if (this.f1880) {
                                    }
                                    referrer = AppsFlyerProperties.getInstance().getReferrer(context);
                                    if (System.currentTimeMillis() - this.f1882 > 30000 && referrer != null && referrer.contains("AppsFlyer_Test")) {
                                    }
                                    if (AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM) == null) {
                                    }
                                    r2 = v.m1248(context.getContentResolver());
                                    if (r2 != null) {
                                    }
                                    hashMap.put("registeredUninstall", Boolean.valueOf(sharedPreferences.getBoolean("sentRegisterRequestToAF", false)));
                                    int r42 = m1108(sharedPreferences, str6, z3);
                                    hashMap.put("counter", Integer.toString(r42));
                                    hashMap.put("iaecounter", Integer.toString(m1108(sharedPreferences, "appsFlyerInAppEventCount", str8 == null)));
                                    appsFlyerProperties.setFirstLaunchCalled();
                                    if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
                                    }
                                    z = true;
                                    if (Boolean.parseBoolean(sharedPreferences.getString("sentSuccessfully", null))) {
                                    }
                                    hashMap.put("isFirstCall", Boolean.toString(z));
                                    HashMap hashMap22 = new HashMap();
                                    hashMap22.put("cpu_abi", m1093("ro.product.cpu.abi"));
                                    hashMap22.put("cpu_abi2", m1093("ro.product.cpu.abi2"));
                                    hashMap22.put("arch", m1093("os.arch"));
                                    hashMap22.put("build_display_id", m1093("ro.build.display.id"));
                                    if (z3) {
                                    }
                                    hashMap22.put("dim", AFExecutor.AnonymousClass4.m1072(context));
                                    hashMap.put("deviceData", hashMap22);
                                    new ai();
                                    String str172 = (String) hashMap.get(obj);
                                    StringBuilder sb52 = new StringBuilder();
                                    sb52.append(((String) hashMap.get(obj2)).substring(0, 7));
                                    sb52.append(((String) hashMap.get("uid")).substring(0, 7));
                                    sb52.append(str172.substring(str172.length() - 7));
                                    hashMap.put("af_v", ai.m1197(sb52.toString()));
                                    new ai();
                                    StringBuilder sb62 = new StringBuilder();
                                    sb62.append((String) hashMap.get(obj2));
                                    sb62.append(hashMap.get(obj));
                                    String obj32 = sb62.toString();
                                    StringBuilder sb72 = new StringBuilder();
                                    sb72.append(obj32);
                                    sb72.append(hashMap.get("uid"));
                                    String obj42 = sb72.toString();
                                    StringBuilder sb82 = new StringBuilder();
                                    sb82.append(obj42);
                                    sb82.append(hashMap.get("installDate"));
                                    String obj52 = sb82.toString();
                                    StringBuilder sb92 = new StringBuilder();
                                    sb92.append(obj52);
                                    sb92.append(hashMap.get("counter"));
                                    String obj62 = sb92.toString();
                                    StringBuilder sb102 = new StringBuilder();
                                    sb102.append(obj62);
                                    sb102.append(hashMap.get("iaecounter"));
                                    hashMap.put("af_v2", ai.m1197(ai.m1199(sb102.toString())));
                                    hashMap.put("ivc", Boolean.valueOf(m1090(context)));
                                    if (sharedPreferences.contains(IS_STOP_TRACKING_USED)) {
                                    }
                                    if (appsFlyerProperties.getObject("consumeAfDeepLink") != null) {
                                    }
                                    HashMap hashMap32 = new HashMap();
                                    hashMap32.put("mcc", Integer.valueOf(context.getResources().getConfiguration().mcc));
                                    hashMap32.put("mnc", Integer.valueOf(context.getResources().getConfiguration().mnc));
                                    hashMap.put("cell", hashMap32);
                                    return hashMap;
                                }
                                this.f1888 = s.d.m1242(context);
                                StringBuilder sb422 = new StringBuilder("didConfigureTokenRefreshService=");
                                sb422.append(this.f1888);
                                AFLogger.afDebugLog(sb422.toString());
                                if (!this.f1888) {
                                }
                                if (z3) {
                                }
                                if (this.f1880) {
                                }
                                referrer = AppsFlyerProperties.getInstance().getReferrer(context);
                                if (System.currentTimeMillis() - this.f1882 > 30000 && referrer != null && referrer.contains("AppsFlyer_Test")) {
                                }
                                if (AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM) == null) {
                                }
                                r2 = v.m1248(context.getContentResolver());
                                if (r2 != null) {
                                }
                                hashMap.put("registeredUninstall", Boolean.valueOf(sharedPreferences.getBoolean("sentRegisterRequestToAF", false)));
                                int r422 = m1108(sharedPreferences, str6, z3);
                                hashMap.put("counter", Integer.toString(r422));
                                hashMap.put("iaecounter", Integer.toString(m1108(sharedPreferences, "appsFlyerInAppEventCount", str8 == null)));
                                appsFlyerProperties.setFirstLaunchCalled();
                                if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
                                }
                                z = true;
                                if (Boolean.parseBoolean(sharedPreferences.getString("sentSuccessfully", null))) {
                                }
                                hashMap.put("isFirstCall", Boolean.toString(z));
                                HashMap hashMap222 = new HashMap();
                                hashMap222.put("cpu_abi", m1093("ro.product.cpu.abi"));
                                hashMap222.put("cpu_abi2", m1093("ro.product.cpu.abi2"));
                                hashMap222.put("arch", m1093("os.arch"));
                                hashMap222.put("build_display_id", m1093("ro.build.display.id"));
                                if (z3) {
                                }
                                hashMap222.put("dim", AFExecutor.AnonymousClass4.m1072(context));
                                hashMap.put("deviceData", hashMap222);
                                new ai();
                                String str1722 = (String) hashMap.get(obj);
                                StringBuilder sb522 = new StringBuilder();
                                sb522.append(((String) hashMap.get(obj2)).substring(0, 7));
                                sb522.append(((String) hashMap.get("uid")).substring(0, 7));
                                sb522.append(str1722.substring(str1722.length() - 7));
                                hashMap.put("af_v", ai.m1197(sb522.toString()));
                                new ai();
                                StringBuilder sb622 = new StringBuilder();
                                sb622.append((String) hashMap.get(obj2));
                                sb622.append(hashMap.get(obj));
                                String obj322 = sb622.toString();
                                StringBuilder sb722 = new StringBuilder();
                                sb722.append(obj322);
                                sb722.append(hashMap.get("uid"));
                                String obj422 = sb722.toString();
                                StringBuilder sb822 = new StringBuilder();
                                sb822.append(obj422);
                                sb822.append(hashMap.get("installDate"));
                                String obj522 = sb822.toString();
                                StringBuilder sb922 = new StringBuilder();
                                sb922.append(obj522);
                                sb922.append(hashMap.get("counter"));
                                String obj622 = sb922.toString();
                                StringBuilder sb1022 = new StringBuilder();
                                sb1022.append(obj622);
                                sb1022.append(hashMap.get("iaecounter"));
                                hashMap.put("af_v2", ai.m1197(ai.m1199(sb1022.toString())));
                                hashMap.put("ivc", Boolean.valueOf(m1090(context)));
                                if (sharedPreferences.contains(IS_STOP_TRACKING_USED)) {
                                }
                                if (appsFlyerProperties.getObject("consumeAfDeepLink") != null) {
                                }
                                HashMap hashMap322 = new HashMap();
                                hashMap322.put("mcc", Integer.valueOf(context.getResources().getConfiguration().mcc));
                                hashMap322.put("mnc", Integer.valueOf(context.getResources().getConfiguration().mnc));
                                hashMap.put("cell", hashMap322);
                                return hashMap;
                            } catch (Exception e13) {
                                e2 = e13;
                                if (string17 == null) {
                                }
                                AFLogger.afErrorLog("WARNING: other reason: ", e2);
                                if (string17 == null) {
                                }
                                z2 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                                String string18222 = sharedPreferences6.getString("androidIdCached", null);
                                if (z2) {
                                }
                                if (this.f1895 != null) {
                                }
                                str9 = null;
                                if (str9 != null) {
                                }
                                boolean z5222222 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_OAID, false);
                                string7 = sharedPreferences6.getString("oaidCached", null);
                                if (this.f1897 != null) {
                                }
                                if (string7 != null) {
                                }
                                r33 = af.m1186(new WeakReference(context));
                                if (r33 != null) {
                                }
                                hashMap.put("lang", Locale.getDefault().getDisplayLanguage());
                                hashMap.put("lang_code", Locale.getDefault().getLanguage());
                                hashMap.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                                hashMap.put("platformextension", this.f1890.m1192());
                                m1134(context, hashMap);
                                simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                                long j32 = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).firstInstallTime;
                                simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
                                hashMap.put("installDate", simpleDateFormat.format(new Date(j32)));
                                packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
                                if (packageInfo.versionCode > sharedPreferences.getInt("versionCode", 0)) {
                                }
                                hashMap.put("app_version_code", Integer.toString(packageInfo.versionCode));
                                hashMap.put("app_version_name", packageInfo.versionName);
                                long j42 = packageInfo.firstInstallTime;
                                long j52 = packageInfo.lastUpdateTime;
                                appsFlyerProperties = instance;
                                str8 = str5;
                                sharedPreferences = sharedPreferences;
                                hashMap.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j42)));
                                hashMap.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j52)));
                                string6 = context.getApplicationContext().getSharedPreferences(str2, 0).getString("appsFlyerFirstInstall", null);
                                if (string6 == null) {
                                }
                                AFLogger.afInfoLog("AppsFlyer: first launch date: ".concat(String.valueOf(string6)));
                                hashMap.put("firstLaunchDate", string6);
                                this.f1888 = s.d.m1242(context);
                                StringBuilder sb4222 = new StringBuilder("didConfigureTokenRefreshService=");
                                sb4222.append(this.f1888);
                                AFLogger.afDebugLog(sb4222.toString());
                                if (!this.f1888) {
                                }
                                if (z3) {
                                }
                                if (this.f1880) {
                                }
                                referrer = AppsFlyerProperties.getInstance().getReferrer(context);
                                if (System.currentTimeMillis() - this.f1882 > 30000 && referrer != null && referrer.contains("AppsFlyer_Test")) {
                                }
                                if (AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM) == null) {
                                }
                                r2 = v.m1248(context.getContentResolver());
                                if (r2 != null) {
                                }
                                hashMap.put("registeredUninstall", Boolean.valueOf(sharedPreferences.getBoolean("sentRegisterRequestToAF", false)));
                                int r4222 = m1108(sharedPreferences, str6, z3);
                                hashMap.put("counter", Integer.toString(r4222));
                                hashMap.put("iaecounter", Integer.toString(m1108(sharedPreferences, "appsFlyerInAppEventCount", str8 == null)));
                                appsFlyerProperties.setFirstLaunchCalled();
                                if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
                                }
                                z = true;
                                if (Boolean.parseBoolean(sharedPreferences.getString("sentSuccessfully", null))) {
                                }
                                hashMap.put("isFirstCall", Boolean.toString(z));
                                HashMap hashMap2222 = new HashMap();
                                hashMap2222.put("cpu_abi", m1093("ro.product.cpu.abi"));
                                hashMap2222.put("cpu_abi2", m1093("ro.product.cpu.abi2"));
                                hashMap2222.put("arch", m1093("os.arch"));
                                hashMap2222.put("build_display_id", m1093("ro.build.display.id"));
                                if (z3) {
                                }
                                hashMap2222.put("dim", AFExecutor.AnonymousClass4.m1072(context));
                                hashMap.put("deviceData", hashMap2222);
                                new ai();
                                String str17222 = (String) hashMap.get(obj);
                                StringBuilder sb5222 = new StringBuilder();
                                sb5222.append(((String) hashMap.get(obj2)).substring(0, 7));
                                sb5222.append(((String) hashMap.get("uid")).substring(0, 7));
                                sb5222.append(str17222.substring(str17222.length() - 7));
                                hashMap.put("af_v", ai.m1197(sb5222.toString()));
                                new ai();
                                StringBuilder sb6222 = new StringBuilder();
                                sb6222.append((String) hashMap.get(obj2));
                                sb6222.append(hashMap.get(obj));
                                String obj3222 = sb6222.toString();
                                StringBuilder sb7222 = new StringBuilder();
                                sb7222.append(obj3222);
                                sb7222.append(hashMap.get("uid"));
                                String obj4222 = sb7222.toString();
                                StringBuilder sb8222 = new StringBuilder();
                                sb8222.append(obj4222);
                                sb8222.append(hashMap.get("installDate"));
                                String obj5222 = sb8222.toString();
                                StringBuilder sb9222 = new StringBuilder();
                                sb9222.append(obj5222);
                                sb9222.append(hashMap.get("counter"));
                                String obj6222 = sb9222.toString();
                                StringBuilder sb10222 = new StringBuilder();
                                sb10222.append(obj6222);
                                sb10222.append(hashMap.get("iaecounter"));
                                hashMap.put("af_v2", ai.m1197(ai.m1199(sb10222.toString())));
                                hashMap.put("ivc", Boolean.valueOf(m1090(context)));
                                if (sharedPreferences.contains(IS_STOP_TRACKING_USED)) {
                                }
                                if (appsFlyerProperties.getObject("consumeAfDeepLink") != null) {
                                }
                                HashMap hashMap3222 = new HashMap();
                                hashMap3222.put("mcc", Integer.valueOf(context.getResources().getConfiguration().mcc));
                                hashMap3222.put("mnc", Integer.valueOf(context.getResources().getConfiguration().mnc));
                                hashMap.put("cell", hashMap3222);
                                return hashMap;
                            }
                        } catch (InvocationTargetException unused4) {
                            obj2 = "appsflyerKey";
                            if (string17 == null) {
                                AFLogger.afDebugLog("use cached IMEI: ".concat(string17));
                            } else {
                                string17 = null;
                            }
                            AFLogger.afWarnLog("WARNING: READ_PHONE_STATE is missing.");
                            if (string17 == null) {
                            }
                            z2 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                            String string182222 = sharedPreferences6.getString("androidIdCached", null);
                            if (z2) {
                            }
                            if (this.f1895 != null) {
                            }
                            str9 = null;
                            if (str9 != null) {
                            }
                            boolean z52222222 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_OAID, false);
                            string7 = sharedPreferences6.getString("oaidCached", null);
                            if (this.f1897 != null) {
                            }
                            if (string7 != null) {
                            }
                            r33 = af.m1186(new WeakReference(context));
                            if (r33 != null) {
                            }
                            hashMap.put("lang", Locale.getDefault().getDisplayLanguage());
                            hashMap.put("lang_code", Locale.getDefault().getLanguage());
                            hashMap.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                            hashMap.put("platformextension", this.f1890.m1192());
                            m1134(context, hashMap);
                            simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                            long j322 = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).firstInstallTime;
                            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
                            hashMap.put("installDate", simpleDateFormat.format(new Date(j322)));
                            packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
                            if (packageInfo.versionCode > sharedPreferences.getInt("versionCode", 0)) {
                            }
                            hashMap.put("app_version_code", Integer.toString(packageInfo.versionCode));
                            hashMap.put("app_version_name", packageInfo.versionName);
                            long j422 = packageInfo.firstInstallTime;
                            long j522 = packageInfo.lastUpdateTime;
                            appsFlyerProperties = instance;
                            str8 = str5;
                            sharedPreferences = sharedPreferences;
                            hashMap.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j422)));
                            hashMap.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j522)));
                            string6 = context.getApplicationContext().getSharedPreferences(str2, 0).getString("appsFlyerFirstInstall", null);
                            if (string6 == null) {
                            }
                            AFLogger.afInfoLog("AppsFlyer: first launch date: ".concat(String.valueOf(string6)));
                            hashMap.put("firstLaunchDate", string6);
                            this.f1888 = s.d.m1242(context);
                            StringBuilder sb42222 = new StringBuilder("didConfigureTokenRefreshService=");
                            sb42222.append(this.f1888);
                            AFLogger.afDebugLog(sb42222.toString());
                            if (!this.f1888) {
                            }
                            if (z3) {
                            }
                            if (this.f1880) {
                            }
                            referrer = AppsFlyerProperties.getInstance().getReferrer(context);
                            if (System.currentTimeMillis() - this.f1882 > 30000 && referrer != null && referrer.contains("AppsFlyer_Test")) {
                            }
                            if (AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM) == null) {
                            }
                            r2 = v.m1248(context.getContentResolver());
                            if (r2 != null) {
                            }
                            hashMap.put("registeredUninstall", Boolean.valueOf(sharedPreferences.getBoolean("sentRegisterRequestToAF", false)));
                            int r42222 = m1108(sharedPreferences, str6, z3);
                            hashMap.put("counter", Integer.toString(r42222));
                            hashMap.put("iaecounter", Integer.toString(m1108(sharedPreferences, "appsFlyerInAppEventCount", str8 == null)));
                            appsFlyerProperties.setFirstLaunchCalled();
                            if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
                            }
                            z = true;
                            if (Boolean.parseBoolean(sharedPreferences.getString("sentSuccessfully", null))) {
                            }
                            hashMap.put("isFirstCall", Boolean.toString(z));
                            HashMap hashMap22222 = new HashMap();
                            hashMap22222.put("cpu_abi", m1093("ro.product.cpu.abi"));
                            hashMap22222.put("cpu_abi2", m1093("ro.product.cpu.abi2"));
                            hashMap22222.put("arch", m1093("os.arch"));
                            hashMap22222.put("build_display_id", m1093("ro.build.display.id"));
                            if (z3) {
                            }
                            hashMap22222.put("dim", AFExecutor.AnonymousClass4.m1072(context));
                            hashMap.put("deviceData", hashMap22222);
                            new ai();
                            String str172222 = (String) hashMap.get(obj);
                            StringBuilder sb52222 = new StringBuilder();
                            sb52222.append(((String) hashMap.get(obj2)).substring(0, 7));
                            sb52222.append(((String) hashMap.get("uid")).substring(0, 7));
                            sb52222.append(str172222.substring(str172222.length() - 7));
                            hashMap.put("af_v", ai.m1197(sb52222.toString()));
                            new ai();
                            StringBuilder sb62222 = new StringBuilder();
                            sb62222.append((String) hashMap.get(obj2));
                            sb62222.append(hashMap.get(obj));
                            String obj32222 = sb62222.toString();
                            StringBuilder sb72222 = new StringBuilder();
                            sb72222.append(obj32222);
                            sb72222.append(hashMap.get("uid"));
                            String obj42222 = sb72222.toString();
                            StringBuilder sb82222 = new StringBuilder();
                            sb82222.append(obj42222);
                            sb82222.append(hashMap.get("installDate"));
                            String obj52222 = sb82222.toString();
                            StringBuilder sb92222 = new StringBuilder();
                            sb92222.append(obj52222);
                            sb92222.append(hashMap.get("counter"));
                            String obj62222 = sb92222.toString();
                            StringBuilder sb102222 = new StringBuilder();
                            sb102222.append(obj62222);
                            sb102222.append(hashMap.get("iaecounter"));
                            hashMap.put("af_v2", ai.m1197(ai.m1199(sb102222.toString())));
                            hashMap.put("ivc", Boolean.valueOf(m1090(context)));
                            if (sharedPreferences.contains(IS_STOP_TRACKING_USED)) {
                            }
                            if (appsFlyerProperties.getObject("consumeAfDeepLink") != null) {
                            }
                            HashMap hashMap32222 = new HashMap();
                            hashMap32222.put("mcc", Integer.valueOf(context.getResources().getConfiguration().mcc));
                            hashMap32222.put("mnc", Integer.valueOf(context.getResources().getConfiguration().mnc));
                            hashMap.put("cell", hashMap32222);
                            return hashMap;
                        } catch (Exception e14) {
                            e2 = e14;
                            obj2 = "appsflyerKey";
                            if (string17 == null) {
                                AFLogger.afDebugLog("use cached IMEI: ".concat(string17));
                            } else {
                                string17 = null;
                            }
                            AFLogger.afErrorLog("WARNING: other reason: ", e2);
                            if (string17 == null) {
                            }
                            z2 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                            String string1822222 = sharedPreferences6.getString("androidIdCached", null);
                            if (z2) {
                            }
                            if (this.f1895 != null) {
                            }
                            str9 = null;
                            if (str9 != null) {
                            }
                            boolean z522222222 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_OAID, false);
                            string7 = sharedPreferences6.getString("oaidCached", null);
                            if (this.f1897 != null) {
                            }
                            if (string7 != null) {
                            }
                            r33 = af.m1186(new WeakReference(context));
                            if (r33 != null) {
                            }
                            hashMap.put("lang", Locale.getDefault().getDisplayLanguage());
                            hashMap.put("lang_code", Locale.getDefault().getLanguage());
                            hashMap.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                            hashMap.put("platformextension", this.f1890.m1192());
                            m1134(context, hashMap);
                            simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                            long j3222 = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).firstInstallTime;
                            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
                            hashMap.put("installDate", simpleDateFormat.format(new Date(j3222)));
                            packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
                            if (packageInfo.versionCode > sharedPreferences.getInt("versionCode", 0)) {
                            }
                            hashMap.put("app_version_code", Integer.toString(packageInfo.versionCode));
                            hashMap.put("app_version_name", packageInfo.versionName);
                            long j4222 = packageInfo.firstInstallTime;
                            long j5222 = packageInfo.lastUpdateTime;
                            appsFlyerProperties = instance;
                            str8 = str5;
                            sharedPreferences = sharedPreferences;
                            hashMap.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j4222)));
                            hashMap.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j5222)));
                            string6 = context.getApplicationContext().getSharedPreferences(str2, 0).getString("appsFlyerFirstInstall", null);
                            if (string6 == null) {
                            }
                            AFLogger.afInfoLog("AppsFlyer: first launch date: ".concat(String.valueOf(string6)));
                            hashMap.put("firstLaunchDate", string6);
                            this.f1888 = s.d.m1242(context);
                            StringBuilder sb422222 = new StringBuilder("didConfigureTokenRefreshService=");
                            sb422222.append(this.f1888);
                            AFLogger.afDebugLog(sb422222.toString());
                            if (!this.f1888) {
                            }
                            if (z3) {
                            }
                            if (this.f1880) {
                            }
                            referrer = AppsFlyerProperties.getInstance().getReferrer(context);
                            if (System.currentTimeMillis() - this.f1882 > 30000 && referrer != null && referrer.contains("AppsFlyer_Test")) {
                            }
                            if (AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM) == null) {
                            }
                            r2 = v.m1248(context.getContentResolver());
                            if (r2 != null) {
                            }
                            hashMap.put("registeredUninstall", Boolean.valueOf(sharedPreferences.getBoolean("sentRegisterRequestToAF", false)));
                            int r422222 = m1108(sharedPreferences, str6, z3);
                            hashMap.put("counter", Integer.toString(r422222));
                            hashMap.put("iaecounter", Integer.toString(m1108(sharedPreferences, "appsFlyerInAppEventCount", str8 == null)));
                            appsFlyerProperties.setFirstLaunchCalled();
                            if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
                            }
                            z = true;
                            if (Boolean.parseBoolean(sharedPreferences.getString("sentSuccessfully", null))) {
                            }
                            hashMap.put("isFirstCall", Boolean.toString(z));
                            HashMap hashMap222222 = new HashMap();
                            hashMap222222.put("cpu_abi", m1093("ro.product.cpu.abi"));
                            hashMap222222.put("cpu_abi2", m1093("ro.product.cpu.abi2"));
                            hashMap222222.put("arch", m1093("os.arch"));
                            hashMap222222.put("build_display_id", m1093("ro.build.display.id"));
                            if (z3) {
                            }
                            hashMap222222.put("dim", AFExecutor.AnonymousClass4.m1072(context));
                            hashMap.put("deviceData", hashMap222222);
                            new ai();
                            String str1722222 = (String) hashMap.get(obj);
                            StringBuilder sb522222 = new StringBuilder();
                            sb522222.append(((String) hashMap.get(obj2)).substring(0, 7));
                            sb522222.append(((String) hashMap.get("uid")).substring(0, 7));
                            sb522222.append(str1722222.substring(str1722222.length() - 7));
                            hashMap.put("af_v", ai.m1197(sb522222.toString()));
                            new ai();
                            StringBuilder sb622222 = new StringBuilder();
                            sb622222.append((String) hashMap.get(obj2));
                            sb622222.append(hashMap.get(obj));
                            String obj322222 = sb622222.toString();
                            StringBuilder sb722222 = new StringBuilder();
                            sb722222.append(obj322222);
                            sb722222.append(hashMap.get("uid"));
                            String obj422222 = sb722222.toString();
                            StringBuilder sb822222 = new StringBuilder();
                            sb822222.append(obj422222);
                            sb822222.append(hashMap.get("installDate"));
                            String obj522222 = sb822222.toString();
                            StringBuilder sb922222 = new StringBuilder();
                            sb922222.append(obj522222);
                            sb922222.append(hashMap.get("counter"));
                            String obj622222 = sb922222.toString();
                            StringBuilder sb1022222 = new StringBuilder();
                            sb1022222.append(obj622222);
                            sb1022222.append(hashMap.get("iaecounter"));
                            hashMap.put("af_v2", ai.m1197(ai.m1199(sb1022222.toString())));
                            hashMap.put("ivc", Boolean.valueOf(m1090(context)));
                            if (sharedPreferences.contains(IS_STOP_TRACKING_USED)) {
                            }
                            if (appsFlyerProperties.getObject("consumeAfDeepLink") != null) {
                            }
                            HashMap hashMap322222 = new HashMap();
                            hashMap322222.put("mcc", Integer.valueOf(context.getResources().getConfiguration().mcc));
                            hashMap322222.put("mnc", Integer.valueOf(context.getResources().getConfiguration().mnc));
                            hashMap.put("cell", hashMap322222);
                            return hashMap;
                        }
                    } else {
                        obj2 = "appsflyerKey";
                    }
                    string17 = null;
                    if (string17 == null) {
                    }
                    z2 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                    String string18222222 = sharedPreferences6.getString("androidIdCached", null);
                    if (z2) {
                    }
                    if (this.f1895 != null) {
                    }
                    str9 = null;
                    if (str9 != null) {
                    }
                    boolean z5222222222 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_OAID, false);
                    string7 = sharedPreferences6.getString("oaidCached", null);
                    if (this.f1897 != null) {
                    }
                    if (string7 != null) {
                    }
                }
                string17 = str10;
                if (string17 == null) {
                }
                z2 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                String string182222222 = sharedPreferences6.getString("androidIdCached", null);
                if (z2) {
                }
                if (this.f1895 != null) {
                }
                str9 = null;
                if (str9 != null) {
                }
                boolean z52222222222 = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_OAID, false);
                string7 = sharedPreferences6.getString("oaidCached", null);
                if (this.f1897 != null) {
                }
                if (string7 != null) {
                }
            }
            try {
                r33 = af.m1186(new WeakReference(context));
                if (r33 != null) {
                    hashMap.put("uid", r33);
                }
            } catch (Exception e15) {
                StringBuilder sb11 = new StringBuilder("ERROR: could not get uid ");
                sb11.append(e15.getMessage());
                AFLogger.afErrorLog(sb11.toString(), e15);
            }
            try {
                hashMap.put("lang", Locale.getDefault().getDisplayLanguage());
            } catch (Exception e16) {
                AFLogger.afErrorLog("Exception while collecting display language name. ", e16);
            }
            try {
                hashMap.put("lang_code", Locale.getDefault().getLanguage());
            } catch (Exception e17) {
                AFLogger.afErrorLog("Exception while collecting display language code. ", e17);
            }
            try {
                hashMap.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
            } catch (Exception e18) {
                AFLogger.afErrorLog("Exception while collecting country name. ", e18);
            }
            hashMap.put("platformextension", this.f1890.m1192());
            m1134(context, hashMap);
            simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
            try {
                long j32222 = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).firstInstallTime;
                simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
                hashMap.put("installDate", simpleDateFormat.format(new Date(j32222)));
            } catch (Exception e19) {
                AFLogger.afErrorLog("Exception while collecting install date. ", e19);
            }
            try {
                packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
                if (packageInfo.versionCode > sharedPreferences.getInt("versionCode", 0)) {
                    int i = packageInfo.versionCode;
                    SharedPreferences.Editor edit3 = context.getApplicationContext().getSharedPreferences(str2, 0).edit();
                    edit3.putInt("versionCode", i);
                    edit3.apply();
                }
                hashMap.put("app_version_code", Integer.toString(packageInfo.versionCode));
                hashMap.put("app_version_name", packageInfo.versionName);
                long j42222 = packageInfo.firstInstallTime;
                long j52222 = packageInfo.lastUpdateTime;
                appsFlyerProperties = instance;
                str8 = str5;
                sharedPreferences = sharedPreferences;
                try {
                    hashMap.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j42222)));
                    hashMap.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j52222)));
                    string6 = context.getApplicationContext().getSharedPreferences(str2, 0).getString("appsFlyerFirstInstall", null);
                    if (string6 == null) {
                        if (!context.getApplicationContext().getSharedPreferences(str2, 0).contains(str6)) {
                            AFLogger.afDebugLog("AppsFlyer: first launch detected");
                            string6 = simpleDateFormat.format(new Date());
                        } else {
                            string6 = "";
                        }
                        m1112(context, "appsFlyerFirstInstall", string6);
                    }
                    AFLogger.afInfoLog("AppsFlyer: first launch date: ".concat(String.valueOf(string6)));
                    hashMap.put("firstLaunchDate", string6);
                } catch (Throwable th5) {
                    th = th5;
                    AFLogger.afErrorLog("Exception while collecting app version data ", th);
                    this.f1888 = s.d.m1242(context);
                    StringBuilder sb4222222 = new StringBuilder("didConfigureTokenRefreshService=");
                    sb4222222.append(this.f1888);
                    AFLogger.afDebugLog(sb4222222.toString());
                    if (!this.f1888) {
                    }
                    if (z3) {
                    }
                    if (this.f1880) {
                    }
                    referrer = AppsFlyerProperties.getInstance().getReferrer(context);
                    if (System.currentTimeMillis() - this.f1882 > 30000 && referrer != null && referrer.contains("AppsFlyer_Test")) {
                    }
                    if (AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM) == null) {
                    }
                    r2 = v.m1248(context.getContentResolver());
                    if (r2 != null) {
                    }
                    hashMap.put("registeredUninstall", Boolean.valueOf(sharedPreferences.getBoolean("sentRegisterRequestToAF", false)));
                    int r4222222 = m1108(sharedPreferences, str6, z3);
                    hashMap.put("counter", Integer.toString(r4222222));
                    hashMap.put("iaecounter", Integer.toString(m1108(sharedPreferences, "appsFlyerInAppEventCount", str8 == null)));
                    appsFlyerProperties.setFirstLaunchCalled();
                    if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
                    }
                    z = true;
                    if (Boolean.parseBoolean(sharedPreferences.getString("sentSuccessfully", null))) {
                    }
                    hashMap.put("isFirstCall", Boolean.toString(z));
                    HashMap hashMap2222222 = new HashMap();
                    hashMap2222222.put("cpu_abi", m1093("ro.product.cpu.abi"));
                    hashMap2222222.put("cpu_abi2", m1093("ro.product.cpu.abi2"));
                    hashMap2222222.put("arch", m1093("os.arch"));
                    hashMap2222222.put("build_display_id", m1093("ro.build.display.id"));
                    if (z3) {
                    }
                    hashMap2222222.put("dim", AFExecutor.AnonymousClass4.m1072(context));
                    hashMap.put("deviceData", hashMap2222222);
                    new ai();
                    String str17222222 = (String) hashMap.get(obj);
                    StringBuilder sb5222222 = new StringBuilder();
                    sb5222222.append(((String) hashMap.get(obj2)).substring(0, 7));
                    sb5222222.append(((String) hashMap.get("uid")).substring(0, 7));
                    sb5222222.append(str17222222.substring(str17222222.length() - 7));
                    hashMap.put("af_v", ai.m1197(sb5222222.toString()));
                    new ai();
                    StringBuilder sb6222222 = new StringBuilder();
                    sb6222222.append((String) hashMap.get(obj2));
                    sb6222222.append(hashMap.get(obj));
                    String obj3222222 = sb6222222.toString();
                    StringBuilder sb7222222 = new StringBuilder();
                    sb7222222.append(obj3222222);
                    sb7222222.append(hashMap.get("uid"));
                    String obj4222222 = sb7222222.toString();
                    StringBuilder sb8222222 = new StringBuilder();
                    sb8222222.append(obj4222222);
                    sb8222222.append(hashMap.get("installDate"));
                    String obj5222222 = sb8222222.toString();
                    StringBuilder sb9222222 = new StringBuilder();
                    sb9222222.append(obj5222222);
                    sb9222222.append(hashMap.get("counter"));
                    String obj6222222 = sb9222222.toString();
                    StringBuilder sb10222222 = new StringBuilder();
                    sb10222222.append(obj6222222);
                    sb10222222.append(hashMap.get("iaecounter"));
                    hashMap.put("af_v2", ai.m1197(ai.m1199(sb10222222.toString())));
                    hashMap.put("ivc", Boolean.valueOf(m1090(context)));
                    if (sharedPreferences.contains(IS_STOP_TRACKING_USED)) {
                    }
                    if (appsFlyerProperties.getObject("consumeAfDeepLink") != null) {
                    }
                    HashMap hashMap3222222 = new HashMap();
                    hashMap3222222.put("mcc", Integer.valueOf(context.getResources().getConfiguration().mcc));
                    hashMap3222222.put("mnc", Integer.valueOf(context.getResources().getConfiguration().mnc));
                    hashMap.put("cell", hashMap3222222);
                    return hashMap;
                }
            } catch (Throwable th6) {
                th = th6;
                appsFlyerProperties = instance;
                str8 = str5;
                AFLogger.afErrorLog("Exception while collecting app version data ", th);
                this.f1888 = s.d.m1242(context);
                StringBuilder sb42222222 = new StringBuilder("didConfigureTokenRefreshService=");
                sb42222222.append(this.f1888);
                AFLogger.afDebugLog(sb42222222.toString());
                if (!this.f1888) {
                }
                if (z3) {
                }
                if (this.f1880) {
                }
                referrer = AppsFlyerProperties.getInstance().getReferrer(context);
                if (System.currentTimeMillis() - this.f1882 > 30000 && referrer != null && referrer.contains("AppsFlyer_Test")) {
                }
                if (AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM) == null) {
                }
                r2 = v.m1248(context.getContentResolver());
                if (r2 != null) {
                }
                hashMap.put("registeredUninstall", Boolean.valueOf(sharedPreferences.getBoolean("sentRegisterRequestToAF", false)));
                int r42222222 = m1108(sharedPreferences, str6, z3);
                hashMap.put("counter", Integer.toString(r42222222));
                hashMap.put("iaecounter", Integer.toString(m1108(sharedPreferences, "appsFlyerInAppEventCount", str8 == null)));
                appsFlyerProperties.setFirstLaunchCalled();
                if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
                }
                z = true;
                if (Boolean.parseBoolean(sharedPreferences.getString("sentSuccessfully", null))) {
                }
                hashMap.put("isFirstCall", Boolean.toString(z));
                HashMap hashMap22222222 = new HashMap();
                hashMap22222222.put("cpu_abi", m1093("ro.product.cpu.abi"));
                hashMap22222222.put("cpu_abi2", m1093("ro.product.cpu.abi2"));
                hashMap22222222.put("arch", m1093("os.arch"));
                hashMap22222222.put("build_display_id", m1093("ro.build.display.id"));
                if (z3) {
                }
                hashMap22222222.put("dim", AFExecutor.AnonymousClass4.m1072(context));
                hashMap.put("deviceData", hashMap22222222);
                new ai();
                String str172222222 = (String) hashMap.get(obj);
                StringBuilder sb52222222 = new StringBuilder();
                sb52222222.append(((String) hashMap.get(obj2)).substring(0, 7));
                sb52222222.append(((String) hashMap.get("uid")).substring(0, 7));
                sb52222222.append(str172222222.substring(str172222222.length() - 7));
                hashMap.put("af_v", ai.m1197(sb52222222.toString()));
                new ai();
                StringBuilder sb62222222 = new StringBuilder();
                sb62222222.append((String) hashMap.get(obj2));
                sb62222222.append(hashMap.get(obj));
                String obj32222222 = sb62222222.toString();
                StringBuilder sb72222222 = new StringBuilder();
                sb72222222.append(obj32222222);
                sb72222222.append(hashMap.get("uid"));
                String obj42222222 = sb72222222.toString();
                StringBuilder sb82222222 = new StringBuilder();
                sb82222222.append(obj42222222);
                sb82222222.append(hashMap.get("installDate"));
                String obj52222222 = sb82222222.toString();
                StringBuilder sb92222222 = new StringBuilder();
                sb92222222.append(obj52222222);
                sb92222222.append(hashMap.get("counter"));
                String obj62222222 = sb92222222.toString();
                StringBuilder sb102222222 = new StringBuilder();
                sb102222222.append(obj62222222);
                sb102222222.append(hashMap.get("iaecounter"));
                hashMap.put("af_v2", ai.m1197(ai.m1199(sb102222222.toString())));
                hashMap.put("ivc", Boolean.valueOf(m1090(context)));
                if (sharedPreferences.contains(IS_STOP_TRACKING_USED)) {
                }
                if (appsFlyerProperties.getObject("consumeAfDeepLink") != null) {
                }
                HashMap hashMap32222222 = new HashMap();
                hashMap32222222.put("mcc", Integer.valueOf(context.getResources().getConfiguration().mcc));
                hashMap32222222.put("mnc", Integer.valueOf(context.getResources().getConfiguration().mnc));
                hashMap.put("cell", hashMap32222222);
                return hashMap;
            }
            this.f1888 = s.d.m1242(context);
            StringBuilder sb422222222 = new StringBuilder("didConfigureTokenRefreshService=");
            sb422222222.append(this.f1888);
            AFLogger.afDebugLog(sb422222222.toString());
            if (!this.f1888) {
                hashMap.put("tokenRefreshConfigured", Boolean.FALSE);
            }
            if (z3) {
                g.m1228().m1229(intent, context, hashMap);
                if (this.f1879 != null) {
                    JSONObject jSONObject3 = new JSONObject(this.f1879);
                    jSONObject3.put("isPush", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
                    hashMap.put("af_deeplink", jSONObject3.toString());
                }
                this.f1879 = null;
                hashMap.put("open_referrer", str15);
            }
            if (this.f1880) {
                hashMap.put("testAppMode_retargeting", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
                m1123(context, new JSONObject(hashMap).toString());
                AFLogger.afInfoLog("Sent retargeting params to test app");
            }
            referrer = AppsFlyerProperties.getInstance().getReferrer(context);
            if (System.currentTimeMillis() - this.f1882 > 30000 && referrer != null && referrer.contains("AppsFlyer_Test")) {
                hashMap.put("testAppMode", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
                m1123(context, new JSONObject(hashMap).toString());
                AFLogger.afInfoLog("Sent params to test app");
                AFLogger.afInfoLog("Test mode ended!");
                this.f1882 = 0;
            }
            if (AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM) == null) {
                v.m1247(context, hashMap);
                if (AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM) != null) {
                    hashMap.put("GAID_retry", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
                } else {
                    hashMap.put("GAID_retry", "false");
                }
            }
            r2 = v.m1248(context.getContentResolver());
            if (r2 != null) {
                hashMap.put("amazon_aid", r2.f2138);
                hashMap.put("amazon_aid_limit", String.valueOf(r2.f2140));
            }
            hashMap.put("registeredUninstall", Boolean.valueOf(sharedPreferences.getBoolean("sentRegisterRequestToAF", false)));
            int r422222222 = m1108(sharedPreferences, str6, z3);
            hashMap.put("counter", Integer.toString(r422222222));
            hashMap.put("iaecounter", Integer.toString(m1108(sharedPreferences, "appsFlyerInAppEventCount", str8 == null)));
            if (z3 && r422222222 == 1) {
                appsFlyerProperties.setFirstLaunchCalled();
                if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
                    z = true;
                    hashMap.put("wait_cid", Boolean.toString(true));
                    if (Boolean.parseBoolean(sharedPreferences.getString("sentSuccessfully", null))) {
                        z = false;
                    }
                    hashMap.put("isFirstCall", Boolean.toString(z));
                    HashMap hashMap222222222 = new HashMap();
                    hashMap222222222.put("cpu_abi", m1093("ro.product.cpu.abi"));
                    hashMap222222222.put("cpu_abi2", m1093("ro.product.cpu.abi2"));
                    hashMap222222222.put("arch", m1093("os.arch"));
                    hashMap222222222.put("build_display_id", m1093("ro.build.display.id"));
                    if (z3) {
                        if (this.f1883) {
                            r rVar = r.d.f2117;
                            Location r23 = r.m1239(context);
                            HashMap hashMap4 = new HashMap(3);
                            if (r23 != null) {
                                hashMap4.put("lat", String.valueOf(r23.getLatitude()));
                                hashMap4.put("lon", String.valueOf(r23.getLongitude()));
                                hashMap4.put("ts", String.valueOf(r23.getTime()));
                            }
                            if (!hashMap4.isEmpty()) {
                                hashMap222222222.put("loc", hashMap4);
                            }
                        }
                        c.b r24 = c.C0328c.f2059.m1209(context);
                        hashMap222222222.put("btl", Float.toString(r24.f2057));
                        String str18 = r24.f2058;
                        if (str18 != null) {
                            hashMap222222222.put("btch", str18);
                        }
                        if (2 >= r422222222) {
                            List<Map<String, Object>> r25 = t.m1243(context).m1246();
                            if (!r25.isEmpty()) {
                                hashMap222222222.put("sensors", r25);
                            }
                        }
                    }
                    hashMap222222222.put("dim", AFExecutor.AnonymousClass4.m1072(context));
                    hashMap.put("deviceData", hashMap222222222);
                    new ai();
                    String str1722222222 = (String) hashMap.get(obj);
                    StringBuilder sb522222222 = new StringBuilder();
                    sb522222222.append(((String) hashMap.get(obj2)).substring(0, 7));
                    sb522222222.append(((String) hashMap.get("uid")).substring(0, 7));
                    sb522222222.append(str1722222222.substring(str1722222222.length() - 7));
                    hashMap.put("af_v", ai.m1197(sb522222222.toString()));
                    new ai();
                    StringBuilder sb622222222 = new StringBuilder();
                    sb622222222.append((String) hashMap.get(obj2));
                    sb622222222.append(hashMap.get(obj));
                    String obj322222222 = sb622222222.toString();
                    StringBuilder sb722222222 = new StringBuilder();
                    sb722222222.append(obj322222222);
                    sb722222222.append(hashMap.get("uid"));
                    String obj422222222 = sb722222222.toString();
                    StringBuilder sb822222222 = new StringBuilder();
                    sb822222222.append(obj422222222);
                    sb822222222.append(hashMap.get("installDate"));
                    String obj522222222 = sb822222222.toString();
                    StringBuilder sb922222222 = new StringBuilder();
                    sb922222222.append(obj522222222);
                    sb922222222.append(hashMap.get("counter"));
                    String obj622222222 = sb922222222.toString();
                    StringBuilder sb1022222222 = new StringBuilder();
                    sb1022222222.append(obj622222222);
                    sb1022222222.append(hashMap.get("iaecounter"));
                    hashMap.put("af_v2", ai.m1197(ai.m1199(sb1022222222.toString())));
                    hashMap.put("ivc", Boolean.valueOf(m1090(context)));
                    if (sharedPreferences.contains(IS_STOP_TRACKING_USED)) {
                        hashMap.put("istu", String.valueOf(sharedPreferences.getBoolean(IS_STOP_TRACKING_USED, false)));
                    }
                    if (appsFlyerProperties.getObject("consumeAfDeepLink") != null) {
                        hashMap.put("is_dp_api", String.valueOf(appsFlyerProperties.getBoolean("consumeAfDeepLink", false)));
                    }
                    HashMap hashMap322222222 = new HashMap();
                    hashMap322222222.put("mcc", Integer.valueOf(context.getResources().getConfiguration().mcc));
                    hashMap322222222.put("mnc", Integer.valueOf(context.getResources().getConfiguration().mnc));
                    hashMap.put("cell", hashMap322222222);
                    return hashMap;
                }
            }
            z = true;
            if (Boolean.parseBoolean(sharedPreferences.getString("sentSuccessfully", null))) {
            }
            hashMap.put("isFirstCall", Boolean.toString(z));
            HashMap hashMap2222222222 = new HashMap();
            hashMap2222222222.put("cpu_abi", m1093("ro.product.cpu.abi"));
            hashMap2222222222.put("cpu_abi2", m1093("ro.product.cpu.abi2"));
            hashMap2222222222.put("arch", m1093("os.arch"));
            hashMap2222222222.put("build_display_id", m1093("ro.build.display.id"));
            if (z3) {
            }
            hashMap2222222222.put("dim", AFExecutor.AnonymousClass4.m1072(context));
            hashMap.put("deviceData", hashMap2222222222);
            new ai();
            String str17222222222 = (String) hashMap.get(obj);
            StringBuilder sb5222222222 = new StringBuilder();
            sb5222222222.append(((String) hashMap.get(obj2)).substring(0, 7));
            sb5222222222.append(((String) hashMap.get("uid")).substring(0, 7));
            sb5222222222.append(str17222222222.substring(str17222222222.length() - 7));
            hashMap.put("af_v", ai.m1197(sb5222222222.toString()));
            new ai();
            StringBuilder sb6222222222 = new StringBuilder();
            sb6222222222.append((String) hashMap.get(obj2));
            sb6222222222.append(hashMap.get(obj));
            String obj3222222222 = sb6222222222.toString();
            StringBuilder sb7222222222 = new StringBuilder();
            sb7222222222.append(obj3222222222);
            sb7222222222.append(hashMap.get("uid"));
            String obj4222222222 = sb7222222222.toString();
            StringBuilder sb8222222222 = new StringBuilder();
            sb8222222222.append(obj4222222222);
            sb8222222222.append(hashMap.get("installDate"));
            String obj5222222222 = sb8222222222.toString();
            StringBuilder sb9222222222 = new StringBuilder();
            sb9222222222.append(obj5222222222);
            sb9222222222.append(hashMap.get("counter"));
            String obj6222222222 = sb9222222222.toString();
            StringBuilder sb10222222222 = new StringBuilder();
            sb10222222222.append(obj6222222222);
            sb10222222222.append(hashMap.get("iaecounter"));
            hashMap.put("af_v2", ai.m1197(ai.m1199(sb10222222222.toString())));
            hashMap.put("ivc", Boolean.valueOf(m1090(context)));
            if (sharedPreferences.contains(IS_STOP_TRACKING_USED)) {
            }
            if (appsFlyerProperties.getObject("consumeAfDeepLink") != null) {
            }
            HashMap hashMap3222222222 = new HashMap();
            hashMap3222222222.put("mcc", Integer.valueOf(context.getResources().getConfiguration().mcc));
            hashMap3222222222.put("mnc", Integer.valueOf(context.getResources().getConfiguration().mnc));
            hashMap.put("cell", hashMap3222222222);
        } catch (Throwable th7) {
            AFLogger.afErrorLog(th7.getLocalizedMessage(), th7);
        }
        return hashMap;
        str11 = null;
        if (str11 != null) {
        }
        if (!AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, false)) {
        }
        r33 = af.m1186(new WeakReference(context));
        if (r33 != null) {
        }
        hashMap.put("lang", Locale.getDefault().getDisplayLanguage());
        hashMap.put("lang_code", Locale.getDefault().getLanguage());
        hashMap.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
        hashMap.put("platformextension", this.f1890.m1192());
        m1134(context, hashMap);
        simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
        long j322222 = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).firstInstallTime;
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        hashMap.put("installDate", simpleDateFormat.format(new Date(j322222)));
        packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
        if (packageInfo.versionCode > sharedPreferences.getInt("versionCode", 0)) {
        }
        hashMap.put("app_version_code", Integer.toString(packageInfo.versionCode));
        hashMap.put("app_version_name", packageInfo.versionName);
        long j422222 = packageInfo.firstInstallTime;
        long j522222 = packageInfo.lastUpdateTime;
        appsFlyerProperties = instance;
        str8 = str5;
        sharedPreferences = sharedPreferences;
        hashMap.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j422222)));
        hashMap.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j522222)));
        string6 = context.getApplicationContext().getSharedPreferences(str2, 0).getString("appsFlyerFirstInstall", null);
        if (string6 == null) {
        }
        AFLogger.afInfoLog("AppsFlyer: first launch date: ".concat(String.valueOf(string6)));
        hashMap.put("firstLaunchDate", string6);
        this.f1888 = s.d.m1242(context);
        StringBuilder sb4222222222 = new StringBuilder("didConfigureTokenRefreshService=");
        sb4222222222.append(this.f1888);
        AFLogger.afDebugLog(sb4222222222.toString());
        if (!this.f1888) {
        }
        if (z3) {
        }
        if (this.f1880) {
        }
        referrer = AppsFlyerProperties.getInstance().getReferrer(context);
        if (System.currentTimeMillis() - this.f1882 > 30000 && referrer != null && referrer.contains("AppsFlyer_Test")) {
        }
        if (AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM) == null) {
        }
        r2 = v.m1248(context.getContentResolver());
        if (r2 != null) {
        }
        hashMap.put("registeredUninstall", Boolean.valueOf(sharedPreferences.getBoolean("sentRegisterRequestToAF", false)));
        int r4222222222 = m1108(sharedPreferences, str6, z3);
        hashMap.put("counter", Integer.toString(r4222222222));
        hashMap.put("iaecounter", Integer.toString(m1108(sharedPreferences, "appsFlyerInAppEventCount", str8 == null)));
        appsFlyerProperties.setFirstLaunchCalled();
        if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
        }
        z = true;
        if (Boolean.parseBoolean(sharedPreferences.getString("sentSuccessfully", null))) {
        }
        hashMap.put("isFirstCall", Boolean.toString(z));
        HashMap hashMap22222222222 = new HashMap();
        hashMap22222222222.put("cpu_abi", m1093("ro.product.cpu.abi"));
        hashMap22222222222.put("cpu_abi2", m1093("ro.product.cpu.abi2"));
        hashMap22222222222.put("arch", m1093("os.arch"));
        hashMap22222222222.put("build_display_id", m1093("ro.build.display.id"));
        if (z3) {
        }
        hashMap22222222222.put("dim", AFExecutor.AnonymousClass4.m1072(context));
        hashMap.put("deviceData", hashMap22222222222);
        new ai();
        String str172222222222 = (String) hashMap.get(obj);
        StringBuilder sb52222222222 = new StringBuilder();
        sb52222222222.append(((String) hashMap.get(obj2)).substring(0, 7));
        sb52222222222.append(((String) hashMap.get("uid")).substring(0, 7));
        sb52222222222.append(str172222222222.substring(str172222222222.length() - 7));
        hashMap.put("af_v", ai.m1197(sb52222222222.toString()));
        new ai();
        StringBuilder sb62222222222 = new StringBuilder();
        sb62222222222.append((String) hashMap.get(obj2));
        sb62222222222.append(hashMap.get(obj));
        String obj32222222222 = sb62222222222.toString();
        StringBuilder sb72222222222 = new StringBuilder();
        sb72222222222.append(obj32222222222);
        sb72222222222.append(hashMap.get("uid"));
        String obj42222222222 = sb72222222222.toString();
        StringBuilder sb82222222222 = new StringBuilder();
        sb82222222222.append(obj42222222222);
        sb82222222222.append(hashMap.get("installDate"));
        String obj52222222222 = sb82222222222.toString();
        StringBuilder sb92222222222 = new StringBuilder();
        sb92222222222.append(obj52222222222);
        sb92222222222.append(hashMap.get("counter"));
        String obj62222222222 = sb92222222222.toString();
        StringBuilder sb102222222222 = new StringBuilder();
        sb102222222222.append(obj62222222222);
        sb102222222222.append(hashMap.get("iaecounter"));
        hashMap.put("af_v2", ai.m1197(ai.m1199(sb102222222222.toString())));
        hashMap.put("ivc", Boolean.valueOf(m1090(context)));
        if (sharedPreferences.contains(IS_STOP_TRACKING_USED)) {
        }
        if (appsFlyerProperties.getObject("consumeAfDeepLink") != null) {
        }
        HashMap hashMap32222222222 = new HashMap();
        hashMap32222222222.put("mcc", Integer.valueOf(context.getResources().getConfiguration().mcc));
        hashMap32222222222.put("mnc", Integer.valueOf(context.getResources().getConfiguration().mnc));
        hashMap.put("cell", hashMap32222222222);
        return hashMap;
    }

    /* renamed from: ˊ  reason: contains not printable characters */
    public static String m1095(WeakReference<Context> weakReference, String str) {
        if (weakReference.get() == null) {
            return null;
        }
        return m1094(str, weakReference.get().getPackageManager(), weakReference.get().getPackageName());
    }

    /* renamed from: ˊ  reason: contains not printable characters */
    public static String m1094(String str, PackageManager packageManager, String str2) {
        Object obj;
        try {
            Bundle bundle = ((PackageItemInfo) packageManager.getApplicationInfo(str2, 128)).metaData;
            if (bundle == null || (obj = bundle.get(str)) == null) {
                return null;
            }
            return obj.toString();
        } catch (Throwable th) {
            StringBuilder sb = new StringBuilder("Could not find ");
            sb.append(str);
            sb.append(" value in the manifest");
            AFLogger.afErrorLog(sb.toString(), th);
            return null;
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:16:0x0031 A[SYNTHETIC, Splitter:B:16:0x0031] */
    /* JADX WARNING: Removed duplicated region for block: B:25:0x0056  */
    /* renamed from: ˊ  reason: contains not printable characters */
    public static String m1092(File file, String str) {
        FileReader fileReader;
        Throwable th;
        try {
            Properties properties = new Properties();
            fileReader = new FileReader(file);
            try {
                properties.load(fileReader);
                AFLogger.afInfoLog("Found PreInstall property!");
                String property = properties.getProperty(str);
                try {
                    fileReader.close();
                } catch (Throwable th2) {
                    AFLogger.afErrorLog(th2.getMessage(), th2);
                }
                return property;
            } catch (FileNotFoundException unused) {
                StringBuilder sb = new StringBuilder("PreInstall file wasn't found: ");
                sb.append(file.getAbsolutePath());
                AFLogger.afDebugLog(sb.toString());
                if (fileReader != null) {
                    fileReader.close();
                }
                return null;
            } catch (Throwable th3) {
                th = th3;
                try {
                    AFLogger.afErrorLog(th.getMessage(), th);
                    if (fileReader != null) {
                        try {
                            fileReader.close();
                        } catch (Throwable th4) {
                            AFLogger.afErrorLog(th4.getMessage(), th4);
                        }
                    }
                    return null;
                } catch (Throwable th5) {
                    AFLogger.afErrorLog(th5.getMessage(), th5);
                }
            }
        } catch (FileNotFoundException unused2) {
            fileReader = null;
            StringBuilder sb2 = new StringBuilder("PreInstall file wasn't found: ");
            sb2.append(file.getAbsolutePath());
            AFLogger.afDebugLog(sb2.toString());
            if (fileReader != null) {
            }
            return null;
        } catch (Throwable th6) {
            th = th6;
            fileReader = null;
            AFLogger.afErrorLog(th.getMessage(), th);
            if (fileReader != null) {
            }
            return null;
        }
        throw th;
    }

    /* renamed from: ˎ  reason: contains not printable characters */
    public static void m1112(Context context, String str, String str2) {
        SharedPreferences.Editor edit = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0).edit();
        edit.putString(str, str2);
        edit.apply();
    }

    /* renamed from: ˎ  reason: contains not printable characters */
    public static boolean m1117(Context context) {
        if (m1108(context.getApplicationContext().getSharedPreferences("appsflyer-data", 0), "appsFlyerCount", false) > 2) {
            AFLogger.afRDLog("Install referrer will not load, the counter > 2, ");
            return false;
        }
        try {
            Class.forName("com.android.installreferrer.api.InstallReferrerClient");
            if (AFExecutor.AnonymousClass4.AnonymousClass3.m1073(context, "com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE")) {
                AFLogger.afDebugLog("Install referrer is allowed");
                return true;
            }
            AFLogger.afDebugLog("Install referrer is not allowed");
            return false;
        } catch (ClassNotFoundException unused) {
            AFLogger.afRDLog("Class com.android.installreferrer.api.InstallReferrerClient not found");
            return false;
        } catch (Throwable th) {
            AFLogger.afErrorLog("An error occurred while trying to verify manifest : com.android.installreferrer.api.InstallReferrerClient", th);
            return false;
        }
    }

    /* renamed from: ˊ  reason: contains not printable characters */
    public static void m1098(Context context, String str, long j) {
        SharedPreferences.Editor edit = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0).edit();
        edit.putLong(str, j);
        edit.apply();
    }

    /* renamed from: ˎ  reason: contains not printable characters */
    public static /* synthetic */ boolean m1118(AppsFlyerLibCore appsFlyerLibCore) {
        Map<String, String> map = appsFlyerLibCore.f1902;
        return map != null && map.size() > 0;
    }

    /* renamed from: ˎ  reason: contains not printable characters */
    public static /* synthetic */ String m1109(String str) {
        return AppsFlyerProperties.getInstance().getString(str);
    }

    /* JADX WARNING: Removed duplicated region for block: B:19:0x0041  */
    /* JADX WARNING: Removed duplicated region for block: B:21:0x0047  */
    /* renamed from: ˊ  reason: contains not printable characters */
    public final void m1144(j jVar) {
        Intent intent;
        String str;
        Context context = jVar.f2090;
        Uri uri = null;
        if (context == null) {
            WeakReference<Context> weakReference = jVar.f2088;
            context = weakReference != null ? weakReference.get() : null;
        }
        if (context instanceof Activity) {
            Activity activity = (Activity) context;
            intent = activity.getIntent();
            try {
                uri = C1826.m4714(activity);
            } catch (Throwable th) {
                AFLogger.afErrorLog(th.getLocalizedMessage(), th);
            }
            if (uri != null) {
                str = uri.toString();
                if (AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY) != null) {
                    AFLogger.afWarnLog("[TrackEvent/Launch] AppsFlyer's SDK cannot send any event without providing DevKey.");
                    return;
                }
                String referrer = AppsFlyerProperties.getInstance().getReferrer(context);
                if (referrer == null) {
                    referrer = "";
                }
                jVar.f2094 = referrer;
                jVar.f2096 = intent;
                jVar.f2100 = str;
                m1106(jVar);
                return;
            }
        } else {
            intent = null;
        }
        str = "";
        if (AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY) != null) {
        }
    }

    /* renamed from: ˊ  reason: contains not printable characters */
    public final void m1143(Context context, String str) {
        if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false) && AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_USER_ID) == null) {
            AFLogger.afInfoLog("CustomerUserId not set, Tracking is disabled", true);
            return;
        }
        HashMap hashMap = new HashMap();
        String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
        if (string == null) {
            AFLogger.afWarnLog("[registerUninstall] AppsFlyer's SDK cannot send any event without providing DevKey.");
            return;
        }
        PackageManager packageManager = context.getPackageManager();
        String packageName = context.getPackageName();
        try {
            PackageInfo packageInfo = packageManager.getPackageInfo(packageName, 0);
            hashMap.put("app_version_code", Integer.toString(packageInfo.versionCode));
            hashMap.put("app_version_name", packageInfo.versionName);
            hashMap.put("app_name", packageManager.getApplicationLabel(packageInfo.applicationInfo).toString());
            long j = packageInfo.firstInstallTime;
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
            hashMap.put("installDate", simpleDateFormat.format(new Date(j)));
        } catch (Throwable th) {
            AFLogger.afErrorLog("Exception while collecting application version info.", th);
        }
        m1134(context, hashMap);
        String string2 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_USER_ID);
        if (string2 != null) {
            hashMap.put("appUserId", string2);
        }
        try {
            hashMap.put(DeviceRequestsHelper.DEVICE_INFO_MODEL, Build.MODEL);
            hashMap.put("brand", Build.BRAND);
        } catch (Throwable th2) {
            AFLogger.afErrorLog("Exception while collecting device brand and model.", th2);
        }
        if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, false)) {
            hashMap.put(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
        }
        u r3 = v.m1248(context.getContentResolver());
        if (r3 != null) {
            hashMap.put("amazon_aid", r3.f2138);
            hashMap.put("amazon_aid_limit", String.valueOf(r3.f2140));
        }
        String string3 = AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM);
        if (string3 != null) {
            hashMap.put(ServerParameters.ADVERTISING_ID_PARAM, string3);
        }
        hashMap.put("devkey", string);
        hashMap.put("uid", af.m1186(new WeakReference(context)));
        hashMap.put("af_gcm_token", str);
        hashMap.put("launch_counter", Integer.toString(m1108(context.getApplicationContext().getSharedPreferences("appsflyer-data", 0), "appsFlyerCount", false)));
        hashMap.put("sdk", Integer.toString(Build.VERSION.SDK_INT));
        String r12 = m1103(new WeakReference(context));
        if (r12 != null) {
            hashMap.put(AppsFlyerProperties.CHANNEL, r12);
        }
        try {
            ab abVar = new ab(context, isTrackingStopped());
            abVar.f1965 = new JSONObject(hashMap).toString();
            StringBuilder sb = new StringBuilder();
            sb.append(ServerConfigHandler.getUrl("https://%sregister.%s/api/v4.11/androidevent?buildnumber=5.0.0&app_id="));
            sb.append(packageName);
            new Thread(
            /*  JADX ERROR: Method code generation error
                jadx.core.utils.exceptions.CodegenException: Error generate insn: 0x0174: INVOKE  
                  (wrap: java.lang.Thread : 0x0171: CONSTRUCTOR  (r0v6 java.lang.Thread) = 
                  (wrap: com.appsflyer.internal.ab$3 : 0x016e: CONSTRUCTOR  (r1v4 com.appsflyer.internal.ab$3) = 
                  (r12v10 'abVar' com.appsflyer.internal.ab)
                  (wrap: java.lang.String : 0x0166: INVOKE  (r11v5 java.lang.String) = (r11v4 'sb' java.lang.StringBuilder) type: VIRTUAL call: java.lang.Object.toString():java.lang.String)
                 call: com.appsflyer.internal.ab.3.<init>(com.appsflyer.internal.ab, java.lang.String):void type: CONSTRUCTOR)
                 call: java.lang.Thread.<init>(java.lang.Runnable):void type: CONSTRUCTOR)
                 type: VIRTUAL call: java.lang.Thread.start():void in method: com.appsflyer.AppsFlyerLibCore.ￋﾊ(android.content.Context, java.lang.String):void, file: classes.dex
                	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:255)
                	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:217)
                	at jadx.core.codegen.RegionGen.makeSimpleBlock(RegionGen.java:110)
                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:56)
                	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93)
                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59)
                	at jadx.core.codegen.RegionGen.makeRegionIndent(RegionGen.java:99)
                	at jadx.core.codegen.RegionGen.makeTryCatch(RegionGen.java:306)
                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:69)
                	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93)
                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59)
                	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93)
                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59)
                	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93)
                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59)
                	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93)
                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59)
                	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93)
                	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59)
                	at jadx.core.codegen.MethodGen.addRegionInsns(MethodGen.java:244)
                	at jadx.core.codegen.MethodGen.addInstructions(MethodGen.java:237)
                	at jadx.core.codegen.ClassGen.addMethodCode(ClassGen.java:342)
                	at jadx.core.codegen.ClassGen.addMethod(ClassGen.java:295)
                	at jadx.core.codegen.ClassGen.lambda$addInnerClsAndMethods$2(ClassGen.java:264)
                	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)
                Caused by: jadx.core.utils.exceptions.CodegenException: Error generate insn: 0x0171: CONSTRUCTOR  (r0v6 java.lang.Thread) = 
                  (wrap: com.appsflyer.internal.ab$3 : 0x016e: CONSTRUCTOR  (r1v4 com.appsflyer.internal.ab$3) = 
                  (r12v10 'abVar' com.appsflyer.internal.ab)
                  (wrap: java.lang.String : 0x0166: INVOKE  (r11v5 java.lang.String) = (r11v4 'sb' java.lang.StringBuilder) type: VIRTUAL call: java.lang.Object.toString():java.lang.String)
                 call: com.appsflyer.internal.ab.3.<init>(com.appsflyer.internal.ab, java.lang.String):void type: CONSTRUCTOR)
                 call: java.lang.Thread.<init>(java.lang.Runnable):void type: CONSTRUCTOR in method: com.appsflyer.AppsFlyerLibCore.ￋﾊ(android.content.Context, java.lang.String):void, file: classes.dex
                	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:255)
                	at jadx.core.codegen.InsnGen.addWrappedArg(InsnGen.java:119)
                	at jadx.core.codegen.InsnGen.addArg(InsnGen.java:103)
                	at jadx.core.codegen.InsnGen.addArgDot(InsnGen.java:87)
                	at jadx.core.codegen.InsnGen.makeInvoke(InsnGen.java:715)
                	at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:367)
                	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:249)
                	... 27 more
                Caused by: jadx.core.utils.exceptions.CodegenException: Error generate insn: 0x016e: CONSTRUCTOR  (r1v4 com.appsflyer.internal.ab$3) = 
                  (r12v10 'abVar' com.appsflyer.internal.ab)
                  (wrap: java.lang.String : 0x0166: INVOKE  (r11v5 java.lang.String) = (r11v4 'sb' java.lang.StringBuilder) type: VIRTUAL call: java.lang.Object.toString():java.lang.String)
                 call: com.appsflyer.internal.ab.3.<init>(com.appsflyer.internal.ab, java.lang.String):void type: CONSTRUCTOR in method: com.appsflyer.AppsFlyerLibCore.ￋﾊ(android.content.Context, java.lang.String):void, file: classes.dex
                	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:255)
                	at jadx.core.codegen.InsnGen.addWrappedArg(InsnGen.java:119)
                	at jadx.core.codegen.InsnGen.addArg(InsnGen.java:103)
                	at jadx.core.codegen.InsnGen.generateMethodArguments(InsnGen.java:806)
                	at jadx.core.codegen.InsnGen.makeConstructor(InsnGen.java:663)
                	at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:363)
                	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:230)
                	... 33 more
                Caused by: jadx.core.utils.exceptions.JadxRuntimeException: Expected class to be processed at this point, class: com.appsflyer.internal.ab, state: GENERATED_AND_UNLOADED
                	at jadx.core.dex.nodes.ClassNode.ensureProcessed(ClassNode.java:215)
                	at jadx.core.codegen.InsnGen.makeConstructor(InsnGen.java:630)
                	at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:363)
                	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:230)
                	... 39 more
                */
            /*
            // Method dump skipped, instructions count: 385
            */
            throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.AppsFlyerLibCore.m1143(android.content.Context, java.lang.String):void");
        }

        /* renamed from: ˏ  reason: contains not printable characters */
        public static /* synthetic */ void m1125(AppsFlyerLibCore appsFlyerLibCore, j jVar) throws IOException {
            String str;
            StringBuilder sb = new StringBuilder("url: ");
            sb.append(jVar.f2095);
            AFLogger.afInfoLog(sb.toString());
            if (jVar.f2086 != null) {
                str = Base64.encodeToString(jVar.f2097, 2);
                AFLogger.afInfoLog("cached data: ".concat(String.valueOf(str)));
            } else {
                str = new JSONObject(jVar.f2093).toString();
                AFFacebookDeferredDeeplink.AnonymousClass3.m1075("data: ".concat(String.valueOf(str)));
            }
            if (ae.f1979 == null) {
                ae.f1979 = new ae();
            }
            ae.f1979.m1180("server_request", jVar.f2095, str);
            try {
                appsFlyerLibCore.m1140(jVar);
            } catch (IOException e2) {
                AFLogger.afErrorLog("Exception in sendRequestToServer. ", e2);
                if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.USE_HTTP_FALLBACK, false)) {
                    jVar.f2095 = jVar.f2095.replace("https:", "http:");
                    appsFlyerLibCore.m1140(jVar);
                    return;
                }
                StringBuilder sb2 = new StringBuilder("failed to send requeset to server. ");
                sb2.append(e2.getLocalizedMessage());
                AFLogger.afInfoLog(sb2.toString());
                throw e2;
            }
        }

        /* renamed from: ॱ  reason: contains not printable characters */
        public static void m1134(Context context, Map<String, ? super String> map) {
            s sVar = s.e.f2121;
            s.d r2 = s.m1240(context);
            map.put("network", r2.f2118);
            String str = r2.f2120;
            if (str != null) {
                map.put("operator", str);
            }
            String str2 = r2.f2119;
            if (str2 != null) {
                map.put("carrier", str2);
            }
        }
    }
