导航菜单

页面标题

页面副标题

Mint v5.7.3 - ae.java 源代码

正在查看: Mint v5.7.3 应用的 ae.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.appsflyer.internal;

import android.app.Activity;
import android.app.Application;
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.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.browser.trusted.sharing.ShareTarget;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.core.os.EnvironmentCompat;
import androidx.leanback.media.MediaPlayerGlue;
import com.android.volley.toolbox.HttpHeaderParser;
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.d;
import com.appsflyer.internal.l;
import com.appsflyer.internal.v;
import com.appsflyer.internal.y;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.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.URI;
import java.net.URL;
import java.net.URLConnection;
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;

    @VisibleForTesting
    private static String onAttributionFailure = null;
    private static String onAttributionFailureNative = null;
    private static String onConversionDataFail = null;

    @VisibleForTesting
    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;

    @VisibleForTesting
    long AFVersionDeclaration;
    String AppsFlyer2dXConversionCallback;
    private long AppsFlyerConversionListener;
    private Map<Long, String> getInstance;
    public String[] getLevel;
    public au init;

    @Nullable
    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 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) {
            }
        }
    }

    class c implements Runnable {
        private final g AFInAppEventParameterName;

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

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

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

    class d implements Runnable {
        private final g AFInAppEventType;

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

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

        @Override
        public final void run() {
            throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.ae.d.run():void");
        }
    }

    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 e2) {
                            AFLogger.AFInAppEventType("Failed to resend cached request", e2);
                        }
                    }
                } catch (Throwable th) {
                    ae.this.onValidateInApp = false;
                    throw th;
                }
            } catch (Exception e3) {
                AFLogger.AFInAppEventType("failed to check cache. ", e3);
            }
            ae.this.onValidateInApp = false;
            ae.this.onValidateInAppFailure.shutdown();
            ae.AppsFlyer2dXConversionCallback(ae.this);
        }
    }

    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();
    }

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

    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;
        }
    }

    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(str));
                    extras.remove("af");
                    activity.setIntent(intent.putExtras(extras));
                }
            } catch (Throwable th) {
                AFLogger.AFInAppEventType(th.getMessage(), th);
            }
        }
        return str;
    }

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

    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;
    }

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

    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));
    }

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

    public static void AFInAppEventType(ScheduledExecutorService scheduledExecutorService, Runnable runnable, long j2, TimeUnit timeUnit) {
        if (scheduledExecutorService != null) {
            try {
                if (!scheduledExecutorService.isShutdown() && !scheduledExecutorService.isTerminated()) {
                    scheduledExecutorService.schedule(runnable, j2, timeUnit);
                    return;
                }
            } catch (RejectedExecutionException e2) {
                AFLogger.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");
    }

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

    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(@NonNull String str, @NonNull 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 = EnvironmentCompat.MEDIA_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() {
                        AnonymousClass2() {
                        }

                        @Override
                        public final Object invoke(Object obj, Method method, Object[] objArr) {
                            if (method.getName().equals("onLvlResult")) {
                                Object obj2 = objArr[0];
                                String str = obj2 != null ? (String) obj2 : null;
                                Object obj3 = objArr[1];
                                String str2 = obj3 != null ? (String) obj3 : 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) {
                                    Object obj4 = objArr[0];
                                    if (obj4 != null) {
                                        dVar3.AFKeystoreWrapper("onLvlFailure with exception", (Exception) obj4);
                                    } else {
                                        dVar3.AFKeystoreWrapper("onLvlFailure", new Exception(EnvironmentCompat.MEDIA_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;
        }
    }

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

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

    @Nullable
    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;
        }
    }

    @NonNull
    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 z2 = false;
                    while (true) {
                        try {
                            String readLine = bufferedReader2.readLine();
                            if (readLine == null) {
                                break;
                            }
                            sb.append(z2 ? '\n' : "");
                            sb.append(readLine);
                            z2 = 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();
            }
        }
    }

    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;
    }

    private static void AFKeystoreWrapper(Context context) {
        int i2;
        if (aa.values()) {
            AFLogger.AFInAppEventParameterName("OPPO device found");
            i2 = 23;
        } else {
            i2 = 18;
        }
        int i3 = Build.VERSION.SDK_INT;
        if (i3 < i2 || AFInAppEventType(AppsFlyerProperties.DISABLE_KEYSTORE, true)) {
            StringBuilder sb = new StringBuilder("OS SDK is=");
            sb.append(i3);
            sb.append("; no KeyStore usage");
            AFLogger.AFInAppEventParameterName(sb.toString());
            return;
        }
        StringBuilder sb2 = new StringBuilder("OS SDK is=");
        sb2.append(i3);
        sb2.append("; use KeyStore");
        AFLogger.AFInAppEventParameterName(sb2.toString());
        AFKeystoreWrapper aFKeystoreWrapper = new AFKeystoreWrapper(context);
        if (aFKeystoreWrapper.AFInAppEventParameterName()) {
            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 sb3 = new StringBuilder("Exception ");
                    sb3.append(e2.getMessage());
                    sb3.append(" occurred");
                    AFLogger.AFInAppEventType(sb3.toString(), e2);
                }
            }
            aFKeystoreWrapper.AFInAppEventType(aFKeystoreWrapper.AFInAppEventType());
        } else {
            aFKeystoreWrapper.AFInAppEventType = an.AFKeystoreWrapper(new WeakReference(context));
            aFKeystoreWrapper.valueOf = 0;
            aFKeystoreWrapper.AFInAppEventType(aFKeystoreWrapper.AFInAppEventType());
        }
        AppsFlyerProperties.getInstance().set("KSAppsFlyerId", aFKeystoreWrapper.values());
        AppsFlyerProperties.getInstance().set("KSAppsFlyerRICounter", String.valueOf(aFKeystoreWrapper.valueOf()));
    }

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

    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);
    }

    static void AFKeystoreWrapper(com.appsflyer.internal.ae r9, com.appsflyer.internal.g r10) {
        throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.ae.AFKeystoreWrapper(com.appsflyer.internal.ae, com.appsflyer.internal.g):void");
    }

    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 z2 = AFKeystoreWrapper2 && gVar.onInstallConversionFailureNative == 1;
        if (z2) {
            try {
                this.setUserEmails.put("from_fg", System.currentTimeMillis() - this.AppsFlyerConversionListener);
            } catch (JSONException unused) {
            }
            currentTimeMillis = System.currentTimeMillis();
        } else {
            currentTimeMillis = 0;
        }
        try {
            HttpURLConnection httpURLConnection2 = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection()));
            try {
                httpURLConnection2.setRequestMethod(ShareTarget.METHOD_POST);
                httpURLConnection2.setRequestProperty("Content-Length", String.valueOf(AFInAppEventParameterName2.length));
                httpURLConnection2.setRequestProperty(HttpHeaderParser.HEADER_CONTENT_TYPE, gVar.values() ? "application/octet-stream" : "application/json");
                httpURLConnection2.setConnectTimeout(MediaPlayerGlue.FAST_FORWARD_REWIND_STEP);
                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 (z2) {
                            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", "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 i2 = RequestError.RESPONSE_CODE_FAILURE;
                            StringBuilder sb = new StringBuilder();
                            sb.append(ax.AFInAppEventType);
                            sb.append(" ");
                            sb.append(responseCode);
                            appsFlyerRequestListener.onError(i2, sb.toString());
                        }
                        ba.values(this, gVar, str, application, values2, Integer.valueOf(responseCode), 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;
        }
    }

    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 i2 = 0; i2 < jSONArray.length(); i2++) {
                    arrayList.add(Long.valueOf(jSONArray.getLong(i2)));
                }
            } catch (JSONException unused) {
            }
        }
        Collections.sort(arrayList);
        Iterator<String> keys2 = jSONObject.keys();
        loop2: while (true) {
            str = null;
            while (keys2.hasNext() && str == null) {
                String next = keys2.next();
                try {
                    JSONArray jSONArray2 = new JSONArray((String) jSONObject.get(next));
                    int i3 = 0;
                    while (i3 < jSONArray2.length()) {
                        if (jSONArray2.getLong(i3) != ((Long) arrayList.get(0)).longValue() && jSONArray2.getLong(i3) != ((Long) arrayList.get(1)).longValue() && jSONArray2.getLong(i3) != ((Long) arrayList.get(arrayList.size() - 1)).longValue()) {
                            i3++;
                            str = next;
                        }
                    }
                } catch (JSONException unused2) {
                }
            }
        }
        if (str != null) {
            jSONObject.remove(str);
        }
    }

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

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

    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 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;
        }
    }

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

    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);
    }

    private static boolean getLevel(Context context) {
        if (context != null) {
            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);
            }
        }
        return false;
    }

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

    private static String valueOf(@Nullable 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());
    }

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

    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);
        String str = AFKeystoreWrapper2.AFInAppEventType;
        if (str != null) {
            map.put("operator", str);
        }
        String str2 = AFKeystoreWrapper2.valueOf;
        if (str2 != null) {
            map.put("carrier", str2);
        }
    }

    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(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;
        }
    }

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

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

    public static ae values() {
        return onConversionDataSuccess;
    }

    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" : "p");
        }
    }

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

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

    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 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")) {
                    AppsFlyerProperties.getInstance().set("preInstallName", stringExtra);
                } else {
                    AFLogger.init("Cannot set preinstall attribution data without a media source");
                }
            } 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.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);
            }
        }
    }

    protected 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();
            String str = AFInAppEventType2.AFVersionDeclaration;
            if (str != null && AFInAppEventType2.AFLogger$LogLevel != null && valueOf2.contains(str)) {
                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(String str2) {
                ap.valueOf(str2, DeepLinkResult.Error.NETWORK);
            }

            @Override
            public final void AFInAppEventParameterName(Map<String, String> map2) {
                for (String str2 : map2.keySet()) {
                    hashMap.put(str2, map2.get(str2));
                }
                ap.AFInAppEventParameterName((Map<String, String>) hashMap);
            }
        };
        if (k.valueOf == null) {
            k.valueOf = new k();
        }
        k.valueOf.valueOf().execute(aoVar);
    }

    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;
    }

    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 j2 = 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, "true");
        }
        d.e.C0036d 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(j2 / 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) {
            AFLogger.values("Stats call is disabled, ignore ...");
            return;
        }
        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();
        } catch (Throwable th) {
            AFLogger.AFInAppEventType("Could not send callStats request", th);
        }
    }

    @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 anonymizeUser(boolean z2) {
        aj.valueOf().AFInAppEventType("public_api_call", "anonymizeUser", String.valueOf(z2));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, z2);
    }

    @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 enableFacebookDeferredApplinks(boolean z2) {
        this.setPhoneNumber = z2;
    }

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

    @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 String getAttributionId(Context context) {
        try {
            return new ah(context).AFInAppEventParameterName();
        } catch (Throwable th) {
            AFLogger.AFInAppEventType("Could not collect facebook attribution id. ", th);
            return null;
        }
    }

    @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 : "";
    }

    @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 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 AppsFlyerLib init(@NonNull String str, AppsFlyerConversionListener appsFlyerConversionListener, @NonNull Context context) {
        if (this.setDebugLog) {
            return this;
        }
        this.setDebugLog = true;
        if (context != null) {
            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();
                                }
                                ae aeVar = ae.this;
                                if (aeVar.AFInAppEventParameterName(bhVar, ae.values(aeVar.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 z2 = values2.getBoolean(AppsFlyerProperties.NEW_REFERRER_SENT, false);
                    boolean z3 = boVar.AFInAppEventParameterName == bt.e.NOT_STARTED;
                    if (valueOf2 == 1) {
                        if (z3 || z2) {
                            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;
        } else {
            AFLogger.init("context is null, Google Install Referrer will be not initialized");
        }
        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;
    }

    @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;
    }

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

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

    @Override
    public final void logEvent(@NonNull 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;
        Map map2 = bjVar.values;
        if (map2 == null) {
            map2 = new HashMap();
        }
        strArr[1] = new JSONObject(map2).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 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);
    }

    @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 onPause(Context context) {
        ag.b bVar = ag.AFInAppEventParameterName;
        if (bVar != null) {
            bVar.values(context);
        }
    }

    @Override
    @Deprecated
    public final void performOnAppAttribution(@NonNull Context context, @NonNull 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) {
            j.AFInAppEventType().AFInAppEventType(context, new HashMap(), Uri.parse(uri.toString()));
            return;
        }
        StringBuilder sb2 = new StringBuilder("Context is \"");
        sb2.append(context);
        sb2.append("\"");
        ap.valueOf(sb2.toString(), DeepLinkResult.Error.NETWORK);
    }

    @Override
    public final void performOnDeepLinking(@NonNull final Intent intent, @NonNull 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 z2 = (AFInAppEventType2 == null || AFInAppEventType2.toString().isEmpty()) ? false : true;
                    if (!ae.values(context2).getBoolean("ddl_sent", false) || z2) {
                        j.AFInAppEventType().AFKeystoreWrapper(new HashMap(), auVar, intent2, context2);
                    } else {
                        ap.valueOf("No direct deep link", null);
                    }
                }
            });
        }
    }

    @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 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;
        }
    }

    @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 b2 = 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 j2 = packageInfo.firstInstallTime;
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
            hashMap.put("install_date", simpleDateFormat.format(new Date(j2)));
            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, b2);
        if (k.valueOf == null) {
            k.valueOf = new k();
        }
        AFInAppEventType(k.valueOf.AFInAppEventParameterName(), dVar, 1L, TimeUnit.MILLISECONDS);
    }

    @Override
    public final void sendPushNotificationData(@androidx.annotation.NonNull android.app.Activity r17) {
        throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.ae.sendPushNotificationData(android.app.Activity):void");
    }

    @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 setAndroidIdData(String str) {
        aj.valueOf().AFInAppEventType("public_api_call", "setAndroidIdData", str);
        this.AFLogger$LogLevel = 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 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 setCollectAndroidID(boolean z2) {
        aj.valueOf().AFInAppEventType("public_api_call", "setCollectAndroidID", String.valueOf(z2));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.COLLECT_ANDROID_ID, Boolean.toString(z2));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.COLLECT_ANDROID_ID_FORCE_BY_USER, Boolean.toString(z2));
    }

    @Override
    public final void setCollectIMEI(boolean z2) {
        aj.valueOf().AFInAppEventType("public_api_call", "setCollectIMEI", String.valueOf(z2));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.COLLECT_IMEI, Boolean.toString(z2));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.COLLECT_IMEI_FORCE_BY_USER, Boolean.toString(z2));
    }

    @Override
    @Deprecated
    public final void setCollectOaid(boolean z2) {
        aj.valueOf().AFInAppEventType("public_api_call", "setCollectOaid", String.valueOf(z2));
        AppsFlyerProperties.getInstance().set(AppsFlyerProperties.COLLECT_OAID, Boolean.toString(z2));
    }

    @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 setCustomerIdAndLogSession(String str, @NonNull Context context) {
        if (context != null) {
            if (!valueOf()) {
                setCustomerUserId(str);
                AFLogger.AFInAppEventType("waitForCustomerUserId is false; setting CustomerUserID: ".concat(String.valueOf(str)), true);
                return;
            }
            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();
            blVar.valueOf = (Application) context.getApplicationContext();
            blVar.AFLogger$LogLevel = null;
            blVar.AFVersionDeclaration = string;
            blVar.values = null;
            blVar.init = referrer;
            blVar.AFInAppEventParameterName = null;
            AFInAppEventType(blVar);
        }
    }

    @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 setDebugLog(boolean z2) {
        setLogLevel(z2 ? AFLogger.LogLevel.DEBUG : AFLogger.LogLevel.NONE);
    }

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

    @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 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 void setImeiData(String str) {
        aj.valueOf().AFInAppEventType("public_api_call", "setImeiData", str);
        this.AppsFlyer2dXConversionCallback = str;
    }

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

    @Override
    public final void setLogLevel(@NonNull 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 i2) {
        this.AppsFlyerLib = TimeUnit.SECONDS.toMillis(i2);
    }

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

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

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

    @Override
    public final void setPartnerData(@NonNull 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(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) {
            avVar.valueOf.put(str, map);
            avVar.AFKeystoreWrapper.remove(str);
        } else {
            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);
        }
    }

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

    @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")) {
            AFLogger.init("Cannot set preinstall attribution data without a media source");
        } else {
            AppsFlyerProperties.getInstance().set("preInstallName", jSONObject.toString());
        }
    }

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

    @Override
    public final void setSharingFilter(@NonNull 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 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 setUserEmails(String... strArr) {
        aj.valueOf().AFInAppEventType("public_api_call", "setUserEmails", strArr);
        setUserEmails(AppsFlyerProperties.EmailsCryptType.NONE, strArr);
    }

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

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

    @Override
    public final void start(@NonNull 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)) {
            AppsFlyerProperties.getInstance().set(AppsFlyerProperties.AF_KEY, str);
            am.valueOf(str);
        } else 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;
        }
        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) {
                        AFLogger.AFKeystoreWrapper("Facebook Deferred AppLink data received: ".concat(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("promo_code", str5);
                            hashMap.put("deeplink_context", hashMap2);
                            ae.this.waitForCustomerUserId.put("extras", hashMap);
                        }
                    } else {
                        ae.this.waitForCustomerUserId.put("link", "");
                    }
                    ae.this.waitForCustomerUserId.put("ttr", String.valueOf(System.currentTimeMillis() - currentTimeMillis));
                }

                @Override
                public final void values(String str3) {
                    ae.this.waitForCustomerUserId.put("error", str3);
                }
            };
            try {
                com.facebook.e eVar = com.facebook.e.f1485a;
                com.facebook.e.class.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;

                    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")) {
                            a aVar2 = r2;
                            if (aVar2 != null) {
                                aVar2.values("onDeferredAppLinkDataFetched invocation failed");
                            }
                            return null;
                        }
                        Object obj2 = objArr[0];
                        if (obj2 != null) {
                            Bundle bundle2 = (Bundle) Bundle.class.cast(r1.getMethod("getArgumentBundle", new Class[0]).invoke(r1.cast(obj2), new Object[0]));
                            if (bundle2 != null) {
                                str4 = bundle2.getString("com.facebook.platform.APPLINK_NATIVE_URL");
                                str5 = bundle2.getString("target_url");
                                Bundle bundle3 = bundle2.getBundle("extras");
                                str3 = (bundle3 == null || (bundle = bundle3.getBundle("deeplink_context")) == null) ? null : bundle.getString("promo_code");
                            } else {
                                str3 = null;
                                str4 = null;
                                str5 = null;
                            }
                            a aVar3 = r2;
                            if (aVar3 != null) {
                                aVar3.AFInAppEventType(str4, str5, str3);
                            }
                        } else {
                            a aVar4 = r2;
                            if (aVar4 != null) {
                                aVar4.AFInAppEventType(null, null, null);
                            }
                        }
                        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;
                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 j2 = ae.this.stop - ae.this.AppsFlyerConversionListener;
                if (j2 > 0 && j2 < 1000) {
                    j2 = 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(j2)).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);
                    Executor executor = kVar.AFKeystoreWrapper;
                    if (executor instanceof ThreadPoolExecutor) {
                        k.AFKeystoreWrapper((ThreadPoolExecutor) executor);
                    }
                } catch (Throwable th) {
                    AFLogger.AFInAppEventType("failed to stop Executors", th);
                }
                z AFKeystoreWrapper2 = z.AFKeystoreWrapper(context2);
                AFKeystoreWrapper2.valueOf.post(AFKeystoreWrapper2.AFVersionDeclaration);
            }
        }, this.setAppInviteOneLink);
    }

    @Override
    public final void stop(boolean z2, Context context) {
        this.setOaidData = z2;
        ai.AFKeystoreWrapper();
        try {
            File AFKeystoreWrapper2 = ai.AFKeystoreWrapper(context);
            if (AFKeystoreWrapper2.exists()) {
                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);
                }
            } else {
                AFKeystoreWrapper2.mkdir();
            }
        } 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 void subscribeForDeepLink(@NonNull DeepLinkListener deepLinkListener) {
        subscribeForDeepLink(deepLinkListener, TimeUnit.SECONDS.toMillis(3L));
    }

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

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

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

    @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();
    }

    @Nullable
    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;
    }

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

    final java.util.Map<java.lang.String, java.lang.Object> values(com.appsflyer.internal.g r30) {
        throw new UnsupportedOperationException("Method not decompiled: com.appsflyer.internal.ae.values(com.appsflyer.internal.g):java.util.Map");
    }

    public final void values(Context context, String str) {
        JSONArray jSONArray;
        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();
                jSONArray = new JSONArray();
            } else {
                JSONObject jSONObject2 = new JSONObject(string);
                jSONArray = jSONObject2.has(str) ? new JSONArray((String) jSONObject2.get(str)) : new JSONArray();
                jSONObject = jSONObject2;
            }
            if (jSONArray.length() < 5) {
                jSONArray.put(currentTimeMillis);
            }
            if (jSONObject.length() >= 4) {
                AFKeystoreWrapper(jSONObject);
            }
            jSONObject.put(str, jSONArray.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);
        }
    }

    @VisibleForTesting
    final void values(@NonNull g gVar, @Nullable 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) {
            String referrer = AppsFlyerProperties.getInstance().getReferrer(application);
            gVar.init = referrer != null ? referrer : "";
            gVar.AFInAppEventParameterName = obj;
            AFInAppEventType(gVar);
            return;
        }
        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);
        }
    }

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