Sketch SG v3.0版本的 MD5 值为:c9b07a41a370e7ad2443807e6792f6ec

以下内容为反编译后的 ae.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.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.ViewConfiguration;
import android.view.WindowManager;
import androidx.constraintlayout.core.motion.utils.TypedValues;
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.ag;
import com.appsflyer.internal.ao;
import com.appsflyer.internal.bt;
import com.appsflyer.internal.c;
import com.appsflyer.internal.d;
import com.appsflyer.internal.l;
import com.appsflyer.internal.u;
import com.appsflyer.internal.v;
import com.appsflyer.internal.y;
import com.facebook.appevents.AppEventsConstants;
import com.facebook.appevents.UserDataStore;
import com.facebook.appevents.ondeviceprocessing.RemoteServiceWrapper;
import com.facebook.applinks.AppLinkData;
import com.facebook.internal.ServerProtocol;
import com.facebook.share.internal.ShareConstants;
import com.google.android.gms.common.GoogleApiAvailability;
import com.onesignal.NotificationBundleProcessor;
import com.yandex.metrica.YandexMetricaDefaultValues;
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.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

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

    static ScheduledExecutorService AppsFlyer2dXConversionCallback(ae aeVar) {
        aeVar.onValidateInAppFailure = null;
        return null;
    }

    static {
        StringBuilder sb = new StringBuilder();
        sb.append(AFInAppEventType);
        sb.append("/androidevent?buildnumber=6.3.2&app_id=");
        AFKeystoreWrapper = sb.toString();
        StringBuilder sb2 = new StringBuilder("https://%sadrevenue.%s/api/v");
        sb2.append(AFInAppEventType);
        sb2.append("/android?buildnumber=6.3.2&app_id=");
        onInstallConversionDataLoadedNative = sb2.toString();
        StringBuilder sb3 = new StringBuilder();
        sb3.append(AFInAppEventType);
        sb3.append("/androidevent?app_id=");
        String obj = sb3.toString();
        onDeepLinkingNative = obj;
        StringBuilder sb4 = new StringBuilder("https://%sconversions.%s/api/v");
        sb4.append(obj);
        onAttributionFailureNative = 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);
        onConversionDataFail = sb6.toString();
        StringBuilder sb7 = new StringBuilder("https://%sattr.%s/api/v");
        sb7.append(obj);
        onAttributionFailure = sb7.toString();
        values = null;
        valueOf = null;
        onConversionDataSuccess = new ae();
    }

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

    public static ae values() {
        return onConversionDataSuccess;
    }

    @Override
    @Deprecated
    public final void performOnAppAttribution(Context context, URI uri) {
        if (uri == null || uri.toString().isEmpty()) {
            StringBuilder sb = new StringBuilder("Link is \"");
            sb.append(uri);
            sb.append("\"");
            ap.valueOf(sb.toString(), DeepLinkResult.Error.NETWORK);
            return;
        }
        if (context == null) {
            StringBuilder sb2 = new StringBuilder("Context is \"");
            sb2.append(context);
            sb2.append("\"");
            ap.valueOf(sb2.toString(), DeepLinkResult.Error.NETWORK);
            return;
        }
        j.AFInAppEventType().AFInAppEventType(context, new HashMap(), Uri.parse(uri.toString()));
    }

    @Override
    public final 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.init("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 final void setSharingFilterForAllPartners() {
        this.getLevel = new String[]{"all"};
    }

    @Override
    public final void appendParametersToDeepLinkingURL(String str, Map<String, String> map) {
        j AFInAppEventType2 = j.AFInAppEventType();
        AFInAppEventType2.AFVersionDeclaration = str;
        AFInAppEventType2.AFLogger$LogLevel = map;
    }

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

    @Override
    public final void subscribeForDeepLink(DeepLinkListener deepLinkListener, long j) {
        j.AFInAppEventType().AFInAppEventParameterName = deepLinkListener;
        aq.onInstallConversionDataLoadedNative = j;
    }

    @Override
    public final void performOnDeepLinking(final Intent intent, Context context) {
        if (intent == null) {
            ap.valueOf("performOnDeepLinking was called with null intent", DeepLinkResult.Error.DEVELOPER_ERROR);
        } else if (context == null) {
            ap.valueOf("performOnDeepLinking was called with null context", DeepLinkResult.Error.DEVELOPER_ERROR);
        } else {
            final Context applicationContext = context.getApplicationContext();
            this.setAppInviteOneLink.execute(new Runnable() {
                @Override
                public final void run() {
                    j.AFInAppEventType();
                    Intent intent2 = intent;
                    Context context2 = applicationContext;
                    ae aeVar = ae.this;
                    if (aeVar.init == null) {
                        aeVar.init = new au(context2);
                    }
                    au auVar = aeVar.init;
                    Uri AFInAppEventType2 = j.AFInAppEventType(intent2);
                    boolean z = (AFInAppEventType2 == null || AFInAppEventType2.toString().isEmpty()) ? false : true;
                    if (ae.values(context2).getBoolean("ddl_sent", false) && !z) {
                        ap.valueOf("No direct deep link", null);
                    } else {
                        j.AFInAppEventType().AFKeystoreWrapper(new HashMap(), auVar, intent2, context2);
                    }
                }
            });
        }
    }

    @Override
    public final void addPushNotificationDeepLinkPath(String... strArr) {
        List<String> asList = Arrays.asList(strArr);
        List<List<String>> list = j.AFInAppEventType().getLevel;
        if (list.contains(asList)) {
            return;
        }
        list.add(asList);
    }

    @Override
    public final void setPartnerData(String str, Map<String, Object> map) {
        if (this.setAdditionalData == null) {
            this.setAdditionalData = new av();
        }
        av avVar = this.setAdditionalData;
        if (str == null || str.isEmpty()) {
            AFLogger.init("Partner ID is missing or `null`");
            return;
        }
        if (map == null || map.isEmpty()) {
            AFLogger.init(avVar.valueOf.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.values(sb.toString());
        int length = new JSONObject(map).toString().length();
        if (length > 1000) {
            AFLogger.init("Partner data 1000 characters limit exceeded");
            HashMap hashMap = new HashMap();
            hashMap.put("error", "limit exceeded: ".concat(String.valueOf(length)));
            avVar.AFKeystoreWrapper.put(str, hashMap);
            return;
        }
        avVar.valueOf.put(str, map);
        avVar.AFKeystoreWrapper.remove(str);
    }

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

    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.init("Cannot set preinstall attribution data without a media source");
                } else {
                    AppsFlyerProperties.getInstance().set("preInstallName", stringExtra);
                }
            } catch (JSONException e2) {
                AFLogger.AFInAppEventType("Error parsing JSON for preinstall", e2);
            }
        }
        AFLogger.AFKeystoreWrapper("****** onReceive called *******");
        AppsFlyerProperties.getInstance();
        String stringExtra2 = intent.getStringExtra("referrer");
        AFLogger.AFKeystoreWrapper("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.valueOf = stringExtra2;
            if (AppsFlyerProperties.getInstance().values()) {
                AFLogger.AFKeystoreWrapper("onReceive: isLaunchCalled");
                bd bdVar = new bd();
                if (context != null) {
                    bdVar.valueOf = (Application) context.getApplicationContext();
                }
                bdVar.init = stringExtra2;
                if (stringExtra2 == null || stringExtra2.length() <= 5 || !AFInAppEventParameterName(bdVar, values(context))) {
                    return;
                }
                if (k.valueOf == null) {
                    k.valueOf = new k();
                }
                AFInAppEventType(k.valueOf.AFInAppEventParameterName(), new c(this, bdVar, (byte) 0), 5L, TimeUnit.MILLISECONDS);
            }
        }
    }

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

    public final void values(Context context, String str) {
        JSONArray jSONArray;
        JSONArray jSONArray2;
        JSONObject jSONObject;
        AFLogger.values("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) {
                AFKeystoreWrapper(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.AFInAppEventType(sb.toString(), th);
        }
    }

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

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

    @Override
    public final void onPause(Context context) {
        if (ag.AFInAppEventParameterName != null) {
            ag.AFInAppEventParameterName.values(context);
        }
    }

    @Override
    public final void updateServerUninstallToken(Context context, String str) {
        new bb(context).valueOf(str);
    }

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

    @Override
    public final void setImeiData(String str) {
        aj.valueOf().AFInAppEventType("public_api_call", "setImeiData", str);
        this.AppsFlyer2dXConversionCallback = str;
    }

    @Override
    public final void setOaidData(String str) {
        aj.valueOf().AFInAppEventType("public_api_call", "setOaidData", str);
        ab.valueOf = str;
    }

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

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

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

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

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

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

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

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

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

    @Override
    public final void setCustomerIdAndLogSession(String str, Context context) {
        if (context != null) {
            if (valueOf()) {
                setCustomerUserId(str);
                StringBuilder sb = new StringBuilder("CustomerUserId set: ");
                sb.append(str);
                sb.append(" - Initializing AppsFlyer Tacking");
                AFLogger.AFInAppEventType(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.values = null;
                blVar.init = referrer;
                blVar.AFInAppEventParameterName = null;
                AFInAppEventType(blVar);
                return;
            }
            setCustomerUserId(str);
            AFLogger.AFInAppEventType("waitForCustomerUserId is false; setting CustomerUserID: ".concat(String.valueOf(str)), true);
        }
    }

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

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

    @Override
    public final void setAppInviteOneLink(String str) {
        aj.valueOf().AFInAppEventType("public_api_call", "setAppInviteOneLink", str);
        AFLogger.AFKeystoreWrapper("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 final void setAdditionalData(Map<String, Object> map) {
        if (map != null) {
            aj.valueOf().AFInAppEventType("public_api_call", "setAdditionalData", map.toString());
            AppsFlyerProperties.getInstance().setCustomData(new JSONObject(map).toString());
        }
    }

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

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

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

    @Override
    public final void setCollectAndroidID(boolean z) {
        aj.valueOf().AFInAppEventType("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 final void setCollectIMEI(boolean z) {
        aj.valueOf().AFInAppEventType("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
    @Deprecated
    public final void setCollectOaid(boolean z) {
        aj.valueOf().AFInAppEventType("public_api_call", "setCollectOaid", String.valueOf(z));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.COLLECT_OAID, Boolean.toString(z));
    }

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

    @Override
    public final void setOneLinkCustomDomain(String... strArr) {
        AFLogger.values(String.format("setOneLinkCustomDomain %s", Arrays.toString(strArr)));
        j.AppsFlyer2dXConversionCallback = strArr;
    }

    @Override
    public final AppsFlyerLib init(String str, AppsFlyerConversionListener appsFlyerConversionListener, Context context) {
        if (this.setDebugLog) {
            return this;
        }
        this.setDebugLog = true;
        if (context == null) {
            AFLogger.init("context is null, Google Install Referrer will be not initialized");
        } else {
            if (this.init == null) {
                this.init = new au(context);
            }
            au auVar = this.init;
            if (auVar.AFInAppEventType()) {
                auVar.valueOf.edit().putLong("init_ts", System.currentTimeMillis()).apply();
            }
            this.setImeiData = (Application) context.getApplicationContext();
            final bo boVar = new bo(new Runnable() {
                @Override
                public final void run() {
                    if (k.valueOf == null) {
                        k.valueOf = new k();
                    }
                    ae.AFInAppEventType(k.valueOf.AFInAppEventParameterName(), new Runnable() {
                        @Override
                        public final void run() {
                            try {
                                bh bhVar = new bh();
                                Application application = ae.this.setImeiData;
                                if (application != null) {
                                    bhVar.valueOf = (Application) application.getApplicationContext();
                                }
                                if (ae.this.AFInAppEventParameterName(bhVar, ae.values(ae.this.setImeiData))) {
                                    ae.AFKeystoreWrapper(ae.this, bhVar);
                                }
                            } catch (Throwable th) {
                                AFLogger.AFInAppEventType(th.getMessage(), th);
                            }
                        }
                    }, 0L, TimeUnit.MILLISECONDS);
                }
            });
            Runnable runnable = new Runnable() {
                @Override
                public final void run() {
                    SharedPreferences values2 = ae.values(ae.this.setImeiData);
                    int valueOf2 = ae.valueOf(values2, "appsFlyerCount", false);
                    boolean z = values2.getBoolean(AppsFlyerProperties.NEW_REFERRER_SENT, false);
                    boolean z2 = boVar.AFInAppEventParameterName == bt.e.NOT_STARTED;
                    if (valueOf2 == 1) {
                        if (z2 || z) {
                            ae aeVar = ae.this;
                            bh bhVar = new bh();
                            Application application = ae.this.setImeiData;
                            if (application != null) {
                                bhVar.valueOf = (Application) application.getApplicationContext();
                            }
                            ae.AFKeystoreWrapper(aeVar, bhVar);
                        }
                    }
                }
            };
            bt[] btVarArr = {boVar, new br(runnable), new bw(runnable)};
            this.onAppOpenAttributionNative = btVarArr;
            for (bt btVar : btVarArr) {
                btVar.AFInAppEventParameterName(this.setImeiData);
            }
            this.getOutOfStore = AFInAppEventType(context);
            at.AFInAppEventParameterName = this.setImeiData;
        }
        aj valueOf2 = aj.valueOf();
        String[] strArr = new String[2];
        strArr[0] = str;
        strArr[1] = appsFlyerConversionListener == null ? "null" : "conversionDataListener";
        valueOf2.AFInAppEventType("public_api_call", "init", strArr);
        AFLogger.AFInAppEventType(String.format("Initializing AppsFlyer SDK: (v%s.%s)", "6.3.2", AFInAppEventParameterName));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.AF_KEY, str);
        am.valueOf(str);
        valueOf = appsFlyerConversionListener;
        return this;
    }

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

                @Override
                public final void AFKeystoreWrapper(String str, Exception exc) {
                    String message = exc.getMessage();
                    if (message == null) {
                        message = "unknown";
                    }
                    ae.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 AnonymousClass2() {
                        }

                        @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;
                                d dVar2 = d.this;
                                if (dVar2 == null) {
                                    AFLogger.values("onLvlResult invocation succeeded, but listener is null");
                                } else if (str != null && str2 != null) {
                                    dVar2.AFInAppEventParameterName(str, str2);
                                } else if (str2 == null) {
                                    dVar2.AFKeystoreWrapper("onLvlResult with error", new Exception("AFLVL Invalid signature"));
                                } else {
                                    dVar2.AFKeystoreWrapper("onLvlResult with error", new Exception("AFLVL Invalid signedData"));
                                }
                            } else if (method.getName().equals("onLvlFailure")) {
                                d dVar3 = d.this;
                                if (dVar3 != null) {
                                    if (objArr[0] != null) {
                                        dVar3.AFKeystoreWrapper("onLvlFailure with exception", (Exception) objArr[0]);
                                    } else {
                                        dVar3.AFKeystoreWrapper("onLvlFailure", new Exception("unknown"));
                                    }
                                } else {
                                    AFLogger.values("onLvlFailure: listener is null");
                                }
                            } else {
                                d dVar4 = d.this;
                                if (dVar4 != null) {
                                    dVar4.AFKeystoreWrapper("lvlInvocation failed", new Exception("com.appsflyer.lvl.AppsFlyerLVL$resultListener invocation failed"));
                                }
                            }
                            return null;
                        }
                    }));
                } catch (ClassNotFoundException e2) {
                    dVar.AFKeystoreWrapper(e2.getClass().getSimpleName(), e2);
                } catch (IllegalAccessException e3) {
                    dVar.AFKeystoreWrapper(e3.getClass().getSimpleName(), e3);
                }
            } catch (NoSuchMethodException e4) {
                dVar.AFKeystoreWrapper(e4.getClass().getSimpleName(), e4);
            } catch (InvocationTargetException e5) {
                dVar.AFKeystoreWrapper(e5.getClass().getSimpleName(), e5);
            }
            return true;
        } catch (ClassNotFoundException unused) {
            return false;
        }
    }

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

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

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

    @Override
    public final void start(Context context, final String str, final AppsFlyerRequestListener appsFlyerRequestListener) {
        if (ag.AFInAppEventParameterName != null) {
            return;
        }
        if (!this.setDebugLog) {
            AFLogger.init("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, ax.AFKeystoreWrapper);
                    return;
                }
                return;
            }
        }
        this.setImeiData = (Application) context.getApplicationContext();
        aj.valueOf().AFInAppEventType("public_api_call", "start", str);
        String str2 = AFInAppEventParameterName;
        AFLogger.AFKeystoreWrapper(String.format("Starting AppsFlyer: (v%s.%s)", "6.3.2", str2));
        StringBuilder sb = new StringBuilder("Build Number: ");
        sb.append(str2);
        AFLogger.AFKeystoreWrapper(sb.toString());
        AppsFlyerProperties.getInstance().loadProperties(this.setImeiData.getApplicationContext());
        if (TextUtils.isEmpty(str)) {
            if (TextUtils.isEmpty(AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY))) {
                AFLogger.init("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, ax.AFKeystoreWrapper);
                    return;
                }
                return;
            }
        } else {
            AppsFlyerProperties.getInstance().set(AppsFlyerProperties.AF_KEY, str);
            am.valueOf(str);
        }
        Context baseContext = this.setImeiData.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.AFInAppEventType("appsflyer_backup_rules.xml detected, using AppsFlyer defined backup rules for AppsFlyer SDK data", true);
                } else {
                    AFLogger.valueOf("'allowBackup' is set to true; appsflyer_backup_rules.xml not detected.\nAppsFlyer shared preferences should be excluded from auto backup by adding: <exclude domain=\"sharedpref\" path=\"appsflyer-data\"/> to the Application's <full-backup-content> rules");
                }
            }
        } catch (Exception e2) {
            StringBuilder sb2 = new StringBuilder("checkBackupRules Exception: ");
            sb2.append(e2.toString());
            AFLogger.AFInAppEventParameterName(sb2.toString());
        }
        if (this.setPhoneNumber) {
            Context applicationContext = this.setImeiData.getApplicationContext();
            this.waitForCustomerUserId = new HashMap();
            final long currentTimeMillis = System.currentTimeMillis();
            l.a aVar = new l.a() {
                @Override
                public final void AFInAppEventType(String str3, String str4, String str5) {
                    if (str3 == null) {
                        ae.this.waitForCustomerUserId.put("link", "");
                    } else {
                        AFLogger.AFKeystoreWrapper("Facebook Deferred AppLink data received: ".concat(String.valueOf(str3)));
                        ae.this.waitForCustomerUserId.put("link", str3);
                        if (str4 != null) {
                            ae.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);
                            ae.this.waitForCustomerUserId.put("extras", hashMap);
                        }
                    }
                    ae.this.waitForCustomerUserId.put("ttr", String.valueOf(System.currentTimeMillis() - currentTimeMillis));
                }

                @Override
                public final void values(String str3) {
                    ae.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 Class AFInAppEventParameterName;
                    private a values;

                    public AnonymousClass5(Class cls3, a aVar2) {
                        r1 = cls3;
                        r2 = aVar2;
                    }

                    @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;
                                }
                                a aVar2 = r2;
                                if (aVar2 != null) {
                                    aVar2.AFInAppEventType(str4, str5, str3);
                                }
                            } else {
                                a aVar3 = r2;
                                if (aVar3 != null) {
                                    aVar3.AFInAppEventType(null, null, null);
                                }
                            }
                            return null;
                        }
                        a aVar4 = r2;
                        if (aVar4 != null) {
                            aVar4.values("onDeferredAppLinkDataFetched invocation failed");
                        }
                        return null;
                    }
                });
                String string = applicationContext.getString(applicationContext.getResources().getIdentifier("facebook_app_id", TypedValues.Custom.S_STRING, applicationContext.getPackageName()));
                if (TextUtils.isEmpty(string)) {
                    aVar2.values("Facebook app id not defined in resources");
                } else {
                    method.invoke(null, applicationContext, string, newProxyInstance);
                }
            } catch (ClassNotFoundException e3) {
                aVar2.values(e3.toString());
            } catch (IllegalAccessException e4) {
                aVar2.values(e4.toString());
            } catch (NoSuchMethodException e5) {
                aVar2.values(e5.toString());
            } catch (InvocationTargetException e6) {
                aVar2.values(e6.toString());
            }
        }
        ag.valueOf(context, new ag.b() {
            @Override
            public final void AFKeystoreWrapper(Activity activity) {
                ae.this.AppsFlyerConversionListener = System.currentTimeMillis();
                ae aeVar = ae.this;
                if (aeVar.init == null) {
                    aeVar.init = new au(activity);
                }
                au auVar = aeVar.init;
                if (auVar.AFInAppEventType()) {
                    auVar.valueOf.edit().putLong("fg_ts", System.currentTimeMillis()).apply();
                }
                int valueOf2 = ae.valueOf(ae.values(activity), "appsFlyerCount", false);
                if (valueOf2 == 0) {
                    try {
                        ae.this.setUserEmails.put("init_to_fg", ae.this.AppsFlyerConversionListener - auVar.valueOf.getLong("init_ts", 0L));
                    } catch (JSONException unused) {
                    }
                }
                AFLogger.AFKeystoreWrapper("onBecameForeground");
                if (valueOf2 < 2) {
                    z AFKeystoreWrapper2 = z.AFKeystoreWrapper(activity);
                    AFKeystoreWrapper2.valueOf.post(AFKeystoreWrapper2.AFVersionDeclaration);
                    AFKeystoreWrapper2.valueOf.post(AFKeystoreWrapper2.AFKeystoreWrapper);
                }
                bl blVar = new bl();
                j.AFInAppEventType().AFKeystoreWrapper(blVar.AFInAppEventType(), auVar, activity.getIntent(), activity.getApplication());
                ae aeVar2 = ae.this;
                if (activity != null) {
                    blVar.valueOf = (Application) activity.getApplicationContext();
                }
                blVar.AFVersionDeclaration = str;
                blVar.AFKeystoreWrapper = appsFlyerRequestListener;
                aeVar2.values(blVar, activity);
            }

            @Override
            public final void values(Context context2) {
                AFLogger.AFKeystoreWrapper("onBecameBackground");
                ae.this.stop = System.currentTimeMillis();
                long j = ae.this.stop - ae.this.AppsFlyerConversionListener;
                if (j > 0 && j < 1000) {
                    j = 1000;
                }
                ae aeVar = ae.this;
                if (aeVar.init == null) {
                    aeVar.init = new au(context2);
                }
                aeVar.init.valueOf.edit().putLong("prev_session_dur", TimeUnit.MILLISECONDS.toSeconds(j)).apply();
                AFLogger.AFKeystoreWrapper("callStatsBackground background call");
                ae.this.AFKeystoreWrapper(new WeakReference<>(context2));
                aj valueOf2 = aj.valueOf();
                if (valueOf2.getLevel()) {
                    valueOf2.AFInAppEventParameterName();
                    if (context2 != null) {
                        aj.valueOf(context2.getPackageName(), context2.getPackageManager());
                    }
                    valueOf2.AFInAppEventType();
                } else {
                    AFLogger.values("RD status is OFF");
                }
                if (k.valueOf == null) {
                    k.valueOf = new k();
                }
                k kVar = k.valueOf;
                try {
                    k.AFKeystoreWrapper(kVar.values);
                    if (kVar.AFKeystoreWrapper instanceof ThreadPoolExecutor) {
                        k.AFKeystoreWrapper((ThreadPoolExecutor) kVar.AFKeystoreWrapper);
                    }
                } catch (Throwable th) {
                    AFLogger.AFInAppEventType("failed to stop Executors", th);
                }
                z AFKeystoreWrapper2 = z.AFKeystoreWrapper(context2);
                AFKeystoreWrapper2.valueOf.post(AFKeystoreWrapper2.AFVersionDeclaration);
            }
        }, this.setAppInviteOneLink);
    }

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

    @Override
    public final void setCustomerUserId(String str) {
        aj.valueOf().AFInAppEventType("public_api_call", "setCustomerUserId", str);
        AFLogger.AFKeystoreWrapper("setCustomerUserId = ".concat(String.valueOf(str)));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.APP_USER_ID, str);
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false);
    }

    @Override
    public final void setPhoneNumber(String str) {
        this.setCustomerUserId = af.values(str);
    }

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

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

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

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

    @Override
    public final void logLocation(Context context, double d2, double d3) {
        aj.valueOf().AFInAppEventType("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));
        AFKeystoreWrapper(context, AFInAppEventType.LOCATION_COORDINATES, hashMap);
    }

    final void AFKeystoreWrapper(WeakReference<Context> weakReference) {
        if (weakReference.get() == null) {
            return;
        }
        AFLogger.AFKeystoreWrapper("app went to background");
        SharedPreferences values2 = values(weakReference.get());
        AppsFlyerProperties.getInstance().saveProperties(values2);
        long j = this.stop - this.AppsFlyerConversionListener;
        HashMap hashMap = new HashMap();
        String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
        if (string == null) {
            AFLogger.init("[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);
        }
        d.e.C0012d AFInAppEventParameterName2 = ab.AFInAppEventParameterName(weakReference.get().getContentResolver());
        if (AFInAppEventParameterName2 != null) {
            hashMap.put("amazon_aid", AFInAppEventParameterName2.values);
            hashMap.put("amazon_aid_limit", String.valueOf(AFInAppEventParameterName2.valueOf));
        }
        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(j / 1000));
        hashMap.put("statType", "user_closed_app");
        hashMap.put("platform", "Android");
        hashMap.put("launch_counter", Integer.toString(valueOf(values2, "appsFlyerCount", false)));
        hashMap.put(AppsFlyerProperties.CHANNEL, valueOf(weakReference.get()));
        if (string2 == null) {
            string2 = "";
        }
        hashMap.put("originalAppsflyerId", string2);
        if (this.setAndroidIdData) {
            try {
                AFLogger.values("Running callStats task");
                bp bpVar = new bp();
                bpVar.onConversionDataFail = isStopped();
                new Thread(new m((bf) bpVar.valueOf(hashMap).AFInAppEventParameterName(String.format(onInstallConversionFailureNative, AppsFlyerLib.getInstance().getHostPrefix(), onConversionDataSuccess.getHostName())))).start();
                return;
            } catch (Throwable th) {
                AFLogger.AFInAppEventType("Could not send callStats request", th);
                return;
            }
        }
        AFLogger.values("Stats call is disabled, ignore ...");
    }

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

    @Override
    public final void logEvent(Context context, String str, Map<String, Object> map, AppsFlyerRequestListener appsFlyerRequestListener) {
        bj bjVar = new bj();
        if (context != null) {
            bjVar.valueOf = (Application) context.getApplicationContext();
        }
        bjVar.AFLogger$LogLevel = str;
        bjVar.values = map == null ? null : new HashMap(map);
        bjVar.AFKeystoreWrapper = appsFlyerRequestListener;
        aj valueOf2 = aj.valueOf();
        String[] strArr = new String[2];
        strArr[0] = str;
        strArr[1] = new JSONObject(bjVar.values == null ? new HashMap() : bjVar.values).toString();
        valueOf2.AFInAppEventType("public_api_call", "logEvent", strArr);
        if (str != null) {
            z.AFKeystoreWrapper(context).AFInAppEventType();
        }
        values(bjVar, context instanceof Activity ? (Activity) context : null);
    }

    @Override
    public final void sendAdRevenue(Context context, Map<String, Object> map) {
        bg bgVar = new bg();
        if (context != null) {
            bgVar.valueOf = (Application) context.getApplicationContext();
        }
        bgVar.values = map;
        Application application = bgVar.valueOf;
        byte b = 0;
        String format = String.format(onInstallConversionDataLoadedNative, AppsFlyerLib.getInstance().getHostPrefix(), onConversionDataSuccess.getHostName());
        StringBuilder sb = new StringBuilder();
        sb.append(format);
        sb.append(application.getPackageName());
        String obj = sb.toString();
        SharedPreferences values2 = values(application);
        int valueOf2 = valueOf(values2, "appsFlyerCount", false);
        int valueOf3 = valueOf(values2, "appsFlyerAdRevenueCount", true);
        HashMap hashMap = new HashMap();
        hashMap.put("ad_network", bgVar.values);
        hashMap.put("adrevenue_counter", Integer.valueOf(valueOf3));
        String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
        hashMap.put("af_key", string);
        hashMap.put("launch_counter", Integer.valueOf(valueOf2));
        hashMap.put("af_timestamp", Long.toString(new Date().getTime()));
        hashMap.put("uid", an.AFKeystoreWrapper(new WeakReference(application)));
        String string2 = AppsFlyerProperties.getInstance().getString("advertiserId");
        String string3 = AppsFlyerProperties.getInstance().getString("advertiserIdEnabled");
        if (string3 != null) {
            hashMap.put("advertiserIdEnabled", string3);
        }
        if (string2 != null) {
            hashMap.put("advertiserId", string2);
        }
        hashMap.put("device", Build.DEVICE);
        values(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 j = packageInfo.firstInstallTime;
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
            hashMap.put("install_date", simpleDateFormat.format(new Date(j)));
            String string4 = values2.getString("appsFlyerFirstInstall", null);
            if (string4 == null) {
                string4 = AFInAppEventParameterName(simpleDateFormat, application);
            }
            hashMap.put("first_launch_date", string4);
        } catch (Throwable th) {
            AFLogger.AFInAppEventType("AdRevenue - Exception while collecting app version data ", th);
        }
        g valueOf4 = bgVar.AFInAppEventParameterName(obj).valueOf(hashMap);
        valueOf4.onInstallConversionFailureNative = valueOf2;
        valueOf4.AFVersionDeclaration = string;
        d dVar = new d(this, valueOf4, b);
        if (k.valueOf == null) {
            k.valueOf = new k();
        }
        AFInAppEventType(k.valueOf.AFInAppEventParameterName(), dVar, 1L, TimeUnit.MILLISECONDS);
    }

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

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

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

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

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

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

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

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

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

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

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

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

    private static void values(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" : NotificationBundleProcessor.PUSH_MINIFIED_BUTTON_ICON);
        }
    }

    private static String AFInAppEventParameterName(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.AFKeystoreWrapper("Push Notification received af payload = ".concat(String.valueOf(str)));
                    extras.remove("af");
                    activity.setIntent(intent.putExtras(extras));
                }
            } catch (Throwable th) {
                AFLogger.AFInAppEventType(th.getMessage(), th);
            }
        }
        return str;
    }

    public final void AFInAppEventParameterName(Context context, Map<String, Object> map, Uri uri) {
        if (!map.containsKey("af_deeplink")) {
            String valueOf2 = valueOf(uri.toString());
            j AFInAppEventType2 = j.AFInAppEventType();
            if (AFInAppEventType2.AFVersionDeclaration != null && AFInAppEventType2.AFLogger$LogLevel != null && valueOf2.contains(AFInAppEventType2.AFVersionDeclaration)) {
                Uri.Builder buildUpon = Uri.parse(valueOf2).buildUpon();
                Uri.Builder buildUpon2 = Uri.EMPTY.buildUpon();
                for (Map.Entry<String, String> entry : AFInAppEventType2.AFLogger$LogLevel.entrySet()) {
                    buildUpon.appendQueryParameter(entry.getKey(), entry.getValue());
                    buildUpon2.appendQueryParameter(entry.getKey(), entry.getValue());
                }
                valueOf2 = buildUpon.build().toString();
                map.put("appended_query_params", buildUpon2.build().getEncodedQuery());
            }
            map.put("af_deeplink", valueOf2);
        }
        final HashMap hashMap = new HashMap();
        hashMap.put("link", uri.toString());
        ao aoVar = new ao(uri, this, context);
        if (aoVar.valueOf) {
            map.put("isBrandedDomain", Boolean.TRUE);
        }
        aa.AFKeystoreWrapper(context, hashMap, uri);
        if (!aoVar.AFKeystoreWrapper()) {
            ap.AFInAppEventParameterName(hashMap);
            return;
        }
        aoVar.values = new ao.b() {
            @Override
            public final void AFInAppEventParameterName(Map<String, String> map2) {
                for (String str : map2.keySet()) {
                    hashMap.put(str, map2.get(str));
                }
                ap.AFInAppEventParameterName((Map<String, String>) hashMap);
            }

            @Override
            public final void AFInAppEventParameterName(String str) {
                ap.valueOf(str, DeepLinkResult.Error.NETWORK);
            }
        };
        if (k.valueOf == null) {
            k.valueOf = new k();
        }
        k.valueOf.valueOf().execute(aoVar);
    }

    private static String valueOf(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 boolean AFLogger$LogLevel(Context context) {
        try {
            if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) == 0) {
                return true;
            }
        } catch (Throwable th) {
            AFLogger.AFInAppEventType("WARNING:  Google play services is unavailable. ", th);
        }
        try {
            context.getPackageManager().getPackageInfo("com.google.android.gms", 0);
            return true;
        } catch (PackageManager.NameNotFoundException e2) {
            AFLogger.AFInAppEventType("WARNING:  Google Play Services is unavailable. ", e2);
            return false;
        }
    }

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

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

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

    private static String AFKeystoreWrapper(String str, PackageManager packageManager, String str2) {
        Object obj;
        try {
            Bundle bundle = ((PackageItemInfo) packageManager.getApplicationInfo(str2, 128)).metaData;
            if (bundle == null || (obj = bundle.get(str)) == null) {
                return null;
            }
            return obj.toString();
        } catch (Throwable th) {
            StringBuilder sb = new StringBuilder("Could not find ");
            sb.append(str);
            sb.append(" value in the manifest");
            AFLogger.AFInAppEventType(sb.toString(), th);
            return null;
        }
    }

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

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

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

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

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

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

    public final String AFKeystoreWrapper(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 AFInAppEventParameterName(SimpleDateFormat simpleDateFormat, Context context) {
        String str;
        String string = values(context).getString("appsFlyerFirstInstall", null);
        if (string == null) {
            if (AFInAppEventParameterName(context)) {
                AFLogger.values("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.AFKeystoreWrapper("AppsFlyer: first launch date: ".concat(String.valueOf(string)));
        return string;
    }

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

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

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

    @Override
    public final void validateAndLogInAppPurchase(Context context, String str, String str2, String str3, String str4, String str5, Map<String, String> map) {
        aj valueOf2 = aj.valueOf();
        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();
        valueOf2.AFInAppEventType("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.AFKeystoreWrapper(sb.toString());
        }
        if (str == null || str4 == null || str2 == null || str5 == null || str3 == null) {
            AppsFlyerInAppPurchaseValidatorListener appsFlyerInAppPurchaseValidatorListener = values;
            if (appsFlyerInAppPurchaseValidatorListener != null) {
                appsFlyerInAppPurchaseValidatorListener.onValidateInAppFailure("Please provide purchase parameters");
                return;
            }
            return;
        }
        Context applicationContext = context.getApplicationContext();
        String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
        if (context instanceof Activity) {
            ((Activity) context).getIntent();
        }
        new Thread(new ad(applicationContext, string, str, str2, str3, str4, str5, map)).start();
    }

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

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

    public static String AFKeystoreWrapper(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.AFInAppEventType(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();
            }
        }
    }

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

    private static boolean getLevel(Context context) {
        if (context != null) {
            if (Build.VERSION.SDK_INT >= 23) {
                try {
                    ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
                    for (Network network : connectivityManager.getAllNetworks()) {
                        NetworkCapabilities networkCapabilities = connectivityManager.getNetworkCapabilities(network);
                        if (networkCapabilities.hasTransport(4) && !networkCapabilities.hasCapability(15)) {
                            return true;
                        }
                    }
                    return false;
                } catch (Exception e2) {
                    AFLogger.AFInAppEventType("Failed collecting ivc data", e2);
                }
            } else if (Build.VERSION.SDK_INT >= 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.AFInAppEventType("Failed collecting ivc data", e3);
                }
            }
        }
        return false;
    }

    @Override
    public final void setLogLevel(AFLogger.LogLevel logLevel) {
        aj.valueOf().AFInAppEventType("public_api_call", "log", String.valueOf(logLevel.getLevel() > AFLogger.LogLevel.NONE.getLevel()));
        AppsFlyerProperties.getInstance().set("logLevel", logLevel.getLevel());
    }

    @Override
    public final void setMinTimeBetweenSessions(int i) {
        this.AppsFlyerLib = TimeUnit.SECONDS.toMillis(i);
    }

    public class c implements Runnable {
        private final g AFInAppEventParameterName;

        c(ae aeVar, g gVar, byte b) {
            this(gVar);
        }

        private c(g gVar) {
            this.AFInAppEventParameterName = gVar;
        }

        @Override
        public final void run() {
            ae.AFKeystoreWrapper(ae.this, this.AFInAppEventParameterName);
        }
    }

    public class d implements Runnable {
        private final g AFInAppEventType;

        d(ae aeVar, g gVar, byte b) {
            this(gVar);
        }

        private d(g gVar) {
            this.AFInAppEventType = gVar;
        }

        @Override
        public final void run() {
            IOException iOException;
            AppsFlyerRequestListener appsFlyerRequestListener;
            Throwable th;
            OutputStreamWriter outputStreamWriter;
            String str;
            Map<String, Object> AFInAppEventType = this.AFInAppEventType.AFInAppEventType();
            boolean AFKeystoreWrapper = this.AFInAppEventType.AFKeystoreWrapper();
            String str2 = this.AFInAppEventType.onAppOpenAttributionNative;
            int i = this.AFInAppEventType.onInstallConversionFailureNative;
            Application application = this.AFInAppEventType.valueOf;
            if (!ae.this.isStopped()) {
                byte[] bArr = new byte[0];
                if (AFKeystoreWrapper && i <= 2) {
                    ArrayList arrayList = new ArrayList();
                    if (ae.this.onAppOpenAttributionNative != null) {
                        for (bt btVar : ae.this.onAppOpenAttributionNative) {
                            boolean z = btVar instanceof bo;
                            int i2 = AnonymousClass9.valueOf[btVar.AFInAppEventParameterName.ordinal()];
                            if (i2 == 1) {
                                if (z) {
                                    AFInAppEventType.put("rfr", ((bo) btVar).AFInAppEventType);
                                    ae.values(application).edit().putBoolean(AppsFlyerProperties.NEW_REFERRER_SENT, true).apply();
                                }
                                arrayList.add(btVar.AFKeystoreWrapper);
                            } else if (i2 == 2 && i == 2 && !z) {
                                HashMap hashMap = new HashMap();
                                hashMap.put("source", btVar.valueOf);
                                hashMap.put("response", "TIMEOUT");
                                hashMap.putAll(new bu());
                                arrayList.add(hashMap);
                            }
                        }
                    }
                    if (!arrayList.isEmpty()) {
                        AFInAppEventType.put("referrers", arrayList);
                    }
                    if (ae.this.waitForCustomerUserId != null) {
                        AFInAppEventType.put("fb_ddl", ae.this.waitForCustomerUserId);
                    }
                }
                if (!(this.AFInAppEventType instanceof bg)) {
                    AFInAppEventType.putAll(new d.e(AFInAppEventType, application));
                    AFInAppEventType.putAll(ae.this.AFInAppEventParameterName());
                }
                ?? r4 = 0;
                r4 = 0;
                r4 = 0;
                r4 = 0;
                r4 = 0;
                try {
                    try {
                        g gVar = this.AFInAppEventType;
                        if (gVar instanceof bg) {
                            str = (String) AFInAppEventType.get("af_key");
                        } else {
                            str = (String) AFInAppEventType.get("appsflyerKey");
                        }
                        gVar.AFVersionDeclaration = str;
                        synchronized (AFInAppEventType) {
                            try {
                                try {
                                    byte[] bArr2 = (byte[]) ((Class) a.AFKeystoreWrapper((ViewConfiguration.getTapTimeout() >> 16) + 48, TextUtils.getOffsetAfter("", 0) + 24, (char) (ViewConfiguration.getFadingEdgeLength() >> 16))).getDeclaredMethod("values", g.class).invoke(null, this.AFInAppEventType);
                                    try {
                                        try {
                                            ae aeVar = ae.this;
                                            g gVar2 = this.AFInAppEventType;
                                            gVar2.AppsFlyer2dXConversionCallback = bArr2;
                                            ae.valueOf(aeVar, gVar2);
                                            return;
                                        } catch (IOException e) {
                                            iOException = e;
                                            bArr = bArr2;
                                            AFLogger.AFInAppEventType("Exception while sending request to server. ", iOException);
                                            if (bArr != null && application != null && !str2.contains("&isCachedRequest=true&timeincache=")) {
                                                ai.AFKeystoreWrapper();
                                                h hVar = new h(str2, bArr, "6.3.2");
                                                try {
                                                    try {
                                                        try {
                                                            File AFKeystoreWrapper2 = ai.AFKeystoreWrapper(application);
                                                            if (!AFKeystoreWrapper2.exists()) {
                                                                AFKeystoreWrapper2.mkdir();
                                                            } else {
                                                                File[] listFiles = AFKeystoreWrapper2.listFiles();
                                                                if (listFiles != null && listFiles.length > 40) {
                                                                    AFLogger.AFKeystoreWrapper("reached cache limit, not caching request");
                                                                } else {
                                                                    AFLogger.AFKeystoreWrapper("caching request...");
                                                                    File file = new File(ai.AFKeystoreWrapper(application), Long.toString(System.currentTimeMillis()));
                                                                    file.createNewFile();
                                                                    OutputStreamWriter outputStreamWriter2 = new OutputStreamWriter(new FileOutputStream(file.getPath(), true));
                                                                    try {
                                                                        outputStreamWriter2.write("version=");
                                                                        outputStreamWriter2.write(hVar.AFKeystoreWrapper);
                                                                        outputStreamWriter2.write(10);
                                                                        outputStreamWriter2.write("url=");
                                                                        outputStreamWriter2.write(hVar.AFInAppEventParameterName);
                                                                        outputStreamWriter2.write(10);
                                                                        r4 = "data=";
                                                                        outputStreamWriter2.write("data=");
                                                                        outputStreamWriter2.write(Base64.encodeToString(hVar.values(), 2));
                                                                        outputStreamWriter2.write(10);
                                                                        outputStreamWriter2.flush();
                                                                        outputStreamWriter2.close();
                                                                    } catch (Exception e2) {
                                                                        e = e2;
                                                                        r4 = outputStreamWriter2;
                                                                        AFLogger.AFInAppEventType("Could not cache request", e);
                                                                        if (r4 != 0) {
                                                                            r4.close();
                                                                        }
                                                                        AFLogger.AFInAppEventType(iOException.getMessage(), iOException);
                                                                        appsFlyerRequestListener = this.AFInAppEventType.AFKeystoreWrapper;
                                                                        if (appsFlyerRequestListener != null) {
                                                                        }
                                                                        ae aeVar2 = ae.this;
                                                                        g gVar3 = this.AFInAppEventType;
                                                                        ba.values(aeVar2, gVar3, gVar3.AFVersionDeclaration, application, ae.values(application), null, iOException);
                                                                        return;
                                                                    } catch (Throwable th2) {
                                                                        th = th2;
                                                                        outputStreamWriter = outputStreamWriter2;
                                                                        if (outputStreamWriter != null) {
                                                                            try {
                                                                                outputStreamWriter.close();
                                                                                throw th;
                                                                            } catch (IOException e3) {
                                                                                AFLogger.values(e3);
                                                                                throw th;
                                                                            }
                                                                        }
                                                                        throw th;
                                                                    }
                                                                }
                                                            }
                                                        } catch (Throwable th3) {
                                                            th = th3;
                                                            outputStreamWriter = r4;
                                                        }
                                                    } catch (Exception e4) {
                                                        e = e4;
                                                    }
                                                } catch (IOException e5) {
                                                    AFLogger.values(e5);
                                                }
                                                AFLogger.AFInAppEventType(iOException.getMessage(), iOException);
                                            }
                                            appsFlyerRequestListener = this.AFInAppEventType.AFKeystoreWrapper;
                                            if (appsFlyerRequestListener != null) {
                                                appsFlyerRequestListener.onError(RequestError.NETWORK_FAILURE, iOException.getMessage());
                                            }
                                            ae aeVar22 = ae.this;
                                            g gVar32 = this.AFInAppEventType;
                                            ba.values(aeVar22, gVar32, gVar32.AFVersionDeclaration, application, ae.values(application), null, iOException);
                                            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 appsFlyerRequestListener2 = this.AFInAppEventType.AFKeystoreWrapper;
                        if (appsFlyerRequestListener2 != null) {
                            appsFlyerRequestListener2.onError(RequestError.NETWORK_FAILURE, th7.getMessage());
                        }
                    }
                } catch (IOException e6) {
                    iOException = e6;
                }
            } else {
                AppsFlyerRequestListener appsFlyerRequestListener3 = this.AFInAppEventType.AFKeystoreWrapper;
                if (appsFlyerRequestListener3 != null) {
                    appsFlyerRequestListener3.onError(RequestError.STOP_TRACKING, ax.values);
                }
            }
        }
    }

    static class AnonymousClass9 {
        static final int[] AFInAppEventType;
        static final int[] valueOf;

        static {
            int[] iArr = new int[bt.e.values().length];
            valueOf = iArr;
            try {
                iArr[bt.e.FINISHED.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                valueOf[bt.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 final Map<String, Object> AFInAppEventParameterName() {
        HashMap hashMap = new HashMap();
        if (AFLogger$LogLevel()) {
            hashMap.put("lvl", this.setCustomerIdAndLogSession);
        } else if (this.getOutOfStore) {
            HashMap hashMap2 = new HashMap();
            this.setCustomerIdAndLogSession = hashMap2;
            hashMap2.put("error", "operation timed out.");
            hashMap.put("lvl", this.setCustomerIdAndLogSession);
        }
        return hashMap;
    }

    public class e implements Runnable {
        private final Application valueOf;

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

        @Override
        public final void run() {
            if (ae.this.onValidateInApp) {
                return;
            }
            ae.this.AFVersionDeclaration = System.currentTimeMillis();
            ae.this.onValidateInApp = true;
            try {
                try {
                    String AFKeystoreWrapper = ae.AFKeystoreWrapper(AppsFlyerProperties.AF_KEY);
                    ai.AFKeystoreWrapper();
                    for (h hVar : ai.AFInAppEventParameterName(this.valueOf)) {
                        StringBuilder sb = new StringBuilder("resending request: ");
                        sb.append(hVar.AFInAppEventParameterName);
                        AFLogger.AFKeystoreWrapper(sb.toString());
                        try {
                            long currentTimeMillis = System.currentTimeMillis();
                            long parseLong = Long.parseLong(hVar.valueOf, 10);
                            ae aeVar = ae.this;
                            be beVar = new be();
                            StringBuilder sb2 = new StringBuilder();
                            sb2.append(hVar.AFInAppEventParameterName);
                            sb2.append("&isCachedRequest=true&timeincache=");
                            sb2.append((currentTimeMillis - parseLong) / 1000);
                            g AFInAppEventParameterName = beVar.AFInAppEventParameterName(sb2.toString());
                            AFInAppEventParameterName.AppsFlyer2dXConversionCallback = hVar.values();
                            AFInAppEventParameterName.AFVersionDeclaration = AFKeystoreWrapper;
                            Application application = this.valueOf;
                            if (application != null) {
                                AFInAppEventParameterName.valueOf = (Application) application.getApplicationContext();
                            }
                            AFInAppEventParameterName.getLevel = hVar.valueOf;
                            AFInAppEventParameterName.onAttributionFailureNative = false;
                            ae.valueOf(aeVar, AFInAppEventParameterName);
                        } catch (Exception e) {
                            AFLogger.AFInAppEventType("Failed to resend cached request", e);
                        }
                    }
                } catch (Throwable th) {
                    ae.this.onValidateInApp = false;
                    throw th;
                }
            } catch (Exception e2) {
                AFLogger.AFInAppEventType("failed to check cache. ", e2);
            }
            ae.this.onValidateInApp = false;
            ae.this.onValidateInAppFailure.shutdown();
            ae.AppsFlyer2dXConversionCallback(ae.this);
        }
    }

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

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

    public boolean AFInAppEventParameterName(g gVar, SharedPreferences sharedPreferences) {
        int valueOf2 = valueOf(sharedPreferences, "appsFlyerCount", false);
        return (!sharedPreferences.getBoolean(AppsFlyerProperties.NEW_REFERRER_SENT, false) && valueOf2 == 1) || (valueOf2 == 1 && !(gVar instanceof bh));
    }

    public final Map<String, Object> values(g gVar) {
        String str;
        String str2;
        au auVar;
        boolean z;
        SharedPreferences sharedPreferences;
        AppsFlyerProperties appsFlyerProperties;
        String str3;
        String str4;
        Exception exc;
        JSONObject jSONObject;
        StringBuilder sb;
        String string;
        String string2;
        String string3;
        String string4;
        String valueOf2;
        String AFKeystoreWrapper2;
        SharedPreferences values2;
        String str5;
        String string5;
        String string6;
        String string7;
        String str6;
        AppsFlyerProperties appsFlyerProperties2;
        Object obj;
        String str7;
        boolean z2;
        String str8;
        d.e.C0012d values3;
        String str9;
        TelephonyManager telephonyManager;
        String str10;
        Object obj2;
        AppsFlyerProperties appsFlyerProperties3;
        String str11;
        SharedPreferences sharedPreferences2;
        d.e.C0012d AFInAppEventParameterName2;
        boolean z3;
        int valueOf3;
        long availableBlocks;
        long blockCount;
        String[] strArr;
        PackageInfo packageInfo;
        String str12;
        String AFKeystoreWrapper3;
        String installerPackageName;
        UiModeManager uiModeManager;
        Application application = gVar.valueOf;
        String str13 = gVar.AFVersionDeclaration;
        String str14 = gVar.AFLogger$LogLevel;
        String jSONObject2 = new JSONObject(gVar.values == null ? new HashMap() : gVar.values).toString();
        String str15 = gVar.init;
        SharedPreferences values4 = values(application);
        boolean AFKeystoreWrapper4 = gVar.AFKeystoreWrapper();
        String str16 = gVar.AFInAppEventParameterName;
        Map<String, Object> map = gVar.AFInAppEventType;
        ab.valueOf(application, map);
        Boolean bool = ab.AFInAppEventType;
        if (bool == null || bool.booleanValue()) {
            str = "preInstallName";
            str2 = str13;
        } else {
            Map<String, Object> AFKeystoreWrapper5 = AFKeystoreWrapper(map);
            str2 = str13;
            Boolean valueOf4 = Boolean.valueOf(!bool.booleanValue());
            str = "preInstallName";
            AFKeystoreWrapper5.put("ad_ids_disabled", valueOf4);
        }
        long time = new Date().getTime();
        map.put("af_timestamp", Long.toString(time));
        String values5 = com.appsflyer.internal.d.values(application, time);
        if (values5 != null) {
            map.put("cksm_v1", values5);
        }
        try {
            if (!isStopped()) {
                StringBuilder sb2 = new StringBuilder("******* sendTrackingWithEvent: ");
                sb2.append(AFKeystoreWrapper4 ? "Launch" : str14);
                AFLogger.AFKeystoreWrapper(sb2.toString());
            } else {
                AFLogger.AFKeystoreWrapper("Reporting has been stopped");
            }
            ai.AFKeystoreWrapper();
            try {
                if (!ai.AFKeystoreWrapper(application).exists()) {
                    ai.AFKeystoreWrapper(application).mkdir();
                }
            } catch (Exception e2) {
                AFLogger.AFInAppEventType("Could not create cache directory", e2);
            }
            try {
                List asList = Arrays.asList(application.getPackageManager().getPackageInfo(application.getPackageName(), 4096).requestedPermissions);
                if (!asList.contains("android.permission.INTERNET")) {
                    AFLogger.init("Permission android.permission.INTERNET is missing in the AndroidManifest.xml");
                }
                if (!asList.contains("android.permission.ACCESS_NETWORK_STATE")) {
                    AFLogger.init("Permission android.permission.ACCESS_NETWORK_STATE is missing in the AndroidManifest.xml");
                }
                if (!asList.contains("android.permission.ACCESS_WIFI_STATE")) {
                    AFLogger.init("Permission android.permission.ACCESS_WIFI_STATE is missing in the AndroidManifest.xml");
                }
            } catch (Exception e3) {
                AFLogger.AFInAppEventType("Exception while validation permissions. ", e3);
            }
            map.put("af_events_api", AppEventsConstants.EVENT_PARAM_VALUE_YES);
            map.put("brand", Build.BRAND);
            map.put("device", Build.DEVICE);
            map.put("product", Build.PRODUCT);
            map.put(ServerProtocol.DIALOG_PARAM_SDK_VERSION, Integer.toString(Build.VERSION.SDK_INT));
            map.put("model", Build.MODEL);
            map.put("deviceType", Build.TYPE);
            values(application, map);
            AppsFlyerProperties appsFlyerProperties4 = AppsFlyerProperties.getInstance();
            if (this.init == null) {
                this.init = new au(application);
            }
            auVar = this.init;
            if (AFKeystoreWrapper4) {
                if (AFInAppEventParameterName(application)) {
                    if (!appsFlyerProperties4.isOtherSdkStringDisabled()) {
                        map.put("batteryLevel", String.valueOf(AFVersionDeclaration(application)));
                    }
                    AFKeystoreWrapper(application);
                    if (Build.VERSION.SDK_INT >= 23) {
                        uiModeManager = (UiModeManager) application.getSystemService(UiModeManager.class);
                    } else {
                        uiModeManager = (UiModeManager) application.getSystemService("uimode");
                    }
                    if (uiModeManager != null && uiModeManager.getCurrentModeType() == 4) {
                        map.put("tv", Boolean.TRUE);
                    }
                    if (bc.valueOf(application)) {
                        map.put("inst_app", Boolean.TRUE);
                    }
                }
                z = AFKeystoreWrapper4;
                long j = values(application).getLong("AppsFlyerTimePassedSincePrevLaunch", 0L);
                long currentTimeMillis = System.currentTimeMillis();
                valueOf(application, "AppsFlyerTimePassedSincePrevLaunch", currentTimeMillis);
                map.put("timepassedsincelastlaunch", Long.toString(j > 0 ? (currentTimeMillis - j) / 1000 : -1L));
                String string8 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ONELINK_ID);
                String string9 = AppsFlyerProperties.getInstance().getString("onelinkVersion");
                if (string8 != null) {
                    map.put("onelink_id", string8);
                }
                if (string9 != null) {
                    map.put("onelink_ver", string9);
                }
                String string10 = this.init.valueOf.getString("gcd", null);
                if (string10 != null) {
                    try {
                        Map<String, Object> AFInAppEventType2 = m.AFInAppEventType(new JSONObject(string10));
                        if (!AFInAppEventType2.isEmpty()) {
                            AFKeystoreWrapper(map).put("gcd", AFInAppEventType2);
                            this.init.valueOf.edit().putString("gcd", null).apply();
                        }
                    } catch (JSONException unused) {
                    }
                }
                String str17 = this.setCustomerUserId;
                if (str17 != null) {
                    map.put("phone", str17);
                }
                if (!TextUtils.isEmpty(str15)) {
                    map.put("referrer", str15);
                }
                String string11 = values4.getString("extraReferrers", null);
                if (string11 != null) {
                    map.put("extraReferrers", string11);
                }
                String referrer = appsFlyerProperties4.getReferrer(application);
                if (!TextUtils.isEmpty(referrer) && map.get("referrer") == null) {
                    map.put("referrer", referrer);
                }
                long j2 = auVar.valueOf.getLong("prev_session_dur", 0L);
                if (j2 != 0) {
                    map.put("prev_session_dur", Long.valueOf(j2));
                }
                map.put("exception_number", Long.valueOf(at.AFInAppEventParameterName == null ? -1L : values(at.AFInAppEventParameterName).getLong("exception_number", 0L)));
                av avVar = this.setAdditionalData;
                if (avVar != null) {
                    if (!avVar.valueOf.isEmpty()) {
                        map.put("partner_data", avVar.valueOf);
                    }
                    if (!avVar.AFKeystoreWrapper.isEmpty()) {
                        AFKeystoreWrapper(map).put("partner_data", avVar.AFKeystoreWrapper);
                        avVar.AFKeystoreWrapper = new HashMap();
                    }
                }
                sharedPreferences = values4;
                appsFlyerProperties = appsFlyerProperties4;
                str3 = str14;
                str4 = jSONObject2;
            } else {
                z = AFKeystoreWrapper4;
                SharedPreferences values6 = values(application);
                SharedPreferences.Editor edit = values6.edit();
                try {
                    String string12 = values6.getString("prev_event_name", null);
                    if (string12 != null) {
                        try {
                            jSONObject = new JSONObject();
                            sb = new StringBuilder();
                            sharedPreferences = values4;
                            appsFlyerProperties = appsFlyerProperties4;
                        } catch (Exception e4) {
                            e = e4;
                            sharedPreferences = values4;
                            appsFlyerProperties = appsFlyerProperties4;
                        }
                        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);
                            map.put("prev_event", jSONObject.toString());
                        } catch (Exception e5) {
                            e = e5;
                            exc = e;
                            str3 = str14;
                            str4 = jSONObject2;
                            AFLogger.AFInAppEventType("Error while processing previous event.", exc);
                            string = AppsFlyerProperties.getInstance().getString("KSAppsFlyerId");
                            string2 = AppsFlyerProperties.getInstance().getString("KSAppsFlyerRICounter");
                            if (string != null) {
                                map.put("reinstallCounter", string2);
                                map.put("originalAppsflyerId", string);
                            }
                            string3 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ADDITIONAL_CUSTOM_DATA);
                            if (string3 != null) {
                            }
                            installerPackageName = application.getPackageManager().getInstallerPackageName(application.getPackageName());
                            if (installerPackageName != null) {
                            }
                            AppsFlyerProperties appsFlyerProperties5 = appsFlyerProperties;
                            string4 = appsFlyerProperties5.getString(AppsFlyerProperties.EXTENSION);
                            if (string4 != null) {
                                map.put(AppsFlyerProperties.EXTENSION, string4);
                            }
                            valueOf2 = valueOf(application);
                            AFKeystoreWrapper2 = AFKeystoreWrapper(application, valueOf2);
                            if (AFKeystoreWrapper2 != null) {
                                map.put("af_latestchannel", valueOf2);
                                values2 = values(application);
                                if (values2.contains("INSTALL_STORE")) {
                                }
                                if (str5 != null) {
                                }
                                SharedPreferences values7 = values(application);
                                String str18 = str;
                                string5 = AppsFlyerProperties.getInstance().getString(str18);
                                if (string5 == null) {
                                }
                                if (string5 != null) {
                                }
                                string6 = AppsFlyerProperties.getInstance().getString("api_store_value");
                                if (string6 == null) {
                                }
                                if (string6 != null) {
                                }
                                if (str2 == null) {
                                }
                                string7 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                                if (string7 == null) {
                                }
                                AFLogger.AFKeystoreWrapper("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                                AFLogger.AFKeystoreWrapper("AppsFlyer will not track this event.");
                                return null;
                            }
                            map.put("af_latestchannel", valueOf2);
                            values2 = values(application);
                            if (values2.contains("INSTALL_STORE")) {
                            }
                            if (str5 != null) {
                            }
                            SharedPreferences values72 = values(application);
                            String str182 = str;
                            string5 = AppsFlyerProperties.getInstance().getString(str182);
                            if (string5 == null) {
                            }
                            if (string5 != null) {
                            }
                            string6 = AppsFlyerProperties.getInstance().getString("api_store_value");
                            if (string6 == null) {
                            }
                            if (string6 != null) {
                            }
                            if (str2 == null) {
                            }
                            string7 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                            if (string7 == null) {
                            }
                            AFLogger.AFKeystoreWrapper("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                            AFLogger.AFKeystoreWrapper("AppsFlyer will not track this event.");
                            return null;
                        }
                    } else {
                        sharedPreferences = values4;
                        appsFlyerProperties = appsFlyerProperties4;
                    }
                    str3 = str14;
                } catch (Exception e6) {
                    e = e6;
                    sharedPreferences = values4;
                    appsFlyerProperties = appsFlyerProperties4;
                    str3 = str14;
                }
                try {
                    edit.putString("prev_event_name", str3);
                    str4 = jSONObject2;
                } catch (Exception e7) {
                    e = e7;
                    str4 = jSONObject2;
                    exc = e;
                    AFLogger.AFInAppEventType("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) {
                    }
                    AppsFlyerProperties appsFlyerProperties52 = appsFlyerProperties;
                    string4 = appsFlyerProperties52.getString(AppsFlyerProperties.EXTENSION);
                    if (string4 != null) {
                    }
                    valueOf2 = valueOf(application);
                    AFKeystoreWrapper2 = AFKeystoreWrapper(application, valueOf2);
                    if (AFKeystoreWrapper2 != null) {
                    }
                    map.put("af_latestchannel", valueOf2);
                    values2 = values(application);
                    if (values2.contains("INSTALL_STORE")) {
                    }
                    if (str5 != null) {
                    }
                    SharedPreferences values722 = values(application);
                    String str1822 = str;
                    string5 = AppsFlyerProperties.getInstance().getString(str1822);
                    if (string5 == null) {
                    }
                    if (string5 != null) {
                    }
                    string6 = AppsFlyerProperties.getInstance().getString("api_store_value");
                    if (string6 == null) {
                    }
                    if (string6 != null) {
                    }
                    if (str2 == null) {
                    }
                    string7 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                    if (string7 == null) {
                    }
                    AFLogger.AFKeystoreWrapper("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                    AFLogger.AFKeystoreWrapper("AppsFlyer will not track this event.");
                    return null;
                }
                try {
                    edit.putString("prev_event_value", str4);
                    edit.putLong("prev_event_timestamp", System.currentTimeMillis());
                    edit.apply();
                } catch (Exception e8) {
                    e = e8;
                    exc = e;
                    AFLogger.AFInAppEventType("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) {
                    }
                    AppsFlyerProperties appsFlyerProperties522 = appsFlyerProperties;
                    string4 = appsFlyerProperties522.getString(AppsFlyerProperties.EXTENSION);
                    if (string4 != null) {
                    }
                    valueOf2 = valueOf(application);
                    AFKeystoreWrapper2 = AFKeystoreWrapper(application, valueOf2);
                    if (AFKeystoreWrapper2 != null) {
                    }
                    map.put("af_latestchannel", valueOf2);
                    values2 = values(application);
                    if (values2.contains("INSTALL_STORE")) {
                    }
                    if (str5 != null) {
                    }
                    SharedPreferences values7222 = values(application);
                    String str18222 = str;
                    string5 = AppsFlyerProperties.getInstance().getString(str18222);
                    if (string5 == null) {
                    }
                    if (string5 != null) {
                    }
                    string6 = AppsFlyerProperties.getInstance().getString("api_store_value");
                    if (string6 == null) {
                    }
                    if (string6 != null) {
                    }
                    if (str2 == null) {
                    }
                    string7 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                    if (string7 == null) {
                    }
                    AFLogger.AFKeystoreWrapper("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                    AFLogger.AFKeystoreWrapper("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) {
                map.put("reinstallCounter", string2);
                map.put("originalAppsflyerId", string);
            }
            string3 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ADDITIONAL_CUSTOM_DATA);
            if (string3 != null) {
                map.put("customData", string3);
            }
            try {
                installerPackageName = application.getPackageManager().getInstallerPackageName(application.getPackageName());
                if (installerPackageName != null) {
                    map.put("installer_package", installerPackageName);
                }
            } catch (Exception e9) {
                AFLogger.AFInAppEventType("Exception while getting the app's installer package. ", e9);
            }
            AppsFlyerProperties appsFlyerProperties5222 = appsFlyerProperties;
            string4 = appsFlyerProperties5222.getString(AppsFlyerProperties.EXTENSION);
            if (string4 != null && string4.length() > 0) {
                map.put(AppsFlyerProperties.EXTENSION, string4);
            }
            valueOf2 = valueOf(application);
            AFKeystoreWrapper2 = AFKeystoreWrapper(application, valueOf2);
            if ((AFKeystoreWrapper2 != null && !AFKeystoreWrapper2.equals(valueOf2)) || (AFKeystoreWrapper2 == null && valueOf2 != null)) {
                map.put("af_latestchannel", valueOf2);
            }
            values2 = values(application);
            if (values2.contains("INSTALL_STORE")) {
                str5 = values2.getString("INSTALL_STORE", null);
            } else {
                if (AFInAppEventParameterName(application)) {
                    str5 = AppsFlyerProperties.getInstance().getString("api_store_value");
                    if (str5 == null) {
                        if (application != null) {
                            str5 = AFKeystoreWrapper("AF_STORE", application.getPackageManager(), application.getPackageName());
                        }
                    }
                    SharedPreferences.Editor edit2 = values(application).edit();
                    edit2.putString("INSTALL_STORE", str5);
                    edit2.apply();
                }
                str5 = null;
                SharedPreferences.Editor edit22 = values(application).edit();
                edit22.putString("INSTALL_STORE", str5);
                edit22.apply();
            }
            if (str5 != null) {
                map.put("af_installstore", str5.toLowerCase());
            }
            SharedPreferences values72222 = values(application);
            String str182222 = str;
            string5 = AppsFlyerProperties.getInstance().getString(str182222);
            if (string5 == null) {
                if (values72222.contains(str182222)) {
                    string5 = values72222.getString(str182222, null);
                } else {
                    if (AFInAppEventParameterName(application)) {
                        File AFInAppEventParameterName3 = AFInAppEventParameterName(AFInAppEventType("ro.appsflyer.preinstall.path"));
                        if (values(AFInAppEventParameterName3)) {
                            AFInAppEventParameterName3 = AFInAppEventParameterName(AFKeystoreWrapper("AF_PRE_INSTALL_PATH", application.getPackageManager(), application.getPackageName()));
                        }
                        if (values(AFInAppEventParameterName3)) {
                            AFInAppEventParameterName3 = AFInAppEventParameterName("/data/local/tmp/pre_install.appsflyer");
                        }
                        if (values(AFInAppEventParameterName3)) {
                            AFInAppEventParameterName3 = AFInAppEventParameterName("/etc/pre_install.appsflyer");
                        }
                        String AFInAppEventType3 = values(AFInAppEventParameterName3) ? null : AFInAppEventType(AFInAppEventParameterName3, application.getPackageName());
                        if (AFInAppEventType3 == null) {
                            AFInAppEventType3 = application == null ? null : AFKeystoreWrapper("AF_PRE_INSTALL_NAME", application.getPackageManager(), application.getPackageName());
                        }
                        string5 = AFInAppEventType3;
                    }
                    if (string5 != null) {
                        SharedPreferences.Editor edit3 = values(application).edit();
                        edit3.putString(str182222, string5);
                        edit3.apply();
                    }
                }
                if (string5 != null) {
                    AppsFlyerProperties.getInstance().set(str182222, string5);
                }
            }
            if (string5 != null) {
                map.put("af_preinstall_name", string5.toLowerCase());
            }
            string6 = AppsFlyerProperties.getInstance().getString("api_store_value");
            if (string6 == null) {
                string6 = application == null ? null : AFKeystoreWrapper("AF_STORE", application.getPackageManager(), application.getPackageName());
            }
            if (string6 != null) {
                map.put("af_currentstore", string6.toLowerCase());
            }
            if (str2 == null && str2.length() > 0) {
                map.put("appsflyerKey", str2);
            } else {
                string7 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.AF_KEY);
                if (string7 == null && string7.length() > 0) {
                    map.put("appsflyerKey", string7);
                } else {
                    AFLogger.AFKeystoreWrapper("AppsFlyer dev key is missing!!! Please use  AppsFlyerLib.getInstance().setAppsFlyerKey(...) to set it. ");
                    AFLogger.AFKeystoreWrapper("AppsFlyer will not track this event.");
                    return null;
                }
            }
            String string13 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_USER_ID);
            if (string13 != null) {
                map.put("appUserId", string13);
            }
            String string14 = appsFlyerProperties5222.getString(AppsFlyerProperties.USER_EMAILS);
            if (string14 != null) {
                map.put("user_emails", string14);
            } else {
                String string15 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.USER_EMAIL);
                if (string15 != null) {
                    map.put("sha1_el", af.AFKeystoreWrapper(string15));
                }
            }
            if (str3 != null) {
                map.put("eventName", str3);
                if (str4 != null) {
                    map.put("eventValue", str4);
                }
            }
            if (AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_ID) != null) {
                map.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.init(sb3.toString());
                }
                map.put("currency", string16);
            }
            String string17 = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.IS_UPDATE);
            if (string17 != null) {
                map.put("isUpdate", string17);
            }
            map.put("af_preinstalled", Boolean.toString(isPreInstalledApp(application)));
            if (appsFlyerProperties5222.getBoolean(AppsFlyerProperties.COLLECT_FACEBOOK_ATTR_ID, true)) {
                try {
                    application.getPackageManager().getApplicationInfo(RemoteServiceWrapper.RECEIVER_SERVICE_PACKAGE, 0);
                    str6 = getAttributionId(application);
                } catch (PackageManager.NameNotFoundException unused2) {
                    AFLogger.init("Exception while collecting facebook's attribution ID. ");
                    str6 = null;
                    if (str6 != null) {
                    }
                    appsFlyerProperties2 = AppsFlyerProperties.getInstance();
                    if (appsFlyerProperties2.getBoolean(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, false)) {
                    }
                    AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application));
                    str10 = "uid";
                    if (AFKeystoreWrapper3 != null) {
                    }
                    map.put("lang", Locale.getDefault().getDisplayLanguage());
                    map.put("lang_code", Locale.getDefault().getLanguage());
                    map.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                    map.put("platformextension", this.enableLocationCollection.AFInAppEventParameterName());
                    valueOf(application, (Map<String, ? super String>) map);
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                    long j3 = application.getPackageManager().getPackageInfo(application.getPackageName(), 0).firstInstallTime;
                    simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
                    map.put("installDate", simpleDateFormat.format(new Date(j3)));
                    packageInfo = application.getPackageManager().getPackageInfo(application.getPackageName(), 0);
                    sharedPreferences2 = sharedPreferences;
                    try {
                        if (packageInfo.versionCode > sharedPreferences2.getInt("versionCode", 0)) {
                        }
                        map.put("app_version_code", Integer.toString(packageInfo.versionCode));
                        map.put("app_version_name", packageInfo.versionName);
                        appsFlyerProperties3 = appsFlyerProperties5222;
                        try {
                            long j4 = packageInfo.firstInstallTime;
                            str12 = str10;
                            try {
                                long j5 = packageInfo.lastUpdateTime;
                                str11 = str12;
                                obj2 = "appsflyerKey";
                            } catch (Throwable th) {
                                th = th;
                                obj2 = "appsflyerKey";
                                str11 = str12;
                            }
                        } catch (Throwable th2) {
                            th = th2;
                            obj2 = "appsflyerKey";
                            str11 = str10;
                            AFLogger.AFInAppEventType("Exception while collecting app version data ", th);
                            this.onPause = bb.values(application);
                            StringBuilder sb4 = new StringBuilder("didConfigureTokenRefreshService=");
                            sb4.append(this.onPause);
                            AFLogger.values(sb4.toString());
                            if (!this.onPause) {
                            }
                            if (z) {
                            }
                            if (!z) {
                            }
                            if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                            }
                            AFInAppEventParameterName2 = ab.AFInAppEventParameterName(application.getContentResolver());
                            if (AFInAppEventParameterName2 != null) {
                            }
                            map.put("registeredUninstall", Boolean.valueOf(bb.AFInAppEventParameterName(sharedPreferences2)));
                            z3 = z;
                            valueOf3 = valueOf(sharedPreferences2, "appsFlyerCount", z3);
                            map.put("counter", Integer.toString(valueOf3));
                            map.put("iaecounter", Integer.toString(valueOf(sharedPreferences2, "appsFlyerInAppEventCount", str3 == null)));
                            if (z3) {
                            }
                            map.put("isFirstCall", Boolean.toString(!values(sharedPreferences2)));
                            HashMap hashMap = new HashMap();
                            hashMap.put("cpu_abi", AFInAppEventType("ro.product.cpu.abi"));
                            hashMap.put("cpu_abi2", AFInAppEventType("ro.product.cpu.abi2"));
                            hashMap.put("arch", AFInAppEventType("os.arch"));
                            hashMap.put("build_display_id", AFInAppEventType("ro.build.display.id"));
                            if (z3) {
                            }
                            hashMap.put("dim", w.AFInAppEventParameterName(application));
                            map.put("deviceData", hashMap);
                            Object obj3 = obj2;
                            String str19 = (String) map.get(obj3);
                            Object obj4 = obj;
                            String str20 = (String) map.get(obj4);
                            String str21 = str11;
                            String str22 = (String) map.get(str21);
                            StringBuilder sb5 = new StringBuilder();
                            sb5.append(str19.substring(0, 7));
                            sb5.append(str22.substring(0, 7));
                            sb5.append(str20.substring(str20.length() - 7));
                            map.put("af_v", af.AFKeystoreWrapper(sb5.toString()));
                            String str23 = (String) map.get(obj3);
                            StringBuilder sb6 = new StringBuilder();
                            sb6.append(str23);
                            sb6.append(map.get(obj4));
                            String obj5 = sb6.toString();
                            StringBuilder sb7 = new StringBuilder();
                            sb7.append(obj5);
                            sb7.append(map.get(str21));
                            String obj6 = sb7.toString();
                            StringBuilder sb8 = new StringBuilder();
                            sb8.append(obj6);
                            sb8.append(map.get("installDate"));
                            String obj7 = sb8.toString();
                            StringBuilder sb9 = new StringBuilder();
                            sb9.append(obj7);
                            sb9.append(map.get("counter"));
                            String obj8 = sb9.toString();
                            StringBuilder sb10 = new StringBuilder();
                            sb10.append(obj8);
                            sb10.append(map.get("iaecounter"));
                            map.put("af_v2", af.AFKeystoreWrapper(af.AFInAppEventType(sb10.toString())));
                            map.put("ivc", Boolean.valueOf(getLevel(application)));
                            if (sharedPreferences2.contains("is_stop_tracking_used")) {
                            }
                            HashMap hashMap2 = new HashMap();
                            hashMap2.put("mcc", Integer.valueOf(application.getResources().getConfiguration().mcc));
                            hashMap2.put("mnc", Integer.valueOf(application.getResources().getConfiguration().mnc));
                            map.put("cell", hashMap2);
                            map.put("sig", aa.values(auVar.AFKeystoreWrapper.getPackageManager(), auVar.AFKeystoreWrapper.getPackageName()));
                            map.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));
                            map.put("disk", sb11.toString());
                            strArr = this.getLevel;
                            if (strArr != null) {
                            }
                            return map;
                        }
                    } catch (Throwable th3) {
                        th = th3;
                        obj2 = "appsflyerKey";
                        appsFlyerProperties3 = appsFlyerProperties5222;
                    }
                    try {
                        map.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j4)));
                        map.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j5)));
                        map.put("firstLaunchDate", AFInAppEventParameterName(simpleDateFormat, application));
                    } catch (Throwable th4) {
                        th = th4;
                        AFLogger.AFInAppEventType("Exception while collecting app version data ", th);
                        this.onPause = bb.values(application);
                        StringBuilder sb42 = new StringBuilder("didConfigureTokenRefreshService=");
                        sb42.append(this.onPause);
                        AFLogger.values(sb42.toString());
                        if (!this.onPause) {
                        }
                        if (z) {
                        }
                        if (!z) {
                        }
                        if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                        }
                        AFInAppEventParameterName2 = ab.AFInAppEventParameterName(application.getContentResolver());
                        if (AFInAppEventParameterName2 != null) {
                        }
                        map.put("registeredUninstall", Boolean.valueOf(bb.AFInAppEventParameterName(sharedPreferences2)));
                        z3 = z;
                        valueOf3 = valueOf(sharedPreferences2, "appsFlyerCount", z3);
                        map.put("counter", Integer.toString(valueOf3));
                        map.put("iaecounter", Integer.toString(valueOf(sharedPreferences2, "appsFlyerInAppEventCount", str3 == null)));
                        if (z3) {
                        }
                        map.put("isFirstCall", Boolean.toString(!values(sharedPreferences2)));
                        HashMap hashMap3 = new HashMap();
                        hashMap3.put("cpu_abi", AFInAppEventType("ro.product.cpu.abi"));
                        hashMap3.put("cpu_abi2", AFInAppEventType("ro.product.cpu.abi2"));
                        hashMap3.put("arch", AFInAppEventType("os.arch"));
                        hashMap3.put("build_display_id", AFInAppEventType("ro.build.display.id"));
                        if (z3) {
                        }
                        hashMap3.put("dim", w.AFInAppEventParameterName(application));
                        map.put("deviceData", hashMap3);
                        Object obj32 = obj2;
                        String str192 = (String) map.get(obj32);
                        Object obj42 = obj;
                        String str202 = (String) map.get(obj42);
                        String str212 = str11;
                        String str222 = (String) map.get(str212);
                        StringBuilder sb52 = new StringBuilder();
                        sb52.append(str192.substring(0, 7));
                        sb52.append(str222.substring(0, 7));
                        sb52.append(str202.substring(str202.length() - 7));
                        map.put("af_v", af.AFKeystoreWrapper(sb52.toString()));
                        String str232 = (String) map.get(obj32);
                        StringBuilder sb62 = new StringBuilder();
                        sb62.append(str232);
                        sb62.append(map.get(obj42));
                        String obj52 = sb62.toString();
                        StringBuilder sb72 = new StringBuilder();
                        sb72.append(obj52);
                        sb72.append(map.get(str212));
                        String obj62 = sb72.toString();
                        StringBuilder sb82 = new StringBuilder();
                        sb82.append(obj62);
                        sb82.append(map.get("installDate"));
                        String obj72 = sb82.toString();
                        StringBuilder sb92 = new StringBuilder();
                        sb92.append(obj72);
                        sb92.append(map.get("counter"));
                        String obj82 = sb92.toString();
                        StringBuilder sb102 = new StringBuilder();
                        sb102.append(obj82);
                        sb102.append(map.get("iaecounter"));
                        map.put("af_v2", af.AFKeystoreWrapper(af.AFInAppEventType(sb102.toString())));
                        map.put("ivc", Boolean.valueOf(getLevel(application)));
                        if (sharedPreferences2.contains("is_stop_tracking_used")) {
                        }
                        HashMap hashMap22 = new HashMap();
                        hashMap22.put("mcc", Integer.valueOf(application.getResources().getConfiguration().mcc));
                        hashMap22.put("mnc", Integer.valueOf(application.getResources().getConfiguration().mnc));
                        map.put("cell", hashMap22);
                        map.put("sig", aa.values(auVar.AFKeystoreWrapper.getPackageManager(), auVar.AFKeystoreWrapper.getPackageName()));
                        map.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));
                        map.put("disk", sb112.toString());
                        strArr = this.getLevel;
                        if (strArr != null) {
                        }
                        return map;
                    }
                    this.onPause = bb.values(application);
                    StringBuilder sb422 = new StringBuilder("didConfigureTokenRefreshService=");
                    sb422.append(this.onPause);
                    AFLogger.values(sb422.toString());
                    if (!this.onPause) {
                    }
                    if (z) {
                    }
                    if (!z) {
                    }
                    if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                    }
                    AFInAppEventParameterName2 = ab.AFInAppEventParameterName(application.getContentResolver());
                    if (AFInAppEventParameterName2 != null) {
                    }
                    map.put("registeredUninstall", Boolean.valueOf(bb.AFInAppEventParameterName(sharedPreferences2)));
                    z3 = z;
                    valueOf3 = valueOf(sharedPreferences2, "appsFlyerCount", z3);
                    map.put("counter", Integer.toString(valueOf3));
                    map.put("iaecounter", Integer.toString(valueOf(sharedPreferences2, "appsFlyerInAppEventCount", str3 == null)));
                    if (z3) {
                    }
                    map.put("isFirstCall", Boolean.toString(!values(sharedPreferences2)));
                    HashMap hashMap32 = new HashMap();
                    hashMap32.put("cpu_abi", AFInAppEventType("ro.product.cpu.abi"));
                    hashMap32.put("cpu_abi2", AFInAppEventType("ro.product.cpu.abi2"));
                    hashMap32.put("arch", AFInAppEventType("os.arch"));
                    hashMap32.put("build_display_id", AFInAppEventType("ro.build.display.id"));
                    if (z3) {
                    }
                    hashMap32.put("dim", w.AFInAppEventParameterName(application));
                    map.put("deviceData", hashMap32);
                    Object obj322 = obj2;
                    String str1922 = (String) map.get(obj322);
                    Object obj422 = obj;
                    String str2022 = (String) map.get(obj422);
                    String str2122 = str11;
                    String str2222 = (String) map.get(str2122);
                    StringBuilder sb522 = new StringBuilder();
                    sb522.append(str1922.substring(0, 7));
                    sb522.append(str2222.substring(0, 7));
                    sb522.append(str2022.substring(str2022.length() - 7));
                    map.put("af_v", af.AFKeystoreWrapper(sb522.toString()));
                    String str2322 = (String) map.get(obj322);
                    StringBuilder sb622 = new StringBuilder();
                    sb622.append(str2322);
                    sb622.append(map.get(obj422));
                    String obj522 = sb622.toString();
                    StringBuilder sb722 = new StringBuilder();
                    sb722.append(obj522);
                    sb722.append(map.get(str2122));
                    String obj622 = sb722.toString();
                    StringBuilder sb822 = new StringBuilder();
                    sb822.append(obj622);
                    sb822.append(map.get("installDate"));
                    String obj722 = sb822.toString();
                    StringBuilder sb922 = new StringBuilder();
                    sb922.append(obj722);
                    sb922.append(map.get("counter"));
                    String obj822 = sb922.toString();
                    StringBuilder sb1022 = new StringBuilder();
                    sb1022.append(obj822);
                    sb1022.append(map.get("iaecounter"));
                    map.put("af_v2", af.AFKeystoreWrapper(af.AFInAppEventType(sb1022.toString())));
                    map.put("ivc", Boolean.valueOf(getLevel(application)));
                    if (sharedPreferences2.contains("is_stop_tracking_used")) {
                    }
                    HashMap hashMap222 = new HashMap();
                    hashMap222.put("mcc", Integer.valueOf(application.getResources().getConfiguration().mcc));
                    hashMap222.put("mnc", Integer.valueOf(application.getResources().getConfiguration().mnc));
                    map.put("cell", hashMap222);
                    map.put("sig", aa.values(auVar.AFKeystoreWrapper.getPackageManager(), auVar.AFKeystoreWrapper.getPackageName()));
                    map.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));
                    map.put("disk", sb1122.toString());
                    strArr = this.getLevel;
                    if (strArr != null) {
                    }
                    return map;
                } catch (Throwable th5) {
                    AFLogger.AFInAppEventType("Exception while collecting facebook's attribution ID. ", th5);
                    str6 = null;
                    if (str6 != null) {
                    }
                    appsFlyerProperties2 = AppsFlyerProperties.getInstance();
                    if (appsFlyerProperties2.getBoolean(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, false)) {
                    }
                    AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application));
                    str10 = "uid";
                    if (AFKeystoreWrapper3 != null) {
                    }
                    map.put("lang", Locale.getDefault().getDisplayLanguage());
                    map.put("lang_code", Locale.getDefault().getLanguage());
                    map.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                    map.put("platformextension", this.enableLocationCollection.AFInAppEventParameterName());
                    valueOf(application, (Map<String, ? super String>) map);
                    SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                    long j32 = application.getPackageManager().getPackageInfo(application.getPackageName(), 0).firstInstallTime;
                    simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC"));
                    map.put("installDate", simpleDateFormat2.format(new Date(j32)));
                    packageInfo = application.getPackageManager().getPackageInfo(application.getPackageName(), 0);
                    sharedPreferences2 = sharedPreferences;
                    if (packageInfo.versionCode > sharedPreferences2.getInt("versionCode", 0)) {
                    }
                    map.put("app_version_code", Integer.toString(packageInfo.versionCode));
                    map.put("app_version_name", packageInfo.versionName);
                    appsFlyerProperties3 = appsFlyerProperties5222;
                    long j42 = packageInfo.firstInstallTime;
                    str12 = str10;
                    long j52 = packageInfo.lastUpdateTime;
                    str11 = str12;
                    obj2 = "appsflyerKey";
                    map.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j42)));
                    map.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j52)));
                    map.put("firstLaunchDate", AFInAppEventParameterName(simpleDateFormat2, application));
                    this.onPause = bb.values(application);
                    StringBuilder sb4222 = new StringBuilder("didConfigureTokenRefreshService=");
                    sb4222.append(this.onPause);
                    AFLogger.values(sb4222.toString());
                    if (!this.onPause) {
                    }
                    if (z) {
                    }
                    if (!z) {
                    }
                    if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                    }
                    AFInAppEventParameterName2 = ab.AFInAppEventParameterName(application.getContentResolver());
                    if (AFInAppEventParameterName2 != null) {
                    }
                    map.put("registeredUninstall", Boolean.valueOf(bb.AFInAppEventParameterName(sharedPreferences2)));
                    z3 = z;
                    valueOf3 = valueOf(sharedPreferences2, "appsFlyerCount", z3);
                    map.put("counter", Integer.toString(valueOf3));
                    map.put("iaecounter", Integer.toString(valueOf(sharedPreferences2, "appsFlyerInAppEventCount", str3 == null)));
                    if (z3) {
                    }
                    map.put("isFirstCall", Boolean.toString(!values(sharedPreferences2)));
                    HashMap hashMap322 = new HashMap();
                    hashMap322.put("cpu_abi", AFInAppEventType("ro.product.cpu.abi"));
                    hashMap322.put("cpu_abi2", AFInAppEventType("ro.product.cpu.abi2"));
                    hashMap322.put("arch", AFInAppEventType("os.arch"));
                    hashMap322.put("build_display_id", AFInAppEventType("ro.build.display.id"));
                    if (z3) {
                    }
                    hashMap322.put("dim", w.AFInAppEventParameterName(application));
                    map.put("deviceData", hashMap322);
                    Object obj3222 = obj2;
                    String str19222 = (String) map.get(obj3222);
                    Object obj4222 = obj;
                    String str20222 = (String) map.get(obj4222);
                    String str21222 = str11;
                    String str22222 = (String) map.get(str21222);
                    StringBuilder sb5222 = new StringBuilder();
                    sb5222.append(str19222.substring(0, 7));
                    sb5222.append(str22222.substring(0, 7));
                    sb5222.append(str20222.substring(str20222.length() - 7));
                    map.put("af_v", af.AFKeystoreWrapper(sb5222.toString()));
                    String str23222 = (String) map.get(obj3222);
                    StringBuilder sb6222 = new StringBuilder();
                    sb6222.append(str23222);
                    sb6222.append(map.get(obj4222));
                    String obj5222 = sb6222.toString();
                    StringBuilder sb7222 = new StringBuilder();
                    sb7222.append(obj5222);
                    sb7222.append(map.get(str21222));
                    String obj6222 = sb7222.toString();
                    StringBuilder sb8222 = new StringBuilder();
                    sb8222.append(obj6222);
                    sb8222.append(map.get("installDate"));
                    String obj7222 = sb8222.toString();
                    StringBuilder sb9222 = new StringBuilder();
                    sb9222.append(obj7222);
                    sb9222.append(map.get("counter"));
                    String obj8222 = sb9222.toString();
                    StringBuilder sb10222 = new StringBuilder();
                    sb10222.append(obj8222);
                    sb10222.append(map.get("iaecounter"));
                    map.put("af_v2", af.AFKeystoreWrapper(af.AFInAppEventType(sb10222.toString())));
                    map.put("ivc", Boolean.valueOf(getLevel(application)));
                    if (sharedPreferences2.contains("is_stop_tracking_used")) {
                    }
                    HashMap hashMap2222 = new HashMap();
                    hashMap2222.put("mcc", Integer.valueOf(application.getResources().getConfiguration().mcc));
                    hashMap2222.put("mnc", Integer.valueOf(application.getResources().getConfiguration().mnc));
                    map.put("cell", hashMap2222);
                    map.put("sig", aa.values(auVar.AFKeystoreWrapper.getPackageManager(), auVar.AFKeystoreWrapper.getPackageName()));
                    map.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));
                    map.put("disk", sb11222.toString());
                    strArr = this.getLevel;
                    if (strArr != null) {
                    }
                    return map;
                }
                if (str6 != null) {
                    map.put("fb", str6);
                }
            }
            appsFlyerProperties2 = AppsFlyerProperties.getInstance();
            if (appsFlyerProperties2.getBoolean(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, false)) {
                map.put(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
                obj = "af_timestamp";
            } else {
                SharedPreferences values8 = values(application);
                boolean z4 = appsFlyerProperties2.getBoolean(AppsFlyerProperties.COLLECT_IMEI, true);
                String string18 = values8.getString("imeiCached", null);
                if (z4 && TextUtils.isEmpty(this.AppsFlyer2dXConversionCallback)) {
                    if (AppsFlyer2dXConversionCallback(application)) {
                        try {
                            telephonyManager = (TelephonyManager) application.getSystemService("phone");
                            obj = "af_timestamp";
                        } catch (InvocationTargetException unused3) {
                            obj = "af_timestamp";
                        } catch (Exception e10) {
                            e = e10;
                            obj = "af_timestamp";
                        }
                        try {
                            str7 = (String) telephonyManager.getClass().getMethod("getDeviceId", new Class[0]).invoke(telephonyManager, new Object[0]);
                            if (str7 != null) {
                                string18 = str7;
                            } else if (string18 != null) {
                                str9 = "use cached IMEI: ";
                                try {
                                    AFLogger.values(str9.concat(String.valueOf(string18)));
                                } catch (InvocationTargetException unused4) {
                                    if (string18 == null) {
                                    }
                                    AFLogger.init("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) {
                                    }
                                    str8 = this.AFLogger$LogLevel;
                                    if (str8 != null) {
                                    }
                                    str8 = null;
                                    if (str8 == null) {
                                    }
                                    values3 = ab.values(application);
                                    if (values3 != null) {
                                    }
                                    AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application));
                                    str10 = "uid";
                                    if (AFKeystoreWrapper3 != null) {
                                    }
                                    map.put("lang", Locale.getDefault().getDisplayLanguage());
                                    map.put("lang_code", Locale.getDefault().getLanguage());
                                    map.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                                    map.put("platformextension", this.enableLocationCollection.AFInAppEventParameterName());
                                    valueOf(application, (Map<String, ? super String>) map);
                                    SimpleDateFormat simpleDateFormat22 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                                    long j322 = application.getPackageManager().getPackageInfo(application.getPackageName(), 0).firstInstallTime;
                                    simpleDateFormat22.setTimeZone(TimeZone.getTimeZone("UTC"));
                                    map.put("installDate", simpleDateFormat22.format(new Date(j322)));
                                    packageInfo = application.getPackageManager().getPackageInfo(application.getPackageName(), 0);
                                    sharedPreferences2 = sharedPreferences;
                                    if (packageInfo.versionCode > sharedPreferences2.getInt("versionCode", 0)) {
                                    }
                                    map.put("app_version_code", Integer.toString(packageInfo.versionCode));
                                    map.put("app_version_name", packageInfo.versionName);
                                    appsFlyerProperties3 = appsFlyerProperties5222;
                                    long j422 = packageInfo.firstInstallTime;
                                    str12 = str10;
                                    long j522 = packageInfo.lastUpdateTime;
                                    str11 = str12;
                                    obj2 = "appsflyerKey";
                                    map.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j422)));
                                    map.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j522)));
                                    map.put("firstLaunchDate", AFInAppEventParameterName(simpleDateFormat22, application));
                                    this.onPause = bb.values(application);
                                    StringBuilder sb42222 = new StringBuilder("didConfigureTokenRefreshService=");
                                    sb42222.append(this.onPause);
                                    AFLogger.values(sb42222.toString());
                                    if (!this.onPause) {
                                    }
                                    if (z) {
                                    }
                                    if (!z) {
                                    }
                                    if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                                    }
                                    AFInAppEventParameterName2 = ab.AFInAppEventParameterName(application.getContentResolver());
                                    if (AFInAppEventParameterName2 != null) {
                                    }
                                    map.put("registeredUninstall", Boolean.valueOf(bb.AFInAppEventParameterName(sharedPreferences2)));
                                    z3 = z;
                                    valueOf3 = valueOf(sharedPreferences2, "appsFlyerCount", z3);
                                    map.put("counter", Integer.toString(valueOf3));
                                    map.put("iaecounter", Integer.toString(valueOf(sharedPreferences2, "appsFlyerInAppEventCount", str3 == null)));
                                    if (z3) {
                                    }
                                    map.put("isFirstCall", Boolean.toString(!values(sharedPreferences2)));
                                    HashMap hashMap3222 = new HashMap();
                                    hashMap3222.put("cpu_abi", AFInAppEventType("ro.product.cpu.abi"));
                                    hashMap3222.put("cpu_abi2", AFInAppEventType("ro.product.cpu.abi2"));
                                    hashMap3222.put("arch", AFInAppEventType("os.arch"));
                                    hashMap3222.put("build_display_id", AFInAppEventType("ro.build.display.id"));
                                    if (z3) {
                                    }
                                    hashMap3222.put("dim", w.AFInAppEventParameterName(application));
                                    map.put("deviceData", hashMap3222);
                                    Object obj32222 = obj2;
                                    String str192222 = (String) map.get(obj32222);
                                    Object obj42222 = obj;
                                    String str202222 = (String) map.get(obj42222);
                                    String str212222 = str11;
                                    String str222222 = (String) map.get(str212222);
                                    StringBuilder sb52222 = new StringBuilder();
                                    sb52222.append(str192222.substring(0, 7));
                                    sb52222.append(str222222.substring(0, 7));
                                    sb52222.append(str202222.substring(str202222.length() - 7));
                                    map.put("af_v", af.AFKeystoreWrapper(sb52222.toString()));
                                    String str232222 = (String) map.get(obj32222);
                                    StringBuilder sb62222 = new StringBuilder();
                                    sb62222.append(str232222);
                                    sb62222.append(map.get(obj42222));
                                    String obj52222 = sb62222.toString();
                                    StringBuilder sb72222 = new StringBuilder();
                                    sb72222.append(obj52222);
                                    sb72222.append(map.get(str212222));
                                    String obj62222 = sb72222.toString();
                                    StringBuilder sb82222 = new StringBuilder();
                                    sb82222.append(obj62222);
                                    sb82222.append(map.get("installDate"));
                                    String obj72222 = sb82222.toString();
                                    StringBuilder sb92222 = new StringBuilder();
                                    sb92222.append(obj72222);
                                    sb92222.append(map.get("counter"));
                                    String obj82222 = sb92222.toString();
                                    StringBuilder sb102222 = new StringBuilder();
                                    sb102222.append(obj82222);
                                    sb102222.append(map.get("iaecounter"));
                                    map.put("af_v2", af.AFKeystoreWrapper(af.AFInAppEventType(sb102222.toString())));
                                    map.put("ivc", Boolean.valueOf(getLevel(application)));
                                    if (sharedPreferences2.contains("is_stop_tracking_used")) {
                                    }
                                    HashMap hashMap22222 = new HashMap();
                                    hashMap22222.put("mcc", Integer.valueOf(application.getResources().getConfiguration().mcc));
                                    hashMap22222.put("mnc", Integer.valueOf(application.getResources().getConfiguration().mnc));
                                    map.put("cell", hashMap22222);
                                    map.put("sig", aa.values(auVar.AFKeystoreWrapper.getPackageManager(), auVar.AFKeystoreWrapper.getPackageName()));
                                    map.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));
                                    map.put("disk", sb112222.toString());
                                    strArr = this.getLevel;
                                    if (strArr != null) {
                                    }
                                    return map;
                                } catch (Exception e11) {
                                    e = e11;
                                    Exception exc2 = e;
                                    if (string18 == null) {
                                    }
                                    AFLogger.AFInAppEventType("WARNING: other reason: ", exc2);
                                    if (string18 == null) {
                                    }
                                    z2 = appsFlyerProperties2.getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                                    String string192 = values8.getString("androidIdCached", null);
                                    if (!z2) {
                                    }
                                    str8 = this.AFLogger$LogLevel;
                                    if (str8 != null) {
                                    }
                                    str8 = null;
                                    if (str8 == null) {
                                    }
                                    values3 = ab.values(application);
                                    if (values3 != null) {
                                    }
                                    AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application));
                                    str10 = "uid";
                                    if (AFKeystoreWrapper3 != null) {
                                    }
                                    map.put("lang", Locale.getDefault().getDisplayLanguage());
                                    map.put("lang_code", Locale.getDefault().getLanguage());
                                    map.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                                    map.put("platformextension", this.enableLocationCollection.AFInAppEventParameterName());
                                    valueOf(application, (Map<String, ? super String>) map);
                                    SimpleDateFormat simpleDateFormat222 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                                    long j3222 = application.getPackageManager().getPackageInfo(application.getPackageName(), 0).firstInstallTime;
                                    simpleDateFormat222.setTimeZone(TimeZone.getTimeZone("UTC"));
                                    map.put("installDate", simpleDateFormat222.format(new Date(j3222)));
                                    packageInfo = application.getPackageManager().getPackageInfo(application.getPackageName(), 0);
                                    sharedPreferences2 = sharedPreferences;
                                    if (packageInfo.versionCode > sharedPreferences2.getInt("versionCode", 0)) {
                                    }
                                    map.put("app_version_code", Integer.toString(packageInfo.versionCode));
                                    map.put("app_version_name", packageInfo.versionName);
                                    appsFlyerProperties3 = appsFlyerProperties5222;
                                    long j4222 = packageInfo.firstInstallTime;
                                    str12 = str10;
                                    long j5222 = packageInfo.lastUpdateTime;
                                    str11 = str12;
                                    obj2 = "appsflyerKey";
                                    map.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j4222)));
                                    map.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j5222)));
                                    map.put("firstLaunchDate", AFInAppEventParameterName(simpleDateFormat222, application));
                                    this.onPause = bb.values(application);
                                    StringBuilder sb422222 = new StringBuilder("didConfigureTokenRefreshService=");
                                    sb422222.append(this.onPause);
                                    AFLogger.values(sb422222.toString());
                                    if (!this.onPause) {
                                    }
                                    if (z) {
                                    }
                                    if (!z) {
                                    }
                                    if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                                    }
                                    AFInAppEventParameterName2 = ab.AFInAppEventParameterName(application.getContentResolver());
                                    if (AFInAppEventParameterName2 != null) {
                                    }
                                    map.put("registeredUninstall", Boolean.valueOf(bb.AFInAppEventParameterName(sharedPreferences2)));
                                    z3 = z;
                                    valueOf3 = valueOf(sharedPreferences2, "appsFlyerCount", z3);
                                    map.put("counter", Integer.toString(valueOf3));
                                    map.put("iaecounter", Integer.toString(valueOf(sharedPreferences2, "appsFlyerInAppEventCount", str3 == null)));
                                    if (z3) {
                                    }
                                    map.put("isFirstCall", Boolean.toString(!values(sharedPreferences2)));
                                    HashMap hashMap32222 = new HashMap();
                                    hashMap32222.put("cpu_abi", AFInAppEventType("ro.product.cpu.abi"));
                                    hashMap32222.put("cpu_abi2", AFInAppEventType("ro.product.cpu.abi2"));
                                    hashMap32222.put("arch", AFInAppEventType("os.arch"));
                                    hashMap32222.put("build_display_id", AFInAppEventType("ro.build.display.id"));
                                    if (z3) {
                                    }
                                    hashMap32222.put("dim", w.AFInAppEventParameterName(application));
                                    map.put("deviceData", hashMap32222);
                                    Object obj322222 = obj2;
                                    String str1922222 = (String) map.get(obj322222);
                                    Object obj422222 = obj;
                                    String str2022222 = (String) map.get(obj422222);
                                    String str2122222 = str11;
                                    String str2222222 = (String) map.get(str2122222);
                                    StringBuilder sb522222 = new StringBuilder();
                                    sb522222.append(str1922222.substring(0, 7));
                                    sb522222.append(str2222222.substring(0, 7));
                                    sb522222.append(str2022222.substring(str2022222.length() - 7));
                                    map.put("af_v", af.AFKeystoreWrapper(sb522222.toString()));
                                    String str2322222 = (String) map.get(obj322222);
                                    StringBuilder sb622222 = new StringBuilder();
                                    sb622222.append(str2322222);
                                    sb622222.append(map.get(obj422222));
                                    String obj522222 = sb622222.toString();
                                    StringBuilder sb722222 = new StringBuilder();
                                    sb722222.append(obj522222);
                                    sb722222.append(map.get(str2122222));
                                    String obj622222 = sb722222.toString();
                                    StringBuilder sb822222 = new StringBuilder();
                                    sb822222.append(obj622222);
                                    sb822222.append(map.get("installDate"));
                                    String obj722222 = sb822222.toString();
                                    StringBuilder sb922222 = new StringBuilder();
                                    sb922222.append(obj722222);
                                    sb922222.append(map.get("counter"));
                                    String obj822222 = sb922222.toString();
                                    StringBuilder sb1022222 = new StringBuilder();
                                    sb1022222.append(obj822222);
                                    sb1022222.append(map.get("iaecounter"));
                                    map.put("af_v2", af.AFKeystoreWrapper(af.AFInAppEventType(sb1022222.toString())));
                                    map.put("ivc", Boolean.valueOf(getLevel(application)));
                                    if (sharedPreferences2.contains("is_stop_tracking_used")) {
                                    }
                                    HashMap hashMap222222 = new HashMap();
                                    hashMap222222.put("mcc", Integer.valueOf(application.getResources().getConfiguration().mcc));
                                    hashMap222222.put("mnc", Integer.valueOf(application.getResources().getConfiguration().mnc));
                                    map.put("cell", hashMap222222);
                                    map.put("sig", aa.values(auVar.AFKeystoreWrapper.getPackageManager(), auVar.AFKeystoreWrapper.getPackageName()));
                                    map.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));
                                    map.put("disk", sb1122222.toString());
                                    strArr = this.getLevel;
                                    if (strArr != null) {
                                    }
                                    return map;
                                }
                            }
                        } catch (InvocationTargetException unused5) {
                            str9 = "use cached IMEI: ";
                            if (string18 == null) {
                                AFLogger.values(str9.concat(String.valueOf(string18)));
                            } else {
                                string18 = null;
                            }
                            AFLogger.init("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) {
                            }
                            str8 = this.AFLogger$LogLevel;
                            if (str8 != null) {
                            }
                            str8 = null;
                            if (str8 == null) {
                            }
                            values3 = ab.values(application);
                            if (values3 != null) {
                            }
                            AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application));
                            str10 = "uid";
                            if (AFKeystoreWrapper3 != null) {
                            }
                            map.put("lang", Locale.getDefault().getDisplayLanguage());
                            map.put("lang_code", Locale.getDefault().getLanguage());
                            map.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                            map.put("platformextension", this.enableLocationCollection.AFInAppEventParameterName());
                            valueOf(application, (Map<String, ? super String>) map);
                            SimpleDateFormat simpleDateFormat2222 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                            long j32222 = application.getPackageManager().getPackageInfo(application.getPackageName(), 0).firstInstallTime;
                            simpleDateFormat2222.setTimeZone(TimeZone.getTimeZone("UTC"));
                            map.put("installDate", simpleDateFormat2222.format(new Date(j32222)));
                            packageInfo = application.getPackageManager().getPackageInfo(application.getPackageName(), 0);
                            sharedPreferences2 = sharedPreferences;
                            if (packageInfo.versionCode > sharedPreferences2.getInt("versionCode", 0)) {
                            }
                            map.put("app_version_code", Integer.toString(packageInfo.versionCode));
                            map.put("app_version_name", packageInfo.versionName);
                            appsFlyerProperties3 = appsFlyerProperties5222;
                            long j42222 = packageInfo.firstInstallTime;
                            str12 = str10;
                            long j52222 = packageInfo.lastUpdateTime;
                            str11 = str12;
                            obj2 = "appsflyerKey";
                            map.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j42222)));
                            map.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j52222)));
                            map.put("firstLaunchDate", AFInAppEventParameterName(simpleDateFormat2222, application));
                            this.onPause = bb.values(application);
                            StringBuilder sb4222222 = new StringBuilder("didConfigureTokenRefreshService=");
                            sb4222222.append(this.onPause);
                            AFLogger.values(sb4222222.toString());
                            if (!this.onPause) {
                            }
                            if (z) {
                            }
                            if (!z) {
                            }
                            if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                            }
                            AFInAppEventParameterName2 = ab.AFInAppEventParameterName(application.getContentResolver());
                            if (AFInAppEventParameterName2 != null) {
                            }
                            map.put("registeredUninstall", Boolean.valueOf(bb.AFInAppEventParameterName(sharedPreferences2)));
                            z3 = z;
                            valueOf3 = valueOf(sharedPreferences2, "appsFlyerCount", z3);
                            map.put("counter", Integer.toString(valueOf3));
                            map.put("iaecounter", Integer.toString(valueOf(sharedPreferences2, "appsFlyerInAppEventCount", str3 == null)));
                            if (z3) {
                            }
                            map.put("isFirstCall", Boolean.toString(!values(sharedPreferences2)));
                            HashMap hashMap322222 = new HashMap();
                            hashMap322222.put("cpu_abi", AFInAppEventType("ro.product.cpu.abi"));
                            hashMap322222.put("cpu_abi2", AFInAppEventType("ro.product.cpu.abi2"));
                            hashMap322222.put("arch", AFInAppEventType("os.arch"));
                            hashMap322222.put("build_display_id", AFInAppEventType("ro.build.display.id"));
                            if (z3) {
                            }
                            hashMap322222.put("dim", w.AFInAppEventParameterName(application));
                            map.put("deviceData", hashMap322222);
                            Object obj3222222 = obj2;
                            String str19222222 = (String) map.get(obj3222222);
                            Object obj4222222 = obj;
                            String str20222222 = (String) map.get(obj4222222);
                            String str21222222 = str11;
                            String str22222222 = (String) map.get(str21222222);
                            StringBuilder sb5222222 = new StringBuilder();
                            sb5222222.append(str19222222.substring(0, 7));
                            sb5222222.append(str22222222.substring(0, 7));
                            sb5222222.append(str20222222.substring(str20222222.length() - 7));
                            map.put("af_v", af.AFKeystoreWrapper(sb5222222.toString()));
                            String str23222222 = (String) map.get(obj3222222);
                            StringBuilder sb6222222 = new StringBuilder();
                            sb6222222.append(str23222222);
                            sb6222222.append(map.get(obj4222222));
                            String obj5222222 = sb6222222.toString();
                            StringBuilder sb7222222 = new StringBuilder();
                            sb7222222.append(obj5222222);
                            sb7222222.append(map.get(str21222222));
                            String obj6222222 = sb7222222.toString();
                            StringBuilder sb8222222 = new StringBuilder();
                            sb8222222.append(obj6222222);
                            sb8222222.append(map.get("installDate"));
                            String obj7222222 = sb8222222.toString();
                            StringBuilder sb9222222 = new StringBuilder();
                            sb9222222.append(obj7222222);
                            sb9222222.append(map.get("counter"));
                            String obj8222222 = sb9222222.toString();
                            StringBuilder sb10222222 = new StringBuilder();
                            sb10222222.append(obj8222222);
                            sb10222222.append(map.get("iaecounter"));
                            map.put("af_v2", af.AFKeystoreWrapper(af.AFInAppEventType(sb10222222.toString())));
                            map.put("ivc", Boolean.valueOf(getLevel(application)));
                            if (sharedPreferences2.contains("is_stop_tracking_used")) {
                            }
                            HashMap hashMap2222222 = new HashMap();
                            hashMap2222222.put("mcc", Integer.valueOf(application.getResources().getConfiguration().mcc));
                            hashMap2222222.put("mnc", Integer.valueOf(application.getResources().getConfiguration().mnc));
                            map.put("cell", hashMap2222222);
                            map.put("sig", aa.values(auVar.AFKeystoreWrapper.getPackageManager(), auVar.AFKeystoreWrapper.getPackageName()));
                            map.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));
                            map.put("disk", sb11222222.toString());
                            strArr = this.getLevel;
                            if (strArr != null) {
                            }
                            return map;
                        } catch (Exception e12) {
                            e = e12;
                            str9 = "use cached IMEI: ";
                            Exception exc22 = e;
                            if (string18 == null) {
                                AFLogger.values(str9.concat(String.valueOf(string18)));
                            } else {
                                string18 = null;
                            }
                            AFLogger.AFInAppEventType("WARNING: other reason: ", exc22);
                            if (string18 == null) {
                            }
                            z2 = appsFlyerProperties2.getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                            String string19222 = values8.getString("androidIdCached", null);
                            if (!z2) {
                            }
                            str8 = this.AFLogger$LogLevel;
                            if (str8 != null) {
                            }
                            str8 = null;
                            if (str8 == null) {
                            }
                            values3 = ab.values(application);
                            if (values3 != null) {
                            }
                            AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application));
                            str10 = "uid";
                            if (AFKeystoreWrapper3 != null) {
                            }
                            map.put("lang", Locale.getDefault().getDisplayLanguage());
                            map.put("lang_code", Locale.getDefault().getLanguage());
                            map.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                            map.put("platformextension", this.enableLocationCollection.AFInAppEventParameterName());
                            valueOf(application, (Map<String, ? super String>) map);
                            SimpleDateFormat simpleDateFormat22222 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                            long j322222 = application.getPackageManager().getPackageInfo(application.getPackageName(), 0).firstInstallTime;
                            simpleDateFormat22222.setTimeZone(TimeZone.getTimeZone("UTC"));
                            map.put("installDate", simpleDateFormat22222.format(new Date(j322222)));
                            packageInfo = application.getPackageManager().getPackageInfo(application.getPackageName(), 0);
                            sharedPreferences2 = sharedPreferences;
                            if (packageInfo.versionCode > sharedPreferences2.getInt("versionCode", 0)) {
                            }
                            map.put("app_version_code", Integer.toString(packageInfo.versionCode));
                            map.put("app_version_name", packageInfo.versionName);
                            appsFlyerProperties3 = appsFlyerProperties5222;
                            long j422222 = packageInfo.firstInstallTime;
                            str12 = str10;
                            long j522222 = packageInfo.lastUpdateTime;
                            str11 = str12;
                            obj2 = "appsflyerKey";
                            map.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j422222)));
                            map.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j522222)));
                            map.put("firstLaunchDate", AFInAppEventParameterName(simpleDateFormat22222, application));
                            this.onPause = bb.values(application);
                            StringBuilder sb42222222 = new StringBuilder("didConfigureTokenRefreshService=");
                            sb42222222.append(this.onPause);
                            AFLogger.values(sb42222222.toString());
                            if (!this.onPause) {
                            }
                            if (z) {
                            }
                            if (!z) {
                            }
                            if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                            }
                            AFInAppEventParameterName2 = ab.AFInAppEventParameterName(application.getContentResolver());
                            if (AFInAppEventParameterName2 != null) {
                            }
                            map.put("registeredUninstall", Boolean.valueOf(bb.AFInAppEventParameterName(sharedPreferences2)));
                            z3 = z;
                            valueOf3 = valueOf(sharedPreferences2, "appsFlyerCount", z3);
                            map.put("counter", Integer.toString(valueOf3));
                            map.put("iaecounter", Integer.toString(valueOf(sharedPreferences2, "appsFlyerInAppEventCount", str3 == null)));
                            if (z3) {
                            }
                            map.put("isFirstCall", Boolean.toString(!values(sharedPreferences2)));
                            HashMap hashMap3222222 = new HashMap();
                            hashMap3222222.put("cpu_abi", AFInAppEventType("ro.product.cpu.abi"));
                            hashMap3222222.put("cpu_abi2", AFInAppEventType("ro.product.cpu.abi2"));
                            hashMap3222222.put("arch", AFInAppEventType("os.arch"));
                            hashMap3222222.put("build_display_id", AFInAppEventType("ro.build.display.id"));
                            if (z3) {
                            }
                            hashMap3222222.put("dim", w.AFInAppEventParameterName(application));
                            map.put("deviceData", hashMap3222222);
                            Object obj32222222 = obj2;
                            String str192222222 = (String) map.get(obj32222222);
                            Object obj42222222 = obj;
                            String str202222222 = (String) map.get(obj42222222);
                            String str212222222 = str11;
                            String str222222222 = (String) map.get(str212222222);
                            StringBuilder sb52222222 = new StringBuilder();
                            sb52222222.append(str192222222.substring(0, 7));
                            sb52222222.append(str222222222.substring(0, 7));
                            sb52222222.append(str202222222.substring(str202222222.length() - 7));
                            map.put("af_v", af.AFKeystoreWrapper(sb52222222.toString()));
                            String str232222222 = (String) map.get(obj32222222);
                            StringBuilder sb62222222 = new StringBuilder();
                            sb62222222.append(str232222222);
                            sb62222222.append(map.get(obj42222222));
                            String obj52222222 = sb62222222.toString();
                            StringBuilder sb72222222 = new StringBuilder();
                            sb72222222.append(obj52222222);
                            sb72222222.append(map.get(str212222222));
                            String obj62222222 = sb72222222.toString();
                            StringBuilder sb82222222 = new StringBuilder();
                            sb82222222.append(obj62222222);
                            sb82222222.append(map.get("installDate"));
                            String obj72222222 = sb82222222.toString();
                            StringBuilder sb92222222 = new StringBuilder();
                            sb92222222.append(obj72222222);
                            sb92222222.append(map.get("counter"));
                            String obj82222222 = sb92222222.toString();
                            StringBuilder sb102222222 = new StringBuilder();
                            sb102222222.append(obj82222222);
                            sb102222222.append(map.get("iaecounter"));
                            map.put("af_v2", af.AFKeystoreWrapper(af.AFInAppEventType(sb102222222.toString())));
                            map.put("ivc", Boolean.valueOf(getLevel(application)));
                            if (sharedPreferences2.contains("is_stop_tracking_used")) {
                            }
                            HashMap hashMap22222222 = new HashMap();
                            hashMap22222222.put("mcc", Integer.valueOf(application.getResources().getConfiguration().mcc));
                            hashMap22222222.put("mnc", Integer.valueOf(application.getResources().getConfiguration().mnc));
                            map.put("cell", hashMap22222222);
                            map.put("sig", aa.values(auVar.AFKeystoreWrapper.getPackageManager(), auVar.AFKeystoreWrapper.getPackageName()));
                            map.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));
                            map.put("disk", sb112222222.toString());
                            strArr = this.getLevel;
                            if (strArr != null) {
                            }
                            return map;
                        }
                    } else {
                        obj = "af_timestamp";
                    }
                    string18 = null;
                } else {
                    obj = "af_timestamp";
                    str7 = this.AppsFlyer2dXConversionCallback;
                }
                if (string18 == null) {
                    AFLogger.AFKeystoreWrapper("IMEI was not collected.");
                } else {
                    SharedPreferences.Editor edit4 = values(application).edit();
                    edit4.putString("imeiCached", string18);
                    edit4.apply();
                    map.put("imei", string18);
                }
                z2 = appsFlyerProperties2.getBoolean(AppsFlyerProperties.COLLECT_ANDROID_ID, true);
                String string192222 = values8.getString("androidIdCached", null);
                if (!z2 && TextUtils.isEmpty(this.AFLogger$LogLevel)) {
                    if (AppsFlyer2dXConversionCallback(application)) {
                        try {
                            str8 = Settings.Secure.getString(application.getContentResolver(), "android_id");
                        } catch (Exception e13) {
                            if (string192222 != null) {
                                AFLogger.values("use cached AndroidId: ".concat(String.valueOf(string192222)));
                            } else {
                                string192222 = null;
                            }
                            AFLogger.AFInAppEventType(e13.getMessage(), e13);
                        }
                        if (str8 == null) {
                            if (string192222 != null) {
                                AFLogger.values("use cached AndroidId: ".concat(String.valueOf(string192222)));
                            } else {
                                string192222 = null;
                            }
                            str8 = string192222;
                            if (str8 == null) {
                            }
                            values3 = ab.values(application);
                            if (values3 != null) {
                            }
                        } else {
                            if (str8 == null) {
                            }
                            values3 = ab.values(application);
                            if (values3 != null) {
                            }
                        }
                    }
                    str8 = null;
                    if (str8 == null) {
                    }
                    values3 = ab.values(application);
                    if (values3 != null) {
                    }
                } else {
                    str8 = this.AFLogger$LogLevel;
                    if (str8 != null) {
                        if (str8 == null) {
                            AFLogger.AFKeystoreWrapper("Android ID was not collected.");
                        } else {
                            SharedPreferences.Editor edit5 = values(application).edit();
                            edit5.putString("androidIdCached", str8);
                            edit5.apply();
                            map.put("android_id", str8);
                        }
                        values3 = ab.values(application);
                        if (values3 != null) {
                            HashMap hashMap4 = new HashMap();
                            hashMap4.put("isManual", values3.AFInAppEventParameterName);
                            hashMap4.put("val", values3.values);
                            Boolean bool2 = values3.valueOf;
                            if (bool2 != null) {
                                hashMap4.put("isLat", bool2);
                            }
                            map.put("oaid", hashMap4);
                        }
                    }
                    str8 = null;
                    if (str8 == null) {
                    }
                    values3 = ab.values(application);
                    if (values3 != null) {
                    }
                }
            }
            try {
                AFKeystoreWrapper3 = an.AFKeystoreWrapper(new WeakReference(application));
                str10 = "uid";
                if (AFKeystoreWrapper3 != null) {
                    try {
                        map.put(str10, AFKeystoreWrapper3);
                    } catch (Exception e14) {
                        e = e14;
                        Exception exc3 = e;
                        StringBuilder sb12 = new StringBuilder("ERROR: could not get uid ");
                        sb12.append(exc3.getMessage());
                        AFLogger.AFInAppEventType(sb12.toString(), exc3);
                        map.put("lang", Locale.getDefault().getDisplayLanguage());
                        map.put("lang_code", Locale.getDefault().getLanguage());
                        map.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
                        map.put("platformextension", this.enableLocationCollection.AFInAppEventParameterName());
                        valueOf(application, (Map<String, ? super String>) map);
                        SimpleDateFormat simpleDateFormat222222 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
                        long j3222222 = application.getPackageManager().getPackageInfo(application.getPackageName(), 0).firstInstallTime;
                        simpleDateFormat222222.setTimeZone(TimeZone.getTimeZone("UTC"));
                        map.put("installDate", simpleDateFormat222222.format(new Date(j3222222)));
                        packageInfo = application.getPackageManager().getPackageInfo(application.getPackageName(), 0);
                        sharedPreferences2 = sharedPreferences;
                        if (packageInfo.versionCode > sharedPreferences2.getInt("versionCode", 0)) {
                        }
                        map.put("app_version_code", Integer.toString(packageInfo.versionCode));
                        map.put("app_version_name", packageInfo.versionName);
                        appsFlyerProperties3 = appsFlyerProperties5222;
                        long j4222222 = packageInfo.firstInstallTime;
                        str12 = str10;
                        long j5222222 = packageInfo.lastUpdateTime;
                        str11 = str12;
                        obj2 = "appsflyerKey";
                        map.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j4222222)));
                        map.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j5222222)));
                        map.put("firstLaunchDate", AFInAppEventParameterName(simpleDateFormat222222, application));
                        this.onPause = bb.values(application);
                        StringBuilder sb422222222 = new StringBuilder("didConfigureTokenRefreshService=");
                        sb422222222.append(this.onPause);
                        AFLogger.values(sb422222222.toString());
                        if (!this.onPause) {
                        }
                        if (z) {
                        }
                        if (!z) {
                        }
                        if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                        }
                        AFInAppEventParameterName2 = ab.AFInAppEventParameterName(application.getContentResolver());
                        if (AFInAppEventParameterName2 != null) {
                        }
                        map.put("registeredUninstall", Boolean.valueOf(bb.AFInAppEventParameterName(sharedPreferences2)));
                        z3 = z;
                        valueOf3 = valueOf(sharedPreferences2, "appsFlyerCount", z3);
                        map.put("counter", Integer.toString(valueOf3));
                        map.put("iaecounter", Integer.toString(valueOf(sharedPreferences2, "appsFlyerInAppEventCount", str3 == null)));
                        if (z3) {
                        }
                        map.put("isFirstCall", Boolean.toString(!values(sharedPreferences2)));
                        HashMap hashMap32222222 = new HashMap();
                        hashMap32222222.put("cpu_abi", AFInAppEventType("ro.product.cpu.abi"));
                        hashMap32222222.put("cpu_abi2", AFInAppEventType("ro.product.cpu.abi2"));
                        hashMap32222222.put("arch", AFInAppEventType("os.arch"));
                        hashMap32222222.put("build_display_id", AFInAppEventType("ro.build.display.id"));
                        if (z3) {
                        }
                        hashMap32222222.put("dim", w.AFInAppEventParameterName(application));
                        map.put("deviceData", hashMap32222222);
                        Object obj322222222 = obj2;
                        String str1922222222 = (String) map.get(obj322222222);
                        Object obj422222222 = obj;
                        String str2022222222 = (String) map.get(obj422222222);
                        String str2122222222 = str11;
                        String str2222222222 = (String) map.get(str2122222222);
                        StringBuilder sb522222222 = new StringBuilder();
                        sb522222222.append(str1922222222.substring(0, 7));
                        sb522222222.append(str2222222222.substring(0, 7));
                        sb522222222.append(str2022222222.substring(str2022222222.length() - 7));
                        map.put("af_v", af.AFKeystoreWrapper(sb522222222.toString()));
                        String str2322222222 = (String) map.get(obj322222222);
                        StringBuilder sb622222222 = new StringBuilder();
                        sb622222222.append(str2322222222);
                        sb622222222.append(map.get(obj422222222));
                        String obj522222222 = sb622222222.toString();
                        StringBuilder sb722222222 = new StringBuilder();
                        sb722222222.append(obj522222222);
                        sb722222222.append(map.get(str2122222222));
                        String obj622222222 = sb722222222.toString();
                        StringBuilder sb822222222 = new StringBuilder();
                        sb822222222.append(obj622222222);
                        sb822222222.append(map.get("installDate"));
                        String obj722222222 = sb822222222.toString();
                        StringBuilder sb922222222 = new StringBuilder();
                        sb922222222.append(obj722222222);
                        sb922222222.append(map.get("counter"));
                        String obj822222222 = sb922222222.toString();
                        StringBuilder sb1022222222 = new StringBuilder();
                        sb1022222222.append(obj822222222);
                        sb1022222222.append(map.get("iaecounter"));
                        map.put("af_v2", af.AFKeystoreWrapper(af.AFInAppEventType(sb1022222222.toString())));
                        map.put("ivc", Boolean.valueOf(getLevel(application)));
                        if (sharedPreferences2.contains("is_stop_tracking_used")) {
                        }
                        HashMap hashMap222222222 = new HashMap();
                        hashMap222222222.put("mcc", Integer.valueOf(application.getResources().getConfiguration().mcc));
                        hashMap222222222.put("mnc", Integer.valueOf(application.getResources().getConfiguration().mnc));
                        map.put("cell", hashMap222222222);
                        map.put("sig", aa.values(auVar.AFKeystoreWrapper.getPackageManager(), auVar.AFKeystoreWrapper.getPackageName()));
                        map.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));
                        map.put("disk", sb1122222222.toString());
                        strArr = this.getLevel;
                        if (strArr != null) {
                        }
                        return map;
                    }
                }
            } catch (Exception e15) {
                e = e15;
                str10 = "uid";
            }
            try {
                map.put("lang", Locale.getDefault().getDisplayLanguage());
            } catch (Exception e16) {
                AFLogger.AFInAppEventType("Exception while collecting display language name. ", e16);
            }
            try {
                map.put("lang_code", Locale.getDefault().getLanguage());
            } catch (Exception e17) {
                AFLogger.AFInAppEventType("Exception while collecting display language code. ", e17);
            }
            try {
                map.put(UserDataStore.COUNTRY, Locale.getDefault().getCountry());
            } catch (Exception e18) {
                AFLogger.AFInAppEventType("Exception while collecting country name. ", e18);
            }
            map.put("platformextension", this.enableLocationCollection.AFInAppEventParameterName());
            valueOf(application, (Map<String, ? super String>) map);
            SimpleDateFormat simpleDateFormat2222222 = new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US);
            try {
                long j32222222 = application.getPackageManager().getPackageInfo(application.getPackageName(), 0).firstInstallTime;
                simpleDateFormat2222222.setTimeZone(TimeZone.getTimeZone("UTC"));
                map.put("installDate", simpleDateFormat2222222.format(new Date(j32222222)));
            } catch (Exception e19) {
                AFLogger.AFInAppEventType("Exception while collecting install date. ", e19);
            }
            try {
                packageInfo = application.getPackageManager().getPackageInfo(application.getPackageName(), 0);
                sharedPreferences2 = sharedPreferences;
                if (packageInfo.versionCode > sharedPreferences2.getInt("versionCode", 0)) {
                    int i = packageInfo.versionCode;
                    SharedPreferences.Editor edit6 = values(application).edit();
                    edit6.putInt("versionCode", i);
                    edit6.apply();
                }
                map.put("app_version_code", Integer.toString(packageInfo.versionCode));
                map.put("app_version_name", packageInfo.versionName);
                appsFlyerProperties3 = appsFlyerProperties5222;
                long j42222222 = packageInfo.firstInstallTime;
                str12 = str10;
                long j52222222 = packageInfo.lastUpdateTime;
                str11 = str12;
                try {
                    obj2 = "appsflyerKey";
                    map.put("date1", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j42222222)));
                    map.put("date2", new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US).format(new Date(j52222222)));
                    map.put("firstLaunchDate", AFInAppEventParameterName(simpleDateFormat2222222, application));
                } catch (Throwable th6) {
                    th = th6;
                    obj2 = "appsflyerKey";
                }
            } catch (Throwable th7) {
                th = th7;
                obj2 = "appsflyerKey";
                appsFlyerProperties3 = appsFlyerProperties5222;
                str11 = str10;
                sharedPreferences2 = sharedPreferences;
            }
            this.onPause = bb.values(application);
            StringBuilder sb4222222222 = new StringBuilder("didConfigureTokenRefreshService=");
            sb4222222222.append(this.onPause);
            AFLogger.values(sb4222222222.toString());
            if (!this.onPause) {
                map.put("tokenRefreshConfigured", Boolean.FALSE);
            }
            if (z) {
                if (this.updateServerUninstallToken != null) {
                    if (map.get("af_deeplink") != null) {
                        AFLogger.values("Skip 'af' payload as deeplink was found by path");
                    } else {
                        JSONObject jSONObject3 = new JSONObject(this.updateServerUninstallToken);
                        jSONObject3.put("isPush", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
                        map.put("af_deeplink", jSONObject3.toString());
                    }
                }
                this.updateServerUninstallToken = null;
                map.put("open_referrer", str16);
            }
            if (!z) {
                try {
                    z AFKeystoreWrapper6 = z.AFKeystoreWrapper(application);
                    ConcurrentHashMap concurrentHashMap = new ConcurrentHashMap();
                    List<Map<String, Object>> values9 = AFKeystoreWrapper6.values();
                    if (!values9.isEmpty()) {
                        concurrentHashMap.put("sensors", new i().AFInAppEventType(values9));
                    } else {
                        concurrentHashMap.put("sensors", "na");
                    }
                    map.putAll(concurrentHashMap);
                } catch (Exception e20) {
                    StringBuilder sb13 = new StringBuilder("Unexpected exception from AFSensorManager: ");
                    sb13.append(e20.getMessage());
                    AFLogger.AFInAppEventParameterName(sb13.toString());
                }
            }
            if (AppsFlyerProperties.getInstance().getString("advertiserId") == null) {
                ab.valueOf(application, map);
                map.put("GAID_retry", String.valueOf(AppsFlyerProperties.getInstance().getString("advertiserId") != null));
            }
            AFInAppEventParameterName2 = ab.AFInAppEventParameterName(application.getContentResolver());
            if (AFInAppEventParameterName2 != null) {
                map.put("amazon_aid", AFInAppEventParameterName2.values);
                map.put("amazon_aid_limit", String.valueOf(AFInAppEventParameterName2.valueOf));
            }
            map.put("registeredUninstall", Boolean.valueOf(bb.AFInAppEventParameterName(sharedPreferences2)));
            z3 = z;
            valueOf3 = valueOf(sharedPreferences2, "appsFlyerCount", z3);
            map.put("counter", Integer.toString(valueOf3));
            map.put("iaecounter", Integer.toString(valueOf(sharedPreferences2, "appsFlyerInAppEventCount", str3 == null)));
        } catch (Throwable th8) {
            AFLogger.AFInAppEventParameterName(th8.getLocalizedMessage(), th8);
        }
        if (z3) {
            if (valueOf3 == 1) {
                appsFlyerProperties3.AFInAppEventParameterName = true;
                if (AFInAppEventType(AppsFlyerProperties.AF_WAITFOR_CUSTOMERID, false)) {
                    map.put("wait_cid", Boolean.toString(true));
                }
                Map<String, Object> AFKeystoreWrapper7 = AFKeystoreWrapper(map);
                String string20 = auVar.valueOf.getString("ddl", null);
                if (string20 != null) {
                    Map<String, Object> AFInAppEventType4 = m.AFInAppEventType(new JSONObject(string20));
                    if (!AFInAppEventType4.isEmpty()) {
                        AFKeystoreWrapper7.put("ddl", AFInAppEventType4);
                    }
                }
                Map<String, Object> AFInAppEventType5 = m.AFInAppEventType(this.setUserEmails);
                if (!AFInAppEventType5.isEmpty()) {
                    AFKeystoreWrapper7.put("first_launch", AFInAppEventType5);
                }
                map.put("isFirstCall", Boolean.toString(!values(sharedPreferences2)));
                HashMap hashMap322222222 = new HashMap();
                hashMap322222222.put("cpu_abi", AFInAppEventType("ro.product.cpu.abi"));
                hashMap322222222.put("cpu_abi2", AFInAppEventType("ro.product.cpu.abi2"));
                hashMap322222222.put("arch", AFInAppEventType("os.arch"));
                hashMap322222222.put("build_display_id", AFInAppEventType("ro.build.display.id"));
                if (z3) {
                    if (this.getSdkVersion) {
                        Location valueOf5 = u.c.AFInAppEventParameterName.valueOf(application);
                        HashMap hashMap5 = new HashMap(3);
                        if (valueOf5 != null) {
                            hashMap5.put("lat", String.valueOf(valueOf5.getLatitude()));
                            hashMap5.put("lon", String.valueOf(valueOf5.getLongitude()));
                            hashMap5.put("ts", String.valueOf(valueOf5.getTime()));
                        }
                        if (!hashMap5.isEmpty()) {
                            hashMap322222222.put("loc", hashMap5);
                        }
                    }
                    c.e values10 = c.C0011c.AFKeystoreWrapper.values(application);
                    hashMap322222222.put("btl", Float.toString(values10.values));
                    if (values10.AFKeystoreWrapper != null) {
                        hashMap322222222.put("btch", values10.AFKeystoreWrapper);
                    }
                    if (valueOf3 <= 2) {
                        z AFKeystoreWrapper8 = z.AFKeystoreWrapper(application);
                        ConcurrentHashMap concurrentHashMap2 = new ConcurrentHashMap();
                        List<Map<String, Object>> AFInAppEventParameterName4 = AFKeystoreWrapper8.AFInAppEventParameterName();
                        if (!AFInAppEventParameterName4.isEmpty()) {
                            concurrentHashMap2.put("sensors", AFInAppEventParameterName4);
                        } else {
                            List<Map<String, Object>> values11 = AFKeystoreWrapper8.values();
                            if (!values11.isEmpty()) {
                                concurrentHashMap2.put("sensors", values11);
                            }
                        }
                        hashMap322222222.putAll(concurrentHashMap2);
                    }
                }
                hashMap322222222.put("dim", w.AFInAppEventParameterName(application));
                map.put("deviceData", hashMap322222222);
                Object obj3222222222 = obj2;
                String str19222222222 = (String) map.get(obj3222222222);
                Object obj4222222222 = obj;
                String str20222222222 = (String) map.get(obj4222222222);
                String str21222222222 = str11;
                String str22222222222 = (String) map.get(str21222222222);
                StringBuilder sb5222222222 = new StringBuilder();
                sb5222222222.append(str19222222222.substring(0, 7));
                sb5222222222.append(str22222222222.substring(0, 7));
                sb5222222222.append(str20222222222.substring(str20222222222.length() - 7));
                map.put("af_v", af.AFKeystoreWrapper(sb5222222222.toString()));
                String str23222222222 = (String) map.get(obj3222222222);
                StringBuilder sb6222222222 = new StringBuilder();
                sb6222222222.append(str23222222222);
                sb6222222222.append(map.get(obj4222222222));
                String obj5222222222 = sb6222222222.toString();
                StringBuilder sb7222222222 = new StringBuilder();
                sb7222222222.append(obj5222222222);
                sb7222222222.append(map.get(str21222222222));
                String obj6222222222 = sb7222222222.toString();
                StringBuilder sb8222222222 = new StringBuilder();
                sb8222222222.append(obj6222222222);
                sb8222222222.append(map.get("installDate"));
                String obj7222222222 = sb8222222222.toString();
                StringBuilder sb9222222222 = new StringBuilder();
                sb9222222222.append(obj7222222222);
                sb9222222222.append(map.get("counter"));
                String obj8222222222 = sb9222222222.toString();
                StringBuilder sb10222222222 = new StringBuilder();
                sb10222222222.append(obj8222222222);
                sb10222222222.append(map.get("iaecounter"));
                map.put("af_v2", af.AFKeystoreWrapper(af.AFInAppEventType(sb10222222222.toString())));
                map.put("ivc", Boolean.valueOf(getLevel(application)));
                if (sharedPreferences2.contains("is_stop_tracking_used")) {
                    map.put("istu", String.valueOf(sharedPreferences2.getBoolean("is_stop_tracking_used", false)));
                }
                HashMap hashMap2222222222 = new HashMap();
                hashMap2222222222.put("mcc", Integer.valueOf(application.getResources().getConfiguration().mcc));
                hashMap2222222222.put("mnc", Integer.valueOf(application.getResources().getConfiguration().mnc));
                map.put("cell", hashMap2222222222);
                map.put("sig", aa.values(auVar.AFKeystoreWrapper.getPackageManager(), auVar.AFKeystoreWrapper.getPackageName()));
                map.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));
                map.put("disk", sb11222222222.toString());
                strArr = this.getLevel;
                if (strArr != null) {
                    map.put("sharing_filter", strArr);
                }
                return map;
            }
            if (valueOf3 == 2) {
                Map<String, Object> AFKeystoreWrapper9 = AFKeystoreWrapper(map);
                String string21 = auVar.valueOf.getString("first_launch", null);
                if (string21 != null) {
                    Map<String, Object> AFInAppEventType6 = m.AFInAppEventType(new JSONObject(string21));
                    if (!AFInAppEventType6.isEmpty()) {
                        AFKeystoreWrapper9.put("first_launch", AFInAppEventType6);
                    }
                }
            }
        }
        map.put("isFirstCall", Boolean.toString(!values(sharedPreferences2)));
        HashMap hashMap3222222222 = new HashMap();
        hashMap3222222222.put("cpu_abi", AFInAppEventType("ro.product.cpu.abi"));
        hashMap3222222222.put("cpu_abi2", AFInAppEventType("ro.product.cpu.abi2"));
        hashMap3222222222.put("arch", AFInAppEventType("os.arch"));
        hashMap3222222222.put("build_display_id", AFInAppEventType("ro.build.display.id"));
        if (z3) {
        }
        hashMap3222222222.put("dim", w.AFInAppEventParameterName(application));
        map.put("deviceData", hashMap3222222222);
        Object obj32222222222 = obj2;
        String str192222222222 = (String) map.get(obj32222222222);
        Object obj42222222222 = obj;
        String str202222222222 = (String) map.get(obj42222222222);
        String str212222222222 = str11;
        String str222222222222 = (String) map.get(str212222222222);
        StringBuilder sb52222222222 = new StringBuilder();
        sb52222222222.append(str192222222222.substring(0, 7));
        sb52222222222.append(str222222222222.substring(0, 7));
        sb52222222222.append(str202222222222.substring(str202222222222.length() - 7));
        map.put("af_v", af.AFKeystoreWrapper(sb52222222222.toString()));
        String str232222222222 = (String) map.get(obj32222222222);
        StringBuilder sb62222222222 = new StringBuilder();
        sb62222222222.append(str232222222222);
        sb62222222222.append(map.get(obj42222222222));
        String obj52222222222 = sb62222222222.toString();
        StringBuilder sb72222222222 = new StringBuilder();
        sb72222222222.append(obj52222222222);
        sb72222222222.append(map.get(str212222222222));
        String obj62222222222 = sb72222222222.toString();
        StringBuilder sb82222222222 = new StringBuilder();
        sb82222222222.append(obj62222222222);
        sb82222222222.append(map.get("installDate"));
        String obj72222222222 = sb82222222222.toString();
        StringBuilder sb92222222222 = new StringBuilder();
        sb92222222222.append(obj72222222222);
        sb92222222222.append(map.get("counter"));
        String obj82222222222 = sb92222222222.toString();
        StringBuilder sb102222222222 = new StringBuilder();
        sb102222222222.append(obj82222222222);
        sb102222222222.append(map.get("iaecounter"));
        map.put("af_v2", af.AFKeystoreWrapper(af.AFInAppEventType(sb102222222222.toString())));
        map.put("ivc", Boolean.valueOf(getLevel(application)));
        if (sharedPreferences2.contains("is_stop_tracking_used")) {
        }
        HashMap hashMap22222222222 = new HashMap();
        hashMap22222222222.put("mcc", Integer.valueOf(application.getResources().getConfiguration().mcc));
        hashMap22222222222.put("mnc", Integer.valueOf(application.getResources().getConfiguration().mnc));
        map.put("cell", hashMap22222222222);
        map.put("sig", aa.values(auVar.AFKeystoreWrapper.getPackageManager(), auVar.AFKeystoreWrapper.getPackageName()));
        map.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));
        map.put("disk", sb112222222222.toString());
        strArr = this.getLevel;
        if (strArr != null) {
        }
        return map;
    }

    public static void valueOf(Context context, Map<String, ? super String> map) {
        y yVar = y.a.valueOf;
        y.d AFKeystoreWrapper2 = y.AFKeystoreWrapper(context);
        map.put("network", AFKeystoreWrapper2.AFKeystoreWrapper);
        if (AFKeystoreWrapper2.AFInAppEventType != null) {
            map.put("operator", AFKeystoreWrapper2.AFInAppEventType);
        }
        if (AFKeystoreWrapper2.valueOf != null) {
            map.put("carrier", AFKeystoreWrapper2.valueOf);
        }
    }

    public static SharedPreferences values(Context context) {
        ae aeVar = onConversionDataSuccess;
        if (aeVar.sendPushNotificationData == null) {
            aeVar.sendPushNotificationData = context.getApplicationContext().getSharedPreferences("appsflyer-data", 0);
        }
        return onConversionDataSuccess.sendPushNotificationData;
    }

    private void AFKeystoreWrapper(g gVar) throws IOException {
        long currentTimeMillis;
        HttpURLConnection httpURLConnection;
        DataOutputStream dataOutputStream;
        URL url = new URL(gVar.onAppOpenAttributionNative);
        byte[] AFInAppEventParameterName2 = gVar.AFInAppEventParameterName();
        String str = gVar.AFVersionDeclaration;
        String str2 = gVar.getLevel;
        boolean AFKeystoreWrapper2 = gVar.AFKeystoreWrapper();
        Application application = gVar.valueOf;
        AppsFlyerRequestListener appsFlyerRequestListener = gVar.AFKeystoreWrapper;
        boolean z = AFKeystoreWrapper2 && gVar.onInstallConversionFailureNative == 1;
        if (z) {
            try {
                this.setUserEmails.put("from_fg", System.currentTimeMillis() - this.AppsFlyerConversionListener);
            } catch (JSONException unused) {
            }
            currentTimeMillis = System.currentTimeMillis();
        } else {
            currentTimeMillis = 0;
        }
        try {
            HttpURLConnection httpURLConnection2 = (HttpURLConnection) url.openConnection();
            try {
                httpURLConnection2.setRequestMethod("POST");
                httpURLConnection2.setRequestProperty("Content-Length", String.valueOf(AFInAppEventParameterName2.length));
                httpURLConnection2.setRequestProperty("Content-Type", gVar.values() ? "application/octet-stream" : "application/json");
                httpURLConnection2.setConnectTimeout(YandexMetricaDefaultValues.DEFAULT_MAX_REPORTS_COUNT_UPPER_BOUND);
                httpURLConnection2.setDoOutput(true);
                if (!AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.HTTP_CACHE, true)) {
                    httpURLConnection2.setUseCaches(false);
                }
                try {
                    dataOutputStream = new DataOutputStream(httpURLConnection2.getOutputStream());
                    try {
                        dataOutputStream.write(AFInAppEventParameterName2);
                        dataOutputStream.close();
                        int responseCode = httpURLConnection2.getResponseCode();
                        if (z) {
                            try {
                                this.setUserEmails.put("net", System.currentTimeMillis() - currentTimeMillis);
                            } catch (JSONException unused2) {
                            }
                        }
                        if (this.init == null) {
                            this.init = new au(application);
                        }
                        this.init.valueOf.edit().putString("first_launch", this.setUserEmails.toString()).apply();
                        String AFKeystoreWrapper3 = AFKeystoreWrapper(httpURLConnection2);
                        aj.valueOf().AFInAppEventType("server_response", url.toString(), String.valueOf(responseCode), AFKeystoreWrapper3);
                        AFLogger.AFKeystoreWrapper("response code: ".concat(String.valueOf(responseCode)));
                        SharedPreferences values2 = values(application);
                        if (responseCode == 200) {
                            if (application != null && AFKeystoreWrapper2) {
                                this.AppsFlyerInAppPurchaseValidatorListener = System.currentTimeMillis();
                            }
                            if (appsFlyerRequestListener != null) {
                                appsFlyerRequestListener.onSuccess();
                            }
                            if (str2 != null) {
                                ai.AFKeystoreWrapper();
                                ai.valueOf(str2, application);
                            } else {
                                SharedPreferences.Editor edit = values(application).edit();
                                edit.putString("sentSuccessfully", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
                                edit.apply();
                                if (!this.onValidateInApp && System.currentTimeMillis() - this.AFVersionDeclaration >= 15000 && this.onValidateInAppFailure == null) {
                                    if (k.valueOf == null) {
                                        k.valueOf = new k();
                                    }
                                    this.onValidateInAppFailure = k.valueOf.AFInAppEventParameterName();
                                    AFInAppEventType(this.onValidateInAppFailure, new e(application), 1L, TimeUnit.SECONDS);
                                }
                            }
                            bb bbVar = new bb(application);
                            l valueOf2 = bbVar.valueOf();
                            if (valueOf2 != null && valueOf2.AFInAppEventParameterName()) {
                                String str3 = valueOf2.values;
                                AFLogger.values("Resending Uninstall token to AF servers: ".concat(String.valueOf(str3)));
                                bbVar.AFInAppEventType(str3);
                            }
                            this.setAndroidIdData = ar.AFKeystoreWrapper(AFKeystoreWrapper3).optBoolean("send_background", false);
                        } else if (appsFlyerRequestListener != null) {
                            int i = RequestError.RESPONSE_CODE_FAILURE;
                            StringBuilder sb = new StringBuilder();
                            sb.append(ax.AFInAppEventType);
                            sb.append(" ");
                            sb.append(responseCode);
                            appsFlyerRequestListener.onError(i, sb.toString());
                        }
                        ba.values(this, gVar, str, application, values2, Integer.valueOf(responseCode), null);
                        if (httpURLConnection2 != null) {
                            httpURLConnection2.disconnect();
                        }
                    } catch (Throwable th) {
                        th = th;
                        if (dataOutputStream != null) {
                            dataOutputStream.close();
                        }
                        throw th;
                    }
                } catch (Throwable th2) {
                    th = th2;
                    dataOutputStream = null;
                }
            } catch (Throwable th3) {
                th = th3;
                httpURLConnection = httpURLConnection2;
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
                throw th;
            }
        } catch (Throwable th4) {
            th = th4;
            httpURLConnection = null;
        }
    }

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

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

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

    static void AFKeystoreWrapper(ae aeVar, g gVar) {
        String format;
        ScheduledExecutorService AFInAppEventParameterName2;
        Application application = gVar.valueOf;
        String str = gVar.AFLogger$LogLevel;
        if (application == null) {
            AFLogger.values("sendWithEvent - got null context. skipping event/launch.");
            return;
        }
        SharedPreferences values2 = values(application);
        AppsFlyerProperties.getInstance().saveProperties(values2);
        if (!aeVar.isStopped()) {
            StringBuilder sb = new StringBuilder("sendWithEvent from activity: ");
            sb.append(application.getClass().getName());
            AFLogger.AFKeystoreWrapper(sb.toString());
        }
        boolean z = true;
        boolean z2 = false;
        boolean z3 = str == null;
        boolean z4 = gVar instanceof bd;
        boolean z5 = gVar instanceof bh;
        gVar.onAttributionFailureNative = z3;
        Map<String, ?> values3 = aeVar.values(gVar);
        String str2 = (String) values3.get("appsflyerKey");
        if (str2 == null || str2.length() == 0) {
            AFLogger.values("Not sending data yet, waiting for dev key");
            AppsFlyerRequestListener appsFlyerRequestListener = gVar.AFKeystoreWrapper;
            if (appsFlyerRequestListener != null) {
                appsFlyerRequestListener.onError(RequestError.NO_DEV_KEY, ax.AFKeystoreWrapper);
                return;
            }
            return;
        }
        if (!aeVar.isStopped()) {
            AFLogger.AFKeystoreWrapper("AppsFlyerLib.sendWithEvent");
        }
        int valueOf2 = valueOf(values2, "appsFlyerCount", false);
        if (z5 || z4) {
            format = String.format(onAttributionFailure, AppsFlyerLib.getInstance().getHostPrefix(), onConversionDataSuccess.getHostName());
        } else if (!z3) {
            format = String.format(onConversionDataFail, AppsFlyerLib.getInstance().getHostPrefix(), onConversionDataSuccess.getHostName());
        } else if (valueOf2 < 2) {
            format = String.format(onAttributionFailureNative, AppsFlyerLib.getInstance().getHostPrefix(), onConversionDataSuccess.getHostName());
        } else {
            format = String.format(onAppOpenAttribution, AppsFlyerLib.getInstance().getHostPrefix(), onConversionDataSuccess.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.3.2");
        String obj2 = sb3.toString();
        String valueOf3 = aeVar.valueOf(application);
        if (valueOf3 != null) {
            StringBuilder sb4 = new StringBuilder();
            sb4.append(obj2);
            sb4.append("&channel=");
            sb4.append(valueOf3);
            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)) && values3.get("advertiserId") != null) {
            try {
                if (TextUtils.isEmpty(aeVar.AFLogger$LogLevel) && values3.remove("android_id") != null) {
                    AFLogger.AFKeystoreWrapper("validateGaidAndIMEI :: removing: android_id");
                }
                if (TextUtils.isEmpty(aeVar.AppsFlyer2dXConversionCallback) && values3.remove("imei") != null) {
                    AFLogger.AFKeystoreWrapper("validateGaidAndIMEI :: removing: imei");
                }
            } catch (Exception e2) {
                AFLogger.AFInAppEventType("failed to remove IMEI or AndroidID key from params; ", e2);
            }
        }
        g valueOf4 = gVar.AFInAppEventParameterName(obj2).valueOf(values3);
        valueOf4.onInstallConversionFailureNative = valueOf2;
        d dVar = new d(aeVar, valueOf4, z2 ? (byte) 1 : (byte) 0);
        if (z3) {
            bt[] btVarArr = aeVar.onAppOpenAttributionNative;
            if (btVarArr != null) {
                boolean z6 = false;
                for (bt btVar : btVarArr) {
                    if (btVar.AFInAppEventParameterName == bt.e.STARTED) {
                        StringBuilder sb5 = new StringBuilder("Failed to get ");
                        sb5.append(btVar.valueOf);
                        sb5.append(" referrer, wait ...");
                        AFLogger.values(sb5.toString());
                        z6 = true;
                    }
                }
                z2 = z6;
            }
            if (aeVar.setPhoneNumber && !aeVar.AFInAppEventType()) {
                AFLogger.values("fetching Facebook deferred AppLink data, wait ...");
                z2 = true;
            }
            if (!aeVar.getOutOfStore || aeVar.AFLogger$LogLevel()) {
                z = z2;
            }
        } else {
            z = false;
        }
        if (j.valueOf) {
            AFLogger.AFInAppEventParameterName("ESP deeplink: execute launch on SerialExecutor");
            if (k.valueOf == null) {
                k.valueOf = new k();
            }
            k kVar = k.valueOf;
            if (kVar.AFInAppEventParameterName == null) {
                kVar.AFInAppEventParameterName = Executors.newSingleThreadScheduledExecutor(kVar.AFInAppEventType);
            }
            AFInAppEventParameterName2 = kVar.AFInAppEventParameterName;
        } else {
            if (k.valueOf == null) {
                k.valueOf = new k();
            }
            AFInAppEventParameterName2 = k.valueOf.AFInAppEventParameterName();
        }
        AFInAppEventType(AFInAppEventParameterName2, dVar, z ? 500L : 0L, TimeUnit.MILLISECONDS);
    }

    static void valueOf(ae aeVar, g gVar) throws IOException {
        String jSONObject;
        StringBuilder sb = new StringBuilder("url: ");
        sb.append(gVar.onAppOpenAttributionNative);
        AFLogger.AFKeystoreWrapper(sb.toString());
        if (gVar.getLevel != null) {
            jSONObject = Base64.encodeToString(gVar.AFInAppEventParameterName(), 2);
            AFLogger.AFKeystoreWrapper("cached data: ".concat(String.valueOf(jSONObject)));
        } else {
            jSONObject = new JSONObject(gVar.AFInAppEventType()).toString();
            String replaceAll = jSONObject.replaceAll("\\p{C}", "*Non-printing character*");
            if (!replaceAll.equals(jSONObject)) {
                AFLogger.init("Payload contains non-printing characters");
                jSONObject = replaceAll;
            }
            am.AFKeystoreWrapper("data: ".concat(String.valueOf(jSONObject)));
        }
        aj.valueOf().AFInAppEventType("server_request", gVar.onAppOpenAttributionNative, jSONObject);
        try {
            aeVar.AFKeystoreWrapper(gVar);
        } catch (IOException e2) {
            AFLogger.AFInAppEventType("Exception in sendRequestToServer. ", e2);
            if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.USE_HTTP_FALLBACK, false)) {
                aeVar.AFKeystoreWrapper(gVar.AFInAppEventParameterName(gVar.onAppOpenAttributionNative.replace("https:", "http:")));
                return;
            }
            StringBuilder sb2 = new StringBuilder("failed to send request to server. ");
            sb2.append(e2.getLocalizedMessage());
            AFLogger.AFKeystoreWrapper(sb2.toString());
            throw e2;
        }
    }
}