Kufar v3.2.0版本的 MD5 值为:6a4d203db1c561c7e3bcd50d23fed59f

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


package com.startapp.sdk.adsbase;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Application;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.browser.customtabs.CustomTabsService;
import com.mbridge.msdk.playercommon.exoplayer2.source.chunk.ChunkedTrackBlacklistUtil;
import com.startapp.a9;
import com.startapp.b0;
import com.startapp.b8;
import com.startapp.c1;
import com.startapp.c8;
import com.startapp.c9;
import com.startapp.d0;
import com.startapp.d9;
import com.startapp.e8;
import com.startapp.g2;
import com.startapp.g6;
import com.startapp.h0;
import com.startapp.i0;
import com.startapp.i4;
import com.startapp.j4;
import com.startapp.j6;
import com.startapp.k0;
import com.startapp.k6;
import com.startapp.kb;
import com.startapp.l7;
import com.startapp.m5;
import com.startapp.m7;
import com.startapp.n7;
import com.startapp.networkTest.startapp.NetworkTester;
import com.startapp.sdk.ads.banner.BannerMetaData;
import com.startapp.sdk.ads.splash.SplashMetaData;
import com.startapp.sdk.adsbase.StartAppAd;
import com.startapp.sdk.adsbase.adinformation.AdInformationMetaData;
import com.startapp.sdk.adsbase.cache.ACMConfig;
import com.startapp.sdk.adsbase.cache.CacheKey;
import com.startapp.sdk.adsbase.cache.CacheMetaData;
import com.startapp.sdk.adsbase.cache.d;
import com.startapp.sdk.adsbase.cache.i;
import com.startapp.sdk.adsbase.cache.j;
import com.startapp.sdk.adsbase.e;
import com.startapp.sdk.adsbase.model.AdPreferences;
import com.startapp.sdk.adsbase.remoteconfig.MetaData;
import com.startapp.sdk.adsbase.remoteconfig.MetaDataRequest;
import com.startapp.sdk.adsbase.remoteconfig.MotionMetadata;
import com.startapp.sdk.cachedservice.BackgroundService;
import com.startapp.sdk.components.ComponentLocator;
import com.startapp.sdk.components.m0;
import com.startapp.sdk.insight.NetworkTestsMetaData;
import com.startapp.sdk.jobs.JobRequest;
import com.startapp.sdk.jobs.e;
import com.startapp.t;
import com.startapp.u9;
import com.startapp.vb;
import com.startapp.w7;
import com.startapp.x2;
import com.startapp.y8;
import com.startapp.ye;
import com.startapp.z2;
import java.lang.Thread;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

public class StartAppSDKInternal implements i0 {
    public static final Object D = new Object();

    @NonNull
    public static volatile InitState E = InitState.UNSET;

    @Nullable
    public h0 A;

    @Nullable
    public kb B;
    public boolean C;

    @Nullable
    public SDKAdPreferences f54558a;

    public boolean f54559b;

    public final boolean f54560c;

    public boolean f54561d;

    public boolean f54562e;

    public boolean f54563f;

    public long f54564g;

    @Nullable
    public Application f54565h;

    public HashMap<Integer, Integer> f54566i;

    public Object f54567j;

    public final AtomicBoolean f54568k;

    public Activity f54569l;

    public boolean f54570m;

    public boolean f54571n;

    public boolean f54572o;

    public boolean f54573p;

    public Map<String, String> f54574q;

    public Bundle f54575r;

    @Nullable
    public AdPreferences f54576s;

    @Nullable
    public CacheKey f54577t;

    public boolean f54578u;

    public boolean f54579v;

    public boolean f54580w;

    public boolean f54581x;

    public boolean f54582y;

    public com.startapp.sdk.adsbase.d f54583z;

    public enum InitState {
        UNSET,
        IMPLICIT,
        EXPLICIT
    }

    public class a implements Runnable {

        public final Context f54588a;

        public final String f54589b;

        public final String f54590c;

        public final SDKAdPreferences f54591d;

        public final boolean f54592e;

        public a(Context context, String str, String str2, SDKAdPreferences sDKAdPreferences, boolean z11) {
            this.f54588a = context;
            this.f54589b = str;
            this.f54590c = str2;
            this.f54591d = sDKAdPreferences;
            this.f54592e = z11;
        }

        @Override
        public void run() {
            synchronized (StartAppSDKInternal.D) {
                StartAppSDKInternal.a(StartAppSDKInternal.this, this.f54588a, this.f54589b, this.f54590c, this.f54591d, this.f54592e);
            }
        }
    }

    public class c implements d.InterfaceC0764d {
        public c() {
        }

        @Override
        public void a(@Nullable Ad ad2, @Nullable CacheKey cacheKey, boolean z11) {
            StartAppSDKInternal.this.f54577t = cacheKey;
        }
    }

    public static class d {

        @SuppressLint({"StaticFieldLeak"})
        public static final StartAppSDKInternal f54598a = new StartAppSDKInternal();
    }

    public StartAppSDKInternal() {
        Map<Activity, Integer> map = vb.f55175a;
        this.f54559b = true;
        this.f54560c = b0.a();
        this.f54561d = false;
        this.f54562e = false;
        this.f54563f = false;
        this.f54566i = new HashMap<>();
        this.f54568k = new AtomicBoolean();
        this.f54570m = false;
        this.f54571n = true;
        this.f54572o = false;
        this.f54573p = false;
        this.f54575r = null;
        this.f54579v = false;
        this.f54580w = false;
        this.f54581x = false;
        this.f54582y = false;
        this.f54583z = null;
    }

    public static void a(StartAppSDKInternal startAppSDKInternal, Context context, String str, String str2, SDKAdPreferences sDKAdPreferences, boolean z11) {
        startAppSDKInternal.getClass();
        ComponentLocator.a(context).H.a();
        InitState initState = E;
        InitState initState2 = InitState.EXPLICIT;
        if (initState == initState2) {
            return;
        }
        boolean a11 = ComponentLocator.a(context).c().a();
        if (TextUtils.isEmpty(str2)) {
            if (!vb.f(context) && !b0.c(context)) {
                Log.w("StartAppSDK", new IllegalArgumentException("\n+-------------------------------------------------------------+\n|                S   T   A   R   T   A   P   P                |\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\n| Invalid App ID passed to init, please provide valid App ID  |\n|                                                             |\n|   https://support.start.io/hc/en-us/articles/360014774799   |\n+-------------------------------------------------------------+\n"));
            } else {
                throw new IllegalArgumentException("\n+-------------------------------------------------------------+\n|                S   T   A   R   T   A   P   P                |\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\n| Invalid App ID passed to init, please provide valid App ID  |\n|                                                             |\n|   https://support.start.io/hc/en-us/articles/360014774799   |\n+-------------------------------------------------------------+\n");
            }
        }
        d0 c11 = ComponentLocator.a(context).c();
        if (str != null) {
            str = str.trim();
        }
        if (str2 != null) {
            str2 = str2.trim();
        }
        synchronized (c11.f52686a) {
            c11.f52688c = str;
            c11.f52689d = str2;
            c11.f52687b.edit().putString("c88d4eab540fab77", str).putString("2696a7f502faed4b", str2).commit();
        }
        startAppSDKInternal.f54558a = sDKAdPreferences;
        z2.b(context, "shared_prefs_sdk_ad_prefs", sDKAdPreferences);
        startAppSDKInternal.a(z11);
        if (E == InitState.IMPLICIT && !a11) {
            startAppSDKInternal.b(context, MetaDataRequest.RequestReason.LAUNCH);
        } else if (E == InitState.UNSET) {
            startAppSDKInternal.a(context, MetaDataRequest.RequestReason.LAUNCH);
        }
        E = initState2;
    }

    public static boolean c() {
        boolean z11;
        synchronized (D) {
            z11 = E == InitState.EXPLICIT;
        }
        return z11;
    }

    public static void h(@Nullable Context context) {
        if (context != null) {
            a(false, (w7) null);
        }
    }

    public boolean b() {
        return this.f54573p;
    }

    public final void d(@NonNull Context context) {
        Application application;
        Context a11 = k0.a(context);
        if (a11 instanceof Application) {
            application = (Application) a11;
        } else if (context instanceof Application) {
            application = (Application) context;
        } else if (context instanceof Activity) {
            application = ((Activity) context).getApplication();
        } else {
            application = context instanceof Service ? ((Service) context).getApplication() : null;
        }
        if (application == null || this.A != null) {
            return;
        }
        h0 h0Var = new h0(this);
        this.A = h0Var;
        application.registerActivityLifecycleCallbacks(h0Var);
        try {
            Application.ActivityLifecycleCallbacks activityLifecycleCallbacks = ComponentLocator.a(context).s().f52649e;
            if (activityLifecycleCallbacks != null) {
                application.registerActivityLifecycleCallbacks(activityLifecycleCallbacks);
                return;
            }
            throw new RuntimeException();
        } catch (Throwable unused) {
        }
    }

    public final boolean e(@NonNull Context context) {
        e j11 = ComponentLocator.a(context).j();
        if (j11.contains("isma")) {
            if (j11.getBoolean("isma", false)) {
                if (j11.contains("iscd") && !j11.getBoolean("iscd", false)) {
                    return true;
                }
                return false;
            }
            if (!j11.contains("iscd") || !j11.getBoolean("iscd", false)) {
                return true;
            }
            return false;
        }
        if (!j11.contains("iscd")) {
            return true;
        }
        return !j11.getBoolean("iscd", false);
    }

    public final void f(Context context) {
        AdPreferences adPreferences;
        if (this.f54578u && !AdsCommonMetaData.f54521h.K()) {
            com.startapp.sdk.adsbase.cache.d dVar = com.startapp.sdk.adsbase.cache.d.f54679h;
            AdPreferences adPreferences2 = this.f54576s;
            if (adPreferences2 != null) {
                adPreferences = new AdPreferences(adPreferences2);
            } else {
                adPreferences = new AdPreferences();
            }
            c cVar = new c();
            AdPreferences.Placement placement = AdPreferences.Placement.INAPP_RETURN;
            if (dVar.a(placement)) {
                dVar.a(context, null, placement, adPreferences, cVar, false, 0);
            } else {
                cVar.a(null, null, false);
            }
        }
    }

    public final void g(@NonNull Context context) {
        if (b0.a() && (context instanceof Application)) {
            Application application = (Application) context;
            this.f54565h = application;
            if (this.f54568k.compareAndSet(false, true) && this.f54567j == null) {
                g gVar = new g();
                application.registerActivityLifecycleCallbacks(gVar);
                this.f54567j = gVar;
            }
        }
    }

    public final void i(Context context) {
        e d11 = ComponentLocator.a(context).d();
        int i11 = d11.getInt("shared_prefs_app_version_id", -1);
        int i12 = b0.f52480a;
        int i13 = 0;
        try {
            i13 = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode;
        } catch (Throwable unused) {
        }
        if (i11 > 0 && i13 > i11) {
            this.f54573p = true;
        }
        e.a edit = d11.edit();
        edit.a("shared_prefs_app_version_id", (String) Integer.valueOf(i13));
        edit.f54764a.putInt("shared_prefs_app_version_id", i13);
        edit.apply();
    }

    public final void j(Context context) {
        ComponentLocator a11 = ComponentLocator.a(context);
        e.a edit = a11.d().edit();
        Boolean bool = Boolean.FALSE;
        edit.a("periodicInfoEventPaused", (String) bool);
        edit.f54764a.putBoolean("periodicInfoEventPaused", false);
        edit.a("periodicMetadataPaused", (String) bool);
        edit.f54764a.putBoolean("periodicMetadataPaused", false);
        edit.apply();
        b bVar = new b(context, a11);
        if (MetaData.f54824k.f54827b) {
            bVar.a(null, false);
        } else {
            MetaData.f54824k.a(bVar);
        }
    }

    public void b(Context context, MetaDataRequest.RequestReason requestReason) {
        u9.f55114d.a(context, requestReason);
    }

    public final void b(Context context) {
        boolean z11;
        String str = "com.android.chrome";
        boolean z12 = true;
        String str2 = null;
        try {
            PackageManager packageManager = context.getPackageManager();
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("http://www.example.com"));
            ResolveInfo resolveActivity = packageManager.resolveActivity(intent, 0);
            String str3 = resolveActivity != null ? resolveActivity.activityInfo.packageName : null;
            List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(intent, 0);
            ArrayList arrayList = new ArrayList();
            for (ResolveInfo resolveInfo : queryIntentActivities) {
                Intent intent2 = new Intent();
                intent2.setAction(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION);
                intent2.setPackage(resolveInfo.activityInfo.packageName);
                if (packageManager.resolveService(intent2, 0) != null) {
                    arrayList.add(resolveInfo.activityInfo.packageName);
                }
            }
            if (!arrayList.isEmpty()) {
                if (arrayList.size() == 1) {
                    str = (String) arrayList.get(0);
                } else if (!TextUtils.isEmpty(str3)) {
                    try {
                        List<ResolveInfo> queryIntentActivities2 = context.getPackageManager().queryIntentActivities(intent, 64);
                        if (queryIntentActivities2 != null && queryIntentActivities2.size() != 0) {
                            for (ResolveInfo resolveInfo2 : queryIntentActivities2) {
                                IntentFilter intentFilter = resolveInfo2.filter;
                                if (intentFilter != null && intentFilter.countDataAuthorities() != 0 && intentFilter.countDataPaths() != 0 && resolveInfo2.activityInfo != null) {
                                    z11 = true;
                                    break;
                                }
                            }
                        }
                    } catch (Throwable th2) {
                        i4.a(th2);
                    }
                    z11 = false;
                    if (!z11 && arrayList.contains(str3)) {
                        str2 = str3;
                    }
                }
                str2 = str;
            }
        } catch (Throwable th3) {
            i4.a(th3);
        }
        if (str2 != null) {
            Intent intent3 = new Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION);
            intent3.setPackage(str2);
            List<ResolveInfo> queryIntentServices = context.getPackageManager().queryIntentServices(intent3, 0);
            if (queryIntentServices != null) {
            }
        }
        z12 = false;
        e.a edit = ComponentLocator.a(context).d().edit();
        edit.a("chromeTabs", (String) Boolean.valueOf(z12));
        edit.f54764a.putBoolean("chromeTabs", z12);
        edit.apply();
    }

    public SDKAdPreferences c(Context context) {
        if (this.f54558a == null) {
            SDKAdPreferences sDKAdPreferences = (SDKAdPreferences) z2.a(context, "shared_prefs_sdk_ad_prefs", SDKAdPreferences.class);
            if (sDKAdPreferences == null) {
                this.f54558a = new SDKAdPreferences();
            } else {
                this.f54558a = sDKAdPreferences;
            }
        }
        return this.f54558a;
    }

    public boolean d() {
        return this.f54571n;
    }

    public void a(@NonNull Context context, @Nullable String str, @NonNull String str2, @Nullable SDKAdPreferences sDKAdPreferences, boolean z11) {
        Context a11 = k0.a(context);
        Context context2 = a11 != null ? a11 : context;
        g(context2);
        try {
            ComponentLocator.a(context2).s().a(256);
        } catch (Throwable unused) {
        }
        ComponentLocator.a(context2).g().execute(new a(context2, str, str2, sDKAdPreferences, z11));
    }

    public static StartAppSDKInternal a() {
        return d.f54598a;
    }

    public static void a(Context context) {
        MetaDataRequest.RequestReason requestReason;
        ComponentLocator a11 = ComponentLocator.a(context);
        a11.H.a();
        ye x11 = a11.x();
        ((m0) x11.f55308a).getClass();
        long elapsedRealtime = SystemClock.elapsedRealtime();
        x11.f55311d = elapsedRealtime;
        x11.f55312e = elapsedRealtime;
        g6 g6Var = new g6(context);
        if (g6Var.f52863d != null || g6Var.f52864e != null) {
            e.a edit = a11.j().edit();
            Boolean bool = g6Var.f52863d;
            if (bool != null) {
                boolean booleanValue = bool.booleanValue();
                edit.a("isma", (String) Boolean.valueOf(booleanValue));
                edit.f54764a.putBoolean("isma", booleanValue);
            }
            Boolean bool2 = g6Var.f52864e;
            if (bool2 != null) {
                boolean booleanValue2 = bool2.booleanValue();
                edit.a("iscd", (String) Boolean.valueOf(booleanValue2));
                edit.f54764a.putBoolean("iscd", booleanValue2);
            }
            edit.apply();
        }
        String str = g6Var.f52860a;
        if (!TextUtils.isEmpty(str)) {
            d.f54598a.a(context, null, str, null, g6Var.f52861b);
            if (!g6Var.f52862c) {
                StartAppAd.disableSplash();
            }
            if (a11.d().getBoolean("shared_prefs_first_init", true)) {
                i4 i4Var = new i4(j4.f53021d);
                i4Var.f52978d = "ManifestInit";
                i4Var.a();
                return;
            }
            return;
        }
        if (E == InitState.UNSET) {
            E = InitState.IMPLICIT;
            d0 c11 = a11.c();
            StartAppSDKInternal startAppSDKInternal = d.f54598a;
            if (c11.a()) {
                requestReason = MetaDataRequest.RequestReason.LAUNCH;
            } else {
                requestReason = MetaDataRequest.RequestReason.IMPLICIT_LAUNCH;
            }
            startAppSDKInternal.a(context, requestReason);
        }
    }

    public final void a(@NonNull Context context, @NonNull MetaDataRequest.RequestReason requestReason) {
        if (Math.random() < 0.0d) {
            Log.i("StartAppSDK", "!SDK-VERSION-STRING!:com.startapp.startappsdk:inapp-sdk:4.10.9");
        }
        try {
            ComponentLocator a11 = ComponentLocator.a(context);
            t a12 = a11.F.a();
            try {
                Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
                if (!(defaultUncaughtExceptionHandler instanceof t)) {
                    Thread.setDefaultUncaughtExceptionHandler(a12);
                    a12.f55029a = defaultUncaughtExceptionHandler;
                }
            } catch (Throwable th2) {
                i4.a(th2);
            }
            a11.m().a();
            if (!b0.a(context, "android.permission.INTERNET") || !b0.a(context, "android.permission.ACCESS_NETWORK_STATE")) {
                vb.a(context, 6, "Please grant the mandatory permissions : INTERNET & ACCESS_NETWORK_STATE, SDK could not be initialized.", true);
            }
            this.f54571n = !vb.d(context);
            a11.a().a(e(context));
            a11.w().c();
            d(context);
            MetaData.c(context);
            AdsCommonMetaData.a(context);
            BannerMetaData.a(context);
            SplashMetaData.a(context);
            if (this.f54559b) {
                CacheMetaData.a(context);
            }
            AdInformationMetaData.a(context);
            SimpleTokenUtils.c(context);
            MetaData.f54824k.a(a11.f());
            g2.f52824a = new CookieManager(new e8(context), CookiePolicy.ACCEPT_ALL);
            i(context);
            b(context, requestReason);
            b(context);
            j(context);
            vb.a(context, 4, "StartApp SDK initialized", true);
        } catch (Throwable th3) {
            i4.a(th3);
        }
    }

    public static void a(boolean z11, @Nullable w7 w7Var) {
        i4 i4Var = new i4(j4.f53028k);
        i4Var.f52984j = z11;
        try {
            ComponentLocator componentLocator = ComponentLocator.L.f55370a;
            if (componentLocator != null) {
                componentLocator.m().a(i4Var, null);
            } else if (w7Var != null) {
                w7Var.a(Boolean.FALSE);
            }
        } catch (Throwable unused) {
        }
    }

    public final boolean a(@NonNull Activity activity) {
        return this.f54582y || activity.getClass().getName().equals(vb.c(activity));
    }

    public boolean a(String str) {
        Map<String, String> map = this.f54574q;
        return (map == null ? null : map.get(str)) != null;
    }

    public void a(boolean z11) {
        if (z11 && b0.a()) {
            this.f54578u = true;
        } else {
            this.f54578u = false;
            com.startapp.sdk.adsbase.cache.d.f54679h.b(AdPreferences.Placement.INAPP_RETURN);
        }
    }

    public class b implements com.startapp.sdk.adsbase.remoteconfig.c {

        public final Context f54594a;

        public final ComponentLocator f54595b;

        public b(Context context, ComponentLocator componentLocator) {
            this.f54594a = context;
            this.f54595b = componentLocator;
        }

        @Override
        public void a(@Nullable MetaDataRequest.RequestReason requestReason, boolean z11) {
            int i11;
            int parseInt;
            int parseInt2;
            String a11;
            int i12;
            int i13;
            StartAppSDKInternal startAppSDKInternal = StartAppSDKInternal.this;
            Context context = this.f54594a;
            if (startAppSDKInternal.f54559b) {
                if (!startAppSDKInternal.f54573p && CacheMetaData.f54673a.a().f()) {
                    if (startAppSDKInternal.f54560c) {
                        com.startapp.sdk.adsbase.cache.d dVar = com.startapp.sdk.adsbase.cache.d.f54679h;
                        dVar.getClass();
                        Context a12 = k0.a(context);
                        if (a12 == null) {
                            a12 = context;
                        }
                        dVar.f54686g = a12;
                        if (!dVar.f54682c && CacheMetaData.f54673a.a().f()) {
                            dVar.f54683d = true;
                            ComponentLocator.a(a12).i().execute(new j(a12, new com.startapp.sdk.adsbase.cache.a(dVar, a12)));
                        }
                    }
                } else {
                    com.startapp.sdk.adsbase.cache.d dVar2 = com.startapp.sdk.adsbase.cache.d.f54679h;
                    dVar2.f54682c = true;
                    ComponentLocator.a(context).i().execute(new i(context, new com.startapp.sdk.adsbase.cache.b(dVar2)));
                }
                startAppSDKInternal.f(context);
                if (z11) {
                    com.startapp.sdk.adsbase.cache.d dVar3 = com.startapp.sdk.adsbase.cache.d.f54679h;
                    dVar3.getClass();
                    ACMConfig a13 = CacheMetaData.f54673a.a();
                    if (a13 != null) {
                        Set<StartAppAd.AdMode> b11 = a13.b();
                        if (b11 != null && b11.size() > 0 && CacheMetaData.d()) {
                            e d11 = ComponentLocator.a(context).d();
                            int M = MetaData.f54824k.M();
                            int i14 = AdsCommonMetaData.f54521h.i();
                            for (StartAppAd.AdMode adMode : b11) {
                                if (adMode != null && (i12 = d11.getInt((a11 = com.startapp.sdk.adsbase.cache.d.a(adMode)), 0)) < M) {
                                    StartAppAd.AdMode adMode2 = StartAppAd.AdMode.FULLPAGE;
                                    if (adMode != adMode2) {
                                        i13 = i12;
                                        StartAppAd.AdMode adMode3 = StartAppAd.AdMode.OFFERWALL;
                                        if (adMode != adMode3) {
                                            dVar3.a(context, (StartAppAd) null, adMode, new AdPreferences(), (d.InterfaceC0764d) null);
                                        } else if (i14 < 100) {
                                            dVar3.a(context, (StartAppAd) null, adMode3, new AdPreferences(), (d.InterfaceC0764d) null);
                                        }
                                    } else if (i14 > 0) {
                                        i13 = i12;
                                        dVar3.a(context, (StartAppAd) null, adMode2, new AdPreferences(), (d.InterfaceC0764d) null);
                                    } else {
                                        i13 = i12;
                                    }
                                    d11.edit().a(a11, i13 + 1).apply();
                                }
                            }
                        }
                    }
                }
            }
            this.f54595b.f54909r.a().e();
            this.f54595b.f54910s.a().e();
            this.f54595b.u().e();
            StartAppSDKInternal startAppSDKInternal2 = StartAppSDKInternal.this;
            Context context2 = this.f54594a;
            startAppSDKInternal2.getClass();
            m5 n11 = ComponentLocator.a(context2).n();
            if (MetaData.f54824k.X()) {
                long C = MetaData.f54824k.C() * ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS;
                e.a aVar = new e.a(com.startapp.sdk.adsbase.remoteconfig.d.class);
                aVar.f55009d = Long.valueOf(C);
                aVar.f54996b = JobRequest.Network.ANY;
                n11.a(new com.startapp.sdk.jobs.e(aVar));
            } else {
                n11.a(JobRequest.a((Class<? extends com.startapp.sdk.jobs.b>[]) new Class[]{com.startapp.sdk.adsbase.remoteconfig.d.class}));
            }
            StartAppSDKInternal startAppSDKInternal3 = StartAppSDKInternal.this;
            Context context3 = this.f54594a;
            startAppSDKInternal3.getClass();
            m5 n12 = ComponentLocator.a(context3).n();
            if (MetaData.f54824k.W()) {
                long b12 = MetaData.f54824k.b(context3) * ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS;
                e.a aVar2 = new e.a(c8.class);
                aVar2.f55009d = Long.valueOf(b12);
                aVar2.f54996b = JobRequest.Network.ANY;
                n12.a(new com.startapp.sdk.jobs.e(aVar2));
            } else {
                n12.a(JobRequest.a((Class<? extends com.startapp.sdk.jobs.b>[]) new Class[]{c8.class}));
            }
            StartAppSDKInternal startAppSDKInternal4 = StartAppSDKInternal.this;
            Context context4 = this.f54594a;
            startAppSDKInternal4.getClass();
            m5 n13 = ComponentLocator.a(context4).n();
            MetaData metaData = MetaData.f54824k;
            if (metaData.W() && metaData.V()) {
                long millis = TimeUnit.SECONDS.toMillis(metaData.a(context4));
                e.a aVar3 = new e.a(b8.class);
                aVar3.f55009d = Long.valueOf(millis);
                aVar3.f54996b = JobRequest.Network.ANY;
                aVar3.f54997c = true;
                n13.a(new com.startapp.sdk.jobs.e(aVar3));
            } else {
                n13.a(JobRequest.a((Class<? extends com.startapp.sdk.jobs.b>[]) new Class[]{b8.class}));
            }
            StartAppSDKInternal startAppSDKInternal5 = StartAppSDKInternal.this;
            Context context5 = this.f54594a;
            startAppSDKInternal5.getClass();
            ComponentLocator a14 = ComponentLocator.a(context5);
            e d12 = a14.d();
            if (d12.getBoolean("shared_prefs_first_init", true)) {
                e.a edit = d12.edit();
                edit.a("totalSessions", (String) 0);
                edit.f54764a.putInt("totalSessions", 0);
                long currentTimeMillis = System.currentTimeMillis();
                edit.a("firstSessionTime", (String) Long.valueOf(currentTimeMillis));
                edit.f54764a.putLong("firstSessionTime", currentTimeMillis);
                edit.apply();
                a14.q().execute(new f(startAppSDKInternal5, context5, a14, d12));
            }
            StartAppSDKInternal.h(this.f54594a);
            StartAppSDKInternal.this.getClass();
            Context context6 = this.f54594a;
            if (ComponentLocator.a(context6).f().c()) {
                NetworkTestsMetaData A = MetaData.f54824k.A();
                m5 n14 = ComponentLocator.a(context6).n();
                boolean z12 = b0.a(context6, "android.permission.ACCESS_FINE_LOCATION") || b0.a(context6, "android.permission.ACCESS_COARSE_LOCATION");
                if (A != null && A.n() && z12) {
                    if (Math.random() < A.j()) {
                        x2.a(new m7());
                    }
                    try {
                        BackgroundService.a(context6, A.o());
                        NetworkTester.Config config = new NetworkTester.Config();
                        config.PROJECT_ID = A.k();
                        config.CONNECTIVITY_TEST_HOSTNAME = A.c();
                        config.CONNECTIVITY_TEST_FILENAME = A.b();
                        config.CONNECTIVITY_TEST_ENABLED = A.l();
                        config.NIR_COLLECT_CELLINFO = A.p();
                        config.CT_COLLECT_CELLINFO = A.m();
                        config.CONNECTIVITY_TEST_CDNCONFIG_URL = A.a();
                        config.GEOIP_URL = A.e();
                        Context a15 = k0.a(context6);
                        if (a15 == null) {
                            a15 = context6;
                        }
                        l7 l7Var = new l7(a15);
                        NetworkTester.init(context6, config);
                        NetworkTester.setOnConnectivityLatencyListener(l7Var);
                        NetworkTester.setOnNetworkInfoListener(l7Var);
                        NetworkTester.startListening(A.d(), A.f());
                        e.a aVar4 = new e.a(n7.class);
                        aVar4.f55009d = Long.valueOf(A.d());
                        aVar4.f54996b = JobRequest.Network.ANY;
                        n14.a(new com.startapp.sdk.jobs.e(aVar4));
                    } catch (Throwable th2) {
                        i4.a(th2);
                    }
                } else {
                    n14.a(JobRequest.a((Class<? extends com.startapp.sdk.jobs.b>[]) new Class[]{n7.class}));
                    NetworkTester.stopListening();
                    BackgroundService.a(context6, false);
                }
            }
            StartAppSDKInternal startAppSDKInternal6 = StartAppSDKInternal.this;
            Context context7 = this.f54594a;
            if (startAppSDKInternal6.B == null) {
                kb a16 = ComponentLocator.a(context7).f54903l.a();
                startAppSDKInternal6.B = a16;
                a16.b();
            }
            c9 s11 = this.f54595b.s();
            try {
                if (!s11.b()) {
                    s11.f52646b.execute(new d9(s11));
                }
            } catch (Throwable th3) {
                i4.a(th3);
            }
            y8 r11 = this.f54595b.r();
            List<a9> a17 = r11.a();
            if (r11.a(1024)) {
                i4 i4Var = new i4(j4.f53021d);
                i4Var.f52978d = "RSC init";
                StringBuilder a18 = c1.a("targets: ");
                a18.append(a17 != null ? Integer.valueOf(a17.size()) : null);
                i4Var.f52979e = a18.toString();
                i4Var.a();
            }
            j6 p11 = this.f54595b.p();
            MotionMetadata a19 = p11.a();
            if (a19 != null) {
                p11.f53045f = Math.random() < a19.k();
            }
            p11.f53043d.post(new k6(p11));
            this.f54595b.b().a(z11 ? 1 : 2);
            String w11 = MetaData.f54824k.w();
            if (w11 != null) {
                String version = StartAppSDK.getVersion();
                String[] split = w11.split("\\.");
                String[] split2 = version.split("\\.");
                int min = Math.min(split.length, split2.length);
                for (int i15 = 0; i15 < min; i15++) {
                    try {
                        parseInt = Integer.parseInt(split[i15]);
                        parseInt2 = Integer.parseInt(split2[i15]);
                    } catch (NumberFormatException unused) {
                        int compareTo = split[i15].compareTo(split2[i15]);
                        if (compareTo <= 0) {
                            if (compareTo < 0) {
                            }
                        }
                    }
                    if (parseInt > parseInt2) {
                        i11 = i15 + 1;
                        break;
                    } else {
                        if (parseInt < parseInt2) {
                            i11 = -(i15 + 1);
                            break;
                        }
                    }
                }
                if (split.length > split2.length) {
                    i11 = min + 1;
                } else {
                    i11 = split.length < split2.length ? -(min + 1) : 0;
                }
                if (i11 > 0) {
                    Context context8 = this.f54594a;
                    StringBuilder a21 = c1.a("Current SDK version (");
                    a21.append(StartAppSDK.getVersion());
                    a21.append(") is outdated. Integrate the most recent version (");
                    a21.append(w11);
                    a21.append(") in order to improve your ads performance.");
                    vb.a(context8, 5, a21.toString(), false);
                }
            }
        }

        @Override
        public void a(@Nullable MetaDataRequest.RequestReason requestReason) {
            this.f54595b.b().a(0);
        }
    }
}