APKPure.apk(点击下载) / d.java


package e.g.a.b;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Looper;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import androidx.recyclerview.widget.RecyclerView;
import com.apkpure.aegon.access.AccessHeadInfo;
import com.apkpure.aegon.application.RealApplicationLike;
import com.apkpure.aegon.person.login.LoginUser;
import com.apkpure.components.clientchannel.channel.headers.DeviceInfo;
import com.apkpure.components.clientchannel.channel.headers.ExtInfo;
import com.apkpure.components.clientchannel.channel.headers.HostAppInfo;
import com.apkpure.components.clientchannel.channel.headers.LbsInfo;
import com.apkpure.components.clientchannel.channel.headers.NetInfo;
import com.apkpure.components.clientchannel.channel.headers.UserInfo;
import com.apkpure.crabshell.GlobalConst;
import com.ola.qsea.sdk.QseaSDK;
import e.g.a.c.h;
import e.g.a.i0.a1;
import e.g.a.i0.u0;
import e.g.c.a.i.g;
import e.g.c.a.i.i;
import java.io.File;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import o.s.c.j;
import o.s.c.k;
import o.y.l;
import okhttp3.Cookie;

public class d implements e.g.c.a.i.e {

    /* renamed from: l  reason: collision with root package name */
    public static String f4873l = "";

    /* renamed from: m  reason: collision with root package name */
    public static String f4874m = "";

    /* renamed from: n  reason: collision with root package name */
    public static String f4875n = "";

    /* renamed from: o  reason: collision with root package name */
    public static boolean f4876o;

    /* renamed from: a  reason: collision with root package name */
    public final Context f4877a;
    public LbsInfo b;
    public String c;
    public String[] d;

    /* renamed from: e  reason: collision with root package name */
    public final o.d f4878e;

    /* renamed from: f  reason: collision with root package name */
    public final o.d f4879f;

    /* renamed from: g  reason: collision with root package name */
    public final o.d f4880g;

    /* renamed from: h  reason: collision with root package name */
    public final o.d f4881h;

    /* renamed from: i  reason: collision with root package name */
    public final o.d f4882i;

    /* renamed from: j  reason: collision with root package name */
    public final o.d f4883j;

    /* renamed from: k  reason: collision with root package name */
    public final boolean f4884k;

    public static final class a extends k implements o.s.b.a<File> {
        public final /* synthetic */ d this$0;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public a(d dVar) {
            super(0);
            this.this$0 = dVar;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // o.s.b.a
        public File b() {
            File file;
            Context context;
            Context context2;
            String str = null;
            if (j.a("mounted", Environment.getExternalStorageState()) || !Environment.isExternalStorageRemovable() ? !((context = this.this$0.f4877a) == null || (file = context.getExternalCacheDir()) == null) : !((context2 = this.this$0.f4877a) == null || (file = context2.getCacheDir()) == null)) {
                str = file.getPath();
            }
            StringBuilder sb = new StringBuilder();
            sb.append((Object) str);
            sb.append((Object) File.separator);
            sb.append((Object) this.this$0.f4877a.getPackageName());
            return new File(sb.toString());
        }
    }

    public static final class b extends k implements o.s.b.a<ExtInfo> {
        public static final b b = new b();

        public b() {
            super(0);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // o.s.b.a
        public ExtInfo b() {
            return new ExtInfo(null, null, 3, null);
        }
    }

    public static final class c extends k implements o.s.b.a<e> {
        public static final c b = new c();

        public c() {
            super(0);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // o.s.b.a
        public e b() {
            return new e();
        }
    }

    /* renamed from: e.g.a.b.d$d  reason: collision with other inner class name */
    public static final class C0068d extends k implements o.s.b.a<e.g.c.a.j.a> {
        public static final C0068d b = new C0068d();

        public C0068d() {
            super(0);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // o.s.b.a
        public e.g.c.a.j.a b() {
            return new e.g.c.a.j.a();
        }
    }

    public static final class e extends k implements o.s.b.a<AccessHeadInfo> {
        public final /* synthetic */ d this$0;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public e(d dVar) {
            super(0);
            this.this$0 = dVar;
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */
        /* JADX WARNING: Code restructure failed: missing block: B:109:0x021d, code lost:
            if (r0.hasTransport(0) != false) goto L_0x021f;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:11:0x00a6, code lost:
            if (r9 == null) goto L_0x00c1;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:38:0x0119, code lost:
            if (r11 != 1) goto L_0x01a0;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:47:0x013e, code lost:
            if (o.y.l.e(r10, "CDMA2000", true) == false) goto L_0x01a0;
         */
        /* JADX WARNING: Removed duplicated region for block: B:103:0x0203 A[Catch:{ Exception -> 0x0221 }] */
        /* JADX WARNING: Removed duplicated region for block: B:121:0x0244  */
        /* JADX WARNING: Removed duplicated region for block: B:123:0x0247  */
        /* JADX WARNING: Removed duplicated region for block: B:138:0x02a5 A[SYNTHETIC, Splitter:B:138:0x02a5] */
        /* JADX WARNING: Removed duplicated region for block: B:154:0x0319  */
        /* JADX WARNING: Removed duplicated region for block: B:58:0x0179  */
        /* JADX WARNING: Removed duplicated region for block: B:59:0x017b  */
        /* JADX WARNING: Removed duplicated region for block: B:60:0x017d  */
        /* JADX WARNING: Removed duplicated region for block: B:61:0x017f  */
        /* JADX WARNING: Removed duplicated region for block: B:74:0x01b0  */
        /* JADX WARNING: Removed duplicated region for block: B:79:0x01bc  */
        /* JADX WARNING: Removed duplicated region for block: B:80:0x01c3  */
        /* JADX WARNING: Removed duplicated region for block: B:85:0x01d8 A[Catch:{ Exception -> 0x0221 }] */
        @Override // o.s.b.a
        public AccessHeadInfo b() {
            String str;
            int i2;
            String str2;
            String str3;
            char c;
            String string;
            String str4;
            String str5;
            NetworkInfo networkInfo;
            int i3 = Build.VERSION.SDK_INT;
            String str6 = "";
            AccessHeadInfo accessHeadInfo = new AccessHeadInfo(null, null, null, null, 15, null);
            d dVar = this.this$0;
            UserInfo userInfo = accessHeadInfo.getUserInfo();
            String uuid = UUID.randomUUID().toString();
            j.d(uuid, "randomUUID().toString()");
            userInfo.setUuid(uuid);
            HostAppInfo hostAppInfo = accessHeadInfo.getHostAppInfo();
            String packageName = dVar.f4877a.getPackageName();
            j.d(packageName, "context.packageName");
            hostAppInfo.setPkgName(packageName);
            accessHeadInfo.getHostAppInfo().setVersionName(GlobalConst.VERSION_NAME);
            accessHeadInfo.getHostAppInfo().setVersionCode(GlobalConst.VERSIONCODE);
            accessHeadInfo.getHostAppInfo().setBuildNo("8195");
            accessHeadInfo.getUserInfo().setAuthKey("qNKrYmW8SSUqJ73k3P2yfMxRTo3sJTR");
            Context context = dVar.f4877a;
            if (context != null) {
                HostAppInfo hostAppInfo2 = accessHeadInfo.getHostAppInfo();
                String lowerCase = e.g.c.a.k.f.a(context).toLowerCase(Locale.ROOT);
                j.d(lowerCase, "this as java.lang.String).toLowerCase(Locale.ROOT)");
                hostAppInfo2.setMd5(lowerCase);
                HostAppInfo hostAppInfo3 = accessHeadInfo.getHostAppInfo();
                j.e(context, "<this>");
                try {
                    ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), RecyclerView.a0.FLAG_IGNORE);
                    if (applicationInfo != null) {
                        Bundle bundle = applicationInfo.metaData;
                        str = bundle == null ? null : bundle.getString("CHANNEL_NAME");
                    }
                } catch (Exception e2) {
                    String t2 = e.d.a.a.a.t(e2, "Context.channel name ", "Util", "tag", "message");
                    g gVar = e.g.c.a.k.d.b;
                    if (gVar != null) {
                        gVar.i(j.k("ClientChannel|", "Util"), t2);
                    } else {
                        j.k("ClientChannel|", "Util");
                    }
                }
                str = str6;
                hostAppInfo3.setChannel(str);
                NetInfo netInfo = accessHeadInfo.getNetInfo();
                e.g.c.a.k.e eVar = e.g.c.a.k.e.f7825a;
                j.e(context, "context");
                boolean z = true;
                if (i.i.d.a.a(context, "android.permission.ACCESS_NETWORK_STATE") == 0) {
                    if (i3 <= 28) {
                        j.e(context, "context");
                        try {
                            networkInfo = i.i.g.c.D(context).getActiveNetworkInfo();
                        } catch (Exception e3) {
                            String str7 = e.g.c.a.k.e.b;
                            String message = e3.getMessage();
                            if (message == null) {
                                message = str6;
                            }
                            j.e(str7, "tag");
                            j.e(message, "message");
                            g gVar2 = e.g.c.a.k.d.b;
                            if (gVar2 != null) {
                                gVar2.e(j.k("ClientChannel|", str7), message);
                            } else {
                                j.k("ClientChannel|", str7);
                            }
                            networkInfo = null;
                        }
                        if (networkInfo != null && networkInfo.isAvailable()) {
                            int type = networkInfo.getType();
                            if (type == 0) {
                                switch (networkInfo.getSubtype()) {
                                    case 1:
                                    case 2:
                                    case 4:
                                    case 7:
                                    case 11:
                                    case 16:
                                        i2 = 2;
                                        break;
                                    case 3:
                                    case 5:
                                    case 6:
                                    case 8:
                                    case 9:
                                    case 10:
                                    case 12:
                                    case 14:
                                    case 15:
                                    case 17:
                                        i2 = 3;
                                        break;
                                    case 13:
                                    case 18:
                                    case 19:
                                        i2 = 4;
                                        break;
                                    case 20:
                                        i2 = 5;
                                        break;
                                    default:
                                        try {
                                            String subtypeName = networkInfo.getSubtypeName();
                                            if (!l.e(subtypeName, "TD-SCDMA", true)) {
                                                if (!l.e(subtypeName, "WCDMA", true)) {
                                                    break;
                                                }
                                            }
                                            i2 = 3;
                                            break;
                                        } catch (Exception unused) {
                                            break;
                                        }
                                }
                                netInfo.setNetType(Integer.valueOf(i2));
                                NetInfo netInfo2 = accessHeadInfo.getNetInfo();
                                str2 = dVar.c;
                                if (!(str2 != null || str2.length() == 0)) {
                                    e.g.c.a.k.e eVar2 = e.g.c.a.k.e.f7825a;
                                    str3 = e.g.c.a.k.e.b(true);
                                } else {
                                    str3 = dVar.c;
                                }
                                netInfo2.setIpv4(str3);
                                e.g.c.a.k.e eVar3 = e.g.c.a.k.e.f7825a;
                                j.e(context, "context");
                                j.e(context, "context");
                                ConnectivityManager D = i.i.g.c.D(context);
                                if (i3 > 28) {
                                    NetworkInfo networkInfo2 = D.getNetworkInfo(1);
                                    NetworkInfo.State state = networkInfo2 == null ? null : networkInfo2.getState();
                                    if (state != NetworkInfo.State.CONNECTED) {
                                        if (state != NetworkInfo.State.CONNECTING) {
                                            NetworkInfo networkInfo3 = D.getNetworkInfo(0);
                                            NetworkInfo.State state2 = networkInfo3 == null ? null : networkInfo3.getState();
                                            if (state2 != NetworkInfo.State.CONNECTED) {
                                                if (state2 == NetworkInfo.State.CONNECTING) {
                                                }
                                                c = 65535;
                                                if (c != 1) {
                                                    z = false;
                                                }
                                                if (z) {
                                                    NetInfo netInfo3 = accessHeadInfo.getNetInfo();
                                                    e.g.c.a.k.e eVar4 = e.g.c.a.k.e.f7825a;
                                                    j.e(context, "context");
                                                    if (i.i.d.a.a(context, "android.permission.ACCESS_WIFI_STATE") == 0) {
                                                        try {
                                                            j.e(context, "<this>");
                                                            Object systemService = context.getSystemService("wifi");
                                                            Objects.requireNonNull(systemService, "null cannot be cast to non-null type android.net.wifi.WifiManager");
                                                            str4 = ((WifiManager) systemService).getConnectionInfo().getBSSID();
                                                        } catch (Exception e4) {
                                                            String str8 = e.g.c.a.k.e.b;
                                                            String message2 = e4.getMessage();
                                                            if (message2 == null) {
                                                                message2 = str6;
                                                            }
                                                            j.e(str8, "tag");
                                                            j.e(message2, "message");
                                                            g gVar3 = e.g.c.a.k.d.b;
                                                            if (gVar3 != null) {
                                                                gVar3.e(j.k("ClientChannel|", str8), message2);
                                                            } else {
                                                                j.k("ClientChannel|", str8);
                                                            }
                                                        }
                                                        netInfo3.setWifiBssid(str4);
                                                        NetInfo netInfo4 = accessHeadInfo.getNetInfo();
                                                        e.g.c.a.k.e eVar5 = e.g.c.a.k.e.f7825a;
                                                        j.e(context, "context");
                                                        if (i.i.d.a.a(context, "android.permission.ACCESS_WIFI_STATE") == 0) {
                                                            try {
                                                                j.e(context, "<this>");
                                                                Object systemService2 = context.getSystemService("wifi");
                                                                Objects.requireNonNull(systemService2, "null cannot be cast to non-null type android.net.wifi.WifiManager");
                                                                str5 = e.g.c.a.k.e.a(((WifiManager) systemService2).getConnectionInfo().getSSID(), false);
                                                            } catch (Exception e5) {
                                                                String str9 = e.g.c.a.k.e.b;
                                                                String message3 = e5.getMessage();
                                                                if (message3 == null) {
                                                                    message3 = str6;
                                                                }
                                                                j.e(str9, "tag");
                                                                j.e(message3, "message");
                                                                g gVar4 = e.g.c.a.k.d.b;
                                                                if (gVar4 != null) {
                                                                    gVar4.e(j.k("ClientChannel|", str9), message3);
                                                                } else {
                                                                    j.k("ClientChannel|", str9);
                                                                }
                                                            }
                                                            netInfo4.setWifiSsid(str5);
                                                        }
                                                        str5 = str6;
                                                        netInfo4.setWifiSsid(str5);
                                                    }
                                                    str4 = str6;
                                                    netInfo3.setWifiBssid(str4);
                                                    NetInfo netInfo42 = accessHeadInfo.getNetInfo();
                                                    e.g.c.a.k.e eVar52 = e.g.c.a.k.e.f7825a;
                                                    j.e(context, "context");
                                                    if (i.i.d.a.a(context, "android.permission.ACCESS_WIFI_STATE") == 0) {
                                                    }
                                                    str5 = str6;
                                                    netInfo42.setWifiSsid(str5);
                                                }
                                                NetInfo netInfo5 = accessHeadInfo.getNetInfo();
                                                e.g.c.a.k.e eVar6 = e.g.c.a.k.e.f7825a;
                                                netInfo5.setMacAddress(e.g.c.a.k.e.c());
                                                accessHeadInfo.getNetInfo().setUseVpn(u0.n(RealApplicationLike.getContext()));
                                                d.f4876o = accessHeadInfo.getNetInfo().getUseVpn();
                                                DeviceInfo deviceInfo = accessHeadInfo.getDeviceInfo();
                                                string = Settings.Secure.getString(context.getContentResolver(), "android_id");
                                                if (string != null) {
                                                    str6 = string;
                                                }
                                                deviceInfo.setAndroidId(str6);
                                                accessHeadInfo.getDeviceInfo().setScreenWidth(a1.b(context));
                                                accessHeadInfo.getDeviceInfo().setScreenHeight(a1.a(context));
                                                accessHeadInfo.getDeviceInfo().setImei(e.g.c.a.k.a.b(context));
                                            }
                                            c = 2;
                                            if (c != 1) {
                                            }
                                            if (z) {
                                            }
                                            NetInfo netInfo52 = accessHeadInfo.getNetInfo();
                                            e.g.c.a.k.e eVar62 = e.g.c.a.k.e.f7825a;
                                            netInfo52.setMacAddress(e.g.c.a.k.e.c());
                                            accessHeadInfo.getNetInfo().setUseVpn(u0.n(RealApplicationLike.getContext()));
                                            d.f4876o = accessHeadInfo.getNetInfo().getUseVpn();
                                            DeviceInfo deviceInfo2 = accessHeadInfo.getDeviceInfo();
                                            string = Settings.Secure.getString(context.getContentResolver(), "android_id");
                                            if (string != null) {
                                            }
                                            deviceInfo2.setAndroidId(str6);
                                            accessHeadInfo.getDeviceInfo().setScreenWidth(a1.b(context));
                                            accessHeadInfo.getDeviceInfo().setScreenHeight(a1.a(context));
                                            accessHeadInfo.getDeviceInfo().setImei(e.g.c.a.k.a.b(context));
                                        }
                                    }
                                } else {
                                    Network activeNetwork = D.getActiveNetwork();
                                    if (activeNetwork != null) {
                                        NetworkCapabilities networkCapabilities = D.getNetworkCapabilities(activeNetwork);
                                        j.c(networkCapabilities);
                                        if (!networkCapabilities.hasTransport(1)) {
                                        }
                                    }
                                    c = 65535;
                                    if (c != 1) {
                                    }
                                    if (z) {
                                    }
                                    NetInfo netInfo522 = accessHeadInfo.getNetInfo();
                                    e.g.c.a.k.e eVar622 = e.g.c.a.k.e.f7825a;
                                    netInfo522.setMacAddress(e.g.c.a.k.e.c());
                                    accessHeadInfo.getNetInfo().setUseVpn(u0.n(RealApplicationLike.getContext()));
                                    d.f4876o = accessHeadInfo.getNetInfo().getUseVpn();
                                    DeviceInfo deviceInfo22 = accessHeadInfo.getDeviceInfo();
                                    string = Settings.Secure.getString(context.getContentResolver(), "android_id");
                                    if (string != null) {
                                    }
                                    deviceInfo22.setAndroidId(str6);
                                    accessHeadInfo.getDeviceInfo().setScreenWidth(a1.b(context));
                                    accessHeadInfo.getDeviceInfo().setScreenHeight(a1.a(context));
                                    accessHeadInfo.getDeviceInfo().setImei(e.g.c.a.k.a.b(context));
                                }
                                c = 1;
                                if (c != 1) {
                                }
                                if (z) {
                                }
                                NetInfo netInfo5222 = accessHeadInfo.getNetInfo();
                                e.g.c.a.k.e eVar6222 = e.g.c.a.k.e.f7825a;
                                netInfo5222.setMacAddress(e.g.c.a.k.e.c());
                                accessHeadInfo.getNetInfo().setUseVpn(u0.n(RealApplicationLike.getContext()));
                                d.f4876o = accessHeadInfo.getNetInfo().getUseVpn();
                                DeviceInfo deviceInfo222 = accessHeadInfo.getDeviceInfo();
                                string = Settings.Secure.getString(context.getContentResolver(), "android_id");
                                if (string != null) {
                                }
                                deviceInfo222.setAndroidId(str6);
                                accessHeadInfo.getDeviceInfo().setScreenWidth(a1.b(context));
                                accessHeadInfo.getDeviceInfo().setScreenHeight(a1.a(context));
                                accessHeadInfo.getDeviceInfo().setImei(e.g.c.a.k.a.b(context));
                            }
                        }
                    } else {
                        try {
                            ConnectivityManager D2 = i.i.g.c.D(context);
                            Network activeNetwork2 = D2.getActiveNetwork();
                            if (activeNetwork2 != null) {
                                NetworkCapabilities networkCapabilities2 = D2.getNetworkCapabilities(activeNetwork2);
                                j.c(networkCapabilities2);
                                if (!networkCapabilities2.hasTransport(1)) {
                                    if (networkCapabilities2.hasTransport(0)) {
                                        j.e(context, "<this>");
                                        Object systemService3 = context.getSystemService("phone");
                                        Objects.requireNonNull(systemService3, "null cannot be cast to non-null type android.telephony.TelephonyManager");
                                        switch (((TelephonyManager) systemService3).getNetworkType()) {
                                        }
                                        netInfo.setNetType(Integer.valueOf(i2));
                                        NetInfo netInfo22 = accessHeadInfo.getNetInfo();
                                        str2 = dVar.c;
                                        if (!(str2 != null || str2.length() == 0)) {
                                        }
                                        netInfo22.setIpv4(str3);
                                        e.g.c.a.k.e eVar32 = e.g.c.a.k.e.f7825a;
                                        j.e(context, "context");
                                        j.e(context, "context");
                                        ConnectivityManager D3 = i.i.g.c.D(context);
                                        if (i3 > 28) {
                                        }
                                        c = 1;
                                        if (c != 1) {
                                        }
                                        if (z) {
                                        }
                                        NetInfo netInfo52222 = accessHeadInfo.getNetInfo();
                                        e.g.c.a.k.e eVar62222 = e.g.c.a.k.e.f7825a;
                                        netInfo52222.setMacAddress(e.g.c.a.k.e.c());
                                        accessHeadInfo.getNetInfo().setUseVpn(u0.n(RealApplicationLike.getContext()));
                                        d.f4876o = accessHeadInfo.getNetInfo().getUseVpn();
                                        DeviceInfo deviceInfo2222 = accessHeadInfo.getDeviceInfo();
                                        string = Settings.Secure.getString(context.getContentResolver(), "android_id");
                                        if (string != null) {
                                        }
                                        deviceInfo2222.setAndroidId(str6);
                                        accessHeadInfo.getDeviceInfo().setScreenWidth(a1.b(context));
                                        accessHeadInfo.getDeviceInfo().setScreenHeight(a1.a(context));
                                        accessHeadInfo.getDeviceInfo().setImei(e.g.c.a.k.a.b(context));
                                    }
                                }
                            }
                        } catch (Exception e6) {
                            String str10 = e.g.c.a.k.e.b;
                            String message4 = e6.getMessage();
                            if (message4 == null) {
                                message4 = str6;
                            }
                            j.e(str10, "tag");
                            j.e(message4, "message");
                            g gVar5 = e.g.c.a.k.d.b;
                            if (gVar5 != null) {
                                gVar5.e(j.k("ClientChannel|", str10), message4);
                            } else {
                                j.k("ClientChannel|", str10);
                            }
                        }
                    }
                    i2 = 1;
                    netInfo.setNetType(Integer.valueOf(i2));
                    NetInfo netInfo222 = accessHeadInfo.getNetInfo();
                    str2 = dVar.c;
                    if (!(str2 != null || str2.length() == 0)) {
                    }
                    netInfo222.setIpv4(str3);
                    e.g.c.a.k.e eVar322 = e.g.c.a.k.e.f7825a;
                    j.e(context, "context");
                    j.e(context, "context");
                    ConnectivityManager D32 = i.i.g.c.D(context);
                    if (i3 > 28) {
                    }
                    c = 1;
                    if (c != 1) {
                    }
                    if (z) {
                    }
                    NetInfo netInfo522222 = accessHeadInfo.getNetInfo();
                    e.g.c.a.k.e eVar622222 = e.g.c.a.k.e.f7825a;
                    netInfo522222.setMacAddress(e.g.c.a.k.e.c());
                    accessHeadInfo.getNetInfo().setUseVpn(u0.n(RealApplicationLike.getContext()));
                    d.f4876o = accessHeadInfo.getNetInfo().getUseVpn();
                    DeviceInfo deviceInfo22222 = accessHeadInfo.getDeviceInfo();
                    string = Settings.Secure.getString(context.getContentResolver(), "android_id");
                    if (string != null) {
                    }
                    deviceInfo22222.setAndroidId(str6);
                    accessHeadInfo.getDeviceInfo().setScreenWidth(a1.b(context));
                    accessHeadInfo.getDeviceInfo().setScreenHeight(a1.a(context));
                    accessHeadInfo.getDeviceInfo().setImei(e.g.c.a.k.a.b(context));
                }
                i2 = 0;
                netInfo.setNetType(Integer.valueOf(i2));
                NetInfo netInfo2222 = accessHeadInfo.getNetInfo();
                str2 = dVar.c;
                if (!(str2 != null || str2.length() == 0)) {
                }
                netInfo2222.setIpv4(str3);
                e.g.c.a.k.e eVar3222 = e.g.c.a.k.e.f7825a;
                j.e(context, "context");
                j.e(context, "context");
                try {
                    ConnectivityManager D322 = i.i.g.c.D(context);
                    if (i3 > 28) {
                    }
                    c = 1;
                } catch (Exception e7) {
                    String str11 = e.g.c.a.k.e.b;
                    String message5 = e7.getMessage();
                    if (message5 == null) {
                        message5 = str6;
                    }
                    j.e(str11, "tag");
                    j.e(message5, "message");
                    g gVar6 = e.g.c.a.k.d.b;
                    if (gVar6 != null) {
                        gVar6.e(j.k("ClientChannel|", str11), message5);
                    } else {
                        j.k("ClientChannel|", str11);
                    }
                }
                if (c != 1) {
                }
                if (z) {
                }
                NetInfo netInfo5222222 = accessHeadInfo.getNetInfo();
                e.g.c.a.k.e eVar6222222 = e.g.c.a.k.e.f7825a;
                netInfo5222222.setMacAddress(e.g.c.a.k.e.c());
                accessHeadInfo.getNetInfo().setUseVpn(u0.n(RealApplicationLike.getContext()));
                d.f4876o = accessHeadInfo.getNetInfo().getUseVpn();
                DeviceInfo deviceInfo222222 = accessHeadInfo.getDeviceInfo();
                try {
                    string = Settings.Secure.getString(context.getContentResolver(), "android_id");
                    if (string != null) {
                    }
                } catch (Exception unused2) {
                }
                deviceInfo222222.setAndroidId(str6);
                accessHeadInfo.getDeviceInfo().setScreenWidth(a1.b(context));
                accessHeadInfo.getDeviceInfo().setScreenHeight(a1.a(context));
                accessHeadInfo.getDeviceInfo().setImei(e.g.c.a.k.a.b(context));
            }
            return accessHeadInfo;
        }
    }

    public static final class f extends k implements o.s.b.a<f> {
        public static final f b = new f();

        public f() {
            super(0);
        }

        /* Return type fixed from 'java.lang.Object' to match base method */
        @Override // o.s.b.a
        public f b() {
            return new f();
        }
    }

    public d(Context context) {
        j.e(context, "context");
        this.f4877a = context;
        try {
            q();
            i.i.g.c.O().a(new b(this));
        } catch (Exception unused) {
        }
        this.f4878e = i.i.g.c.V(new e(this));
        this.f4879f = i.i.g.c.V(b.b);
        this.f4880g = i.i.g.c.V(C0068d.b);
        this.f4881h = i.i.g.c.V(f.b);
        this.f4882i = i.i.g.c.V(c.b);
        this.f4883j = i.i.g.c.V(new a(this));
        this.f4884k = true;
    }

    public static final void l(d dVar) {
        j.e(dVar, "this$0");
        try {
            dVar.b = LbsInfo.Companion.location(dVar.f4877a);
            e.g.c.a.k.e eVar = e.g.c.a.k.e.f7825a;
            boolean z = true;
            String b2 = e.g.c.a.k.e.b(true);
            if (b2.length() != 0) {
                z = false;
            }
            if (z || l.E(b2, "127", false, 2) || l.E(b2, "192", false, 2)) {
                String d2 = e.g.c.a.k.e.d(0);
                if (d2 != null) {
                    b2 = d2;
                }
            }
            dVar.c = b2;
            if (j.a(f4873l, "")) {
                String b3 = h.b();
                if (!j.a(b3, "gaid_exception")) {
                    j.d(b3, "gaid");
                    f4873l = b3;
                }
            }
        } catch (Throwable unused) {
        }
    }

    @Override // e.g.c.a.i.d
    public int a() {
        j.e(this, "this");
        j.e(this, "this");
        return 0;
    }

    @Override // e.g.c.a.i.e
    public boolean b() {
        return this.f4884k;
    }

    @Override // e.g.c.a.i.f
    public String[] c() {
        String[] strArr = this.d;
        boolean z = true;
        if (strArr != null) {
            if (!(strArr.length == 0)) {
                z = false;
            }
        }
        if (!z) {
            j.c(strArr);
            return strArr;
        }
        String F = i.i.g.c.F(this.f4877a, "ApkPureSpareHosts");
        if (TextUtils.isEmpty(F)) {
            F = "https://tapi.upload.app";
        }
        ArrayList arrayList = new ArrayList();
        j.d(F, "hostsSave");
        for (String str : l.C(F, new String[]{";"}, false, 0, 6)) {
            arrayList.add(j.k(str, "/v3"));
        }
        Object[] array = arrayList.toArray(new String[0]);
        Objects.requireNonNull(array, "null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
        String[] strArr2 = (String[]) array;
        this.d = strArr2;
        j.c(strArr2);
        return strArr2;
    }

    @Override // e.g.c.a.i.f
    public String contentType() {
        return "application/json; charset=utf-8";
    }

    @Override // e.g.c.a.i.d
    public i d() {
        return (f) this.f4881h.getValue();
    }

    @Override // e.g.c.a.i.f
    public String e() {
        return this.f4884k ? "https://tapi.pureapk.com/v3" : "https://fungogaming.com/v3";
    }

    @Override // e.g.c.a.i.c
    public long f() {
        return 10485760;
    }

    @Override // e.g.c.a.i.c
    public File g() {
        return (File) this.f4883j.getValue();
    }

    @Override // e.g.c.a.i.e
    public g h() {
        return (e) this.f4882i.getValue();
    }

    @Override // e.g.c.a.i.f
    public Map<String, String> headers() {
        boolean z;
        int i2;
        j();
        k();
        m().setLbsInfo(this.b);
        String str = this.c;
        if (!(str == null || str.length() == 0)) {
            o().getNetInfo().setIpv4(this.c);
        }
        NetInfo netInfo = o().getNetInfo();
        if (!f4876o) {
            String str2 = u0.f6569a;
            String property = System.getProperty("http.proxyHost");
            String property2 = System.getProperty("http.proxyPort");
            if (property2 == null) {
                property2 = "-1";
            }
            try {
                i2 = Integer.parseInt(property2);
            } catch (Exception unused) {
                i2 = -1;
            }
            if (!(!TextUtils.isEmpty(property) && i2 != -1)) {
                z = false;
                netInfo.setUseVpn(z);
                return o.o.h.q(i.i.d.c.d0("User-Agent-WebView", f4875n), i.i.d.c.d0("User-Agent", u0.j()), i.i.d.c.d0("Ual-Access-Businessid", "projecta"), i.i.d.c.d0("Ual-Access-ProjectA", o().toJson()), i.i.d.c.d0("Ual-Access-ExtInfo", n()), i.i.d.c.d0("Ual-Access-Sequence", UUID.randomUUID().toString()), i.i.d.c.d0("Cookie", p()));
            }
        }
        z = true;
        netInfo.setUseVpn(z);
        return o.o.h.q(i.i.d.c.d0("User-Agent-WebView", f4875n), i.i.d.c.d0("User-Agent", u0.j()), i.i.d.c.d0("Ual-Access-Businessid", "projecta"), i.i.d.c.d0("Ual-Access-ProjectA", o().toJson()), i.i.d.c.d0("Ual-Access-ExtInfo", n()), i.i.d.c.d0("Ual-Access-Sequence", UUID.randomUUID().toString()), i.i.d.c.d0("Cookie", p()));
    }

    @Override // e.g.c.a.i.f
    public String i() {
        j.e(this, "this");
        j.e(this, "this");
        j.e(this, "this");
        return "https://";
    }

    public final void j() {
        UserInfo userInfo;
        if (TextUtils.isEmpty(o().getUserInfo().getQimei())) {
            String d2 = e.g.a.h0.a.j.a().d();
            String token = QseaSDK.getInstance("0AND02Z8WN41BWCA").getToken();
            if (!(d2 == null || l.n(d2))) {
                UserInfo userInfo2 = o().getUserInfo();
                j.d(d2, "qimei");
                userInfo2.setQimei(d2);
                userInfo = o().getUserInfo();
                token = "";
            } else {
                userInfo = o().getUserInfo();
                j.d(token, "qimeiToaken");
            }
            userInfo.setQimeiToken(token);
        }
    }

    public final void k() {
        String userId = o().getUserInfo().getUserId();
        if (userId == null || l.n(userId)) {
            LoginUser.User t2 = i.i.d.c.t(this.f4877a);
            o().getUserInfo().setUserId(String.valueOf(t2 == null ? "" : Integer.valueOf(t2.m())));
        }
    }

    public final ExtInfo m() {
        return (ExtInfo) this.f4879f.getValue();
    }

    @Override // e.g.c.a.i.f
    public String method() {
        return "POST";
    }

    public final String n() {
        Map q2 = o.o.h.q(i.i.d.c.d0("gaid", f4873l), i.i.d.c.d0("oaid", f4874m));
        ExtInfo m2 = m();
        e.g.c.a.k.b bVar = e.g.c.a.k.b.f7823a;
        m2.setExtInfo(e.g.c.a.k.b.b(q2));
        return e.g.c.a.k.b.b(m());
    }

    public final AccessHeadInfo o() {
        return (AccessHeadInfo) this.f4878e.getValue();
    }

    public final String p() {
        LoginUser.User t2;
        Cookie y = i.i.d.c.y(((Object) e.g.a.v.l.f7326a) + "://" + ((Object) e.g.a.v.l.b));
        String cookie = y == null ? null : y.toString();
        if (cookie == null) {
            return "";
        }
        if (!i.i.d.c.J(this.f4877a) || (t2 = i.i.d.c.t(this.f4877a)) == null) {
            return cookie;
        }
        StringBuilder d0 = e.d.a.a.a.d0(cookie, "; uid=");
        d0.append(t2.m());
        return d0.toString();
    }

    @Override // e.g.c.a.i.d
    public e.g.c.a.i.h parser() {
        return (e.g.c.a.j.a) this.f4880g.getValue();
    }

    public final void q() {
        if (j.a(Thread.currentThread(), Looper.getMainLooper().getThread())) {
            try {
                String userAgentString = new e.w.e.a.b.t.d.a.a(this.f4877a).getSettings().getUserAgentString();
                j.d(userAgentString, "WebView(context).settings.userAgentString");
                f4875n = userAgentString;
            } catch (Exception unused) {
            }
        } else {
            e.g.a.i0.f2.a.d().post(new a(this));
        }
    }
}