Maxcredito v1.2.1版本的 MD5 值为:2605738f37f8ddb81288799ddcbfcbe8

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


package com.appsflyer.internal;

import android.app.Activity;
import android.app.Application;
import android.app.UiModeManager;
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.graphics.Color;
import android.graphics.drawable.Drawable;
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.os.Environment;
import android.os.StatFs;
import android.os.SystemClock;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Base64;
import android.view.WindowManager;
import androidx.recyclerview.widget.RecyclerView;
import com.appsflyer.AFInAppEventParameterName;
import com.appsflyer.AFInAppEventType;
import com.appsflyer.AFKeystoreWrapper;
import com.appsflyer.AFLogger;
import com.appsflyer.AFVersionDeclaration;
import com.appsflyer.AppsFlyerConversionListener;
import com.appsflyer.AppsFlyerInAppPurchaseValidatorListener;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerProperties;
import com.appsflyer.attribution.AppsFlyerRequestListener;
import com.appsflyer.attribution.RequestError;
import com.appsflyer.deeplink.DeepLinkListener;
import com.appsflyer.deeplink.DeepLinkResult;
import com.appsflyer.internal.af;
import com.appsflyer.internal.ai;
import com.appsflyer.internal.am;
import com.appsflyer.internal.b;
import com.appsflyer.internal.bs;
import com.appsflyer.internal.e;
import com.appsflyer.internal.o;
import com.appsflyer.internal.u;
import com.appsflyer.internal.v;
import com.appsflyer.internal.x;
import com.facebook.appevents.UserDataStore;
import com.facebook.applinks.AppLinkData;
import com.facebook.devicerequests.internal.DeviceRequestsHelper;
import com.facebook.internal.ServerProtocol;
import com.facebook.share.internal.ShareConstants;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.search.SearchAuth;
import com.google.android.material.datepicker.UtcDates;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
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.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.HttpURLConnection;
import java.net.NetworkInterface;
import java.net.URI;
import java.net.URL;
import java.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.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.TimeZone;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.regex.Pattern;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

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

    public static class AnonymousClass8 {
        public static final int[] AFInAppEventType;
        public static final int[] values;

        static {
            int[] iArr = new int[bs.e.values().length];
            values = iArr;
            try {
                iArr[bs.e.FINISHED.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                values[bs.e.STARTED.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            int[] iArr2 = new int[AppsFlyerProperties.EmailsCryptType.values().length];
            AFInAppEventType = iArr2;
            try {
                iArr2[AppsFlyerProperties.EmailsCryptType.SHA256.ordinal()] = 1;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                AFInAppEventType[AppsFlyerProperties.EmailsCryptType.NONE.ordinal()] = 2;
            } catch (NoSuchFieldError unused4) {
            }
        }
    }

    public class a implements Runnable {
        private h valueOf;

        public a(ah ahVar, h hVar, byte b) {
            this(hVar);
        }

        @Override
        public final void run() {
            ah.AFInAppEventParameterName(ah.this, this.valueOf);
        }

        private a(h hVar) {
            this.valueOf = hVar;
        }
    }

    public class c implements Runnable {
        private final Application valueOf;

        public c(Context context) {
            this.valueOf = (Application) context.getApplicationContext();
        }

        @Override
        public final void run() {
            if (ah.this.AppsFlyerLib) {
                return;
            }
            ah.this.AFVersionDeclaration = System.currentTimeMillis();
            ah.this.AppsFlyerLib = true;
            try {
                try {
                    String values = ah.values(AppsFlyerProperties.AF_KEY);
                    ag.AFKeystoreWrapper();
                    for (j jVar : ag.values(this.valueOf)) {
                        StringBuilder sb = new StringBuilder("resending request: ");
                        sb.append(jVar.AFInAppEventParameterName);
                        AFLogger.valueOf(sb.toString());
                        try {
                            long currentTimeMillis = System.currentTimeMillis();
                            long parseLong = Long.parseLong(jVar.AFInAppEventType, 10);
                            ah ahVar = ah.this;
                            bg bgVar = new bg();
                            StringBuilder sb2 = new StringBuilder();
                            sb2.append(jVar.AFInAppEventParameterName);
                            sb2.append("&isCachedRequest=true&timeincache=");
                            sb2.append((currentTimeMillis - parseLong) / 1000);
                            h AFInAppEventParameterName = bgVar.AFInAppEventParameterName(sb2.toString());
                            AFInAppEventParameterName.init = jVar.valueOf();
                            AFInAppEventParameterName.AFVersionDeclaration = values;
                            Application application = this.valueOf;
                            if (application != null) {
                                AFInAppEventParameterName.valueOf = (Application) application.getApplicationContext();
                            }
                            AFInAppEventParameterName.AppsFlyer2dXConversionCallback = jVar.AFInAppEventType;
                            AFInAppEventParameterName.onInstallConversionDataLoadedNative = false;
                            ah.values(ahVar, AFInAppEventParameterName);
                        } catch (Exception e2) {
                            AFLogger.values("Failed to resend cached request", e2);
                        }
                    }
                } catch (Throwable th) {
                    ah.this.AppsFlyerLib = false;
                    throw th;
                }
            } catch (Exception e3) {
                AFLogger.values("failed to check cache. ", e3);
            }
            ah.this.AppsFlyerLib = false;
            ah.this.AppsFlyerInAppPurchaseValidatorListener.shutdown();
            ah.onInstallConversionFailureNative(ah.this);
        }
    }

    public class d implements Runnable {
        private final h valueOf;

        public d(ah ahVar, h hVar, byte b) {
            this(hVar);
        }

        @Override
        public final void run() {
            IOException iOException;
            AppsFlyerRequestListener appsFlyerRequestListener;
            Throwable th;
            OutputStreamWriter outputStreamWriter;
            String str;
            Map<String, Object> AFInAppEventType = this.valueOf.AFInAppEventType();
            boolean AFInAppEventParameterName = this.valueOf.AFInAppEventParameterName();
            h hVar = this.valueOf;
            String str2 = hVar.onAttributionFailureNative;
            int i2 = hVar.onInstallConversionFailureNative;
            Application application = hVar.valueOf;
            if (ah.this.isStopped()) {
                AppsFlyerRequestListener appsFlyerRequestListener2 = this.valueOf.AFKeystoreWrapper;
                if (appsFlyerRequestListener2 != null) {
                    appsFlyerRequestListener2.onError(RequestError.STOP_TRACKING, at.values);
                    return;
                }
                return;
            }
            byte[] bArr = new byte[0];
            if (AFInAppEventParameterName && i2 <= 2) {
                ArrayList arrayList = new ArrayList();
                if (ah.this.onDeepLinkingNative != null) {
                    for (bs bsVar : ah.this.onDeepLinkingNative) {
                        boolean z = bsVar instanceof bp;
                        int i3 = AnonymousClass8.values[bsVar.AFKeystoreWrapper.ordinal()];
                        if (i3 == 1) {
                            if (z) {
                                AFInAppEventType.put("rfr", ((bp) bsVar).valueOf);
                                ah.values(application).edit().putBoolean(AppsFlyerProperties.NEW_REFERRER_SENT, true).apply();
                            }
                            arrayList.add(bsVar.values);
                        } else if (i3 == 2 && i2 == 2 && !z) {
                            HashMap hashMap = new HashMap();
                            hashMap.put("source", bsVar.AFInAppEventParameterName);
                            hashMap.put("response", "TIMEOUT");
                            hashMap.putAll(new bv());
                            arrayList.add(hashMap);
                        }
                    }
                }
                if (!arrayList.isEmpty()) {
                    AFInAppEventType.put("referrers", arrayList);
                }
                if (ah.this.waitForCustomerUserId != null) {
                    AFInAppEventType.put("fb_ddl", ah.this.waitForCustomerUserId);
                }
            }
            if (!(this.valueOf instanceof bf)) {
                AFInAppEventType.putAll(new b.e(AFInAppEventType, application));
                AFInAppEventType.putAll(ah.this.AFInAppEventType());
            }
            ?? r5 = 0;
            r5 = 0;
            r5 = 0;
            r5 = 0;
            r5 = 0;
            try {
                try {
                    h hVar2 = this.valueOf;
                    if (hVar2 instanceof bf) {
                        str = (String) AFInAppEventType.get("af_key");
                    } else {
                        str = (String) AFInAppEventType.get("appsflyerKey");
                    }
                    hVar2.AFVersionDeclaration = str;
                    synchronized (AFInAppEventType) {
                        try {
                            try {
                                byte[] bArr2 = (byte[]) ((Class) com.appsflyer.internal.d.AFInAppEventParameterName((-16777168) - Color.rgb(0, 0, 0), Drawable.resolveOpacity(0, 0) + 24, (char) (1 - (SystemClock.elapsedRealtime() > 0L ? 1 : (SystemClock.elapsedRealtime() == 0L ? 0 : -1))))).getDeclaredMethod("valueOf", h.class).invoke(null, this.valueOf);
                                try {
                                    try {
                                        ah ahVar = ah.this;
                                        h hVar3 = this.valueOf;
                                        hVar3.init = bArr2;
                                        ah.values(ahVar, hVar3);
                                        return;
                                    } catch (IOException e2) {
                                        iOException = e2;
                                        bArr = bArr2;
                                        AFLogger.values("Exception while sending request to server. ", iOException);
                                        if (bArr != null && application != null && !str2.contains("&isCachedRequest=true&timeincache=")) {
                                            ag.AFKeystoreWrapper();
                                            j jVar = new j(str2, bArr, "6.2.3");
                                            try {
                                                try {
                                                    try {
                                                        File AFInAppEventType2 = ag.AFInAppEventType(application);
                                                        if (!AFInAppEventType2.exists()) {
                                                            AFInAppEventType2.mkdir();
                                                        } else {
                                                            File[] listFiles = AFInAppEventType2.listFiles();
                                                            if (listFiles != null && listFiles.length > 40) {
                                                                AFLogger.valueOf("reached cache limit, not caching request");
                                                            } else {
                                                                AFLogger.valueOf("caching request...");
                                                                File file = new File(ag.AFInAppEventType(application), Long.toString(System.currentTimeMillis()));
                                                                file.createNewFile();
                                                                OutputStreamWriter outputStreamWriter2 = new OutputStreamWriter(new FileOutputStream(file.getPath(), true));
                                                                try {
                                                                    outputStreamWriter2.write("version=");
                                                                    outputStreamWriter2.write(jVar.AFKeystoreWrapper);
                                                                    outputStreamWriter2.write(10);
                                                                    outputStreamWriter2.write("url=");
                                                                    outputStreamWriter2.write(jVar.AFInAppEventParameterName);
                                                                    outputStreamWriter2.write(10);
                                                                    r5 = "data=";
                                                                    outputStreamWriter2.write("data=");
                                                                    outputStreamWriter2.write(Base64.encodeToString(jVar.valueOf(), 2));
                                                                    outputStreamWriter2.write(10);
                                                                    outputStreamWriter2.flush();
                                                                    outputStreamWriter2.close();
                                                                } catch (Exception e3) {
                                                                    e = e3;
                                                                    r5 = outputStreamWriter2;
                                                                    AFLogger.values("Could not cache request", e);
                                                                    if (r5 != 0) {
                                                                        r5.close();
                                                                    }
                                                                    AFLogger.values(iOException.getMessage(), iOException);
                                                                    appsFlyerRequestListener = this.valueOf.AFKeystoreWrapper;
                                                                    if (appsFlyerRequestListener != null) {
                                                                    }
                                                                    bc.AFKeystoreWrapper(iOException.getMessage());
                                                                    return;
                                                                } catch (Throwable th2) {
                                                                    th = th2;
                                                                    outputStreamWriter = outputStreamWriter2;
                                                                    if (outputStreamWriter != null) {
                                                                        try {
                                                                            outputStreamWriter.close();
                                                                            throw th;
                                                                        } catch (IOException e4) {
                                                                            AFLogger.values(e4);
                                                                            throw th;
                                                                        }
                                                                    }
                                                                    throw th;
                                                                }
                                                            }
                                                        }
                                                    } catch (IOException e5) {
                                                        AFLogger.values(e5);
                                                    }
                                                } catch (Exception e6) {
                                                    e = e6;
                                                }
                                                AFLogger.values(iOException.getMessage(), iOException);
                                            } catch (Throwable th3) {
                                                th = th3;
                                                outputStreamWriter = r5;
                                            }
                                        }
                                        appsFlyerRequestListener = this.valueOf.AFKeystoreWrapper;
                                        if (appsFlyerRequestListener != null) {
                                            appsFlyerRequestListener.onError(RequestError.NETWORK_FAILURE, iOException.getMessage());
                                        }
                                        bc.AFKeystoreWrapper(iOException.getMessage());
                                        return;
                                    }
                                } catch (Throwable th4) {
                                    th = th4;
                                    bArr = bArr2;
                                }
                            } catch (Throwable th5) {
                                Throwable cause = th5.getCause();
                                if (cause == null) {
                                    throw th5;
                                }
                                throw cause;
                            }
                        } catch (Throwable th6) {
                            th = th6;
                        }
                    }
                    throw th;
                } catch (Throwable th7) {
                    AFLogger.AFInAppEventParameterName(th7.getMessage(), th7);
                    AppsFlyerRequestListener appsFlyerRequestListener3 = this.valueOf.AFKeystoreWrapper;
                    if (appsFlyerRequestListener3 != null) {
                        appsFlyerRequestListener3.onError(RequestError.NETWORK_FAILURE, th7.getMessage());
                    }
                }
            } catch (IOException e7) {
                iOException = e7;
            }
        }

        private d(h hVar) {
            this.valueOf = hVar;
        }
    }

    static {
        StringBuilder sb = new StringBuilder();
        sb.append(AFInAppEventParameterName);
        sb.append("/androidevent?buildnumber=6.2.3&app_id=");
        values = sb.toString();
        StringBuilder sb2 = new StringBuilder("https://%sadrevenue.%s/api/v");
        sb2.append(AFInAppEventParameterName);
        sb2.append("/android?buildnumber=6.2.3&app_id=");
        onInstallConversionFailureNative = sb2.toString();
        StringBuilder sb3 = new StringBuilder();
        sb3.append(AFInAppEventParameterName);
        sb3.append("/androidevent?app_id=");
        String obj = sb3.toString();
        onAppOpenAttributionNative = obj;
        StringBuilder sb4 = new StringBuilder("https://%sconversions.%s/api/v");
        sb4.append(obj);
        onInstallConversionDataLoadedNative = sb4.toString();
        StringBuilder sb5 = new StringBuilder("https://%slaunches.%s/api/v");
        sb5.append(obj);
        onAppOpenAttribution = sb5.toString();
        StringBuilder sb6 = new StringBuilder("https://%sinapps.%s/api/v");
        sb6.append(obj);
        onAttributionFailure = sb6.toString();
        StringBuilder sb7 = new StringBuilder("https://%sattr.%s/api/v");
        sb7.append(obj);
        onConversionDataSuccess = sb7.toString();
        AFKeystoreWrapper = null;
        AFInAppEventType = null;
        onConversionDataFail = new ah();
    }

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

    public static ScheduledExecutorService onInstallConversionFailureNative(ah ahVar) {
        ahVar.AppsFlyerInAppPurchaseValidatorListener = null;
        return null;
    }

    @Override
    public void addPushNotificationDeepLinkPath(String... strArr) {
        List<String> asList = Arrays.asList(strArr);
        List<List<String>> list = f.values().AFVersionDeclaration;
        if (list.contains(asList)) {
            return;
        }
        list.add(asList);
    }

    @Override
    public void anonymizeUser(boolean z) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "anonymizeUser", String.valueOf(z));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, z);
    }

    @Override
    public void appendParametersToDeepLinkingURL(String str, Map<String, String> map) {
        f values2 = f.values();
        values2.AFLogger$LogLevel = str;
        values2.AppsFlyer2dXConversionCallback = map;
    }

    @Override
    public void enableFacebookDeferredApplinks(boolean z) {
        this.setCustomerUserId = z;
    }

    @Override
    public AppsFlyerLib enableLocationCollection(boolean z) {
        this.stop = z;
        return this;
    }

    @Override
    public String getAppsFlyerUID(Context context) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "getAppsFlyerUID", new String[0]);
        return an.AFKeystoreWrapper(new WeakReference(context));
    }

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

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

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

    @Override
    public String getOutOfStore(Context context) {
        String string = AppsFlyerProperties.getInstance().getString("api_store_value");
        if (string != null) {
            return string;
        }
        String AFInAppEventParameterName2 = context == null ? null : AFInAppEventParameterName("AF_STORE", context.getPackageManager(), context.getPackageName());
        if (AFInAppEventParameterName2 != null) {
            return AFInAppEventParameterName2;
        }
        AFLogger.valueOf("No out-of-store value set");
        return null;
    }

    @Override
    public String getSdkVersion() {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "getSdkVersion", new String[0]);
        StringBuilder sb = new StringBuilder("version: 6.2.3 (build ");
        sb.append(valueOf);
        sb.append(")");
        return sb.toString();
    }

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

    @Override
    public boolean isStopped() {
        return this.setDebugLog;
    }

    @Override
    public void logEvent(Context context, String str, Map<String, Object> map, AppsFlyerRequestListener appsFlyerRequestListener) {
        bm bmVar = new bm();
        if (context != null) {
            bmVar.valueOf = (Application) context.getApplicationContext();
        }
        bmVar.AFLogger$LogLevel = str;
        bmVar.AFInAppEventType = map == null ? null : new HashMap(map);
        bmVar.AFKeystoreWrapper = appsFlyerRequestListener;
        ap AFInAppEventParameterName2 = ap.AFInAppEventParameterName();
        String[] strArr = new String[2];
        strArr[0] = str;
        Map map2 = bmVar.AFInAppEventType;
        if (map2 == null) {
            map2 = new HashMap();
        }
        strArr[1] = new JSONObject((Map<?, ?>) map2).toString();
        AFInAppEventParameterName2.valueOf("public_api_call", "logEvent", strArr);
        if (str != null) {
            ad.AFInAppEventParameterName(context).AFKeystoreWrapper();
        }
        AFKeystoreWrapper(bmVar, context instanceof Activity ? (Activity) context : null);
    }

    @Override
    public void logLocation(Context context, double d2, double d3) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "logLocation", String.valueOf(d2), String.valueOf(d3));
        HashMap hashMap = new HashMap();
        hashMap.put(AFInAppEventParameterName.LONGTITUDE, Double.toString(d3));
        hashMap.put(AFInAppEventParameterName.LATITUDE, Double.toString(d2));
        AFInAppEventType(context, AFInAppEventType.LOCATION_COORDINATES, hashMap);
    }

    @Override
    public void logSession(Context context) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "logSession", new String[0]);
        ap.AFInAppEventParameterName().AFInAppEventType = false;
        AFInAppEventType(context, null, null);
    }

    @Override
    public void onPause(Context context) {
        af.b bVar = af.AFKeystoreWrapper;
        if (bVar != null) {
            bVar.values(context);
        }
    }

    @Override
    public void performOnAppAttribution(Context context, URI uri) {
        if (uri == null || uri.toString().isEmpty()) {
            StringBuilder sb = new StringBuilder("Link is \"");
            sb.append(uri);
            sb.append("\"");
            aq.valueOf(sb.toString());
            return;
        }
        if (context == null) {
            StringBuilder sb2 = new StringBuilder("Context is \"");
            sb2.append(context);
            sb2.append("\"");
            aq.valueOf(sb2.toString());
            return;
        }
        f.values().values(context, new HashMap(), Uri.parse(uri.toString()));
    }

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

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

    @Override
    public void sendAdRevenue(Context context, Map<String, Object> map) {
        bf bfVar = new bf();
        if (context != null) {
            bfVar.valueOf = (Application) context.getApplicationContext();
        }
        bfVar.AFInAppEventType = map;
        Application application = bfVar.valueOf;
        byte b = 0;
        String format = String.format(onInstallConversionFailureNative, AppsFlyerLib.getInstance().getHostPrefix(), onConversionDataFail.getHostName());
        StringBuilder sb = new StringBuilder();
        sb.append(format);
        sb.append(application.getPackageName());
        String obj = sb.toString();
        SharedPreferences values2 = values(application);
        int values3 = values(values2, "appsFlyerCount", false);
        int values4 = values(values2, "appsFlyerAdRevenueCount", true);
        HashMap hashMap = new HashMap();
        hashMap.put("ad_network", bfVar.AFInAppEventType);
        hashMap.put("adrevenue_counter", Integer.valueOf(values4));
        String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
        hashMap.put("af_key", string);
        hashMap.put("launch_counter", Integer.valueOf(values3));
        hashMap.put("af_timestamp", Long.toString(new Date().getTime()));
        hashMap.put("uid", an.AFKeystoreWrapper(new WeakReference(application)));
        String string2 = AppsFlyerProperties.getInstance().getString("advertiserId");
        hashMap.put("advertiserIdEnabled", AppsFlyerProperties.getInstance().getString("advertiserIdEnabled"));
        if (string2 != null) {
            hashMap.put("advertiserId", string2);
        }
        hashMap.put(DeviceRequestsHelper.DEVICE_INFO_DEVICE, Build.DEVICE);
        AFKeystoreWrapper(application, hashMap);
        try {
            PackageInfo packageInfo = application.getPackageManager().getPackageInfo(application.getPackageName(), 0);
            hashMap.put("app_version_code", Integer.toString(packageInfo.versionCode));
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
            long j2 = packageInfo.firstInstallTime;
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
            hashMap.put("install_date", simpleDateFormat.format(new Date(j2)));
            String string3 = values2.getString("appsFlyerFirstInstall", null);
            if (string3 == null) {
                string3 = values(simpleDateFormat, application);
            }
            hashMap.put("first_launch_date", string3);
        } catch (Throwable th) {
            AFLogger.values("AdRevenue - Exception while collecting app version data ", th);
        }
        h values5 = bfVar.AFInAppEventParameterName(obj).values(hashMap);
        values5.onInstallConversionFailureNative = values3;
        values5.AFVersionDeclaration = string;
        d dVar = new d(this, values5, b);
        if (l.AFKeystoreWrapper == null) {
            l.AFKeystoreWrapper = new l();
        }
        AFKeystoreWrapper(l.AFKeystoreWrapper.values(), dVar, 1L, TimeUnit.MILLISECONDS);
    }

    @Override
    public void sendPushNotificationData(Activity activity) {
        long j2;
        if (activity != null && activity.getIntent() != null) {
            ap AFInAppEventParameterName2 = ap.AFInAppEventParameterName();
            StringBuilder sb = new StringBuilder("activity_intent_");
            sb.append(activity.getIntent().toString());
            AFInAppEventParameterName2.valueOf("public_api_call", "sendPushNotificationData", activity.getLocalClassName(), sb.toString());
        } else if (activity != null) {
            ap.AFInAppEventParameterName().valueOf("public_api_call", "sendPushNotificationData", activity.getLocalClassName(), "activity_intent_null");
        } else {
            ap.AFInAppEventParameterName().valueOf("public_api_call", "sendPushNotificationData", "activity_null");
        }
        String values2 = values(activity);
        this.updateServerUninstallToken = values2;
        if (values2 != null) {
            long currentTimeMillis = System.currentTimeMillis();
            if (this.onPause == null) {
                AFLogger.valueOf("pushes: initializing pushes history..");
                this.onPause = new ConcurrentHashMap();
                j2 = currentTimeMillis;
            } else {
                try {
                    long j3 = AppsFlyerProperties.getInstance().getLong("pushPayloadMaxAging", 1800000L);
                    j2 = currentTimeMillis;
                    for (Long l2 : this.onPause.keySet()) {
                        try {
                            JSONObject jSONObject = new JSONObject(this.updateServerUninstallToken);
                            JSONObject jSONObject2 = new JSONObject(this.onPause.get(l2));
                            if (jSONObject.opt("pid").equals(jSONObject2.opt("pid")) && jSONObject.opt(e.e.b.m3.o1.c.c).equals(jSONObject2.opt(e.e.b.m3.o1.c.c))) {
                                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.valueOf(sb2.toString());
                                this.updateServerUninstallToken = null;
                                return;
                            }
                            if (currentTimeMillis - l2.longValue() > j3) {
                                this.onPause.remove(l2);
                            }
                            if (l2.longValue() <= j2) {
                                j2 = l2.longValue();
                            }
                        } catch (Throwable th) {
                            th = th;
                            StringBuilder sb3 = new StringBuilder("Error while handling push notification measurement: ");
                            sb3.append(th.getClass().getSimpleName());
                            AFLogger.values(sb3.toString(), th);
                            if (this.onPause.size() == AppsFlyerProperties.getInstance().getInt("pushPayloadHistorySize", 2)) {
                            }
                            this.onPause.put(Long.valueOf(currentTimeMillis), this.updateServerUninstallToken);
                            start(activity);
                        }
                    }
                } catch (Throwable th2) {
                    th = th2;
                    j2 = currentTimeMillis;
                }
            }
            if (this.onPause.size() == AppsFlyerProperties.getInstance().getInt("pushPayloadHistorySize", 2)) {
                StringBuilder sb4 = new StringBuilder("pushes: removing oldest overflowing push (oldest push:");
                sb4.append(j2);
                sb4.append(")");
                AFLogger.valueOf(sb4.toString());
                this.onPause.remove(Long.valueOf(j2));
            }
            this.onPause.put(Long.valueOf(currentTimeMillis), this.updateServerUninstallToken);
            start(activity);
        }
    }

    @Override
    public void setAdditionalData(Map<String, Object> map) {
        if (map != null) {
            ap.AFInAppEventParameterName().valueOf("public_api_call", "setAdditionalData", map.toString());
            AppsFlyerProperties.getInstance().setCustomData(new JSONObject((Map<?, ?>) map).toString());
        }
    }

    @Override
    public void setAndroidIdData(String str) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "setAndroidIdData", str);
        this.AFLogger$LogLevel = str;
    }

    @Override
    public void setAppId(String str) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "setAppId", str);
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.APP_ID, str);
    }

    @Override
    public void setAppInviteOneLink(String str) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "setAppInviteOneLink", str);
        AFLogger.valueOf("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
    public void setCollectAndroidID(boolean z) {
        ap.AFInAppEventParameterName().valueOf("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
    public void setCollectIMEI(boolean z) {
        ap.AFInAppEventParameterName().valueOf("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
    public void setCollectOaid(boolean z) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "setCollectOaid", String.valueOf(z));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.COLLECT_OAID, Boolean.toString(z));
    }

    @Override
    public void setCurrencyCode(String str) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "setCurrencyCode", str);
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.CURRENCY_CODE, str);
    }

    @Override
    public void setCustomerIdAndLogSession(String str, Context context) {
        if (context != null) {
            if (AFKeystoreWrapper()) {
                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.values(sb.toString(), true);
                String referrer = AppsFlyerProperties.getInstance().getReferrer(context);
                String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                if (referrer == null) {
                    referrer = "";
                }
                if (context instanceof Activity) {
                    ((Activity) context).getIntent();
                }
                bl blVar = new bl();
                if (context != null) {
                    blVar.valueOf = (Application) context.getApplicationContext();
                }
                blVar.AFLogger$LogLevel = null;
                blVar.AFVersionDeclaration = string;
                blVar.AFInAppEventType = null;
                blVar.getLevel = referrer;
                blVar.AFInAppEventParameterName = null;
                AFInAppEventType(blVar);
                return;
            }
            setCustomerUserId(str);
            AFLogger.values("waitForCustomerUserId is false; setting CustomerUserID: ".concat(String.valueOf(str)), true);
        }
    }

    @Override
    public void setCustomerUserId(String str) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "setCustomerUserId", str);
        AFLogger.valueOf("setCustomerUserId = ".concat(String.valueOf(str)));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.APP_USER_ID, str);
    }

    @Override
    public void setDebugLog(boolean z) {
        setLogLevel(z ? AFLogger.LogLevel.DEBUG : AFLogger.LogLevel.NONE);
    }

    @Override
    public void setExtension(String str) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "setExtension", str);
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.EXTENSION, str);
    }

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

    @Override
    public void setImeiData(String str) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "setImeiData", str);
        this.init = str;
    }

    @Override
    public void setIsUpdate(boolean z) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "setIsUpdate", String.valueOf(z));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.IS_UPDATE, z);
    }

    @Override
    public void setLogLevel(AFLogger.LogLevel logLevel) {
        boolean z = logLevel.getLevel() > AFLogger.LogLevel.NONE.getLevel();
        ap.AFInAppEventParameterName().valueOf("public_api_call", "log", String.valueOf(z));
        AppsFlyerProperties.getInstance().set("shouldLog", z);
        AppsFlyerProperties.getInstance().set("logLevel", logLevel.getLevel());
    }

    @Override
    public void setMinTimeBetweenSessions(int i2) {
        this.onValidateInApp = TimeUnit.SECONDS.toMillis(i2);
    }

    @Override
    public void setOaidData(String str) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "setOaidData", str);
        ac.values = str;
    }

    @Override
    public void setOneLinkCustomDomain(String... strArr) {
        AFLogger.AFKeystoreWrapper(String.format("setOneLinkCustomDomain %s", Arrays.toString(strArr)));
        f.init = strArr;
    }

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

    @Override
    public void setPartnerData(String str, Map<String, Object> map) {
        if (this.sendPushNotificationData == null) {
            this.sendPushNotificationData = new au();
        }
        au auVar = this.sendPushNotificationData;
        if (str == null || str.isEmpty()) {
            AFLogger.AFInAppEventParameterName("Partner ID is missing or `null`");
            return;
        }
        if (map == null || map.isEmpty()) {
            AFLogger.AFInAppEventParameterName(auVar.AFInAppEventParameterName.remove(str) == null ? "Partner data is missing or `null`" : "Cleared partner data for ".concat(String.valueOf(str)));
            return;
        }
        StringBuilder sb = new StringBuilder("Setting partner data for ");
        sb.append(str);
        sb.append(": ");
        sb.append(map);
        AFLogger.AFKeystoreWrapper(sb.toString());
        int length = new JSONObject((Map<?, ?>) map).toString().length();
        if (length > 1000) {
            AFLogger.AFInAppEventParameterName("Partner data 1000 characters limit exceeded");
            HashMap hashMap = new HashMap();
            hashMap.put("error", "limit exceeded: ".concat(String.valueOf(length)));
            auVar.AFKeystoreWrapper.put(str, hashMap);
            return;
        }
        auVar.AFInAppEventParameterName.put(str, map);
        auVar.AFKeystoreWrapper.remove(str);
    }

    @Override
    public void setPhoneNumber(String str) {
        this.getOutOfStore = aj.AFInAppEventParameterName(str);
    }

    @Override
    public void setPreinstallAttribution(String str, String str2, String str3) {
        AFLogger.AFKeystoreWrapper("setPreinstallAttribution API called");
        JSONObject jSONObject = new JSONObject();
        if (str != null) {
            try {
                jSONObject.put("pid", str);
            } catch (JSONException e2) {
                AFLogger.values(e2.getMessage(), e2);
            }
        }
        if (str2 != null) {
            jSONObject.put(e.e.b.m3.o1.c.c, str2);
        }
        if (str3 != null) {
            jSONObject.put("af_siteid", str3);
        }
        if (!jSONObject.has("pid")) {
            AFLogger.AFInAppEventParameterName("Cannot set preinstall attribution data without a media source");
        } else {
            AppsFlyerProperties.getInstance().set("preInstallName", jSONObject.toString());
        }
    }

    @Override
    public void setResolveDeepLinkURLs(String... strArr) {
        AFLogger.AFKeystoreWrapper(String.format("setResolveDeepLinkURLs %s", Arrays.toString(strArr)));
        f.AFInAppEventType = strArr;
    }

    @Override
    public void setSharingFilter(String... strArr) {
        if (strArr == null || Arrays.equals(this.getLevel, new String[]{"all"})) {
            return;
        }
        Pattern compile = Pattern.compile("[\\d\\w_]{1,45}");
        ArrayList arrayList = new ArrayList();
        for (String str : strArr) {
            if (str == null || !compile.matcher(str).matches()) {
                AFLogger.AFInAppEventParameterName("Invalid partner name :".concat(String.valueOf(str)));
            } else {
                arrayList.add(str);
            }
        }
        if (arrayList.isEmpty()) {
            this.getLevel = null;
        } else {
            this.getLevel = (String[]) arrayList.toArray(new String[0]);
        }
    }

    @Override
    public void setSharingFilterForAllPartners() {
        this.getLevel = new String[]{"all"};
    }

    @Override
    public void setUserEmails(String... strArr) {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "setUserEmails", strArr);
        setUserEmails(AppsFlyerProperties.EmailsCryptType.NONE, strArr);
    }

    @Override
    public void start(Context context) {
        start(context, null);
    }

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

    @Override
    public void subscribeForDeepLink(DeepLinkListener deepLinkListener) {
        f.values().values = deepLinkListener;
    }

    @Override
    public void unregisterConversionListener() {
        ap.AFInAppEventParameterName().valueOf("public_api_call", "unregisterConversionListener", new String[0]);
        AFInAppEventType = null;
    }

    @Override
    public void updateServerUninstallToken(Context context, String str) {
        new ba(context).AFInAppEventType(str);
    }

    @Override
    public void validateAndLogInAppPurchase(Context context, String str, String str2, String str3, String str4, String str5, Map<String, String> map) {
        ap AFInAppEventParameterName2 = ap.AFInAppEventParameterName();
        String[] strArr = new String[6];
        strArr[0] = str;
        strArr[1] = str2;
        strArr[2] = str3;
        strArr[3] = str4;
        strArr[4] = str5;
        strArr[5] = map == null ? "" : map.toString();
        AFInAppEventParameterName2.valueOf("public_api_call", "validateAndTrackInAppPurchase", strArr);
        if (!isStopped()) {
            StringBuilder sb = new StringBuilder("Validate in app called with parameters: ");
            sb.append(str3);
            sb.append(" ");
            sb.append(str4);
            sb.append(" ");
            sb.append(str5);
            AFLogger.valueOf(sb.toString());
        }
        if (str != null && str4 != null && str2 != null && str5 != null && str3 != null) {
            Context applicationContext = context.getApplicationContext();
            String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
            if (context instanceof Activity) {
                ((Activity) context).getIntent();
            }
            new Thread(new z(applicationContext, string, str, str2, str3, str4, str5, map)).start();
            return;
        }
        AppsFlyerInAppPurchaseValidatorListener appsFlyerInAppPurchaseValidatorListener = AFKeystoreWrapper;
        if (appsFlyerInAppPurchaseValidatorListener != null) {
            appsFlyerInAppPurchaseValidatorListener.onValidateInAppFailure("Please provide purchase parameters");
        }
    }

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

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

    private boolean AFVersionDeclaration() {
        Map<String, Object> map = this.setCustomerIdAndLogSession;
        return (map == null || map.isEmpty()) ? false : true;
    }

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

    private static boolean getLevel(Context context) {
        return (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID_FORCE_BY_USER, false) || AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_IMEI_FORCE_BY_USER, false)) || !AppsFlyer2dXConversionCallback(context);
    }

    private boolean valueOf(Context context) {
        try {
            Class.forName("com.appsflyer.lvl.AppsFlyerLVL");
            final long currentTimeMillis = System.currentTimeMillis();
            this.setCustomerIdAndLogSession = new ConcurrentHashMap();
            final x.a aVar = new x.a() {
                @Override
                public final void AFInAppEventType(String str, String str2) {
                    ah.this.setCustomerIdAndLogSession.put("signedData", str);
                    ah.this.setCustomerIdAndLogSession.put("signature", str2);
                    ah.this.setCustomerIdAndLogSession.put("ttr", Long.valueOf(System.currentTimeMillis() - currentTimeMillis));
                    AFLogger.valueOf("Successfully retrieved Google LVL data.");
                }

                @Override
                public final void AFInAppEventType(String str, Exception exc) {
                    String message = exc.getMessage();
                    if (message == null) {
                        message = "unknown";
                    }
                    ah.this.setCustomerIdAndLogSession.put("error", message);
                    AFLogger.AFInAppEventParameterName(str, exc);
                }
            };
            try {
                try {
                    Class<?> cls = Class.forName("com.appsflyer.lvl.AppsFlyerLVL");
                    Class<?> cls2 = Class.forName("com.appsflyer.lvl.AppsFlyerLVL$resultListener");
                    cls.getMethod("checkLicense", Long.TYPE, Context.class, cls2).invoke(null, Long.valueOf(currentTimeMillis), context, Proxy.newProxyInstance(cls2.getClassLoader(), new Class[]{cls2}, new InvocationHandler() {
                        public AnonymousClass1() {
                        }

                        @Override
                        public final Object invoke(Object obj, Method method, Object[] objArr) {
                            if (method.getName().equals("onLvlResult")) {
                                String str = objArr[0] != null ? (String) objArr[0] : null;
                                String str2 = objArr[1] != null ? (String) objArr[1] : null;
                                a aVar2 = a.this;
                                if (aVar2 == null) {
                                    AFLogger.AFKeystoreWrapper("onLvlResult invocation succeeded, but listener is null");
                                } else if (str != null && str2 != null) {
                                    aVar2.AFInAppEventType(str, str2);
                                } else if (str2 == null) {
                                    aVar2.AFInAppEventType("onLvlResult with error", new Exception("AFLVL Invalid signature"));
                                } else {
                                    aVar2.AFInAppEventType("onLvlResult with error", new Exception("AFLVL Invalid signedData"));
                                }
                            } else if (method.getName().equals("onLvlFailure")) {
                                a aVar3 = a.this;
                                if (aVar3 != null) {
                                    if (objArr[0] != null) {
                                        aVar3.AFInAppEventType("onLvlFailure with exception", (Exception) objArr[0]);
                                    } else {
                                        aVar3.AFInAppEventType("onLvlFailure", new Exception("unknown"));
                                    }
                                } else {
                                    AFLogger.AFKeystoreWrapper("onLvlFailure: listener is null");
                                }
                            } else {
                                a aVar4 = a.this;
                                if (aVar4 != null) {
                                    aVar4.AFInAppEventType("lvlInvocation failed", new Exception("com.appsflyer.lvl.AppsFlyerLVL$resultListener invocation failed"));
                                }
                            }
                            return null;
                        }
                    }));
                } catch (ClassNotFoundException e2) {
                    aVar.AFInAppEventType(e2.getClass().getSimpleName(), e2);
                } catch (IllegalAccessException e3) {
                    aVar.AFInAppEventType(e3.getClass().getSimpleName(), e3);
                }
            } catch (NoSuchMethodException e4) {
                aVar.AFInAppEventType(e4.getClass().getSimpleName(), e4);
            } catch (InvocationTargetException e5) {
                aVar.AFInAppEventType(e5.getClass().getSimpleName(), e5);
            }
            return true;
        } catch (ClassNotFoundException unused) {
            return false;
        }
    }

    @Override
    public AppsFlyerLib init(String str, AppsFlyerConversionListener appsFlyerConversionListener, Context context) {
        if (this.setOaidData) {
            return this;
        }
        this.setOaidData = true;
        if (context == null) {
            AFLogger.AFInAppEventParameterName("context is null, Google Install Referrer will be not initialized");
        } else {
            if (this.AppsFlyer2dXConversionCallback == null) {
                this.AppsFlyer2dXConversionCallback = new ax(context);
            }
            ax axVar = this.AppsFlyer2dXConversionCallback;
            if (axVar.AFInAppEventType()) {
                axVar.AFInAppEventType.edit().putLong("init_ts", System.currentTimeMillis()).apply();
            }
            this.enableLocationCollection = (Application) context.getApplicationContext();
            final bp bpVar = new bp(new Runnable() {
                @Override
                public final void run() {
                    if (l.AFKeystoreWrapper == null) {
                        l.AFKeystoreWrapper = new l();
                    }
                    ah.AFKeystoreWrapper(l.AFKeystoreWrapper.values(), new Runnable() {
                        @Override
                        public final void run() {
                            try {
                                AFLogger.AFKeystoreWrapper("Install Referrer collected locally");
                                be beVar = new be();
                                Application application = ah.this.enableLocationCollection;
                                if (application != null) {
                                    beVar.valueOf = (Application) application.getApplicationContext();
                                }
                                ah ahVar = ah.this;
                                if (ahVar.AFInAppEventType(beVar, ah.values(ahVar.enableLocationCollection))) {
                                    ah.AFInAppEventParameterName(ah.this, beVar);
                                }
                            } catch (Throwable th) {
                                AFLogger.values(th.getMessage(), th);
                            }
                        }
                    }, 0L, TimeUnit.MILLISECONDS);
                }
            });
            Runnable runnable = new Runnable() {
                @Override
                public final void run() {
                    SharedPreferences values2 = ah.values(ah.this.enableLocationCollection);
                    int values3 = ah.values(values2, "appsFlyerCount", false);
                    boolean z = values2.getBoolean(AppsFlyerProperties.NEW_REFERRER_SENT, false);
                    boolean z2 = bpVar.AFKeystoreWrapper == bs.e.NOT_STARTED;
                    if (values3 == 1) {
                        if (z2 || z) {
                            ah ahVar = ah.this;
                            be beVar = new be();
                            Application application = ah.this.enableLocationCollection;
                            if (application != null) {
                                beVar.valueOf = (Application) application.getApplicationContext();
                            }
                            ah.AFInAppEventParameterName(ahVar, beVar);
                        }
                    }
                }
            };
            bs[] bsVarArr = {bpVar, new br(runnable), new bt(runnable)};
            this.onDeepLinkingNative = bsVarArr;
            for (bs bsVar : bsVarArr) {
                bsVar.AFInAppEventParameterName(this.enableLocationCollection);
            }
            this.setPhoneNumber = valueOf(context);
            aw.AFInAppEventParameterName = this.enableLocationCollection;
        }
        ap AFInAppEventParameterName2 = ap.AFInAppEventParameterName();
        String[] strArr = new String[2];
        strArr[0] = str;
        strArr[1] = appsFlyerConversionListener == null ? "null" : "conversionDataListener";
        AFInAppEventParameterName2.valueOf("public_api_call", "init", strArr);
        AFLogger.values(String.format("Initializing AppsFlyer SDK: (v%s.%s)", "6.2.3", valueOf));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.AF_KEY, str);
        ak.AFInAppEventParameterName(str);
        AFInAppEventType = appsFlyerConversionListener;
        return this;
    }

    @Override
    public void start(Context context, String str) {
        start(context, str, null);
    }

    @Override
    public void subscribeForDeepLink(DeepLinkListener deepLinkListener, long j2) {
        ar.onAppOpenAttributionNative = j2;
        subscribeForDeepLink(deepLinkListener);
    }

    public static ah AFInAppEventParameterName() {
        return onConversionDataFail;
    }

    private void AFInAppEventType(Context context, String str, Map<String, Object> map) {
        bm bmVar = new bm();
        if (context != null) {
            bmVar.valueOf = (Application) context.getApplicationContext();
        }
        bmVar.AFLogger$LogLevel = str;
        bmVar.AFInAppEventType = map;
        AFKeystoreWrapper(bmVar, context instanceof Activity ? (Activity) context : null);
    }

    private static float AFVersionDeclaration(Context context) {
        try {
            Intent registerReceiver = context.getApplicationContext().registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
            int intExtra = registerReceiver.getIntExtra(FirebaseAnalytics.Param.LEVEL, -1);
            int intExtra2 = registerReceiver.getIntExtra("scale", -1);
            if (intExtra == -1 || intExtra2 == -1) {
                return 50.0f;
            }
            return (intExtra / intExtra2) * 100.0f;
        } catch (Throwable th) {
            AFLogger.values(th.getMessage(), th);
            return 1.0f;
        }
    }

    private static void values(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 i2 = 0; i2 < jSONArray.length(); i2++) {
                    arrayList.add(Long.valueOf(jSONArray.getLong(i2)));
                }
            } 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));
                    int i3 = 0;
                    while (i3 < jSONArray2.length()) {
                        if (jSONArray2.getLong(i3) != ((Long) arrayList.get(0)).longValue() && jSONArray2.getLong(i3) != ((Long) arrayList.get(1)).longValue() && jSONArray2.getLong(i3) != ((Long) arrayList.get(arrayList.size() - 1)).longValue()) {
                            i3++;
                            str = next;
                        }
                    }
                } catch (JSONException unused2) {
                }
            }
        }
        if (str != null) {
            jSONObject.remove(str);
        }
    }

    @Override
    public void start(Context context, final String str, final AppsFlyerRequestListener appsFlyerRequestListener) {
        if (af.AFKeystoreWrapper != null) {
            return;
        }
        if (!this.setOaidData) {
            AFLogger.AFInAppEventParameterName("ERROR: AppsFlyer SDK is not initialized! The API call 'start()' must be called after the 'init(String, AppsFlyerConversionListener)' API method, which should be called on the Application's onCreate.");
            if (str == null) {
                if (appsFlyerRequestListener != null) {
                    appsFlyerRequestListener.onError(RequestError.NO_DEV_KEY, at.valueOf);
                    return;
                }
                return;
            }
        }
        this.enableLocationCollection = (Application) context.getApplicationContext();
        ap.AFInAppEventParameterName().valueOf("public_api_call", "start", str);
        String str2 = valueOf;
        AFLogger.valueOf(String.format("Starting AppsFlyer: (v%s.%s)", "6.2.3", str2));
        StringBuilder sb = new StringBuilder("Build Number: ");
        sb.append(str2);
        AFLogger.valueOf(sb.toString());
        AppsFlyerProperties.getInstance().loadProperties(this.enableLocationCollection.getApplicationContext());
        if (!TextUtils.isEmpty(str)) {
            AppsFlyerProperties.getInstance().set(AppsFlyerProperties.AF_KEY, str);
            ak.AFInAppEventParameterName(str);
        } else if (TextUtils.isEmpty(AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY))) {
            AFLogger.AFInAppEventParameterName("ERROR: AppsFlyer SDK is not initialized! You must provide AppsFlyer Dev-Key either in the 'init' API method (should be called on Application's onCreate),or in the start() API (should be called on Activity's onCreate).");
            if (appsFlyerRequestListener != null) {
                appsFlyerRequestListener.onError(RequestError.NO_DEV_KEY, at.valueOf);
                return;
            }
            return;
        }
        Context baseContext = this.enableLocationCollection.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.values("appsflyer_backup_rules.xml detected, using AppsFlyer defined backup rules for AppsFlyer SDK data", true);
                } else {
                    AFLogger.AFInAppEventParameterName("'allowBackup' is set to true; appsflyer_backup_rules.xml not detected.\nAppsFlyer shared preferences should be excluded from auto backup by adding: <exclude domain=\"sharedpref\" path=\"appsflyer-data\"/> to the Application's <full-backup-content> rules");
                }
            }
        } catch (Exception e2) {
            StringBuilder sb2 = new StringBuilder("checkBackupRules Exception: ");
            sb2.append(e2.toString());
            AFLogger.AFInAppEventType(sb2.toString());
        }
        if (this.setCustomerUserId) {
            Context applicationContext = this.enableLocationCollection.getApplicationContext();
            this.waitForCustomerUserId = new HashMap();
            final long currentTimeMillis = System.currentTimeMillis();
            o.d dVar = new o.d() {
                @Override
                public final void AFInAppEventType(String str3, String str4, String str5) {
                    if (str3 != null) {
                        AFLogger.valueOf("Facebook Deferred AppLink data received: ".concat(String.valueOf(str3)));
                        ah.this.waitForCustomerUserId.put("link", str3);
                        if (str4 != null) {
                            ah.this.waitForCustomerUserId.put("target_url", str4);
                        }
                        if (str5 != null) {
                            HashMap hashMap = new HashMap();
                            HashMap hashMap2 = new HashMap();
                            hashMap2.put(ShareConstants.PROMO_CODE, str5);
                            hashMap.put(ShareConstants.DEEPLINK_CONTEXT, hashMap2);
                            ah.this.waitForCustomerUserId.put("extras", hashMap);
                        }
                    } else {
                        ah.this.waitForCustomerUserId.put("link", "");
                    }
                    ah.this.waitForCustomerUserId.put("ttr", String.valueOf(System.currentTimeMillis() - currentTimeMillis));
                }

                @Override
                public final void values(String str3) {
                    ah.this.waitForCustomerUserId.put("error", str3);
                }
            };
            try {
                Class.forName("com.facebook.FacebookSdk").getMethod("sdkInitialize", Context.class).invoke(null, applicationContext);
                Class<?> cls = Class.forName("com.facebook.applinks.AppLinkData");
                Class<?> cls2 = Class.forName("com.facebook.applinks.AppLinkData$CompletionHandler");
                Method method = cls.getMethod("fetchDeferredAppLinkData", Context.class, String.class, cls2);
                Object newProxyInstance = Proxy.newProxyInstance(cls2.getClassLoader(), new Class[]{cls2}, new InvocationHandler() {
                    private d AFInAppEventType;
                    private Class values;

                    public AnonymousClass1(Class cls3, d dVar2) {
                        r1 = cls3;
                        r2 = dVar2;
                    }

                    @Override
                    public final Object invoke(Object obj, Method method2, Object[] objArr) throws Throwable {
                        String str3;
                        String str4;
                        String str5;
                        Bundle bundle;
                        if (method2.getName().equals("onDeferredAppLinkDataFetched")) {
                            if (objArr[0] != null) {
                                Bundle bundle2 = (Bundle) Bundle.class.cast(r1.getMethod("getArgumentBundle", new Class[0]).invoke(r1.cast(objArr[0]), new Object[0]));
                                if (bundle2 != null) {
                                    str4 = bundle2.getString(AppLinkData.ARGUMENTS_NATIVE_URL);
                                    str5 = bundle2.getString("target_url");
                                    Bundle bundle3 = bundle2.getBundle("extras");
                                    str3 = (bundle3 == null || (bundle = bundle3.getBundle(ShareConstants.DEEPLINK_CONTEXT)) == null) ? null : bundle.getString(ShareConstants.PROMO_CODE);
                                } else {
                                    str3 = null;
                                    str4 = null;
                                    str5 = null;
                                }
                                d dVar2 = r2;
                                if (dVar2 != null) {
                                    dVar2.AFInAppEventType(str4, str5, str3);
                                }
                            } else {
                                d dVar3 = r2;
                                if (dVar3 != null) {
                                    dVar3.AFInAppEventType(null, null, null);
                                }
                            }
                            return null;
                        }
                        d dVar4 = r2;
                        if (dVar4 != null) {
                            dVar4.values("onDeferredAppLinkDataFetched invocation failed");
                        }
                        return null;
                    }
                });
                String string = applicationContext.getString(applicationContext.getResources().getIdentifier("facebook_app_id", "string", applicationContext.getPackageName()));
                if (TextUtils.isEmpty(string)) {
                    dVar2.values("Facebook app id not defined in resources");
                } else {
                    method.invoke(null, applicationContext, string, newProxyInstance);
                }
            } catch (ClassNotFoundException e3) {
                dVar2.values(e3.toString());
            } catch (IllegalAccessException e4) {
                dVar2.values(e4.toString());
            } catch (NoSuchMethodException e5) {
                dVar2.values(e5.toString());
            } catch (InvocationTargetException e6) {
                dVar2.values(e6.toString());
            }
        }
        af.valueOf(context, new af.b() {
            @Override
            public final void valueOf(Activity activity) {
                ah.this.onValidateInAppFailure = System.currentTimeMillis();
                ah ahVar = ah.this;
                if (ahVar.AppsFlyer2dXConversionCallback == null) {
                    ahVar.AppsFlyer2dXConversionCallback = new ax(activity);
                }
                ax axVar = ahVar.AppsFlyer2dXConversionCallback;
                if (axVar.AFInAppEventType()) {
                    axVar.AFInAppEventType.edit().putLong("fg_ts", System.currentTimeMillis()).apply();
                }
                if (ah.values(ah.this.setUserEmails, "appsFlyerCount", false) == 0) {
                    try {
                        ah.this.setAdditionalData.put("init_to_fg", ah.this.onValidateInAppFailure - ah.this.AppsFlyer2dXConversionCallback.AFInAppEventType.getLong("init_ts", 0L));
                    } catch (JSONException unused) {
                    }
                }
                AFLogger.valueOf("onBecameForeground");
                if (ah.values(ah.values((Context) activity), "appsFlyerCount", false) < 2) {
                    ad AFInAppEventParameterName2 = ad.AFInAppEventParameterName(activity);
                    AFInAppEventParameterName2.valueOf.post(AFInAppEventParameterName2.AppsFlyer2dXConversionCallback);
                    AFInAppEventParameterName2.valueOf.post(AFInAppEventParameterName2.AFInAppEventType);
                }
                bl blVar = new bl();
                f values2 = f.values();
                Map<String, Object> AFInAppEventType2 = blVar.AFInAppEventType();
                ax axVar2 = ah.this.AppsFlyer2dXConversionCallback;
                SharedPreferences values3 = ah.values((Context) activity);
                boolean z = values3.getBoolean("ddl_sent", false);
                ah.AFInAppEventParameterName();
                int values4 = ah.values(values3, "appsFlyerCount", false);
                if (!values2.AFKeystoreWrapper(activity.getIntent(), activity, AFInAppEventType2) && values2.values != null && values4 == 0 && !z) {
                    final ar arVar = new ar(activity.getApplicationContext(), axVar2);
                    AFLogger.AFKeystoreWrapper("[DDL] start");
                    FutureTask futureTask = new FutureTask(new Callable<DeepLinkResult>() {
                        @Override
                        public final DeepLinkResult call() throws Exception {
                            Application application = ar.this.valueOf;
                            ar.values(ar.this);
                            ar.this.valueOf(application);
                            return ar.AFKeystoreWrapper(ar.this, application);
                        }
                    });
                    new Thread(futureTask).start();
                    try {
                        arVar.valueOf((DeepLinkResult) futureTask.get(ar.onAppOpenAttributionNative, TimeUnit.MILLISECONDS));
                    } catch (InterruptedException e7) {
                        e = e7;
                        AFLogger.AFInAppEventParameterName("[DDL] Error occurred", e);
                        arVar.valueOf(new DeepLinkResult(null, !(e.getCause() instanceof IOException) ? DeepLinkResult.c.NETWORK : DeepLinkResult.c.UNEXPECTED));
                    } catch (ExecutionException e8) {
                        e = e8;
                        AFLogger.AFInAppEventParameterName("[DDL] Error occurred", e);
                        arVar.valueOf(new DeepLinkResult(null, !(e.getCause() instanceof IOException) ? DeepLinkResult.c.NETWORK : DeepLinkResult.c.UNEXPECTED));
                    } catch (TimeoutException unused2) {
                        StringBuilder sb3 = new StringBuilder("[DDL] Timeout, didn't manage to find deferred deep link after ");
                        sb3.append(arVar.onDeepLinkingNative);
                        sb3.append(" attempt(s) within ");
                        sb3.append(ar.onAppOpenAttributionNative);
                        sb3.append(" milliseconds");
                        AFLogger.AFKeystoreWrapper(sb3.toString());
                        arVar.valueOf(new DeepLinkResult(null, DeepLinkResult.c.TIMEOUT));
                    }
                }
                ah ahVar2 = ah.this;
                if (activity != null) {
                    blVar.valueOf = (Application) activity.getApplicationContext();
                }
                blVar.AFVersionDeclaration = str;
                blVar.AFKeystoreWrapper = appsFlyerRequestListener;
                ahVar2.AFKeystoreWrapper(blVar, activity);
            }

            @Override
            public final void values(Context context2) {
                AFLogger.valueOf("onBecameBackground");
                ah.this.getInstance = System.currentTimeMillis();
                long j2 = ah.this.getInstance - ah.this.onValidateInAppFailure;
                if (j2 > 0 && j2 < 1000) {
                    j2 = 1000;
                }
                ah ahVar = ah.this;
                if (ahVar.AppsFlyer2dXConversionCallback == null) {
                    ahVar.AppsFlyer2dXConversionCallback = new ax(context2);
                }
                ahVar.AppsFlyer2dXConversionCallback.AFInAppEventType.edit().putLong("prev_session_dur", TimeUnit.MILLISECONDS.toSeconds(j2)).apply();
                AFLogger.valueOf("callStatsBackground background call");
                ah.this.valueOf(new WeakReference<>(context2));
                ap AFInAppEventParameterName2 = ap.AFInAppEventParameterName();
                if (AFInAppEventParameterName2.AppsFlyer2dXConversionCallback()) {
                    AFInAppEventParameterName2.values();
                    if (context2 != null) {
                        ap.values(context2.getPackageName(), context2.getPackageManager());
                    }
                    AFInAppEventParameterName2.AFKeystoreWrapper();
                } else {
                    AFLogger.AFKeystoreWrapper("RD status is OFF");
                }
                if (l.AFKeystoreWrapper == null) {
                    l.AFKeystoreWrapper = new l();
                }
                l lVar = l.AFKeystoreWrapper;
                try {
                    l.values(lVar.AFInAppEventType);
                    Executor executor = lVar.AFInAppEventParameterName;
                    if (executor instanceof ThreadPoolExecutor) {
                        l.values((ThreadPoolExecutor) executor);
                    }
                } catch (Throwable th) {
                    AFLogger.values("failed to stop Executors", th);
                }
                ad AFInAppEventParameterName3 = ad.AFInAppEventParameterName(context2);
                AFInAppEventParameterName3.valueOf.post(AFInAppEventParameterName3.AppsFlyer2dXConversionCallback);
            }
        });
    }

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

    public final void AFInAppEventParameterName(Context context, Intent intent) {
        if (intent.getStringExtra("appsflyer_preinstall") != null) {
            String stringExtra = intent.getStringExtra("appsflyer_preinstall");
            try {
                if (!new JSONObject(stringExtra).has("pid")) {
                    AFLogger.AFInAppEventParameterName("Cannot set preinstall attribution data without a media source");
                } else {
                    AppsFlyerProperties.getInstance().set("preInstallName", stringExtra);
                }
            } catch (JSONException e2) {
                AFLogger.values("Error parsing JSON for preinstall", e2);
            }
        }
        AFLogger.valueOf("****** onReceive called *******");
        AppsFlyerProperties.getInstance();
        String stringExtra2 = intent.getStringExtra("referrer");
        AFLogger.valueOf("Play store referrer: ".concat(String.valueOf(stringExtra2)));
        if (stringExtra2 != null) {
            SharedPreferences.Editor edit = values(context).edit();
            edit.putString("referrer", stringExtra2);
            edit.apply();
            AppsFlyerProperties appsFlyerProperties = AppsFlyerProperties.getInstance();
            appsFlyerProperties.set("AF_REFERRER", stringExtra2);
            appsFlyerProperties.AFInAppEventType = stringExtra2;
            if (AppsFlyerProperties.getInstance().values()) {
                AFLogger.valueOf("onReceive: isLaunchCalled");
                bh bhVar = new bh();
                if (context != null) {
                    bhVar.valueOf = (Application) context.getApplicationContext();
                }
                bhVar.getLevel = stringExtra2;
                if (stringExtra2 == null || stringExtra2.length() <= 5 || !AFInAppEventType(bhVar, values(context))) {
                    return;
                }
                if (l.AFKeystoreWrapper == null) {
                    l.AFKeystoreWrapper = new l();
                }
                AFKeystoreWrapper(l.AFKeystoreWrapper.values(), new a(this, bhVar, (byte) 0), 5L, TimeUnit.MILLISECONDS);
            }
        }
    }

    @Override
    public void setUserEmails(AppsFlyerProperties.EmailsCryptType emailsCryptType, String... strArr) {
        ArrayList arrayList = new ArrayList(strArr.length + 1);
        arrayList.add(emailsCryptType.toString());
        arrayList.addAll(Arrays.asList(strArr));
        ap.AFInAppEventParameterName().valueOf("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();
        ArrayList arrayList2 = new ArrayList();
        String str = null;
        for (String str2 : strArr) {
            if (AnonymousClass8.AFInAppEventType[emailsCryptType.ordinal()] != 2) {
                arrayList2.add(aj.AFInAppEventParameterName(str2));
                str = "sha256_el_arr";
            } else {
                arrayList2.add(str2);
                str = "plain_el_arr";
            }
        }
        hashMap.put(str, arrayList2);
        AppsFlyerProperties.getInstance().setUserEmails(new JSONObject((Map<?, ?>) hashMap).toString());
    }

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

    public static boolean AFKeystoreWrapper() {
        return AFInAppEventType(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false) && AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_USER_ID) == null;
    }

    public static String AFKeystoreWrapper(SimpleDateFormat simpleDateFormat, long j2) {
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
        return simpleDateFormat.format(new Date(j2));
    }

    public final String AFInAppEventType(Context context) {
        String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.CHANNEL);
        if (string == null) {
            string = context == null ? null : AFInAppEventParameterName("CHANNEL", context.getPackageManager(), context.getPackageName());
        }
        if (string == null || !string.equals("")) {
            return string;
        }
        return null;
    }

    private static void AFKeystoreWrapper(Context context, Map<String, Object> map) {
        WindowManager windowManager = (WindowManager) context.getSystemService("window");
        if (windowManager != null) {
            int rotation = windowManager.getDefaultDisplay().getRotation();
            map.put("sc_o", rotation != 0 ? rotation != 1 ? rotation != 2 ? rotation != 3 ? "" : "lr" : "pr" : "l" : "p");
        }
    }

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

    public final String AFInAppEventType(HttpURLConnection httpURLConnection) {
        String obj;
        InputStreamReader inputStreamReader;
        StringBuilder sb = new StringBuilder();
        BufferedReader bufferedReader = null;
        try {
            try {
                InputStream errorStream = httpURLConnection.getErrorStream();
                if (errorStream == null) {
                    errorStream = httpURLConnection.getInputStream();
                }
                inputStreamReader = new InputStreamReader(errorStream);
                try {
                    BufferedReader bufferedReader2 = new BufferedReader(inputStreamReader);
                    boolean z = false;
                    while (true) {
                        try {
                            String readLine = bufferedReader2.readLine();
                            if (readLine == null) {
                                break;
                            }
                            sb.append(z ? '\n' : "");
                            sb.append(readLine);
                            z = true;
                        } catch (Throwable th) {
                            th = th;
                            bufferedReader = bufferedReader2;
                            try {
                                StringBuilder sb2 = new StringBuilder("Could not read connection response from: ");
                                sb2.append(httpURLConnection.getURL().toString());
                                AFLogger.values(sb2.toString(), th);
                                if (bufferedReader != null) {
                                    bufferedReader.close();
                                }
                                if (inputStreamReader != null) {
                                    inputStreamReader.close();
                                }
                                obj = sb.toString();
                                new JSONObject(obj);
                                return obj;
                            } catch (Throwable th2) {
                                if (bufferedReader != null) {
                                    try {
                                        bufferedReader.close();
                                    } catch (Throwable th3) {
                                        AFLogger.values(th3);
                                        throw th2;
                                    }
                                }
                                if (inputStreamReader != null) {
                                    inputStreamReader.close();
                                }
                                throw th2;
                            }
                        }
                    }
                    bufferedReader2.close();
                    inputStreamReader.close();
                } catch (Throwable th4) {
                    th = th4;
                }
            } catch (Throwable th5) {
                th = th5;
                inputStreamReader = null;
            }
        } catch (Throwable th6) {
            AFLogger.values(th6);
        }
        obj = sb.toString();
        try {
            new JSONObject(obj);
            return obj;
        } catch (JSONException unused) {
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put("string_response", obj);
                return jSONObject.toString();
            } catch (JSONException unused2) {
                return new JSONObject().toString();
            }
        }
    }

    public static boolean AFKeystoreWrapper(Context context) {
        return !values(context).contains("appsFlyerCount");
    }

    public final void valueOf(WeakReference<Context> weakReference) {
        if (weakReference.get() == null) {
            return;
        }
        AFLogger.valueOf("app went to background");
        SharedPreferences values2 = values(weakReference.get());
        AppsFlyerProperties.getInstance().saveProperties(values2);
        long j2 = this.getInstance - this.onValidateInAppFailure;
        HashMap hashMap = new HashMap();
        String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
        if (string == null) {
            AFLogger.AFInAppEventParameterName("[callStats] AppsFlyer's SDK cannot send any event without providing DevKey.");
            return;
        }
        String string2 = AppsFlyerProperties.getInstance().getString("KSAppsFlyerId");
        if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, false)) {
            hashMap.put(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
        }
        b.e.a AFInAppEventType2 = ac.AFInAppEventType(weakReference.get().getContentResolver());
        if (AFInAppEventType2 != null) {
            hashMap.put("amazon_aid", AFInAppEventType2.AFKeystoreWrapper);
            hashMap.put("amazon_aid_limit", String.valueOf(AFInAppEventType2.values));
        }
        String string3 = AppsFlyerProperties.getInstance().getString("advertiserId");
        if (string3 != null) {
            hashMap.put("advertiserId", string3);
        }
        hashMap.put("app_id", weakReference.get().getPackageName());
        hashMap.put("devkey", string);
        hashMap.put("uid", an.AFKeystoreWrapper(weakReference));
        hashMap.put("time_in_app", String.valueOf(j2 / 1000));
        hashMap.put("statType", "user_closed_app");
        hashMap.put("platform", "Android");
        hashMap.put("launch_counter", Integer.toString(values(values2, "appsFlyerCount", false)));
        hashMap.put(AppsFlyerProperties.CHANNEL, AFInAppEventType(weakReference.get()));
        if (string2 == null) {
            string2 = "";
        }
        hashMap.put("originalAppsflyerId", string2);
        if (this.setImeiData) {
            try {
                AFLogger.AFKeystoreWrapper("Running callStats task");
                bo boVar = new bo();
                boVar.onDeepLinking = isStopped();
                new Thread(new m((bd) boVar.values(hashMap).AFInAppEventParameterName(String.format(onAttributionFailureNative, AppsFlyerLib.getInstance().getHostPrefix(), onConversionDataFail.getHostName())))).start();
                return;
            } catch (Throwable th) {
                AFLogger.values("Could not send callStats request", th);
                return;
            }
        }
        AFLogger.AFKeystoreWrapper("Stats call is disabled, ignore ...");
    }

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

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

    private static boolean init(Context context) {
        if (context != null) {
            int i2 = Build.VERSION.SDK_INT;
            if (i2 >= 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.values("Failed collecting ivc data", e2);
                }
            } else if (i2 >= 16) {
                ArrayList arrayList = new ArrayList();
                try {
                    Iterator it = Collections.list(NetworkInterface.getNetworkInterfaces()).iterator();
                    while (it.hasNext()) {
                        NetworkInterface networkInterface = (NetworkInterface) it.next();
                        if (networkInterface.isUp()) {
                            arrayList.add(networkInterface.getName());
                        }
                    }
                    return arrayList.contains("tun0");
                } catch (Exception e3) {
                    AFLogger.values("Failed collecting ivc data", e3);
                }
            }
        }
        return false;
    }

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

    public final void AFKeystoreWrapper(h hVar, Activity activity) {
        Uri AFInAppEventParameterName2;
        Application application = hVar.valueOf;
        String obj = (activity == null || (AFInAppEventParameterName2 = ao.AFInAppEventParameterName(activity)) == null) ? "" : AFInAppEventParameterName2.toString();
        if (AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY) == null) {
            AFLogger.AFInAppEventParameterName("[LogEvent/Launch] AppsFlyer's SDK cannot send any event without providing DevKey.");
            AppsFlyerRequestListener appsFlyerRequestListener = hVar.AFKeystoreWrapper;
            if (appsFlyerRequestListener != null) {
                appsFlyerRequestListener.onError(RequestError.NO_DEV_KEY, at.valueOf);
                return;
            }
            return;
        }
        String referrer = AppsFlyerProperties.getInstance().getReferrer(application);
        hVar.getLevel = referrer != null ? referrer : "";
        hVar.AFInAppEventParameterName = obj;
        AFInAppEventType(hVar);
    }

    private boolean values() {
        Map<String, Object> map = this.waitForCustomerUserId;
        return (map == null || map.isEmpty()) ? false : true;
    }

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

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

    private static String values(File file, String str) {
        FileReader fileReader;
        Properties properties;
        try {
            try {
                try {
                    properties = new Properties();
                    fileReader = new FileReader(file);
                } catch (Throwable th) {
                    AFLogger.values(th.getMessage(), th);
                    return null;
                }
            } catch (FileNotFoundException unused) {
                fileReader = null;
            } catch (Throwable th2) {
                th = th2;
                fileReader = null;
            }
            try {
                properties.load(fileReader);
                AFLogger.valueOf("Found PreInstall property!");
                String property = properties.getProperty(str);
                try {
                    fileReader.close();
                } catch (Throwable th3) {
                    AFLogger.values(th3.getMessage(), th3);
                }
                return property;
            } catch (FileNotFoundException unused2) {
                StringBuilder sb = new StringBuilder("PreInstall file wasn't found: ");
                sb.append(file.getAbsolutePath());
                AFLogger.AFKeystoreWrapper(sb.toString());
                if (fileReader != null) {
                    fileReader.close();
                }
                return null;
            } catch (Throwable th4) {
                th = th4;
                AFLogger.values(th.getMessage(), th);
                if (fileReader != null) {
                    fileReader.close();
                }
                return null;
            }
        } catch (Throwable th5) {
            if (fileReader != null) {
                try {
                    fileReader.close();
                } catch (Throwable th6) {
                    AFLogger.values(th6.getMessage(), th6);
                }
            }
            throw th5;
        }
    }

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

    public final Map<String, Object> AFKeystoreWrapper(h hVar) {
        AppsFlyerProperties appsFlyerProperties;
        boolean z;
        ax axVar;
        String str;
        Application application;
        String str2;
        Exception exc;
        JSONObject jSONObject;
        StringBuilder sb;
        String string;
        String string2;
        String string3;
        String string4;
        Application application2;
        String AFInAppEventType2;
        String values2;
        SharedPreferences values3;
        String str3;
        String string5;
        String string6;
        String string7;
        String str4;
        AppsFlyerProperties appsFlyerProperties2;
        Object obj;
        String str5;
        boolean z2;
        String str6;
        b.e.a AFKeystoreWrapper2;
        String str7;
        String str8;
        String str9;
        AppsFlyerProperties appsFlyerProperties3;
        String str10;
        b.e.a AFInAppEventType3;
        boolean z3;
        int values4;
        ax axVar2;
        long availableBlocks;
        long blockCount;
        String[] strArr;
        int i2;
        int i3;
        String AFKeystoreWrapper3;
        String str11;
        String installerPackageName;
        UiModeManager uiModeManager;
        Application application3 = hVar.valueOf;
        String str12 = hVar.AFVersionDeclaration;
        String str13 = hVar.AFLogger$LogLevel;
        Map map = hVar.AFInAppEventType;
        if (map == null) {
            map = new HashMap();
        }
        String jSONObject2 = new JSONObject((Map<?, ?>) map).toString();
        String str14 = hVar.getLevel;
        SharedPreferences values5 = values(application3);
        boolean AFInAppEventParameterName2 = hVar.AFInAppEventParameterName();
        String str15 = hVar.AFInAppEventParameterName;
        Map<String, Object> map2 = hVar.values;
        ac.values(application3, map2);
        long time = new Date().getTime();
        map2.put("af_timestamp", Long.toString(time));
        String valueOf2 = b.valueOf(application3, time);
        if (valueOf2 != null) {
            map2.put("cksm_v1", valueOf2);
        }
        try {
            if (!isStopped()) {
                StringBuilder sb2 = new StringBuilder("******* sendTrackingWithEvent: ");
                sb2.append(AFInAppEventParameterName2 ? "Launch" : str13);
                AFLogger.valueOf(sb2.toString());
            } else {
                AFLogger.valueOf("Reporting has been stopped");
            }
            ag.AFKeystoreWrapper();
            try {
                if (!ag.AFInAppEventType(application3).exists()) {
                    ag.AFInAppEventType(application3).mkdir();
                }
            } catch (Exception e2) {
                AFLogger.values("Could not create cache directory", e2);
            }
            try {
                List asList = Arrays.asList(application3.getPackageManager().getPackageInfo(application3.getPackageName(), 4096).requestedPermissions);
                if (!asList.contains("android.permission.INTERNET")) {
                    AFLogger.AFInAppEventParameterName("Permission android.permission.INTERNET is missing in the AndroidManifest.xml");
                }
                if (!asList.contains("android.permission.ACCESS_NETWORK_STATE")) {
                    AFLogger.AFInAppEventParameterName("Permission android.permission.ACCESS_NETWORK_STATE is missing in the AndroidManifest.xml");
                }
                if (!asList.contains("android.permission.ACCESS_WIFI_STATE")) {
                    AFLogger.AFInAppEventParameterName("Permission android.permission.ACCESS_WIFI_STATE is missing in the AndroidManifest.xml");
                }
            } catch (Exception e3) {
                AFLogger.values("Exception while validation permissions. ", e3);
            }
            map2.put("af_events_api", "1");
            map2.put("brand", Build.BRAND);
            map2.put(DeviceRequestsHelper.DEVICE_INFO_DEVICE, Build.DEVICE);
            map2.put("product", Build.PRODUCT);
            int i4 = Build.VERSION.SDK_INT;
            map2.put(ServerProtocol.DIALOG_PARAM_SDK_VERSION, Integer.toString(i4));
            map2.put(DeviceRequestsHelper.DEVICE_INFO_MODEL, Build.MODEL);
            map2.put("deviceType", Build.TYPE);
            AFKeystoreWrapper(application3, map2);
            AppsFlyerProperties appsFlyerProperties4 = AppsFlyerProperties.getInstance();
            if (this.AppsFlyer2dXConversionCallback == null) {
                this.AppsFlyer2dXConversionCallback = new ax(application3);
            }
            ax axVar3 = this.AppsFlyer2dXConversionCallback;
            if (AFInAppEventParameterName2) {
                if (AFKeystoreWrapper(application3)) {
                    if (!appsFlyerProperties4.isOtherSdkStringDisabled()) {
                        map2.put("batteryLevel", String.valueOf(AFVersionDeclaration(application3)));
                    }
                    AFInAppEventParameterName(application3);
                    if (i4 >= 23) {
                        uiModeManager = (UiModeManager) application3.getSystemService(UiModeManager.class);
                    } else {
                        uiModeManager = (UiModeManager) application3.getSystemService("uimode");
                    }
                    if (uiModeManager != null && uiModeManager.getCurrentModeType() == 4) {
                        map2.put("tv", Boolean.TRUE);
                    }
                    if (bb.AFInAppEventParameterName(application3)) {
                        map2.put("inst_app", Boolean.TRUE);
                    }
                }
                z = AFInAppEventParameterName2;
                long j2 = values(application3).getLong("AppsFlyerTimePassedSincePrevLaunch", 0L);
                long currentTimeMillis = System.currentTimeMillis();
                values(application3, "AppsFlyerTimePassedSincePrevLaunch", currentTimeMillis);
                map2.put("timepassedsincelastlaunch", Long.toString(j2 > 0 ? (currentTimeMillis - j2) / 1000 : -1L));
                String string8 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ONELINK_ID);
                String string9 = AppsFlyerProperties.getInstance().getString("onelinkVersion");
                if (string8 != null) {
                    map2.put("onelink_id", string8);
                }
                if (string9 != null) {
                    map2.put("onelink_ver", string9);
                }
                String string10 = this.AppsFlyer2dXConversionCallback.AFInAppEventType.getString("gcd", null);
                if (string10 != null) {
                    try {
                        Map<String, Object> AFKeystoreWrapper4 = m.AFKeystoreWrapper(new JSONObject(string10));
                        if (!AFKeystoreWrapper4.isEmpty()) {
                            valueOf(map2).put("gcd", AFKeystoreWrapper4);
                            this.AppsFlyer2dXConversionCallback.AFInAppEventType.edit().putString("gcd", null).apply();
                        }
                    } catch (JSONException unused) {
                    }
                }
                String str16 = this.getOutOfStore;
                if (str16 != null) {
                    map2.put("phone", str16);
                }
                if (!TextUtils.isEmpty(str14)) {
                    map2.put("referrer", str14);
                }
                String string11 = values5.getString("extraReferrers", null);
                if (string11 != null) {
                    map2.put("extraReferrers", string11);
                }
                appsFlyerProperties = appsFlyerProperties4;
                String referrer = appsFlyerProperties.getReferrer(application3);
                if (!TextUtils.isEmpty(referrer) && map2.get("referrer") == null) {
                    map2.put("referrer", referrer);
                }
                long j3 = axVar3.AFInAppEventType.getLong("prev_session_dur", 0L);
                if (j3 != 0) {
                    map2.put("prev_session_dur", Long.valueOf(j3));
                }
                Application application4 = aw.AFInAppEventParameterName;
                map2.put("exception_number", Long.valueOf(application4 == null ? -1L : values(application4).getLong("exception_number", 0L)));
                au auVar = this.sendPushNotificationData;
                if (auVar != null) {
                    if (!auVar.AFInAppEventParameterName.isEmpty()) {
                        map2.put("partner_data", auVar.AFInAppEventParameterName);
                    }
                    if (!auVar.AFKeystoreWrapper.isEmpty()) {
                        valueOf(map2).put("partner_data", auVar.AFKeystoreWrapper);
                        auVar.AFKeystoreWrapper = new HashMap();
                    }
                }
                axVar = axVar3;
                str = "preInstallName";
                application = application3;
                str2 = str13;
            } else {
                appsFlyerProperties = appsFlyerProperties4;
                z = AFInAppEventParameterName2;
                SharedPreferences values6 = values(application3);
                SharedPreferences.Editor edit = values6.edit();
                try {
                    String string12 = values6.getString("prev_event_name", null);
                    if (string12 != null) {
                        try {
                            jSONObject = new JSONObject();
                            axVar = axVar3;
                        } catch (Exception e4) {
                            e = e4;
                            axVar = axVar3;
                        }
                        try {
                            sb = new StringBuilder();
                            str = "preInstallName";
                            application = application3;
                        } catch (Exception e5) {
                            e = e5;
                            str = "preInstallName";
                            application = application3;
                            exc = e;
                            str2 = str13;
                            AFLogger.values("Error while processing previous event.", exc);
                            string = AppsFlyerProperties.getInstance().getString("KSAppsFlyerId");
                            string2 = AppsFlyerProperties.getInstance().getString("KSAppsFlyerRICounter");
                            if (string != null) {
                                map2.put("reinstallCounter", string2);
                                map2.put("originalAppsflyerId", string);
                            }
                            string3 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ADDITIONAL_CUSTOM_DATA);
                            if (string3 != null) {
                            }
                            installerPackageName = application.getPackageManager().getInstallerPackageName(application.getPackageName());
                            if (installerPackageName != null) {
                            }
                            string4 = appsFlyerProperties.getString(AppsFlyerProperties.EXTENSION);
                            if (string4 != null) {
                                map2.put(AppsFlyerProperties.EXTENSION, string4);
                            }
                            application2 = application;
                            AFInAppEventType2 = AFInAppEventType(application2);
                            values2 = values(application2, AFInAppEventType2);
                            if (values2 != null) {
                                map2.put("af_latestchannel", AFInAppEventType2);
                                values3 = values(application2);
                                if (values3.contains("INSTALL_STORE")) {
                                }
                                if (str3 != null) {
                                }
                                SharedPreferences values7 = values(application2);
                                String str17 = str;
                                string5 = AppsFlyerProperties.getInstance().getString(str17);
                                if (string5 == null) {
                                }
                                if (string5 != null) {
                                }
                                string6 = AppsFlyerProperties.getInstance().getString("api_store_value");
                                if (string6 == null) {
                                }
                                if (string6 != null) {
                                }
                                if (str12 == null) {
                                }
                                string7 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                                if (string7 == null) {
                                }
                                AFLogger.valueOf("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                                AFLogger.valueOf("AppsFlyer will not track this event.");
                                return null;
                            }
                            map2.put("af_latestchannel", AFInAppEventType2);
                            values3 = values(application2);
                            if (values3.contains("INSTALL_STORE")) {
                            }
                            if (str3 != null) {
                            }
                            SharedPreferences values72 = values(application2);
                            String str172 = str;
                            string5 = AppsFlyerProperties.getInstance().getString(str172);
                            if (string5 == null) {
                            }
                            if (string5 != null) {
                            }
                            string6 = AppsFlyerProperties.getInstance().getString("api_store_value");
                            if (string6 == null) {
                            }
                            if (string6 != null) {
                            }
                            if (str12 == null) {
                            }
                            string7 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                            if (string7 == null) {
                            }
                            AFLogger.valueOf("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                            AFLogger.valueOf("AppsFlyer will not track this event.");
                            return null;
                        }
                        try {
                            sb.append(values6.getLong("prev_event_timestamp", -1L));
                            jSONObject.put("prev_event_timestamp", sb.toString());
                            jSONObject.put("prev_event_value", values6.getString("prev_event_value", null));
                            jSONObject.put("prev_event_name", string12);
                            map2.put("prev_event", jSONObject.toString());
                        } catch (Exception e6) {
                            e = e6;
                            exc = e;
                            str2 = str13;
                            AFLogger.values("Error while processing previous event.", exc);
                            string = AppsFlyerProperties.getInstance().getString("KSAppsFlyerId");
                            string2 = AppsFlyerProperties.getInstance().getString("KSAppsFlyerRICounter");
                            if (string != null) {
                            }
                            string3 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ADDITIONAL_CUSTOM_DATA);
                            if (string3 != null) {
                            }
                            installerPackageName = application.getPackageManager().getInstallerPackageName(application.getPackageName());
                            if (installerPackageName != null) {
                            }
                            string4 = appsFlyerProperties.getString(AppsFlyerProperties.EXTENSION);
                            if (string4 != null) {
                            }
                            application2 = application;
                            AFInAppEventType2 = AFInAppEventType(application2);
                            values2 = values(application2, AFInAppEventType2);
                            if (values2 != null) {
                            }
                            map2.put("af_latestchannel", AFInAppEventType2);
                            values3 = values(application2);
                            if (values3.contains("INSTALL_STORE")) {
                            }
                            if (str3 != null) {
                            }
                            SharedPreferences values722 = values(application2);
                            String str1722 = str;
                            string5 = AppsFlyerProperties.getInstance().getString(str1722);
                            if (string5 == null) {
                            }
                            if (string5 != null) {
                            }
                            string6 = AppsFlyerProperties.getInstance().getString("api_store_value");
                            if (string6 == null) {
                            }
                            if (string6 != null) {
                            }
                            if (str12 == null) {
                            }
                            string7 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                            if (string7 == null) {
                            }
                            AFLogger.valueOf("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                            AFLogger.valueOf("AppsFlyer will not track this event.");
                            return null;
                        }
                    } else {
                        axVar = axVar3;
                        str = "preInstallName";
                        application = application3;
                    }
                    str2 = str13;
                } catch (Exception e7) {
                    e = e7;
                    axVar = axVar3;
                    str = "preInstallName";
                    application = application3;
                    str2 = str13;
                }
                try {
                    edit.putString("prev_event_name", str2);
                    edit.putString("prev_event_value", jSONObject2);
                    edit.putLong("prev_event_timestamp", System.currentTimeMillis());
                    edit.apply();
                } catch (Exception e8) {
                    e = e8;
                    exc = e;
                    AFLogger.values("Error while processing previous event.", exc);
                    string = AppsFlyerProperties.getInstance().getString("KSAppsFlyerId");
                    string2 = AppsFlyerProperties.getInstance().getString("KSAppsFlyerRICounter");
                    if (string != null) {
                    }
                    string3 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ADDITIONAL_CUSTOM_DATA);
                    if (string3 != null) {
                    }
                    installerPackageName = application.getPackageManager().getInstallerPackageName(application.getPackageName());
                    if (installerPackageName != null) {
                    }
                    string4 = appsFlyerProperties.getString(AppsFlyerProperties.EXTENSION);
                    if (string4 != null) {
                    }
                    application2 = application;
                    AFInAppEventType2 = AFInAppEventType(application2);
                    values2 = values(application2, AFInAppEventType2);
                    if (values2 != null) {
                    }
                    map2.put("af_latestchannel", AFInAppEventType2);
                    values3 = values(application2);
                    if (values3.contains("INSTALL_STORE")) {
                    }
                    if (str3 != null) {
                    }
                    SharedPreferences values7222 = values(application2);
                    String str17222 = str;
                    string5 = AppsFlyerProperties.getInstance().getString(str17222);
                    if (string5 == null) {
                    }
                    if (string5 != null) {
                    }
                    string6 = AppsFlyerProperties.getInstance().getString("api_store_value");
                    if (string6 == null) {
                    }
                    if (string6 != null) {
                    }
                    if (str12 == null) {
                    }
                    string7 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                    if (string7 == null) {
                    }
                    AFLogger.valueOf("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                    AFLogger.valueOf("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) {
                map2.put("reinstallCounter", string2);
                map2.put("originalAppsflyerId", string);
            }
            string3 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ADDITIONAL_CUSTOM_DATA);
            if (string3 != null) {
                map2.put("customData", string3);
            }
            try {
                installerPackageName = application.getPackageManager().getInstallerPackageName(application.getPackageName());
                if (installerPackageName != null) {
                    map2.put("installer_package", installerPackageName);
                }
            } catch (Exception e9) {
                AFLogger.values("Exception while getting the app's installer package. ", e9);
            }
            string4 = appsFlyerProperties.getString(AppsFlyerProperties.EXTENSION);
            if (string4 != null && string4.length() > 0) {
                map2.put(AppsFlyerProperties.EXTENSION, string4);
            }
            application2 = application;
            AFInAppEventType2 = AFInAppEventType(application2);
            values2 = values(application2, AFInAppEventType2);
            if ((values2 != null && !values2.equals(AFInAppEventType2)) || (values2 == null && AFInAppEventType2 != null)) {
                map2.put("af_latestchannel", AFInAppEventType2);
            }
            values3 = values(application2);
            if (values3.contains("INSTALL_STORE")) {
                str3 = values3.getString("INSTALL_STORE", null);
            } else {
                if (AFKeystoreWrapper(application2)) {
                    str3 = AppsFlyerProperties.getInstance().getString("api_store_value");
                    if (str3 == null) {
                        if (application2 != null) {
                            str3 = AFInAppEventParameterName("AF_STORE", application2.getPackageManager(), application2.getPackageName());
                        }
                    }
                    SharedPreferences.Editor edit2 = values(application2).edit();
                    edit2.putString("INSTALL_STORE", str3);
                    edit2.apply();
                }
                str3 = null;
                SharedPreferences.Editor edit22 = values(application2).edit();
                edit22.putString("INSTALL_STORE", str3);
                edit22.apply();
            }
            if (str3 != null) {
                map2.put("af_installstore", str3.toLowerCase());
            }
            SharedPreferences values72222 = values(application2);
            String str172222 = str;
            string5 = AppsFlyerProperties.getInstance().getString(str172222);
            if (string5 == null) {
                if (values72222.contains(str172222)) {
                    string5 = values72222.getString(str172222, null);
                } else {
                    if (AFKeystoreWrapper(application2)) {
                        File AFInAppEventType4 = AFInAppEventType(valueOf("ro.appsflyer.preinstall.path"));
                        if (AFInAppEventParameterName(AFInAppEventType4)) {
                            AFInAppEventType4 = AFInAppEventType(AFInAppEventParameterName("AF_PRE_INSTALL_PATH", application2.getPackageManager(), application2.getPackageName()));
                        }
                        if (AFInAppEventParameterName(AFInAppEventType4)) {
                            AFInAppEventType4 = AFInAppEventType("/data/local/tmp/pre_install.appsflyer");
                        }
                        if (AFInAppEventParameterName(AFInAppEventType4)) {
                            AFInAppEventType4 = AFInAppEventType("/etc/pre_install.appsflyer");
                        }
                        if (AFInAppEventParameterName(AFInAppEventType4) || (str11 = values(AFInAppEventType4, application2.getPackageName())) == null) {
                            str11 = null;
                        }
                        if (str11 == null) {
                            str11 = application2 == null ? null : AFInAppEventParameterName("AF_PRE_INSTALL_NAME", application2.getPackageManager(), application2.getPackageName());
                        }
                        string5 = str11;
                    }
                    if (string5 != null) {
                        SharedPreferences.Editor edit3 = values(application2).edit();
                        edit3.putString(str172222, string5);
                        edit3.apply();
                    }
                }
                if (string5 != null) {
                    AppsFlyerProperties.getInstance().set(str172222, string5);
                }
            }
            if (string5 != null) {
                map2.put("af_preinstall_name", string5.toLowerCase());
            }
            string6 = AppsFlyerProperties.getInstance().getString("api_store_value");
            if (string6 == null) {
                string6 = application2 == null ? null : AFInAppEventParameterName("AF_STORE", application2.getPackageManager(), application2.getPackageName());
            }
            if (string6 != null) {
                map2.put("af_currentstore", string6.toLowerCase());
            }
            if (str12 == null && str12.length() > 0) {
                map2.put("appsflyerKey", str12);
            } else {
                string7 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                if (string7 == null && string7.length() > 0) {
                    map2.put("appsflyerKey", string7);
                } else {
                    AFLogger.valueOf("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                    AFLogger.valueOf("AppsFlyer will not track this event.");
                    return null;
                }
            }
            String string13 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_USER_ID);
            if (string13 != null) {
                map2.put("appUserId", string13);
            }
            String string14 = appsFlyerProperties.getString(AppsFlyerProperties.USER_EMAILS);
            if (string14 != null) {
                map2.put("user_emails", string14);
            } else {
                String string15 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.USER_EMAIL);
                if (string15 != null) {
                    map2.put("sha1_el", aj.valueOf(string15));
                }
            }
            if (str2 != null) {
                map2.put("eventName", str2);
                if (jSONObject2 != null) {
                    map2.put("eventValue", jSONObject2);
                }
            }
            if (AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_ID) != null) {
                map2.put(AppsFlyerProperties.APP_ID, AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_ID));
            }
            String string16 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.CURRENCY_CODE);
            if (string16 != null) {
                if (string16.length() != 3) {
                    StringBuilder sb3 = new StringBuilder("WARNING: currency code should be 3 characters!!! '");
                    sb3.append(string16);
                    sb3.append("' is not a legal value.");
                    AFLogger.AFInAppEventParameterName(sb3.toString());
                }
                map2.put(FirebaseAnalytics.Param.CURRENCY, string16);
            }
            String string17 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.IS_UPDATE);
            if (string17 != null) {
                map2.put("isUpdate", string17);
            }
            map2.put("af_preinstalled", Boolean.toString(isPreInstalledApp(application2)));
            if (appsFlyerProperties.getBoolean(AppsFlyerProperties.COLLECT_FACEBOOK_ATTR_ID, true)) {
                try {
                    application2.getPackageManager().getApplicationInfo("com.facebook.katana", 0);
                    str4 = getAttributionId(application2);
                } catch (PackageManager.NameNotFoundException unused2) {
                    AFLogger.AFInAppEventParameterName("Exception while collecting facebook's attribution ID. ");
                    str4 = null;
                    if (str4 != null) {
                    }
                    appsFlyerProperties2 = AppsFlyerProperties.getInstance();
                    if (appsFlyerProperties2.getBoolean(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, false)) {
                    }
                    AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application2));
                    str8 = "uid";
                    if (AFKeystoreWrapper3 != null) {
                    }
                    map2.put("lang", Locale.getDefault().getDisplayLanguage());
                    map2.put("lang_code", Locale.getDefault().getLanguage());
                    map2.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                    map2.put("platformextension", this.setAndroidIdData.values());
                    valueOf(application2, map2);
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                    long j4 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0).firstInstallTime;
                    simpleDateFormat.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
                    map2.put("installDate", simpleDateFormat.format(new Date(j4)));
                    PackageInfo packageInfo = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0);
                    i2 = values5.getInt("versionCode", 0);
                    i3 = packageInfo.versionCode;
                    if (i3 > i2) {
                    }
                    map2.put("app_version_code", Integer.toString(packageInfo.versionCode));
                    map2.put("app_version_name", packageInfo.versionName);
                    long j5 = packageInfo.firstInstallTime;
                    long j6 = packageInfo.lastUpdateTime;
                    str10 = str8;
                    try {
                        Locale locale = Locale.US;
                        appsFlyerProperties3 = appsFlyerProperties;
                        try {
                            str9 = str2;
                            try {
                                map2.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale).format(new Date(j5)));
                                map2.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale).format(new Date(j6)));
                                map2.put("firstLaunchDate", values(simpleDateFormat, application2));
                            } catch (Throwable th) {
                                th = th;
                                AFLogger.values("Exception while collecting app version data ", th);
                                this.getSdkVersion = ba.valueOf(application2);
                                StringBuilder sb4 = new StringBuilder("didConfigureTokenRefreshService=");
                                sb4.append(this.getSdkVersion);
                                AFLogger.AFKeystoreWrapper(sb4.toString());
                                if (!this.getSdkVersion) {
                                }
                                if (z) {
                                }
                                if (!z) {
                                }
                                if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                                }
                                AFInAppEventType3 = ac.AFInAppEventType(application2.getContentResolver());
                                if (AFInAppEventType3 != null) {
                                }
                                map2.put("registeredUninstall", Boolean.valueOf(ba.AFInAppEventParameterName(values5)));
                                z3 = z;
                                values4 = values(values5, "appsFlyerCount", z3);
                                map2.put("counter", Integer.toString(values4));
                                map2.put("iaecounter", Integer.toString(values(values5, "appsFlyerInAppEventCount", str9 != null)));
                                if (z3) {
                                }
                                axVar2 = axVar;
                                map2.put("isFirstCall", Boolean.toString(!values(values5)));
                                HashMap hashMap = new HashMap();
                                hashMap.put("cpu_abi", valueOf("ro.product.cpu.abi"));
                                hashMap.put("cpu_abi2", valueOf("ro.product.cpu.abi2"));
                                hashMap.put("arch", valueOf("os.arch"));
                                hashMap.put("build_display_id", valueOf("ro.build.display.id"));
                                if (z3) {
                                }
                                hashMap.put("dim", y.valueOf(application2));
                                map2.put("deviceData", hashMap);
                                Object obj2 = obj;
                                String str18 = (String) map2.get(obj2);
                                String str19 = (String) map2.get("af_timestamp");
                                String str20 = str10;
                                String str21 = (String) map2.get(str20);
                                StringBuilder sb5 = new StringBuilder();
                                sb5.append(str18.substring(0, 7));
                                sb5.append(str21.substring(0, 7));
                                sb5.append(str19.substring(str19.length() - 7));
                                map2.put("af_v", aj.valueOf(sb5.toString()));
                                String str22 = (String) map2.get(obj2);
                                StringBuilder sb6 = new StringBuilder();
                                sb6.append(str22);
                                sb6.append(map2.get("af_timestamp"));
                                String obj3 = sb6.toString();
                                StringBuilder sb7 = new StringBuilder();
                                sb7.append(obj3);
                                sb7.append(map2.get(str20));
                                String obj4 = sb7.toString();
                                StringBuilder sb8 = new StringBuilder();
                                sb8.append(obj4);
                                sb8.append(map2.get("installDate"));
                                String obj5 = sb8.toString();
                                StringBuilder sb9 = new StringBuilder();
                                sb9.append(obj5);
                                sb9.append(map2.get("counter"));
                                String obj6 = sb9.toString();
                                StringBuilder sb10 = new StringBuilder();
                                sb10.append(obj6);
                                sb10.append(map2.get("iaecounter"));
                                map2.put("af_v2", aj.valueOf(aj.values(sb10.toString())));
                                map2.put("ivc", Boolean.valueOf(init(application2)));
                                if (values5.contains("is_stop_tracking_used")) {
                                }
                                HashMap hashMap2 = new HashMap();
                                hashMap2.put("mcc", Integer.valueOf(application2.getResources().getConfiguration().mcc));
                                hashMap2.put("mnc", Integer.valueOf(application2.getResources().getConfiguration().mnc));
                                map2.put("cell", hashMap2);
                                map2.put("sig", aa.AFInAppEventParameterName(axVar2.AFInAppEventParameterName.getPackageManager(), axVar2.AFInAppEventParameterName.getPackageName()));
                                map2.put("last_boot_time", Long.valueOf(System.currentTimeMillis() - SystemClock.elapsedRealtime()));
                                StatFs statFs = new StatFs(Environment.getDataDirectory().getAbsolutePath());
                                if (Build.VERSION.SDK_INT >= 18) {
                                }
                                double pow = Math.pow(2.0d, 20.0d);
                                StringBuilder sb11 = new StringBuilder();
                                sb11.append((long) (availableBlocks / pow));
                                sb11.append("/");
                                sb11.append((long) (blockCount / pow));
                                map2.put("disk", sb11.toString());
                                strArr = this.getLevel;
                                if (strArr != null) {
                                }
                                return map2;
                            }
                        } catch (Throwable th2) {
                            th = th2;
                            str9 = str2;
                        }
                    } catch (Throwable th3) {
                        th = th3;
                        str9 = str2;
                        appsFlyerProperties3 = appsFlyerProperties;
                    }
                    this.getSdkVersion = ba.valueOf(application2);
                    StringBuilder sb42 = new StringBuilder("didConfigureTokenRefreshService=");
                    sb42.append(this.getSdkVersion);
                    AFLogger.AFKeystoreWrapper(sb42.toString());
                    if (!this.getSdkVersion) {
                    }
                    if (z) {
                    }
                    if (!z) {
                    }
                    if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                    }
                    AFInAppEventType3 = ac.AFInAppEventType(application2.getContentResolver());
                    if (AFInAppEventType3 != null) {
                    }
                    map2.put("registeredUninstall", Boolean.valueOf(ba.AFInAppEventParameterName(values5)));
                    z3 = z;
                    values4 = values(values5, "appsFlyerCount", z3);
                    map2.put("counter", Integer.toString(values4));
                    map2.put("iaecounter", Integer.toString(values(values5, "appsFlyerInAppEventCount", str9 != null)));
                    if (z3) {
                    }
                    axVar2 = axVar;
                    map2.put("isFirstCall", Boolean.toString(!values(values5)));
                    HashMap hashMap3 = new HashMap();
                    hashMap3.put("cpu_abi", valueOf("ro.product.cpu.abi"));
                    hashMap3.put("cpu_abi2", valueOf("ro.product.cpu.abi2"));
                    hashMap3.put("arch", valueOf("os.arch"));
                    hashMap3.put("build_display_id", valueOf("ro.build.display.id"));
                    if (z3) {
                    }
                    hashMap3.put("dim", y.valueOf(application2));
                    map2.put("deviceData", hashMap3);
                    Object obj22 = obj;
                    String str182 = (String) map2.get(obj22);
                    String str192 = (String) map2.get("af_timestamp");
                    String str202 = str10;
                    String str212 = (String) map2.get(str202);
                    StringBuilder sb52 = new StringBuilder();
                    sb52.append(str182.substring(0, 7));
                    sb52.append(str212.substring(0, 7));
                    sb52.append(str192.substring(str192.length() - 7));
                    map2.put("af_v", aj.valueOf(sb52.toString()));
                    String str222 = (String) map2.get(obj22);
                    StringBuilder sb62 = new StringBuilder();
                    sb62.append(str222);
                    sb62.append(map2.get("af_timestamp"));
                    String obj32 = sb62.toString();
                    StringBuilder sb72 = new StringBuilder();
                    sb72.append(obj32);
                    sb72.append(map2.get(str202));
                    String obj42 = sb72.toString();
                    StringBuilder sb82 = new StringBuilder();
                    sb82.append(obj42);
                    sb82.append(map2.get("installDate"));
                    String obj52 = sb82.toString();
                    StringBuilder sb92 = new StringBuilder();
                    sb92.append(obj52);
                    sb92.append(map2.get("counter"));
                    String obj62 = sb92.toString();
                    StringBuilder sb102 = new StringBuilder();
                    sb102.append(obj62);
                    sb102.append(map2.get("iaecounter"));
                    map2.put("af_v2", aj.valueOf(aj.values(sb102.toString())));
                    map2.put("ivc", Boolean.valueOf(init(application2)));
                    if (values5.contains("is_stop_tracking_used")) {
                    }
                    HashMap hashMap22 = new HashMap();
                    hashMap22.put("mcc", Integer.valueOf(application2.getResources().getConfiguration().mcc));
                    hashMap22.put("mnc", Integer.valueOf(application2.getResources().getConfiguration().mnc));
                    map2.put("cell", hashMap22);
                    map2.put("sig", aa.AFInAppEventParameterName(axVar2.AFInAppEventParameterName.getPackageManager(), axVar2.AFInAppEventParameterName.getPackageName()));
                    map2.put("last_boot_time", Long.valueOf(System.currentTimeMillis() - SystemClock.elapsedRealtime()));
                    StatFs statFs2 = new StatFs(Environment.getDataDirectory().getAbsolutePath());
                    if (Build.VERSION.SDK_INT >= 18) {
                    }
                    double pow2 = Math.pow(2.0d, 20.0d);
                    StringBuilder sb112 = new StringBuilder();
                    sb112.append((long) (availableBlocks / pow2));
                    sb112.append("/");
                    sb112.append((long) (blockCount / pow2));
                    map2.put("disk", sb112.toString());
                    strArr = this.getLevel;
                    if (strArr != null) {
                    }
                    return map2;
                } catch (Throwable th4) {
                    AFLogger.values("Exception while collecting facebook's attribution ID. ", th4);
                    str4 = null;
                    if (str4 != null) {
                    }
                    appsFlyerProperties2 = AppsFlyerProperties.getInstance();
                    if (appsFlyerProperties2.getBoolean(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, false)) {
                    }
                    AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application2));
                    str8 = "uid";
                    if (AFKeystoreWrapper3 != null) {
                    }
                    map2.put("lang", Locale.getDefault().getDisplayLanguage());
                    map2.put("lang_code", Locale.getDefault().getLanguage());
                    map2.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                    map2.put("platformextension", this.setAndroidIdData.values());
                    valueOf(application2, map2);
                    SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                    long j42 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0).firstInstallTime;
                    simpleDateFormat2.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
                    map2.put("installDate", simpleDateFormat2.format(new Date(j42)));
                    PackageInfo packageInfo2 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0);
                    i2 = values5.getInt("versionCode", 0);
                    i3 = packageInfo2.versionCode;
                    if (i3 > i2) {
                    }
                    map2.put("app_version_code", Integer.toString(packageInfo2.versionCode));
                    map2.put("app_version_name", packageInfo2.versionName);
                    long j52 = packageInfo2.firstInstallTime;
                    long j62 = packageInfo2.lastUpdateTime;
                    str10 = str8;
                    Locale locale2 = Locale.US;
                    appsFlyerProperties3 = appsFlyerProperties;
                    str9 = str2;
                    map2.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale2).format(new Date(j52)));
                    map2.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale2).format(new Date(j62)));
                    map2.put("firstLaunchDate", values(simpleDateFormat2, application2));
                    this.getSdkVersion = ba.valueOf(application2);
                    StringBuilder sb422 = new StringBuilder("didConfigureTokenRefreshService=");
                    sb422.append(this.getSdkVersion);
                    AFLogger.AFKeystoreWrapper(sb422.toString());
                    if (!this.getSdkVersion) {
                    }
                    if (z) {
                    }
                    if (!z) {
                    }
                    if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                    }
                    AFInAppEventType3 = ac.AFInAppEventType(application2.getContentResolver());
                    if (AFInAppEventType3 != null) {
                    }
                    map2.put("registeredUninstall", Boolean.valueOf(ba.AFInAppEventParameterName(values5)));
                    z3 = z;
                    values4 = values(values5, "appsFlyerCount", z3);
                    map2.put("counter", Integer.toString(values4));
                    map2.put("iaecounter", Integer.toString(values(values5, "appsFlyerInAppEventCount", str9 != null)));
                    if (z3) {
                    }
                    axVar2 = axVar;
                    map2.put("isFirstCall", Boolean.toString(!values(values5)));
                    HashMap hashMap32 = new HashMap();
                    hashMap32.put("cpu_abi", valueOf("ro.product.cpu.abi"));
                    hashMap32.put("cpu_abi2", valueOf("ro.product.cpu.abi2"));
                    hashMap32.put("arch", valueOf("os.arch"));
                    hashMap32.put("build_display_id", valueOf("ro.build.display.id"));
                    if (z3) {
                    }
                    hashMap32.put("dim", y.valueOf(application2));
                    map2.put("deviceData", hashMap32);
                    Object obj222 = obj;
                    String str1822 = (String) map2.get(obj222);
                    String str1922 = (String) map2.get("af_timestamp");
                    String str2022 = str10;
                    String str2122 = (String) map2.get(str2022);
                    StringBuilder sb522 = new StringBuilder();
                    sb522.append(str1822.substring(0, 7));
                    sb522.append(str2122.substring(0, 7));
                    sb522.append(str1922.substring(str1922.length() - 7));
                    map2.put("af_v", aj.valueOf(sb522.toString()));
                    String str2222 = (String) map2.get(obj222);
                    StringBuilder sb622 = new StringBuilder();
                    sb622.append(str2222);
                    sb622.append(map2.get("af_timestamp"));
                    String obj322 = sb622.toString();
                    StringBuilder sb722 = new StringBuilder();
                    sb722.append(obj322);
                    sb722.append(map2.get(str2022));
                    String obj422 = sb722.toString();
                    StringBuilder sb822 = new StringBuilder();
                    sb822.append(obj422);
                    sb822.append(map2.get("installDate"));
                    String obj522 = sb822.toString();
                    StringBuilder sb922 = new StringBuilder();
                    sb922.append(obj522);
                    sb922.append(map2.get("counter"));
                    String obj622 = sb922.toString();
                    StringBuilder sb1022 = new StringBuilder();
                    sb1022.append(obj622);
                    sb1022.append(map2.get("iaecounter"));
                    map2.put("af_v2", aj.valueOf(aj.values(sb1022.toString())));
                    map2.put("ivc", Boolean.valueOf(init(application2)));
                    if (values5.contains("is_stop_tracking_used")) {
                    }
                    HashMap hashMap222 = new HashMap();
                    hashMap222.put("mcc", Integer.valueOf(application2.getResources().getConfiguration().mcc));
                    hashMap222.put("mnc", Integer.valueOf(application2.getResources().getConfiguration().mnc));
                    map2.put("cell", hashMap222);
                    map2.put("sig", aa.AFInAppEventParameterName(axVar2.AFInAppEventParameterName.getPackageManager(), axVar2.AFInAppEventParameterName.getPackageName()));
                    map2.put("last_boot_time", Long.valueOf(System.currentTimeMillis() - SystemClock.elapsedRealtime()));
                    StatFs statFs22 = new StatFs(Environment.getDataDirectory().getAbsolutePath());
                    if (Build.VERSION.SDK_INT >= 18) {
                    }
                    double pow22 = Math.pow(2.0d, 20.0d);
                    StringBuilder sb1122 = new StringBuilder();
                    sb1122.append((long) (availableBlocks / pow22));
                    sb1122.append("/");
                    sb1122.append((long) (blockCount / pow22));
                    map2.put("disk", sb1122.toString());
                    strArr = this.getLevel;
                    if (strArr != null) {
                    }
                    return map2;
                }
                if (str4 != null) {
                    map2.put("fb", str4);
                }
            }
            appsFlyerProperties2 = AppsFlyerProperties.getInstance();
            if (appsFlyerProperties2.getBoolean(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, false)) {
                map2.put(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
                obj = "appsflyerKey";
            } else {
                SharedPreferences values8 = values(application2);
                boolean z4 = appsFlyerProperties2.getBoolean(AppsFlyerProperties.COLLECT_IMEI, true);
                String string18 = values8.getString("imeiCached", null);
                if (z4 && TextUtils.isEmpty(this.init)) {
                    if (getLevel(application2)) {
                        try {
                            TelephonyManager telephonyManager = (TelephonyManager) application2.getSystemService("phone");
                            obj = "appsflyerKey";
                            try {
                                str5 = (String) telephonyManager.getClass().getMethod("getDeviceId", new Class[0]).invoke(telephonyManager, new Object[0]);
                                if (str5 != null) {
                                    string18 = str5;
                                } else if (string18 != null) {
                                    str7 = "use cached IMEI: ";
                                    try {
                                        AFLogger.AFKeystoreWrapper(str7.concat(String.valueOf(string18)));
                                    } catch (InvocationTargetException unused3) {
                                        if (string18 == null) {
                                            AFLogger.AFKeystoreWrapper(str7.concat(String.valueOf(string18)));
                                        } else {
                                            string18 = null;
                                        }
                                        AFLogger.AFInAppEventParameterName("WARNING: READ_PHONE_STATE is missing.");
                                        if (string18 != null) {
                                        }
                                        z2 = appsFlyerProperties2.getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                                        String string19 = values8.getString("androidIdCached", null);
                                        if (!z2) {
                                        }
                                        str6 = this.AFLogger$LogLevel;
                                        if (str6 != null) {
                                        }
                                        str6 = null;
                                        if (str6 != null) {
                                        }
                                        AFKeystoreWrapper2 = ac.AFKeystoreWrapper(application2);
                                        if (AFKeystoreWrapper2 != null) {
                                        }
                                        AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application2));
                                        str8 = "uid";
                                        if (AFKeystoreWrapper3 != null) {
                                        }
                                        map2.put("lang", Locale.getDefault().getDisplayLanguage());
                                        map2.put("lang_code", Locale.getDefault().getLanguage());
                                        map2.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                                        map2.put("platformextension", this.setAndroidIdData.values());
                                        valueOf(application2, map2);
                                        SimpleDateFormat simpleDateFormat22 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                                        long j422 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0).firstInstallTime;
                                        simpleDateFormat22.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
                                        map2.put("installDate", simpleDateFormat22.format(new Date(j422)));
                                        PackageInfo packageInfo22 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0);
                                        i2 = values5.getInt("versionCode", 0);
                                        i3 = packageInfo22.versionCode;
                                        if (i3 > i2) {
                                        }
                                        map2.put("app_version_code", Integer.toString(packageInfo22.versionCode));
                                        map2.put("app_version_name", packageInfo22.versionName);
                                        long j522 = packageInfo22.firstInstallTime;
                                        long j622 = packageInfo22.lastUpdateTime;
                                        str10 = str8;
                                        Locale locale22 = Locale.US;
                                        appsFlyerProperties3 = appsFlyerProperties;
                                        str9 = str2;
                                        map2.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale22).format(new Date(j522)));
                                        map2.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale22).format(new Date(j622)));
                                        map2.put("firstLaunchDate", values(simpleDateFormat22, application2));
                                        this.getSdkVersion = ba.valueOf(application2);
                                        StringBuilder sb4222 = new StringBuilder("didConfigureTokenRefreshService=");
                                        sb4222.append(this.getSdkVersion);
                                        AFLogger.AFKeystoreWrapper(sb4222.toString());
                                        if (!this.getSdkVersion) {
                                        }
                                        if (z) {
                                        }
                                        if (!z) {
                                        }
                                        if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                                        }
                                        AFInAppEventType3 = ac.AFInAppEventType(application2.getContentResolver());
                                        if (AFInAppEventType3 != null) {
                                        }
                                        map2.put("registeredUninstall", Boolean.valueOf(ba.AFInAppEventParameterName(values5)));
                                        z3 = z;
                                        values4 = values(values5, "appsFlyerCount", z3);
                                        map2.put("counter", Integer.toString(values4));
                                        map2.put("iaecounter", Integer.toString(values(values5, "appsFlyerInAppEventCount", str9 != null)));
                                        if (z3) {
                                        }
                                        axVar2 = axVar;
                                        map2.put("isFirstCall", Boolean.toString(!values(values5)));
                                        HashMap hashMap322 = new HashMap();
                                        hashMap322.put("cpu_abi", valueOf("ro.product.cpu.abi"));
                                        hashMap322.put("cpu_abi2", valueOf("ro.product.cpu.abi2"));
                                        hashMap322.put("arch", valueOf("os.arch"));
                                        hashMap322.put("build_display_id", valueOf("ro.build.display.id"));
                                        if (z3) {
                                        }
                                        hashMap322.put("dim", y.valueOf(application2));
                                        map2.put("deviceData", hashMap322);
                                        Object obj2222 = obj;
                                        String str18222 = (String) map2.get(obj2222);
                                        String str19222 = (String) map2.get("af_timestamp");
                                        String str20222 = str10;
                                        String str21222 = (String) map2.get(str20222);
                                        StringBuilder sb5222 = new StringBuilder();
                                        sb5222.append(str18222.substring(0, 7));
                                        sb5222.append(str21222.substring(0, 7));
                                        sb5222.append(str19222.substring(str19222.length() - 7));
                                        map2.put("af_v", aj.valueOf(sb5222.toString()));
                                        String str22222 = (String) map2.get(obj2222);
                                        StringBuilder sb6222 = new StringBuilder();
                                        sb6222.append(str22222);
                                        sb6222.append(map2.get("af_timestamp"));
                                        String obj3222 = sb6222.toString();
                                        StringBuilder sb7222 = new StringBuilder();
                                        sb7222.append(obj3222);
                                        sb7222.append(map2.get(str20222));
                                        String obj4222 = sb7222.toString();
                                        StringBuilder sb8222 = new StringBuilder();
                                        sb8222.append(obj4222);
                                        sb8222.append(map2.get("installDate"));
                                        String obj5222 = sb8222.toString();
                                        StringBuilder sb9222 = new StringBuilder();
                                        sb9222.append(obj5222);
                                        sb9222.append(map2.get("counter"));
                                        String obj6222 = sb9222.toString();
                                        StringBuilder sb10222 = new StringBuilder();
                                        sb10222.append(obj6222);
                                        sb10222.append(map2.get("iaecounter"));
                                        map2.put("af_v2", aj.valueOf(aj.values(sb10222.toString())));
                                        map2.put("ivc", Boolean.valueOf(init(application2)));
                                        if (values5.contains("is_stop_tracking_used")) {
                                        }
                                        HashMap hashMap2222 = new HashMap();
                                        hashMap2222.put("mcc", Integer.valueOf(application2.getResources().getConfiguration().mcc));
                                        hashMap2222.put("mnc", Integer.valueOf(application2.getResources().getConfiguration().mnc));
                                        map2.put("cell", hashMap2222);
                                        map2.put("sig", aa.AFInAppEventParameterName(axVar2.AFInAppEventParameterName.getPackageManager(), axVar2.AFInAppEventParameterName.getPackageName()));
                                        map2.put("last_boot_time", Long.valueOf(System.currentTimeMillis() - SystemClock.elapsedRealtime()));
                                        StatFs statFs222 = new StatFs(Environment.getDataDirectory().getAbsolutePath());
                                        if (Build.VERSION.SDK_INT >= 18) {
                                        }
                                        double pow222 = Math.pow(2.0d, 20.0d);
                                        StringBuilder sb11222 = new StringBuilder();
                                        sb11222.append((long) (availableBlocks / pow222));
                                        sb11222.append("/");
                                        sb11222.append((long) (blockCount / pow222));
                                        map2.put("disk", sb11222.toString());
                                        strArr = this.getLevel;
                                        if (strArr != null) {
                                        }
                                        return map2;
                                    } catch (Exception e10) {
                                        e = e10;
                                        Exception exc2 = e;
                                        if (string18 == null) {
                                            AFLogger.AFKeystoreWrapper(str7.concat(String.valueOf(string18)));
                                        } else {
                                            string18 = null;
                                        }
                                        AFLogger.values("WARNING: other reason: ", exc2);
                                        if (string18 != null) {
                                        }
                                        z2 = appsFlyerProperties2.getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                                        String string192 = values8.getString("androidIdCached", null);
                                        if (!z2) {
                                        }
                                        str6 = this.AFLogger$LogLevel;
                                        if (str6 != null) {
                                        }
                                        str6 = null;
                                        if (str6 != null) {
                                        }
                                        AFKeystoreWrapper2 = ac.AFKeystoreWrapper(application2);
                                        if (AFKeystoreWrapper2 != null) {
                                        }
                                        AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application2));
                                        str8 = "uid";
                                        if (AFKeystoreWrapper3 != null) {
                                        }
                                        map2.put("lang", Locale.getDefault().getDisplayLanguage());
                                        map2.put("lang_code", Locale.getDefault().getLanguage());
                                        map2.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                                        map2.put("platformextension", this.setAndroidIdData.values());
                                        valueOf(application2, map2);
                                        SimpleDateFormat simpleDateFormat222 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                                        long j4222 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0).firstInstallTime;
                                        simpleDateFormat222.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
                                        map2.put("installDate", simpleDateFormat222.format(new Date(j4222)));
                                        PackageInfo packageInfo222 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0);
                                        i2 = values5.getInt("versionCode", 0);
                                        i3 = packageInfo222.versionCode;
                                        if (i3 > i2) {
                                        }
                                        map2.put("app_version_code", Integer.toString(packageInfo222.versionCode));
                                        map2.put("app_version_name", packageInfo222.versionName);
                                        long j5222 = packageInfo222.firstInstallTime;
                                        long j6222 = packageInfo222.lastUpdateTime;
                                        str10 = str8;
                                        Locale locale222 = Locale.US;
                                        appsFlyerProperties3 = appsFlyerProperties;
                                        str9 = str2;
                                        map2.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale222).format(new Date(j5222)));
                                        map2.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale222).format(new Date(j6222)));
                                        map2.put("firstLaunchDate", values(simpleDateFormat222, application2));
                                        this.getSdkVersion = ba.valueOf(application2);
                                        StringBuilder sb42222 = new StringBuilder("didConfigureTokenRefreshService=");
                                        sb42222.append(this.getSdkVersion);
                                        AFLogger.AFKeystoreWrapper(sb42222.toString());
                                        if (!this.getSdkVersion) {
                                        }
                                        if (z) {
                                        }
                                        if (!z) {
                                        }
                                        if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                                        }
                                        AFInAppEventType3 = ac.AFInAppEventType(application2.getContentResolver());
                                        if (AFInAppEventType3 != null) {
                                        }
                                        map2.put("registeredUninstall", Boolean.valueOf(ba.AFInAppEventParameterName(values5)));
                                        z3 = z;
                                        values4 = values(values5, "appsFlyerCount", z3);
                                        map2.put("counter", Integer.toString(values4));
                                        map2.put("iaecounter", Integer.toString(values(values5, "appsFlyerInAppEventCount", str9 != null)));
                                        if (z3) {
                                        }
                                        axVar2 = axVar;
                                        map2.put("isFirstCall", Boolean.toString(!values(values5)));
                                        HashMap hashMap3222 = new HashMap();
                                        hashMap3222.put("cpu_abi", valueOf("ro.product.cpu.abi"));
                                        hashMap3222.put("cpu_abi2", valueOf("ro.product.cpu.abi2"));
                                        hashMap3222.put("arch", valueOf("os.arch"));
                                        hashMap3222.put("build_display_id", valueOf("ro.build.display.id"));
                                        if (z3) {
                                        }
                                        hashMap3222.put("dim", y.valueOf(application2));
                                        map2.put("deviceData", hashMap3222);
                                        Object obj22222 = obj;
                                        String str182222 = (String) map2.get(obj22222);
                                        String str192222 = (String) map2.get("af_timestamp");
                                        String str202222 = str10;
                                        String str212222 = (String) map2.get(str202222);
                                        StringBuilder sb52222 = new StringBuilder();
                                        sb52222.append(str182222.substring(0, 7));
                                        sb52222.append(str212222.substring(0, 7));
                                        sb52222.append(str192222.substring(str192222.length() - 7));
                                        map2.put("af_v", aj.valueOf(sb52222.toString()));
                                        String str222222 = (String) map2.get(obj22222);
                                        StringBuilder sb62222 = new StringBuilder();
                                        sb62222.append(str222222);
                                        sb62222.append(map2.get("af_timestamp"));
                                        String obj32222 = sb62222.toString();
                                        StringBuilder sb72222 = new StringBuilder();
                                        sb72222.append(obj32222);
                                        sb72222.append(map2.get(str202222));
                                        String obj42222 = sb72222.toString();
                                        StringBuilder sb82222 = new StringBuilder();
                                        sb82222.append(obj42222);
                                        sb82222.append(map2.get("installDate"));
                                        String obj52222 = sb82222.toString();
                                        StringBuilder sb92222 = new StringBuilder();
                                        sb92222.append(obj52222);
                                        sb92222.append(map2.get("counter"));
                                        String obj62222 = sb92222.toString();
                                        StringBuilder sb102222 = new StringBuilder();
                                        sb102222.append(obj62222);
                                        sb102222.append(map2.get("iaecounter"));
                                        map2.put("af_v2", aj.valueOf(aj.values(sb102222.toString())));
                                        map2.put("ivc", Boolean.valueOf(init(application2)));
                                        if (values5.contains("is_stop_tracking_used")) {
                                        }
                                        HashMap hashMap22222 = new HashMap();
                                        hashMap22222.put("mcc", Integer.valueOf(application2.getResources().getConfiguration().mcc));
                                        hashMap22222.put("mnc", Integer.valueOf(application2.getResources().getConfiguration().mnc));
                                        map2.put("cell", hashMap22222);
                                        map2.put("sig", aa.AFInAppEventParameterName(axVar2.AFInAppEventParameterName.getPackageManager(), axVar2.AFInAppEventParameterName.getPackageName()));
                                        map2.put("last_boot_time", Long.valueOf(System.currentTimeMillis() - SystemClock.elapsedRealtime()));
                                        StatFs statFs2222 = new StatFs(Environment.getDataDirectory().getAbsolutePath());
                                        if (Build.VERSION.SDK_INT >= 18) {
                                        }
                                        double pow2222 = Math.pow(2.0d, 20.0d);
                                        StringBuilder sb112222 = new StringBuilder();
                                        sb112222.append((long) (availableBlocks / pow2222));
                                        sb112222.append("/");
                                        sb112222.append((long) (blockCount / pow2222));
                                        map2.put("disk", sb112222.toString());
                                        strArr = this.getLevel;
                                        if (strArr != null) {
                                        }
                                        return map2;
                                    }
                                }
                            } catch (InvocationTargetException unused4) {
                                str7 = "use cached IMEI: ";
                                if (string18 == null) {
                                }
                                AFLogger.AFInAppEventParameterName("WARNING: READ_PHONE_STATE is missing.");
                                if (string18 != null) {
                                }
                                z2 = appsFlyerProperties2.getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                                String string1922 = values8.getString("androidIdCached", null);
                                if (!z2) {
                                }
                                str6 = this.AFLogger$LogLevel;
                                if (str6 != null) {
                                }
                                str6 = null;
                                if (str6 != null) {
                                }
                                AFKeystoreWrapper2 = ac.AFKeystoreWrapper(application2);
                                if (AFKeystoreWrapper2 != null) {
                                }
                                AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application2));
                                str8 = "uid";
                                if (AFKeystoreWrapper3 != null) {
                                }
                                map2.put("lang", Locale.getDefault().getDisplayLanguage());
                                map2.put("lang_code", Locale.getDefault().getLanguage());
                                map2.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                                map2.put("platformextension", this.setAndroidIdData.values());
                                valueOf(application2, map2);
                                SimpleDateFormat simpleDateFormat2222 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                                long j42222 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0).firstInstallTime;
                                simpleDateFormat2222.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
                                map2.put("installDate", simpleDateFormat2222.format(new Date(j42222)));
                                PackageInfo packageInfo2222 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0);
                                i2 = values5.getInt("versionCode", 0);
                                i3 = packageInfo2222.versionCode;
                                if (i3 > i2) {
                                }
                                map2.put("app_version_code", Integer.toString(packageInfo2222.versionCode));
                                map2.put("app_version_name", packageInfo2222.versionName);
                                long j52222 = packageInfo2222.firstInstallTime;
                                long j62222 = packageInfo2222.lastUpdateTime;
                                str10 = str8;
                                Locale locale2222 = Locale.US;
                                appsFlyerProperties3 = appsFlyerProperties;
                                str9 = str2;
                                map2.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale2222).format(new Date(j52222)));
                                map2.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale2222).format(new Date(j62222)));
                                map2.put("firstLaunchDate", values(simpleDateFormat2222, application2));
                                this.getSdkVersion = ba.valueOf(application2);
                                StringBuilder sb422222 = new StringBuilder("didConfigureTokenRefreshService=");
                                sb422222.append(this.getSdkVersion);
                                AFLogger.AFKeystoreWrapper(sb422222.toString());
                                if (!this.getSdkVersion) {
                                }
                                if (z) {
                                }
                                if (!z) {
                                }
                                if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                                }
                                AFInAppEventType3 = ac.AFInAppEventType(application2.getContentResolver());
                                if (AFInAppEventType3 != null) {
                                }
                                map2.put("registeredUninstall", Boolean.valueOf(ba.AFInAppEventParameterName(values5)));
                                z3 = z;
                                values4 = values(values5, "appsFlyerCount", z3);
                                map2.put("counter", Integer.toString(values4));
                                map2.put("iaecounter", Integer.toString(values(values5, "appsFlyerInAppEventCount", str9 != null)));
                                if (z3) {
                                }
                                axVar2 = axVar;
                                map2.put("isFirstCall", Boolean.toString(!values(values5)));
                                HashMap hashMap32222 = new HashMap();
                                hashMap32222.put("cpu_abi", valueOf("ro.product.cpu.abi"));
                                hashMap32222.put("cpu_abi2", valueOf("ro.product.cpu.abi2"));
                                hashMap32222.put("arch", valueOf("os.arch"));
                                hashMap32222.put("build_display_id", valueOf("ro.build.display.id"));
                                if (z3) {
                                }
                                hashMap32222.put("dim", y.valueOf(application2));
                                map2.put("deviceData", hashMap32222);
                                Object obj222222 = obj;
                                String str1822222 = (String) map2.get(obj222222);
                                String str1922222 = (String) map2.get("af_timestamp");
                                String str2022222 = str10;
                                String str2122222 = (String) map2.get(str2022222);
                                StringBuilder sb522222 = new StringBuilder();
                                sb522222.append(str1822222.substring(0, 7));
                                sb522222.append(str2122222.substring(0, 7));
                                sb522222.append(str1922222.substring(str1922222.length() - 7));
                                map2.put("af_v", aj.valueOf(sb522222.toString()));
                                String str2222222 = (String) map2.get(obj222222);
                                StringBuilder sb622222 = new StringBuilder();
                                sb622222.append(str2222222);
                                sb622222.append(map2.get("af_timestamp"));
                                String obj322222 = sb622222.toString();
                                StringBuilder sb722222 = new StringBuilder();
                                sb722222.append(obj322222);
                                sb722222.append(map2.get(str2022222));
                                String obj422222 = sb722222.toString();
                                StringBuilder sb822222 = new StringBuilder();
                                sb822222.append(obj422222);
                                sb822222.append(map2.get("installDate"));
                                String obj522222 = sb822222.toString();
                                StringBuilder sb922222 = new StringBuilder();
                                sb922222.append(obj522222);
                                sb922222.append(map2.get("counter"));
                                String obj622222 = sb922222.toString();
                                StringBuilder sb1022222 = new StringBuilder();
                                sb1022222.append(obj622222);
                                sb1022222.append(map2.get("iaecounter"));
                                map2.put("af_v2", aj.valueOf(aj.values(sb1022222.toString())));
                                map2.put("ivc", Boolean.valueOf(init(application2)));
                                if (values5.contains("is_stop_tracking_used")) {
                                }
                                HashMap hashMap222222 = new HashMap();
                                hashMap222222.put("mcc", Integer.valueOf(application2.getResources().getConfiguration().mcc));
                                hashMap222222.put("mnc", Integer.valueOf(application2.getResources().getConfiguration().mnc));
                                map2.put("cell", hashMap222222);
                                map2.put("sig", aa.AFInAppEventParameterName(axVar2.AFInAppEventParameterName.getPackageManager(), axVar2.AFInAppEventParameterName.getPackageName()));
                                map2.put("last_boot_time", Long.valueOf(System.currentTimeMillis() - SystemClock.elapsedRealtime()));
                                StatFs statFs22222 = new StatFs(Environment.getDataDirectory().getAbsolutePath());
                                if (Build.VERSION.SDK_INT >= 18) {
                                }
                                double pow22222 = Math.pow(2.0d, 20.0d);
                                StringBuilder sb1122222 = new StringBuilder();
                                sb1122222.append((long) (availableBlocks / pow22222));
                                sb1122222.append("/");
                                sb1122222.append((long) (blockCount / pow22222));
                                map2.put("disk", sb1122222.toString());
                                strArr = this.getLevel;
                                if (strArr != null) {
                                }
                                return map2;
                            } catch (Exception e11) {
                                e = e11;
                                str7 = "use cached IMEI: ";
                                Exception exc22 = e;
                                if (string18 == null) {
                                }
                                AFLogger.values("WARNING: other reason: ", exc22);
                                if (string18 != null) {
                                }
                                z2 = appsFlyerProperties2.getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                                String string19222 = values8.getString("androidIdCached", null);
                                if (!z2) {
                                }
                                str6 = this.AFLogger$LogLevel;
                                if (str6 != null) {
                                }
                                str6 = null;
                                if (str6 != null) {
                                }
                                AFKeystoreWrapper2 = ac.AFKeystoreWrapper(application2);
                                if (AFKeystoreWrapper2 != null) {
                                }
                                AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application2));
                                str8 = "uid";
                                if (AFKeystoreWrapper3 != null) {
                                }
                                map2.put("lang", Locale.getDefault().getDisplayLanguage());
                                map2.put("lang_code", Locale.getDefault().getLanguage());
                                map2.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                                map2.put("platformextension", this.setAndroidIdData.values());
                                valueOf(application2, map2);
                                SimpleDateFormat simpleDateFormat22222 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                                long j422222 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0).firstInstallTime;
                                simpleDateFormat22222.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
                                map2.put("installDate", simpleDateFormat22222.format(new Date(j422222)));
                                PackageInfo packageInfo22222 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0);
                                i2 = values5.getInt("versionCode", 0);
                                i3 = packageInfo22222.versionCode;
                                if (i3 > i2) {
                                }
                                map2.put("app_version_code", Integer.toString(packageInfo22222.versionCode));
                                map2.put("app_version_name", packageInfo22222.versionName);
                                long j522222 = packageInfo22222.firstInstallTime;
                                long j622222 = packageInfo22222.lastUpdateTime;
                                str10 = str8;
                                Locale locale22222 = Locale.US;
                                appsFlyerProperties3 = appsFlyerProperties;
                                str9 = str2;
                                map2.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale22222).format(new Date(j522222)));
                                map2.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale22222).format(new Date(j622222)));
                                map2.put("firstLaunchDate", values(simpleDateFormat22222, application2));
                                this.getSdkVersion = ba.valueOf(application2);
                                StringBuilder sb4222222 = new StringBuilder("didConfigureTokenRefreshService=");
                                sb4222222.append(this.getSdkVersion);
                                AFLogger.AFKeystoreWrapper(sb4222222.toString());
                                if (!this.getSdkVersion) {
                                }
                                if (z) {
                                }
                                if (!z) {
                                }
                                if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                                }
                                AFInAppEventType3 = ac.AFInAppEventType(application2.getContentResolver());
                                if (AFInAppEventType3 != null) {
                                }
                                map2.put("registeredUninstall", Boolean.valueOf(ba.AFInAppEventParameterName(values5)));
                                z3 = z;
                                values4 = values(values5, "appsFlyerCount", z3);
                                map2.put("counter", Integer.toString(values4));
                                map2.put("iaecounter", Integer.toString(values(values5, "appsFlyerInAppEventCount", str9 != null)));
                                if (z3) {
                                }
                                axVar2 = axVar;
                                map2.put("isFirstCall", Boolean.toString(!values(values5)));
                                HashMap hashMap322222 = new HashMap();
                                hashMap322222.put("cpu_abi", valueOf("ro.product.cpu.abi"));
                                hashMap322222.put("cpu_abi2", valueOf("ro.product.cpu.abi2"));
                                hashMap322222.put("arch", valueOf("os.arch"));
                                hashMap322222.put("build_display_id", valueOf("ro.build.display.id"));
                                if (z3) {
                                }
                                hashMap322222.put("dim", y.valueOf(application2));
                                map2.put("deviceData", hashMap322222);
                                Object obj2222222 = obj;
                                String str18222222 = (String) map2.get(obj2222222);
                                String str19222222 = (String) map2.get("af_timestamp");
                                String str20222222 = str10;
                                String str21222222 = (String) map2.get(str20222222);
                                StringBuilder sb5222222 = new StringBuilder();
                                sb5222222.append(str18222222.substring(0, 7));
                                sb5222222.append(str21222222.substring(0, 7));
                                sb5222222.append(str19222222.substring(str19222222.length() - 7));
                                map2.put("af_v", aj.valueOf(sb5222222.toString()));
                                String str22222222 = (String) map2.get(obj2222222);
                                StringBuilder sb6222222 = new StringBuilder();
                                sb6222222.append(str22222222);
                                sb6222222.append(map2.get("af_timestamp"));
                                String obj3222222 = sb6222222.toString();
                                StringBuilder sb7222222 = new StringBuilder();
                                sb7222222.append(obj3222222);
                                sb7222222.append(map2.get(str20222222));
                                String obj4222222 = sb7222222.toString();
                                StringBuilder sb8222222 = new StringBuilder();
                                sb8222222.append(obj4222222);
                                sb8222222.append(map2.get("installDate"));
                                String obj5222222 = sb8222222.toString();
                                StringBuilder sb9222222 = new StringBuilder();
                                sb9222222.append(obj5222222);
                                sb9222222.append(map2.get("counter"));
                                String obj6222222 = sb9222222.toString();
                                StringBuilder sb10222222 = new StringBuilder();
                                sb10222222.append(obj6222222);
                                sb10222222.append(map2.get("iaecounter"));
                                map2.put("af_v2", aj.valueOf(aj.values(sb10222222.toString())));
                                map2.put("ivc", Boolean.valueOf(init(application2)));
                                if (values5.contains("is_stop_tracking_used")) {
                                }
                                HashMap hashMap2222222 = new HashMap();
                                hashMap2222222.put("mcc", Integer.valueOf(application2.getResources().getConfiguration().mcc));
                                hashMap2222222.put("mnc", Integer.valueOf(application2.getResources().getConfiguration().mnc));
                                map2.put("cell", hashMap2222222);
                                map2.put("sig", aa.AFInAppEventParameterName(axVar2.AFInAppEventParameterName.getPackageManager(), axVar2.AFInAppEventParameterName.getPackageName()));
                                map2.put("last_boot_time", Long.valueOf(System.currentTimeMillis() - SystemClock.elapsedRealtime()));
                                StatFs statFs222222 = new StatFs(Environment.getDataDirectory().getAbsolutePath());
                                if (Build.VERSION.SDK_INT >= 18) {
                                }
                                double pow222222 = Math.pow(2.0d, 20.0d);
                                StringBuilder sb11222222 = new StringBuilder();
                                sb11222222.append((long) (availableBlocks / pow222222));
                                sb11222222.append("/");
                                sb11222222.append((long) (blockCount / pow222222));
                                map2.put("disk", sb11222222.toString());
                                strArr = this.getLevel;
                                if (strArr != null) {
                                }
                                return map2;
                            }
                        } catch (InvocationTargetException unused5) {
                            obj = "appsflyerKey";
                        } catch (Exception e12) {
                            e = e12;
                            obj = "appsflyerKey";
                        }
                    } else {
                        obj = "appsflyerKey";
                    }
                    string18 = null;
                } else {
                    obj = "appsflyerKey";
                    str5 = this.init;
                }
                if (string18 != null) {
                    SharedPreferences.Editor edit4 = values(application2).edit();
                    edit4.putString("imeiCached", string18);
                    edit4.apply();
                    map2.put("imei", string18);
                } else {
                    AFLogger.valueOf("IMEI was not collected.");
                }
                z2 = appsFlyerProperties2.getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                String string192222 = values8.getString("androidIdCached", null);
                if (!z2 && TextUtils.isEmpty(this.AFLogger$LogLevel)) {
                    if (getLevel(application2)) {
                        try {
                            str6 = Settings.Secure.getString(application2.getContentResolver(), "android_id");
                        } catch (Exception e13) {
                            if (string192222 != null) {
                                AFLogger.AFKeystoreWrapper("use cached AndroidId: ".concat(String.valueOf(string192222)));
                            } else {
                                string192222 = null;
                            }
                            AFLogger.values(e13.getMessage(), e13);
                        }
                        if (str6 == null) {
                            if (string192222 != null) {
                                AFLogger.AFKeystoreWrapper("use cached AndroidId: ".concat(String.valueOf(string192222)));
                            } else {
                                string192222 = null;
                            }
                            str6 = string192222;
                            if (str6 != null) {
                            }
                            AFKeystoreWrapper2 = ac.AFKeystoreWrapper(application2);
                            if (AFKeystoreWrapper2 != null) {
                            }
                        } else {
                            if (str6 != null) {
                            }
                            AFKeystoreWrapper2 = ac.AFKeystoreWrapper(application2);
                            if (AFKeystoreWrapper2 != null) {
                            }
                        }
                    }
                    str6 = null;
                    if (str6 != null) {
                    }
                    AFKeystoreWrapper2 = ac.AFKeystoreWrapper(application2);
                    if (AFKeystoreWrapper2 != null) {
                    }
                } else {
                    str6 = this.AFLogger$LogLevel;
                    if (str6 != null) {
                        if (str6 != null) {
                            SharedPreferences.Editor edit5 = values(application2).edit();
                            edit5.putString("androidIdCached", str6);
                            edit5.apply();
                            map2.put("android_id", str6);
                        } else {
                            AFLogger.valueOf("Android ID was not collected.");
                        }
                        AFKeystoreWrapper2 = ac.AFKeystoreWrapper(application2);
                        if (AFKeystoreWrapper2 != null) {
                            HashMap hashMap4 = new HashMap();
                            hashMap4.put("isManual", AFKeystoreWrapper2.valueOf);
                            hashMap4.put("val", AFKeystoreWrapper2.AFKeystoreWrapper);
                            Boolean bool = AFKeystoreWrapper2.values;
                            if (bool != null) {
                                hashMap4.put("isLat", bool);
                            }
                            map2.put("oaid", hashMap4);
                        }
                    }
                    str6 = null;
                    if (str6 != null) {
                    }
                    AFKeystoreWrapper2 = ac.AFKeystoreWrapper(application2);
                    if (AFKeystoreWrapper2 != null) {
                    }
                }
            }
            try {
                AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application2));
                str8 = "uid";
                if (AFKeystoreWrapper3 != null) {
                    try {
                        map2.put(str8, AFKeystoreWrapper3);
                    } catch (Exception e14) {
                        e = e14;
                        Exception exc3 = e;
                        StringBuilder sb12 = new StringBuilder("ERROR: could not get uid ");
                        sb12.append(exc3.getMessage());
                        AFLogger.values(sb12.toString(), exc3);
                        map2.put("lang", Locale.getDefault().getDisplayLanguage());
                        map2.put("lang_code", Locale.getDefault().getLanguage());
                        map2.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                        map2.put("platformextension", this.setAndroidIdData.values());
                        valueOf(application2, map2);
                        SimpleDateFormat simpleDateFormat222222 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                        long j4222222 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0).firstInstallTime;
                        simpleDateFormat222222.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
                        map2.put("installDate", simpleDateFormat222222.format(new Date(j4222222)));
                        PackageInfo packageInfo222222 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0);
                        i2 = values5.getInt("versionCode", 0);
                        i3 = packageInfo222222.versionCode;
                        if (i3 > i2) {
                        }
                        map2.put("app_version_code", Integer.toString(packageInfo222222.versionCode));
                        map2.put("app_version_name", packageInfo222222.versionName);
                        long j5222222 = packageInfo222222.firstInstallTime;
                        long j6222222 = packageInfo222222.lastUpdateTime;
                        str10 = str8;
                        Locale locale222222 = Locale.US;
                        appsFlyerProperties3 = appsFlyerProperties;
                        str9 = str2;
                        map2.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale222222).format(new Date(j5222222)));
                        map2.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale222222).format(new Date(j6222222)));
                        map2.put("firstLaunchDate", values(simpleDateFormat222222, application2));
                        this.getSdkVersion = ba.valueOf(application2);
                        StringBuilder sb42222222 = new StringBuilder("didConfigureTokenRefreshService=");
                        sb42222222.append(this.getSdkVersion);
                        AFLogger.AFKeystoreWrapper(sb42222222.toString());
                        if (!this.getSdkVersion) {
                        }
                        if (z) {
                        }
                        if (!z) {
                        }
                        if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                        }
                        AFInAppEventType3 = ac.AFInAppEventType(application2.getContentResolver());
                        if (AFInAppEventType3 != null) {
                        }
                        map2.put("registeredUninstall", Boolean.valueOf(ba.AFInAppEventParameterName(values5)));
                        z3 = z;
                        values4 = values(values5, "appsFlyerCount", z3);
                        map2.put("counter", Integer.toString(values4));
                        map2.put("iaecounter", Integer.toString(values(values5, "appsFlyerInAppEventCount", str9 != null)));
                        if (z3) {
                        }
                        axVar2 = axVar;
                        map2.put("isFirstCall", Boolean.toString(!values(values5)));
                        HashMap hashMap3222222 = new HashMap();
                        hashMap3222222.put("cpu_abi", valueOf("ro.product.cpu.abi"));
                        hashMap3222222.put("cpu_abi2", valueOf("ro.product.cpu.abi2"));
                        hashMap3222222.put("arch", valueOf("os.arch"));
                        hashMap3222222.put("build_display_id", valueOf("ro.build.display.id"));
                        if (z3) {
                        }
                        hashMap3222222.put("dim", y.valueOf(application2));
                        map2.put("deviceData", hashMap3222222);
                        Object obj22222222 = obj;
                        String str182222222 = (String) map2.get(obj22222222);
                        String str192222222 = (String) map2.get("af_timestamp");
                        String str202222222 = str10;
                        String str212222222 = (String) map2.get(str202222222);
                        StringBuilder sb52222222 = new StringBuilder();
                        sb52222222.append(str182222222.substring(0, 7));
                        sb52222222.append(str212222222.substring(0, 7));
                        sb52222222.append(str192222222.substring(str192222222.length() - 7));
                        map2.put("af_v", aj.valueOf(sb52222222.toString()));
                        String str222222222 = (String) map2.get(obj22222222);
                        StringBuilder sb62222222 = new StringBuilder();
                        sb62222222.append(str222222222);
                        sb62222222.append(map2.get("af_timestamp"));
                        String obj32222222 = sb62222222.toString();
                        StringBuilder sb72222222 = new StringBuilder();
                        sb72222222.append(obj32222222);
                        sb72222222.append(map2.get(str202222222));
                        String obj42222222 = sb72222222.toString();
                        StringBuilder sb82222222 = new StringBuilder();
                        sb82222222.append(obj42222222);
                        sb82222222.append(map2.get("installDate"));
                        String obj52222222 = sb82222222.toString();
                        StringBuilder sb92222222 = new StringBuilder();
                        sb92222222.append(obj52222222);
                        sb92222222.append(map2.get("counter"));
                        String obj62222222 = sb92222222.toString();
                        StringBuilder sb102222222 = new StringBuilder();
                        sb102222222.append(obj62222222);
                        sb102222222.append(map2.get("iaecounter"));
                        map2.put("af_v2", aj.valueOf(aj.values(sb102222222.toString())));
                        map2.put("ivc", Boolean.valueOf(init(application2)));
                        if (values5.contains("is_stop_tracking_used")) {
                        }
                        HashMap hashMap22222222 = new HashMap();
                        hashMap22222222.put("mcc", Integer.valueOf(application2.getResources().getConfiguration().mcc));
                        hashMap22222222.put("mnc", Integer.valueOf(application2.getResources().getConfiguration().mnc));
                        map2.put("cell", hashMap22222222);
                        map2.put("sig", aa.AFInAppEventParameterName(axVar2.AFInAppEventParameterName.getPackageManager(), axVar2.AFInAppEventParameterName.getPackageName()));
                        map2.put("last_boot_time", Long.valueOf(System.currentTimeMillis() - SystemClock.elapsedRealtime()));
                        StatFs statFs2222222 = new StatFs(Environment.getDataDirectory().getAbsolutePath());
                        if (Build.VERSION.SDK_INT >= 18) {
                        }
                        double pow2222222 = Math.pow(2.0d, 20.0d);
                        StringBuilder sb112222222 = new StringBuilder();
                        sb112222222.append((long) (availableBlocks / pow2222222));
                        sb112222222.append("/");
                        sb112222222.append((long) (blockCount / pow2222222));
                        map2.put("disk", sb112222222.toString());
                        strArr = this.getLevel;
                        if (strArr != null) {
                        }
                        return map2;
                    }
                }
            } catch (Exception e15) {
                e = e15;
                str8 = "uid";
            }
            try {
                map2.put("lang", Locale.getDefault().getDisplayLanguage());
            } catch (Exception e16) {
                AFLogger.values("Exception while collecting display language name. ", e16);
            }
            try {
                map2.put("lang_code", Locale.getDefault().getLanguage());
            } catch (Exception e17) {
                AFLogger.values("Exception while collecting display language code. ", e17);
            }
            try {
                map2.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
            } catch (Exception e18) {
                AFLogger.values("Exception while collecting country name. ", e18);
            }
            map2.put("platformextension", this.setAndroidIdData.values());
            valueOf(application2, map2);
            SimpleDateFormat simpleDateFormat2222222 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
            try {
                long j42222222 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0).firstInstallTime;
                simpleDateFormat2222222.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
                map2.put("installDate", simpleDateFormat2222222.format(new Date(j42222222)));
            } catch (Exception e19) {
                AFLogger.values("Exception while collecting install date. ", e19);
            }
            try {
                PackageInfo packageInfo2222222 = application2.getPackageManager().getPackageInfo(application2.getPackageName(), 0);
                i2 = values5.getInt("versionCode", 0);
                i3 = packageInfo2222222.versionCode;
                if (i3 > i2) {
                    SharedPreferences.Editor edit6 = values(application2).edit();
                    edit6.putInt("versionCode", i3);
                    edit6.apply();
                }
                map2.put("app_version_code", Integer.toString(packageInfo2222222.versionCode));
                map2.put("app_version_name", packageInfo2222222.versionName);
                long j52222222 = packageInfo2222222.firstInstallTime;
                long j62222222 = packageInfo2222222.lastUpdateTime;
                str10 = str8;
                Locale locale2222222 = Locale.US;
                appsFlyerProperties3 = appsFlyerProperties;
                str9 = str2;
                map2.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale2222222).format(new Date(j52222222)));
                map2.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", locale2222222).format(new Date(j62222222)));
                map2.put("firstLaunchDate", values(simpleDateFormat2222222, application2));
            } catch (Throwable th5) {
                th = th5;
                str9 = str2;
                appsFlyerProperties3 = appsFlyerProperties;
                str10 = str8;
            }
            this.getSdkVersion = ba.valueOf(application2);
            StringBuilder sb422222222 = new StringBuilder("didConfigureTokenRefreshService=");
            sb422222222.append(this.getSdkVersion);
            AFLogger.AFKeystoreWrapper(sb422222222.toString());
            if (!this.getSdkVersion) {
                map2.put("tokenRefreshConfigured", Boolean.FALSE);
            }
            if (z) {
                if (this.updateServerUninstallToken != null) {
                    if (map2.get("af_deeplink") != null) {
                        AFLogger.AFKeystoreWrapper("Skip 'af' payload as deeplink was found by path");
                    } else {
                        JSONObject jSONObject3 = new JSONObject(this.updateServerUninstallToken);
                        jSONObject3.put("isPush", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
                        map2.put("af_deeplink", jSONObject3.toString());
                    }
                }
                this.updateServerUninstallToken = null;
                map2.put("open_referrer", str15);
            }
            if (!z) {
                try {
                    ad AFInAppEventParameterName3 = ad.AFInAppEventParameterName(application2);
                    ConcurrentHashMap concurrentHashMap = new ConcurrentHashMap();
                    List<Map<String, Object>> AFInAppEventParameterName4 = AFInAppEventParameterName3.AFInAppEventParameterName();
                    if (!AFInAppEventParameterName4.isEmpty()) {
                        concurrentHashMap.put("sensors", new i().valueOf(AFInAppEventParameterName4));
                    } else {
                        concurrentHashMap.put("sensors", "na");
                    }
                    map2.putAll(concurrentHashMap);
                } catch (Exception e20) {
                    StringBuilder sb13 = new StringBuilder("Unexpected exception from AFSensorManager: ");
                    sb13.append(e20.getMessage());
                    AFLogger.AFInAppEventType(sb13.toString());
                }
            }
            if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                ac.values(application2, map2);
                if (AppsFlyerProperties.getInstance().getString("advertiserId") != null) {
                    map2.put("GAID_retry", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
                } else {
                    map2.put("GAID_retry", "false");
                }
            }
            AFInAppEventType3 = ac.AFInAppEventType(application2.getContentResolver());
            if (AFInAppEventType3 != null) {
                map2.put("amazon_aid", AFInAppEventType3.AFKeystoreWrapper);
                map2.put("amazon_aid_limit", String.valueOf(AFInAppEventType3.values));
            }
            map2.put("registeredUninstall", Boolean.valueOf(ba.AFInAppEventParameterName(values5)));
            z3 = z;
            values4 = values(values5, "appsFlyerCount", z3);
            map2.put("counter", Integer.toString(values4));
            map2.put("iaecounter", Integer.toString(values(values5, "appsFlyerInAppEventCount", str9 != null)));
        } catch (Throwable th6) {
            AFLogger.AFInAppEventParameterName(th6.getLocalizedMessage(), th6);
        }
        if (z3) {
            if (values4 == 1) {
                axVar2 = axVar;
                appsFlyerProperties3.AFInAppEventParameterName = true;
                if (AFInAppEventType(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
                    map2.put("wait_cid", Boolean.toString(true));
                }
                Map<String, Object> valueOf3 = valueOf(map2);
                String string20 = axVar2.AFInAppEventType.getString("ddl", null);
                if (string20 != null) {
                    Map<String, Object> AFKeystoreWrapper5 = m.AFKeystoreWrapper(new JSONObject(string20));
                    if (!AFKeystoreWrapper5.isEmpty()) {
                        valueOf3.put("ddl", AFKeystoreWrapper5);
                    }
                }
                Map<String, Object> AFKeystoreWrapper6 = m.AFKeystoreWrapper(this.setAdditionalData);
                if (!AFKeystoreWrapper6.isEmpty()) {
                    valueOf3.put("first_launch", AFKeystoreWrapper6);
                }
                map2.put("isFirstCall", Boolean.toString(!values(values5)));
                HashMap hashMap32222222 = new HashMap();
                hashMap32222222.put("cpu_abi", valueOf("ro.product.cpu.abi"));
                hashMap32222222.put("cpu_abi2", valueOf("ro.product.cpu.abi2"));
                hashMap32222222.put("arch", valueOf("os.arch"));
                hashMap32222222.put("build_display_id", valueOf("ro.build.display.id"));
                if (z3) {
                }
                hashMap32222222.put("dim", y.valueOf(application2));
                map2.put("deviceData", hashMap32222222);
                Object obj222222222 = obj;
                String str1822222222 = (String) map2.get(obj222222222);
                String str1922222222 = (String) map2.get("af_timestamp");
                String str2022222222 = str10;
                String str2122222222 = (String) map2.get(str2022222222);
                StringBuilder sb522222222 = new StringBuilder();
                sb522222222.append(str1822222222.substring(0, 7));
                sb522222222.append(str2122222222.substring(0, 7));
                sb522222222.append(str1922222222.substring(str1922222222.length() - 7));
                map2.put("af_v", aj.valueOf(sb522222222.toString()));
                String str2222222222 = (String) map2.get(obj222222222);
                StringBuilder sb622222222 = new StringBuilder();
                sb622222222.append(str2222222222);
                sb622222222.append(map2.get("af_timestamp"));
                String obj322222222 = sb622222222.toString();
                StringBuilder sb722222222 = new StringBuilder();
                sb722222222.append(obj322222222);
                sb722222222.append(map2.get(str2022222222));
                String obj422222222 = sb722222222.toString();
                StringBuilder sb822222222 = new StringBuilder();
                sb822222222.append(obj422222222);
                sb822222222.append(map2.get("installDate"));
                String obj522222222 = sb822222222.toString();
                StringBuilder sb922222222 = new StringBuilder();
                sb922222222.append(obj522222222);
                sb922222222.append(map2.get("counter"));
                String obj622222222 = sb922222222.toString();
                StringBuilder sb1022222222 = new StringBuilder();
                sb1022222222.append(obj622222222);
                sb1022222222.append(map2.get("iaecounter"));
                map2.put("af_v2", aj.valueOf(aj.values(sb1022222222.toString())));
                map2.put("ivc", Boolean.valueOf(init(application2)));
                if (values5.contains("is_stop_tracking_used")) {
                }
                HashMap hashMap222222222 = new HashMap();
                hashMap222222222.put("mcc", Integer.valueOf(application2.getResources().getConfiguration().mcc));
                hashMap222222222.put("mnc", Integer.valueOf(application2.getResources().getConfiguration().mnc));
                map2.put("cell", hashMap222222222);
                map2.put("sig", aa.AFInAppEventParameterName(axVar2.AFInAppEventParameterName.getPackageManager(), axVar2.AFInAppEventParameterName.getPackageName()));
                map2.put("last_boot_time", Long.valueOf(System.currentTimeMillis() - SystemClock.elapsedRealtime()));
                StatFs statFs22222222 = new StatFs(Environment.getDataDirectory().getAbsolutePath());
                if (Build.VERSION.SDK_INT >= 18) {
                }
                double pow22222222 = Math.pow(2.0d, 20.0d);
                StringBuilder sb1122222222 = new StringBuilder();
                sb1122222222.append((long) (availableBlocks / pow22222222));
                sb1122222222.append("/");
                sb1122222222.append((long) (blockCount / pow22222222));
                map2.put("disk", sb1122222222.toString());
                strArr = this.getLevel;
                if (strArr != null) {
                }
                return map2;
            }
            if (values4 == 2) {
                Map<String, Object> valueOf4 = valueOf(map2);
                axVar2 = axVar;
                String string21 = axVar2.AFInAppEventType.getString("first_launch", null);
                if (string21 != null) {
                    Map<String, Object> AFKeystoreWrapper7 = m.AFKeystoreWrapper(new JSONObject(string21));
                    if (!AFKeystoreWrapper7.isEmpty()) {
                        valueOf4.put("first_launch", AFKeystoreWrapper7);
                    }
                }
                map2.put("isFirstCall", Boolean.toString(!values(values5)));
                HashMap hashMap322222222 = new HashMap();
                hashMap322222222.put("cpu_abi", valueOf("ro.product.cpu.abi"));
                hashMap322222222.put("cpu_abi2", valueOf("ro.product.cpu.abi2"));
                hashMap322222222.put("arch", valueOf("os.arch"));
                hashMap322222222.put("build_display_id", valueOf("ro.build.display.id"));
                if (z3) {
                    if (this.stop) {
                        Location AFInAppEventParameterName5 = v.e.AFInAppEventType.AFInAppEventParameterName(application2);
                        HashMap hashMap5 = new HashMap(3);
                        if (AFInAppEventParameterName5 != null) {
                            hashMap5.put("lat", String.valueOf(AFInAppEventParameterName5.getLatitude()));
                            hashMap5.put("lon", String.valueOf(AFInAppEventParameterName5.getLongitude()));
                            hashMap5.put("ts", String.valueOf(AFInAppEventParameterName5.getTime()));
                        }
                        if (!hashMap5.isEmpty()) {
                            hashMap322222222.put("loc", hashMap5);
                        }
                    }
                    e.d values9 = e.b.values.values(application2);
                    hashMap322222222.put("btl", Float.toString(values9.values));
                    String str23 = values9.valueOf;
                    if (str23 != null) {
                        hashMap322222222.put("btch", str23);
                    }
                    if (values4 <= 2) {
                        ad AFInAppEventParameterName6 = ad.AFInAppEventParameterName(application2);
                        ConcurrentHashMap concurrentHashMap2 = new ConcurrentHashMap();
                        List<Map<String, Object>> values10 = AFInAppEventParameterName6.values();
                        if (!values10.isEmpty()) {
                            concurrentHashMap2.put("sensors", values10);
                        } else {
                            List<Map<String, Object>> AFInAppEventParameterName7 = AFInAppEventParameterName6.AFInAppEventParameterName();
                            if (!AFInAppEventParameterName7.isEmpty()) {
                                concurrentHashMap2.put("sensors", AFInAppEventParameterName7);
                            }
                        }
                        hashMap322222222.putAll(concurrentHashMap2);
                    }
                }
                hashMap322222222.put("dim", y.valueOf(application2));
                map2.put("deviceData", hashMap322222222);
                Object obj2222222222 = obj;
                String str18222222222 = (String) map2.get(obj2222222222);
                String str19222222222 = (String) map2.get("af_timestamp");
                String str20222222222 = str10;
                String str21222222222 = (String) map2.get(str20222222222);
                StringBuilder sb5222222222 = new StringBuilder();
                sb5222222222.append(str18222222222.substring(0, 7));
                sb5222222222.append(str21222222222.substring(0, 7));
                sb5222222222.append(str19222222222.substring(str19222222222.length() - 7));
                map2.put("af_v", aj.valueOf(sb5222222222.toString()));
                String str22222222222 = (String) map2.get(obj2222222222);
                StringBuilder sb6222222222 = new StringBuilder();
                sb6222222222.append(str22222222222);
                sb6222222222.append(map2.get("af_timestamp"));
                String obj3222222222 = sb6222222222.toString();
                StringBuilder sb7222222222 = new StringBuilder();
                sb7222222222.append(obj3222222222);
                sb7222222222.append(map2.get(str20222222222));
                String obj4222222222 = sb7222222222.toString();
                StringBuilder sb8222222222 = new StringBuilder();
                sb8222222222.append(obj4222222222);
                sb8222222222.append(map2.get("installDate"));
                String obj5222222222 = sb8222222222.toString();
                StringBuilder sb9222222222 = new StringBuilder();
                sb9222222222.append(obj5222222222);
                sb9222222222.append(map2.get("counter"));
                String obj6222222222 = sb9222222222.toString();
                StringBuilder sb10222222222 = new StringBuilder();
                sb10222222222.append(obj6222222222);
                sb10222222222.append(map2.get("iaecounter"));
                map2.put("af_v2", aj.valueOf(aj.values(sb10222222222.toString())));
                map2.put("ivc", Boolean.valueOf(init(application2)));
                if (values5.contains("is_stop_tracking_used")) {
                    map2.put("istu", String.valueOf(values5.getBoolean("is_stop_tracking_used", false)));
                }
                HashMap hashMap2222222222 = new HashMap();
                hashMap2222222222.put("mcc", Integer.valueOf(application2.getResources().getConfiguration().mcc));
                hashMap2222222222.put("mnc", Integer.valueOf(application2.getResources().getConfiguration().mnc));
                map2.put("cell", hashMap2222222222);
                map2.put("sig", aa.AFInAppEventParameterName(axVar2.AFInAppEventParameterName.getPackageManager(), axVar2.AFInAppEventParameterName.getPackageName()));
                map2.put("last_boot_time", Long.valueOf(System.currentTimeMillis() - SystemClock.elapsedRealtime()));
                StatFs statFs222222222 = new StatFs(Environment.getDataDirectory().getAbsolutePath());
                if (Build.VERSION.SDK_INT >= 18) {
                    long blockSizeLong = statFs222222222.getBlockSizeLong();
                    availableBlocks = statFs222222222.getAvailableBlocksLong() * blockSizeLong;
                    blockCount = statFs222222222.getBlockCountLong() * blockSizeLong;
                } else {
                    int blockSize = statFs222222222.getBlockSize();
                    availableBlocks = statFs222222222.getAvailableBlocks() * blockSize;
                    blockCount = statFs222222222.getBlockCount() * blockSize;
                }
                double pow222222222 = Math.pow(2.0d, 20.0d);
                StringBuilder sb11222222222 = new StringBuilder();
                sb11222222222.append((long) (availableBlocks / pow222222222));
                sb11222222222.append("/");
                sb11222222222.append((long) (blockCount / pow222222222));
                map2.put("disk", sb11222222222.toString());
                strArr = this.getLevel;
                if (strArr != null) {
                    map2.put("sharing_filter", strArr);
                }
                return map2;
            }
        }
        axVar2 = axVar;
        map2.put("isFirstCall", Boolean.toString(!values(values5)));
        HashMap hashMap3222222222 = new HashMap();
        hashMap3222222222.put("cpu_abi", valueOf("ro.product.cpu.abi"));
        hashMap3222222222.put("cpu_abi2", valueOf("ro.product.cpu.abi2"));
        hashMap3222222222.put("arch", valueOf("os.arch"));
        hashMap3222222222.put("build_display_id", valueOf("ro.build.display.id"));
        if (z3) {
        }
        hashMap3222222222.put("dim", y.valueOf(application2));
        map2.put("deviceData", hashMap3222222222);
        Object obj22222222222 = obj;
        String str182222222222 = (String) map2.get(obj22222222222);
        String str192222222222 = (String) map2.get("af_timestamp");
        String str202222222222 = str10;
        String str212222222222 = (String) map2.get(str202222222222);
        StringBuilder sb52222222222 = new StringBuilder();
        sb52222222222.append(str182222222222.substring(0, 7));
        sb52222222222.append(str212222222222.substring(0, 7));
        sb52222222222.append(str192222222222.substring(str192222222222.length() - 7));
        map2.put("af_v", aj.valueOf(sb52222222222.toString()));
        String str222222222222 = (String) map2.get(obj22222222222);
        StringBuilder sb62222222222 = new StringBuilder();
        sb62222222222.append(str222222222222);
        sb62222222222.append(map2.get("af_timestamp"));
        String obj32222222222 = sb62222222222.toString();
        StringBuilder sb72222222222 = new StringBuilder();
        sb72222222222.append(obj32222222222);
        sb72222222222.append(map2.get(str202222222222));
        String obj42222222222 = sb72222222222.toString();
        StringBuilder sb82222222222 = new StringBuilder();
        sb82222222222.append(obj42222222222);
        sb82222222222.append(map2.get("installDate"));
        String obj52222222222 = sb82222222222.toString();
        StringBuilder sb92222222222 = new StringBuilder();
        sb92222222222.append(obj52222222222);
        sb92222222222.append(map2.get("counter"));
        String obj62222222222 = sb92222222222.toString();
        StringBuilder sb102222222222 = new StringBuilder();
        sb102222222222.append(obj62222222222);
        sb102222222222.append(map2.get("iaecounter"));
        map2.put("af_v2", aj.valueOf(aj.values(sb102222222222.toString())));
        map2.put("ivc", Boolean.valueOf(init(application2)));
        if (values5.contains("is_stop_tracking_used")) {
        }
        HashMap hashMap22222222222 = new HashMap();
        hashMap22222222222.put("mcc", Integer.valueOf(application2.getResources().getConfiguration().mcc));
        hashMap22222222222.put("mnc", Integer.valueOf(application2.getResources().getConfiguration().mnc));
        map2.put("cell", hashMap22222222222);
        map2.put("sig", aa.AFInAppEventParameterName(axVar2.AFInAppEventParameterName.getPackageManager(), axVar2.AFInAppEventParameterName.getPackageName()));
        map2.put("last_boot_time", Long.valueOf(System.currentTimeMillis() - SystemClock.elapsedRealtime()));
        StatFs statFs2222222222 = new StatFs(Environment.getDataDirectory().getAbsolutePath());
        if (Build.VERSION.SDK_INT >= 18) {
        }
        double pow2222222222 = Math.pow(2.0d, 20.0d);
        StringBuilder sb112222222222 = new StringBuilder();
        sb112222222222.append((long) (availableBlocks / pow2222222222));
        sb112222222222.append("/");
        sb112222222222.append((long) (blockCount / pow2222222222));
        map2.put("disk", sb112222222222.toString());
        strArr = this.getLevel;
        if (strArr != null) {
        }
        return map2;
    }

    public final Map<String, Object> AFInAppEventType() {
        HashMap hashMap = new HashMap();
        if (AFVersionDeclaration()) {
            hashMap.put("lvl", this.setCustomerIdAndLogSession);
        } else if (this.setPhoneNumber) {
            HashMap hashMap2 = new HashMap();
            this.setCustomerIdAndLogSession = hashMap2;
            hashMap2.put("error", "operation timed out.");
            hashMap.put("lvl", this.setCustomerIdAndLogSession);
        }
        return hashMap;
    }

    private void AFInAppEventType(h hVar) {
        byte b = 0;
        boolean z = hVar.AFLogger$LogLevel == null;
        if (AFKeystoreWrapper()) {
            AFLogger.values("CustomerUserId not set, reporting is disabled", true);
            return;
        }
        if (z) {
            if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.LAUNCH_PROTECT_ENABLED, true)) {
                if (valueOf()) {
                    AppsFlyerRequestListener appsFlyerRequestListener = hVar.AFKeystoreWrapper;
                    if (appsFlyerRequestListener != null) {
                        appsFlyerRequestListener.onError(RequestError.EVENT_TIMEOUT, at.AFInAppEventType);
                        return;
                    }
                    return;
                }
            } else {
                AFLogger.valueOf("Allowing multiple launches within a 5 second time window.");
            }
            this.onDeepLinking = System.currentTimeMillis();
        }
        if (l.AFKeystoreWrapper == null) {
            l.AFKeystoreWrapper = new l();
        }
        AFKeystoreWrapper(l.AFKeystoreWrapper.values(), new a(this, hVar, b), 0L, TimeUnit.MILLISECONDS);
    }

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

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

    private static void AFInAppEventParameterName(Context context) {
        int i2;
        if (aa.AFInAppEventParameterName()) {
            i2 = 23;
            AFLogger.AFInAppEventType("OPPO device found");
        } else {
            i2 = 18;
        }
        int i3 = Build.VERSION.SDK_INT;
        if (i3 >= i2 && !AFInAppEventType(AppsFlyerProperties.DISABLE_KEYSTORE, true)) {
            StringBuilder sb = new StringBuilder("OS SDK is=");
            sb.append(i3);
            sb.append("; use KeyStore");
            AFLogger.AFInAppEventType(sb.toString());
            AFKeystoreWrapper aFKeystoreWrapper = new AFKeystoreWrapper(context);
            if (!aFKeystoreWrapper.AFInAppEventType()) {
                aFKeystoreWrapper.values = an.AFKeystoreWrapper(new WeakReference(context));
                aFKeystoreWrapper.AFInAppEventType = 0;
                aFKeystoreWrapper.values(aFKeystoreWrapper.values());
            } else {
                String values2 = aFKeystoreWrapper.values();
                synchronized (aFKeystoreWrapper.valueOf) {
                    aFKeystoreWrapper.AFInAppEventType++;
                    AFLogger.valueOf("Deleting key with alias: ".concat(String.valueOf(values2)));
                    try {
                        synchronized (aFKeystoreWrapper.valueOf) {
                            aFKeystoreWrapper.AFKeystoreWrapper.deleteEntry(values2);
                        }
                    } catch (KeyStoreException e2) {
                        StringBuilder sb2 = new StringBuilder("Exception ");
                        sb2.append(e2.getMessage());
                        sb2.append(" occurred");
                        AFLogger.values(sb2.toString(), e2);
                    }
                }
                aFKeystoreWrapper.values(aFKeystoreWrapper.values());
            }
            AppsFlyerProperties.getInstance().set("KSAppsFlyerId", aFKeystoreWrapper.AFInAppEventParameterName());
            AppsFlyerProperties.getInstance().set("KSAppsFlyerRICounter", String.valueOf(aFKeystoreWrapper.valueOf()));
            return;
        }
        StringBuilder sb3 = new StringBuilder("OS SDK is=");
        sb3.append(i3);
        sb3.append("; no KeyStore usage");
        AFLogger.AFInAppEventType(sb3.toString());
    }

    private boolean valueOf() {
        if (this.onDeepLinking > 0) {
            long currentTimeMillis = System.currentTimeMillis() - this.onDeepLinking;
            Locale locale = Locale.US;
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS Z", locale);
            long j2 = this.onDeepLinking;
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
            String format = simpleDateFormat.format(new Date(j2));
            long j3 = this.AppsFlyerConversionListener;
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone(UtcDates.UTC));
            String format2 = simpleDateFormat.format(new Date(j3));
            if (currentTimeMillis < this.onValidateInApp && !isStopped()) {
                AFLogger.valueOf(String.format(locale, "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.onValidateInApp)));
                return true;
            }
            if (!isStopped()) {
                AFLogger.valueOf(String.format(locale, "Last Launch attempt: %s;\nLast successful Launch event: %s;\nSending launch (+%s ms)", format, format2, Long.valueOf(currentTimeMillis)));
            }
        } else if (!isStopped()) {
            AFLogger.valueOf("Sending first launch for this session!");
        }
        return false;
    }

    public boolean AFInAppEventType(h hVar, SharedPreferences sharedPreferences) {
        int values2 = values(sharedPreferences, "appsFlyerCount", false);
        return (!sharedPreferences.getBoolean(AppsFlyerProperties.NEW_REFERRER_SENT, false) && values2 == 1) || (values2 == 1 && !(hVar instanceof be));
    }

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

    public static SharedPreferences values(Context context) {
        ah ahVar = onConversionDataFail;
        if (ahVar.setUserEmails == null) {
            ahVar.setUserEmails = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0);
        }
        return onConversionDataFail.setUserEmails;
    }

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

    private static String valueOf(String str) {
        try {
            return (String) Class.forName("android.os.SystemProperties").getMethod("get", String.class).invoke(null, str);
        } catch (Throwable th) {
            AFLogger.values(th.getMessage(), th);
            return null;
        }
    }

    public static void values(ah ahVar, h hVar) throws IOException {
        String jSONObject;
        StringBuilder sb = new StringBuilder("url: ");
        sb.append(hVar.onAttributionFailureNative);
        AFLogger.valueOf(sb.toString());
        if (hVar.AppsFlyer2dXConversionCallback != null) {
            jSONObject = Base64.encodeToString(hVar.valueOf(), 2);
            AFLogger.valueOf("cached data: ".concat(String.valueOf(jSONObject)));
        } else {
            jSONObject = new JSONObject((Map<?, ?>) hVar.AFInAppEventType()).toString();
            String replaceAll = jSONObject.replaceAll("\\p{C}", "*Non-printing character*");
            if (!replaceAll.equals(jSONObject)) {
                AFLogger.AFInAppEventParameterName("Payload contains non-printing characters");
                jSONObject = replaceAll;
            }
            ak.values("data: ".concat(String.valueOf(jSONObject)));
        }
        ap.AFInAppEventParameterName().valueOf("server_request", hVar.onAttributionFailureNative, jSONObject);
        try {
            ahVar.AFInAppEventParameterName(hVar);
        } catch (IOException e2) {
            AFLogger.values("Exception in sendRequestToServer. ", e2);
            if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.USE_HTTP_FALLBACK, false)) {
                ahVar.AFInAppEventParameterName(hVar.AFInAppEventParameterName(hVar.onAttributionFailureNative.replace("https:", "http:")));
                return;
            }
            StringBuilder sb2 = new StringBuilder("failed to send request to server. ");
            sb2.append(e2.getLocalizedMessage());
            AFLogger.valueOf(sb2.toString());
            throw e2;
        }
    }

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

    public final void AFInAppEventParameterName(Context context, Map<String, Object> map, Uri uri) {
        if (!map.containsKey("af_deeplink")) {
            String AFInAppEventParameterName2 = AFInAppEventParameterName(uri.toString());
            f values2 = f.values();
            String str = values2.AFLogger$LogLevel;
            if (str != null && values2.AppsFlyer2dXConversionCallback != null && AFInAppEventParameterName2.contains(str)) {
                Uri.Builder buildUpon = Uri.parse(AFInAppEventParameterName2).buildUpon();
                Uri.Builder buildUpon2 = Uri.EMPTY.buildUpon();
                for (Map.Entry<String, String> entry : values2.AppsFlyer2dXConversionCallback.entrySet()) {
                    buildUpon.appendQueryParameter(entry.getKey(), entry.getValue());
                    buildUpon2.appendQueryParameter(entry.getKey(), entry.getValue());
                }
                AFInAppEventParameterName2 = buildUpon.build().toString();
                map.put("appended_query_params", buildUpon2.build().getEncodedQuery());
            }
            map.put("af_deeplink", AFInAppEventParameterName2);
        }
        final HashMap hashMap = new HashMap();
        hashMap.put("link", uri.toString());
        ai aiVar = new ai(uri, this);
        if (aiVar.AFInAppEventType) {
            map.put("isBrandedDomain", Boolean.TRUE);
        }
        aiVar.setConnProvider(new am.d());
        aa.AFKeystoreWrapper(context, hashMap, uri);
        if (aiVar.values()) {
            aiVar.AFInAppEventParameterName = new ai.b() {
                @Override
                public final void AFInAppEventType(Map<String, String> map2) {
                    for (String str2 : map2.keySet()) {
                        hashMap.put(str2, map2.get(str2));
                    }
                    aq.valueOf((Map<String, String>) hashMap);
                }

                @Override
                public final void valueOf(String str2) {
                    aq.valueOf(str2);
                }
            };
            if (l.AFKeystoreWrapper == null) {
                l.AFKeystoreWrapper = new l();
            }
            l.AFKeystoreWrapper.AFInAppEventParameterName().execute(aiVar);
            return;
        }
        aq.valueOf(hashMap);
    }

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

    private static String AFInAppEventParameterName(String str, PackageManager packageManager, String str2) {
        Object obj;
        try {
            Bundle bundle = ((PackageItemInfo) packageManager.getApplicationInfo(str2, RecyclerView.ViewHolder.FLAG_IGNORE)).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.values(sb.toString(), th);
            return null;
        }
    }

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

    private void AFInAppEventParameterName(h hVar) throws IOException {
        boolean z;
        long currentTimeMillis;
        HttpURLConnection httpURLConnection;
        HttpURLConnection httpURLConnection2;
        DataOutputStream dataOutputStream;
        DataOutputStream dataOutputStream2;
        URL url = new URL(hVar.onAttributionFailureNative);
        byte[] valueOf2 = hVar.valueOf();
        String str = hVar.AFVersionDeclaration;
        String str2 = hVar.AppsFlyer2dXConversionCallback;
        boolean AFInAppEventParameterName2 = hVar.AFInAppEventParameterName();
        Application application = hVar.valueOf;
        AppsFlyerRequestListener appsFlyerRequestListener = hVar.AFKeystoreWrapper;
        boolean z2 = AFInAppEventParameterName2 && AFInAppEventType != null;
        boolean z3 = AFInAppEventParameterName2 && hVar.onInstallConversionFailureNative == 1;
        if (z3) {
            try {
                z = z2;
                try {
                    this.setAdditionalData.put("from_fg", System.currentTimeMillis() - this.onValidateInAppFailure);
                } catch (JSONException unused) {
                }
            } catch (JSONException unused2) {
                z = z2;
            }
            currentTimeMillis = System.currentTimeMillis();
        } else {
            z = z2;
            currentTimeMillis = 0;
        }
        try {
            HttpURLConnection httpURLConnection3 = (HttpURLConnection) url.openConnection();
            try {
                httpURLConnection3.setRequestMethod("POST");
                httpURLConnection3.setRequestProperty("Content-Length", String.valueOf(valueOf2.length));
                httpURLConnection3.setRequestProperty("Content-Type", hVar.AFKeystoreWrapper() ? "application/octet-stream" : "application/json");
                httpURLConnection3.setConnectTimeout(SearchAuth.StatusCodes.AUTH_DISABLED);
                httpURLConnection3.setDoOutput(true);
                if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.HTTP_CACHE, true)) {
                    httpURLConnection2 = httpURLConnection3;
                } else {
                    httpURLConnection3.setUseCaches(false);
                    httpURLConnection2 = httpURLConnection3;
                }
                try {
                    try {
                        dataOutputStream2 = new DataOutputStream(httpURLConnection2.getOutputStream());
                    } catch (Throwable th) {
                        th = th;
                        dataOutputStream = null;
                    }
                    try {
                        dataOutputStream2.write(valueOf2);
                        dataOutputStream2.close();
                        int responseCode = httpURLConnection2.getResponseCode();
                        if (z3) {
                            try {
                                this.setAdditionalData.put("net", System.currentTimeMillis() - currentTimeMillis);
                            } catch (JSONException unused3) {
                            }
                        }
                        if (this.AppsFlyer2dXConversionCallback == null) {
                            this.AppsFlyer2dXConversionCallback = new ax(application);
                        }
                        this.AppsFlyer2dXConversionCallback.AFInAppEventType.edit().putString("first_launch", this.setAdditionalData.toString()).apply();
                        String AFInAppEventType2 = AFInAppEventType(httpURLConnection2);
                        ap.AFInAppEventParameterName().valueOf("server_response", url.toString(), String.valueOf(responseCode), AFInAppEventType2);
                        AFLogger.valueOf("response code: ".concat(String.valueOf(responseCode)));
                        SharedPreferences values2 = values(application);
                        if (responseCode == 200) {
                            if (application != null && AFInAppEventParameterName2) {
                                this.AppsFlyerConversionListener = System.currentTimeMillis();
                            }
                            if (appsFlyerRequestListener != null) {
                                appsFlyerRequestListener.onSuccess();
                            }
                            if (str2 != null) {
                                ag.AFKeystoreWrapper();
                                ag.values(str2, application);
                            } else {
                                SharedPreferences.Editor edit = values(application).edit();
                                edit.putString("sentSuccessfully", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
                                edit.apply();
                                if (!this.AppsFlyerLib && System.currentTimeMillis() - this.AFVersionDeclaration >= 15000 && this.AppsFlyerInAppPurchaseValidatorListener == null) {
                                    if (l.AFKeystoreWrapper == null) {
                                        l.AFKeystoreWrapper = new l();
                                    }
                                    this.AppsFlyerInAppPurchaseValidatorListener = l.AFKeystoreWrapper.values();
                                    AFKeystoreWrapper(this.AppsFlyerInAppPurchaseValidatorListener, new c(application), 1L, TimeUnit.SECONDS);
                                }
                            }
                            ba baVar = new ba(application);
                            o values3 = baVar.values();
                            if (values3 != null && values3.valueOf()) {
                                String str3 = values3.AFKeystoreWrapper;
                                AFLogger.AFKeystoreWrapper("Resending Uninstall token to AF servers: ".concat(String.valueOf(str3)));
                                baVar.valueOf(str3);
                            }
                            this.setImeiData = as.AFInAppEventType(AFInAppEventType2).optBoolean("send_background", false);
                        } else if (appsFlyerRequestListener != null) {
                            int i2 = RequestError.RESPONSE_CODE_FAILURE;
                            StringBuilder sb = new StringBuilder();
                            sb.append(at.AFInAppEventParameterName);
                            sb.append(" ");
                            sb.append(responseCode);
                            appsFlyerRequestListener.onError(i2, sb.toString());
                        }
                        StringBuilder sb2 = new StringBuilder("[GCD-A01] Loading conversion data. Counter: ");
                        sb2.append(hVar.onInstallConversionFailureNative);
                        AFLogger.AFKeystoreWrapper(sb2.toString());
                        long j2 = values2.getLong("appsflyerConversionDataCacheExpiration", 0L);
                        if (j2 != 0 && System.currentTimeMillis() - j2 > 5184000000L) {
                            AFLogger.AFKeystoreWrapper("[GCD-E02] Cached conversion data expired");
                            SharedPreferences.Editor edit2 = values(application).edit();
                            edit2.putBoolean("sixtyDayConversionData", true);
                            edit2.apply();
                            SharedPreferences.Editor edit3 = values(application).edit();
                            edit3.putString("attributionId", null);
                            edit3.apply();
                            values(application, "appsflyerConversionDataCacheExpiration", 0L);
                        }
                        if (values2.getString("attributionId", null) == null && str != null && z) {
                            bc bcVar = new bc(this, (Application) application.getApplicationContext(), str);
                            AFKeystoreWrapper(bcVar.AFKeystoreWrapper, bcVar, 10L, TimeUnit.MILLISECONDS);
                        } else if (str == null) {
                            AFLogger.AFKeystoreWrapper("[GCD-E05] AppsFlyer dev key is missing");
                        } else if (z && values2.getString("attributionId", null) != null && values(values2, "appsFlyerCount", false) > 1) {
                            try {
                                Map<String, Object> AFInAppEventType3 = az.AFInAppEventType(application);
                                if (AFInAppEventType3 != null) {
                                    try {
                                        if (!AFInAppEventType3.containsKey("is_first_launch")) {
                                            AFInAppEventType3.put("is_first_launch", Boolean.FALSE);
                                        }
                                        bc.valueOf(AFInAppEventType3);
                                    } catch (Throwable th2) {
                                        AFLogger.values(th2.getLocalizedMessage(), th2);
                                    }
                                }
                            } catch (ay e2) {
                                AFLogger.values(e2.getMessage(), e2);
                            }
                        } else if (AFInAppEventType == null) {
                            AFLogger.AFKeystoreWrapper("[GCD-E01] AppsFlyerConversionListener is null - skip gcd");
                        }
                        if (httpURLConnection2 != null) {
                            httpURLConnection2.disconnect();
                        }
                    } catch (Throwable th3) {
                        th = th3;
                        dataOutputStream = dataOutputStream2;
                        if (dataOutputStream != null) {
                            dataOutputStream.close();
                        }
                        throw th;
                    }
                } catch (Throwable th4) {
                    th = th4;
                    httpURLConnection = httpURLConnection2;
                    if (httpURLConnection != null) {
                        httpURLConnection.disconnect();
                    }
                    throw th;
                }
            } catch (Throwable th5) {
                th = th5;
                httpURLConnection2 = httpURLConnection3;
            }
        } catch (Throwable th6) {
            th = th6;
            httpURLConnection = null;
        }
    }

    public static void AFInAppEventParameterName(ah ahVar, h hVar) {
        String format;
        ScheduledExecutorService values2;
        Application application = hVar.valueOf;
        String str = hVar.AFLogger$LogLevel;
        if (application == null) {
            AFLogger.AFKeystoreWrapper("sendWithEvent - got null context. skipping event/launch.");
            return;
        }
        SharedPreferences values3 = values(application);
        AppsFlyerProperties.getInstance().saveProperties(values3);
        if (!ahVar.isStopped()) {
            StringBuilder sb = new StringBuilder("sendWithEvent from activity: ");
            sb.append(application.getClass().getName());
            AFLogger.valueOf(sb.toString());
        }
        boolean z = true;
        boolean z2 = false;
        boolean z3 = str == null;
        boolean z4 = hVar instanceof bh;
        boolean z5 = hVar instanceof be;
        hVar.onInstallConversionDataLoadedNative = z3;
        Map<String, ?> AFKeystoreWrapper2 = ahVar.AFKeystoreWrapper(hVar);
        String str2 = (String) AFKeystoreWrapper2.get("appsflyerKey");
        if (str2 != null && str2.length() != 0) {
            if (!ahVar.isStopped()) {
                AFLogger.valueOf("AppsFlyerLib.sendWithEvent");
            }
            int values4 = values(values3, "appsFlyerCount", false);
            if (z5 || z4) {
                format = String.format(onConversionDataSuccess, AppsFlyerLib.getInstance().getHostPrefix(), onConversionDataFail.getHostName());
            } else if (!z3) {
                format = String.format(onAttributionFailure, AppsFlyerLib.getInstance().getHostPrefix(), onConversionDataFail.getHostName());
            } else if (values4 < 2) {
                format = String.format(onInstallConversionDataLoadedNative, AppsFlyerLib.getInstance().getHostPrefix(), onConversionDataFail.getHostName());
            } else {
                format = String.format(onAppOpenAttribution, AppsFlyerLib.getInstance().getHostPrefix(), onConversionDataFail.getHostName());
            }
            StringBuilder sb2 = new StringBuilder();
            sb2.append(format);
            sb2.append(application.getPackageName());
            String obj = sb2.toString();
            StringBuilder sb3 = new StringBuilder();
            sb3.append(obj);
            sb3.append("&buildnumber=6.2.3");
            String obj2 = sb3.toString();
            String AFInAppEventType2 = ahVar.AFInAppEventType(application);
            if (AFInAppEventType2 != null) {
                StringBuilder sb4 = new StringBuilder();
                sb4.append(obj2);
                sb4.append("&channel=");
                sb4.append(AFInAppEventType2);
                obj2 = sb4.toString();
            }
            if (!(AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID_FORCE_BY_USER, false) || AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.COLLECT_IMEI_FORCE_BY_USER, false)) && AFKeystoreWrapper2.get("advertiserId") != null) {
                try {
                    if (TextUtils.isEmpty(ahVar.AFLogger$LogLevel) && AFKeystoreWrapper2.remove("android_id") != null) {
                        AFLogger.valueOf("validateGaidAndIMEI :: removing: android_id");
                    }
                    if (TextUtils.isEmpty(ahVar.init) && AFKeystoreWrapper2.remove("imei") != null) {
                        AFLogger.valueOf("validateGaidAndIMEI :: removing: imei");
                    }
                } catch (Exception e2) {
                    AFLogger.values("failed to remove IMEI or AndroidID key from params; ", e2);
                }
            }
            h values5 = hVar.AFInAppEventParameterName(obj2).values(AFKeystoreWrapper2);
            values5.onInstallConversionFailureNative = values4;
            d dVar = new d(ahVar, values5, z2 ? (byte) 1 : (byte) 0);
            if (z3) {
                bs[] bsVarArr = ahVar.onDeepLinkingNative;
                if (bsVarArr != null) {
                    boolean z6 = false;
                    for (bs bsVar : bsVarArr) {
                        if (bsVar.AFKeystoreWrapper == bs.e.STARTED) {
                            StringBuilder sb5 = new StringBuilder("Failed to get ");
                            sb5.append(bsVar.AFInAppEventParameterName);
                            sb5.append(" referrer, wait ...");
                            AFLogger.AFKeystoreWrapper(sb5.toString());
                            z6 = true;
                        }
                    }
                    z2 = z6;
                }
                if (ahVar.setCustomerUserId && !ahVar.values()) {
                    AFLogger.AFKeystoreWrapper("fetching Facebook deferred AppLink data, wait ...");
                    z2 = true;
                }
                if (!ahVar.setPhoneNumber || ahVar.AFVersionDeclaration()) {
                    z = z2;
                }
            } else {
                z = false;
            }
            if (f.valueOf) {
                AFLogger.AFInAppEventType("ESP deeplink: execute launch on SerialExecutor");
                if (l.AFKeystoreWrapper == null) {
                    l.AFKeystoreWrapper = new l();
                }
                l lVar = l.AFKeystoreWrapper;
                if (lVar.valueOf == null) {
                    lVar.valueOf = Executors.newSingleThreadScheduledExecutor(lVar.values);
                }
                values2 = lVar.valueOf;
            } else {
                if (l.AFKeystoreWrapper == null) {
                    l.AFKeystoreWrapper = new l();
                }
                values2 = l.AFKeystoreWrapper.values();
            }
            AFKeystoreWrapper(values2, dVar, z ? 500L : 0L, TimeUnit.MILLISECONDS);
            return;
        }
        AFLogger.AFKeystoreWrapper("Not sending data yet, waiting for dev key");
        AppsFlyerRequestListener appsFlyerRequestListener = hVar.AFKeystoreWrapper;
        if (appsFlyerRequestListener != null) {
            appsFlyerRequestListener.onError(RequestError.NO_DEV_KEY, at.valueOf);
        }
    }
}