OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

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


package com.excelliance.kxqp.gs.util;

import a.q;
import android.accounts.Account;
import android.app.Activity;
import android.app.Application;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.WebView;
import com.android.spush.util.WebActionRouter;
import com.excean.ggspace.main.R;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.PlatSdk;
import com.excelliance.kxqp.SmtServService;
import com.excelliance.kxqp.VersionManager;
import com.excelliance.kxqp.api.ApiManager;
import com.excelliance.kxqp.api.request.GameAttrsRequest;
import com.excelliance.kxqp.api.response.GameAttrsResponse;
import com.excelliance.kxqp.avds.AvdSplashCallBackImp;
import com.excelliance.kxqp.bean.AppBuyBean;
import com.excelliance.kxqp.bean.AppExtraBean;
import com.excelliance.kxqp.bean.AppLocalInfo;
import com.excelliance.kxqp.bean.AppNativeGametype;
import com.excelliance.kxqp.bean.AppNativeImportWhiteGame;
import com.excelliance.kxqp.bean.AppNativeInfo;
import com.excelliance.kxqp.bean.CloudGameInfo;
import com.excelliance.kxqp.bean.CloudGameList;
import com.excelliance.kxqp.bean.CouponServerBean;
import com.excelliance.kxqp.bean.DeleteAppInfo;
import com.excelliance.kxqp.bean.ProxyServerCheckRequest;
import com.excelliance.kxqp.bean.ProxyServerCheckResult;
import com.excelliance.kxqp.bean.VMExternalArrayResult;
import com.excelliance.kxqp.bean.WXconfig;
import com.excelliance.kxqp.bean.WebDownBean;
import com.excelliance.kxqp.bitmap.bean.RankingItem;
import com.excelliance.kxqp.bitmap.model.AppInfo;
import com.excelliance.kxqp.bitmap.model.Entrance;
import com.excelliance.kxqp.bitmap.model.GiftPackBean;
import com.excelliance.kxqp.bitmap.model.RankBean;
import com.excelliance.kxqp.bitmap.model.ThirdLink;
import com.excelliance.kxqp.gs.appstore.model.ResponseData;
import com.excelliance.kxqp.gs.bean.AddGameBean;
import com.excelliance.kxqp.gs.bean.AppAreaBean;
import com.excelliance.kxqp.gs.bean.AppDownLoadInfoBean;
import com.excelliance.kxqp.gs.bean.AppDownLoadInfoChildBean;
import com.excelliance.kxqp.gs.bean.CityBean;
import com.excelliance.kxqp.gs.bean.GameAccountBean;
import com.excelliance.kxqp.gs.bean.ImportParams;
import com.excelliance.kxqp.gs.bean.ObbNativeInfo;
import com.excelliance.kxqp.gs.bean.PrepayInfoBean;
import com.excelliance.kxqp.gs.bean.RiotAccountBean;
import com.excelliance.kxqp.gs.bean.VersionBean;
import com.excelliance.kxqp.gs.bean.WhiteNativeInfo;
import com.excelliance.kxqp.gs.discover.model.request.RequestData;
import com.excelliance.kxqp.gs.g.t;
import com.excelliance.kxqp.gs.game.GameAttributesHelper;
import com.excelliance.kxqp.gs.game.GameType;
import com.excelliance.kxqp.gs.multi.down.model.DownBean;
import com.excelliance.kxqp.gs.service.ProxyDelayService;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.ui.add.InstallLocalActivity;
import com.excelliance.kxqp.gs.ui.gaccount.GGAccBean;
import com.excelliance.kxqp.gs.ui.home.MainFragment;
import com.excelliance.kxqp.model.GoogleAppDownloadInfo;
import com.excelliance.kxqp.platforms.ExcellianceAppInfo;
import com.excelliance.kxqp.sdk.StatisticsBuilder;
import com.excelliance.kxqp.sdk.UploadstaticData;
import com.excelliance.kxqp.task.model.BuyGoogleAccountSupportPayResult;
import com.excelliance.kxqp.ui.InitialData;
import com.excelliance.kxqp.ui.InstallActivity;
import com.excelliance.kxqp.ui.detail.RankingDetailInfo;
import com.excelliance.kxqp.ui.detail.category.CC1Tag;
import com.excelliance.kxqp.ui.detail.category.CategoryListActivity;
import com.excelliance.staticslio.StatisticsManager;
import com.fred.patcher.PatcherInstall;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.umeng.union.UMUnionConstants;
import com.zero.support.core.task.Response;
import io.github.prototypez.service.account.request.LoginRequest;
import io.reactivex.annotations.SchedulerSupport;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.NetworkInterface;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.apache.http.cookie.ClientCookie;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class as {

    private static String f11801a = null;

    private static int f11802b = -1;

    public static boolean E(Context context, String str) {
        return false;
    }

    public static com.excelliance.kxqp.y a(Context context, String str, String str2, VersionManager versionManager) {
        String str3;
        String str4;
        int i;
        PackageManager packageManager = context.getPackageManager();
        String str5 = "";
        PackageInfo a2 = a(context, str2);
        if (a2 != null) {
            str3 = a2.packageName;
            String str6 = a2.versionName;
            i = a2.versionCode;
            ApplicationInfo applicationInfo = a2.applicationInfo;
            if (applicationInfo != null) {
                new File(str2);
                az.d("GSUtil", "getSearchedGame before apkPath:" + str2);
                if (b.U(context) && bn.d(str2)) {
                    String str7 = str2 + "/base.apk";
                    applicationInfo.sourceDir = str7;
                    applicationInfo.publicSourceDir = str7;
                    az.d("GSUtil", "getSearchedGame after basePath:" + str7);
                } else {
                    applicationInfo.sourceDir = str2;
                    applicationInfo.publicSourceDir = str2;
                }
                str5 = applicationInfo.loadLabel(packageManager).toString();
            }
            az.d("GSUtil", "---- verN:" + str6 + "-verC:" + i + " ppa: " + str5);
            str4 = str5;
        } else {
            str3 = str;
            str4 = "";
            i = 0;
        }
        StringBuilder sb = new StringBuilder();
        sb.append((str4 + str3).hashCode());
        sb.append("");
        com.excelliance.kxqp.y yVar = new com.excelliance.kxqp.y(sb.toString(), null, "0", str4, str3, 1, 1, 0, 1);
        yVar.i = i + "";
        yVar.ac = null;
        yVar.x = 1;
        yVar.l = versionManager.a(yVar);
        yVar.s = "";
        yVar.q = "";
        yVar.r = "";
        yVar.o = 0;
        yVar.t = false;
        yVar.k = "0";
        yVar.h = 0L;
        yVar.g = str2;
        yVar.m = 0;
        yVar.y = 0;
        yVar.p = false;
        yVar.u = "";
        yVar.v = "";
        yVar.f = 1;
        yVar.j = "1";
        yVar.A = null;
        com.excelliance.kxqp.wr.a a3 = com.excelliance.kxqp.wr.a.a();
        ApplicationInfo d = a3.d(0, str3, 0);
        if (d != null && !"com.excean.android.vending".equals(str3)) {
            CharSequence a4 = a3.a(0, d);
            if (!TextUtils.isEmpty(a4)) {
                yVar.c = a4.toString();
            }
        } else if ("com.excean.android.vending".equals(str3)) {
            yVar.c = w.e(context, "tourist_play");
        }
        return yVar;
    }

    public static com.excelliance.kxqp.y a(Context context, VersionManager versionManager, String str) {
        String str2;
        String str3;
        int i;
        com.excelliance.kxqp.y yVar;
        PackageManager packageManager = context.getPackageManager();
        com.excelliance.kxqp.y yVar2 = null;
        try {
            try {
                PackageInfo packageInfo = packageManager.getPackageInfo(str, 0);
                if (packageInfo != null) {
                    ApplicationInfo applicationInfo = packageInfo.applicationInfo;
                    String charSequence = applicationInfo != null ? applicationInfo.loadLabel(packageManager).toString() : null;
                    str = packageInfo.packageName;
                    String str4 = packageInfo.versionName;
                    str3 = charSequence;
                    i = packageInfo.versionCode;
                    str2 = str4;
                } else {
                    str2 = null;
                    str3 = null;
                    i = 0;
                }
                StringBuilder sb = new StringBuilder();
                sb.append((str3 + str).hashCode());
                sb.append("");
                yVar = new com.excelliance.kxqp.y(sb.toString(), str2, "0", str3, str, 5, 1, 0, 1);
            } catch (Throwable unused) {
                return null;
            }
        } catch (PackageManager.NameNotFoundException e) {
            e = e;
        }
        try {
            yVar.i = i + "";
            yVar.ac = null;
            yVar.x = 1;
            yVar.l = versionManager.a(yVar);
            yVar.s = "";
            yVar.q = "";
            yVar.r = "";
            yVar.o = 0;
            yVar.t = false;
            yVar.k = "0";
            yVar.h = 0L;
            yVar.g = GameUtil.getIntance().g(str);
            yVar.m = 0;
            yVar.y = 0;
            yVar.p = false;
            yVar.u = "";
            yVar.v = "";
            yVar.f = 1;
            yVar.j = "1";
            yVar.A = null;
            return yVar;
        } catch (PackageManager.NameNotFoundException e2) {
            e = e2;
            yVar2 = yVar;
            e.printStackTrace();
            return yVar2;
        } catch (Throwable unused2) {
            return yVar;
        }
    }

    public static PackageInfo a(Context context, String str) {
        File[] listFiles;
        if (context == null || TextUtils.isEmpty(str)) {
            return null;
        }
        PackageManager packageManager = context.getPackageManager();
        az.d("GSUtil", "----" + str + "-len:" + str.length() + "-exist:" + new File(str).exists());
        if (str.length() == 0 || !new File(str).exists()) {
            return null;
        }
        File file = new File(str);
        if (file.isDirectory() && (listFiles = file.listFiles()) != null) {
            int i = 0;
            while (true) {
                if (i < listFiles.length) {
                    File file2 = listFiles[i];
                    if (file2 != null && file2.getName().equalsIgnoreCase("base.apk")) {
                        str = file2.getAbsolutePath();
                        break;
                    }
                    i++;
                } else {
                    break;
                }
            }
        }
        try {
            return packageManager.getPackageArchiveInfo(str, 1);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    @Deprecated
    public static String a(Context context) {
        return bn.g(context);
    }

    @Deprecated
    public static String b(Context context, String str) {
        ArrayList<ExcellianceAppInfo> a2 = InitialData.a(context).a();
        if (a2 == null || a2.size() <= 0) {
            return null;
        }
        Iterator<ExcellianceAppInfo> it = a2.iterator();
        while (it.hasNext()) {
            ExcellianceAppInfo next = it.next();
            if (TextUtils.equals(next.getAppPackageName(), str)) {
                return next.getPath();
            }
        }
        return null;
    }

    public static GoogleAppDownloadInfo a(int[] iArr, Context context) {
        ResponseData responseData;
        com.excean.a.b.a("GSUtil", String.format("GSUtil/getGoogleAppInfo:thread(%s)", Thread.currentThread().getName()));
        a.q a2 = new q.a().a("sdkInt", String.valueOf(Build.VERSION.SDK_INT)).a("issl", String.valueOf(1)).a("b64", com.excelliance.kxqp.gs.ui.home.b.a(context).c() ? "1" : "0").a("plugin", a(iArr)).a("SUPPORTED_32_BIT_ABIS", a()).a("manufacturer", Build.MANUFACTURER).a("CPU_ABI_RAM", m.a(context)).a("CPU_ABI2_RAM", m.b(context)).a(com.alipay.sdk.packet.e.n, Build.DEVICE).a();
        com.excelliance.kxqp.api.c cVar = new com.excelliance.kxqp.api.c(context);
        try {
            cVar.a(ApiManager.getInstance().b(context, "https://gapi.ourplay.com.cn/").k(a2));
        } catch (Error e) {
            e.printStackTrace();
        }
        try {
            responseData = cVar.b();
        } catch (Exception e2) {
            e2.printStackTrace();
            responseData = null;
        }
        com.excean.a.b.a("GSUtil", String.format("GSUtil/getGoogleAppInfo:thread(%s) responseData(%s)", Thread.currentThread().getName(), responseData));
        if (responseData == null) {
            return null;
        }
        if (responseData.code == 1) {
            return (GoogleAppDownloadInfo) responseData.data;
        }
        az.d("GSUtil", String.format("GSUtil/getGoogleAppInfo:thread(%s) fail msg(%s)", Thread.currentThread().getName(), responseData.msg));
        return null;
    }

    public static String a(int[] iArr) {
        return "{\"" + bs.a(0) + "\":" + iArr[0] + ",\"" + bs.a(1) + "\":" + iArr[1] + ",\"" + bs.a(2) + "\":" + iArr[2] + ",\"" + bs.a(3) + "\":" + iArr[3] + ",\"" + bs.a(4) + "\":" + iArr[4] + ",\"" + bs.a(5) + "\":" + iArr[5] + ",\"" + bs.a(6) + "\":" + iArr[6] + ",\"" + bs.a(7) + "\":" + iArr[7] + ",\"" + bs.a(8) + "\":" + iArr[8] + ",\"" + bs.a(9) + "\":" + iArr[9] + com.alipay.sdk.util.i.d;
    }

    public static String a() {
        if (Build.VERSION.SDK_INT < 21) {
            return "[]";
        }
        String[] strArr = Build.SUPPORTED_32_BIT_ABIS;
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        for (int i = 0; i < strArr.length; i++) {
            if (i == strArr.length - 1) {
                sb.append("\"" + strArr[i] + "\"");
            } else {
                sb.append("\"" + strArr[i] + "\",");
            }
        }
        sb.append("]");
        return sb.toString();
    }

    public static String b(Context context) {
        String str;
        String h = ck.h(context);
        az.d("GSUtil", "getCity----encryptToBase64:" + h + "-city: " + h);
        if (aq.v() || aq.e()) {
            str = "https://sdk.ourplay.com.cn/vpncountrylist.php";
        } else {
            str = "https://api.ourplay.com.cn/deloydload/countrylist";
        }
        az.d("GSUtil", "getCity: url:" + str);
        String a2 = bd.a(str, h);
        String str2 = null;
        if (!TextUtils.isEmpty(a2)) {
            str2 = bp.a(a2, "fuck_snsslmm_bslznw", "utf-8");
            if (aq.f() == -2) {
                a(context, h, str2);
            }
        }
        az.d("GSUtil", "线路测试getCity----result:" + str2);
        return str2;
    }

    public static String a(int[] iArr, String[] strArr, Context context) {
        String str;
        String a2 = ck.a(iArr, strArr, context);
        az.d("GSUtil", "getProxyConfig----config: " + a2);
        if (aq.v() || aq.e()) {
            str = "https://sdk.ourplay.com.cn/v1/deployDload.php";
        } else {
            str = "https://api.ourplay.com.cn/deloydload/index";
        }
        String a3 = bd.a(str, a2);
        String a4 = TextUtils.isEmpty(a3) ? null : bp.a(a3, "fuck_snsslmm_bslznw", "utf-8");
        ProxyDelayService.a("GSUtil", "线路测试getProxyConfig----result" + a4);
        return a4;
    }

    public static String c(Context context) {
        String a2 = bd.a("https://api.ourplay.com.cn/deloydload/specialips", com.excelliance.kxqp.api.f.a(context).toString());
        String a3 = !TextUtils.isEmpty(a2) ? bp.a(a2, "fuck_snsslmm_bslznw", "utf-8") : null;
        az.d("GSUtil", "getGameDomainList----result" + a3);
        return a3;
    }

    public static void a(Context context, String str, String str2) {
        String a2 = bd.a("https://sdk.ourplay.com.cn/vpncountrylist.php", str);
        if (TextUtils.isEmpty(a2) || TextUtils.isEmpty(str2)) {
            return;
        }
        String a3 = cn.a(a2);
        List<CityBean> a4 = ay.a(str2, true);
        List<CityBean> c = ay.c(a3);
        int t = t(context);
        if (c != null && t < c.size()) {
            String id = c.get(t).getId();
            if (a4 != null && a4.size() > 0) {
                int i = 0;
                while (true) {
                    if (i >= a4.size()) {
                        break;
                    }
                    if ((id + "_0").equals(a4.get(i).getId())) {
                        a(context, i);
                        break;
                    }
                    i++;
                }
            }
        }
        by.a(context, "global_config").a("old_upgrade_to_version_k_flag", -3);
    }

    public static String a(Context context, String str, int i) {
        String a2 = ck.a(context, str, i);
        az.d("GSUtil", "getRegProxyConfig----config: " + a2);
        String a3 = bd.a("https://sdk.ourplay.com.cn/v4/ggreg.php", a2);
        az.d("GSUtil", "getRegProxyConfig----result: " + a3);
        String a4 = !TextUtils.isEmpty(a3) ? bp.a(a3, "fuck_snsslmm_bslznw", "utf-8") : null;
        az.d("GSUtil", "getRegProxyConfig----result" + a4);
        return a4;
    }

    @Deprecated
    public static String a(Context context, String str, boolean z) {
        String a2;
        String a3 = ck.a(context, str, z);
        az.d("GSUtil", "getGameListType----blackList: " + a3);
        if (z) {
            a2 = bd.b("https://sdk.ourplay.com.cn/v1/vpn_check_black.php", a3, 3000, 3000);
        } else {
            a2 = bd.a("https://sdk.ourplay.com.cn/v1/vpn_check_black.php", a3);
        }
        if (TextUtils.isEmpty(a2)) {
            return null;
        }
        String a4 = bp.a(a2, "fuck_snsslmm_bslznw", "utf-8");
        az.d("GSUtil", "getGameListType----decodeResult:" + a4);
        return a4;
    }

    public static String d(Context context) {
        String i = ck.i(context);
        az.d("GSUtil", "getCommon----List: " + i);
        String a2 = bd.a("https://api.ourplay.com.cn/gp/conf", i);
        String a3 = !TextUtils.isEmpty(a2) ? bp.a(a2, "fuck_snsslmm_bslznw", "utf-8") : null;
        az.d("GSUtil", "getCommon----result: " + a3);
        return a3;
    }

    public static String a(String str, Context context) {
        String a2 = ck.a(str, context);
        az.d("GSUtil", "getShare----shareList: " + a2);
        String a3 = bd.a("https://sdk.ourplay.com.cn/share.php", a2);
        String a4 = !TextUtils.isEmpty(a3) ? bp.a(a3, "fuck_snsslmm_bslznw", "utf-8") : null;
        az.d("GSUtil", "getShare----getShare: " + a4);
        return a4;
    }

    public static String a(Context context, String str, JSONArray jSONArray) {
        return a(context, str, jSONArray, false);
    }

    public static String a(Context context, String str, JSONArray jSONArray, boolean z) {
        String a2 = ck.a(context, str, jSONArray, z, false);
        az.d("GSUtil", "Tourist----playAppNeededInfo: " + a2);
        String a3 = bd.a("https://sdk.ourplay.com.cn/v1/webApkDl.php", a2, 120000, 60000);
        String a4 = !TextUtils.isEmpty(a3) ? bp.a(a3, "fuck_snsslmm_bslznw", "utf-8") : null;
        az.d("GSUtil", "Tourist----result: " + a3 + "-----decodeResult:" + a4);
        return a4;
    }

    public static String b(Context context, String str, JSONArray jSONArray, boolean z) {
        String a2 = ck.a(context, str, jSONArray, z, true);
        az.d("GSUtil", "Tourist----getTouristPlayAppInfoUpdate: " + a2);
        String a3 = bd.a("https://api.ourplay.com.cn/apk/updatenew", a2, 120000, 60000);
        String a4 = !TextUtils.isEmpty(a3) ? bp.a(a3, "fuck_snsslmm_bslznw", "utf-8") : null;
        az.d("GSUtil", "Tourist----getTouristPlayAppInfoUpdate -----decodeResult:" + a4);
        return a4;
    }

    public static String b() {
        String a2 = bd.a("https://api.ourplay.com.cn/getinfo/accelerator", 120000, 60000);
        String a3 = !TextUtils.isEmpty(a2) ? bp.a(a2, "fuck_snsslmm_bslznw", "utf-8") : null;
        az.d("GSUtil", "Tourist----getNativeVPNInfo result: " + a2 + "-----decodeResult:" + a3);
        return a3;
    }

    public static String a(Context context, String str, JSONArray jSONArray, boolean z, AppDownLoadInfoBean appDownLoadInfoBean, boolean z2) {
        String a2 = ck.a(context, str, jSONArray, z, appDownLoadInfoBean, z2);
        az.d("GSUtil", "Tourist----getTouristPlayAppInfoDownload: " + a2);
        String a3 = bd.a("https://api.ourplay.com.cn/apk/downloadnew", a2, 120000, 60000);
        String a4 = !TextUtils.isEmpty(a3) ? bp.a(a3, "fuck_snsslmm_bslznw", "utf-8") : null;
        az.d("GSUtil", "Tourist----getTouristPlayAppInfoDownload result: " + a3 + "-----decodeResult:" + a4);
        return a4;
    }

    public static void a(Map<String, GameType> map, Context context, Map<String, String> map2, boolean z) {
        if (z) {
            List<AppNativeGametype> h = com.excelliance.kxqp.repository.a.a(context).h();
            List<com.excelliance.kxqp.platforms.d> o = com.excelliance.kxqp.repository.a.a(context).o();
            for (AppNativeGametype appNativeGametype : h) {
                if (map.containsKey(appNativeGametype.packageName)) {
                    GameType gameType = map.get(appNativeGametype.packageName);
                    Integer ext = gameType.getExt();
                    if (gameType != null && ext != null && (ext.intValue() & 16384) == 16384 && ext.intValue() != appNativeGametype.attr) {
                        az.d("GSUtil", "addGameType  pkg:" + appNativeGametype.packageName + " old ext type:" + appNativeGametype.attr + " new ext type:" + ext);
                        map2.put(appNativeGametype.packageName, appNativeGametype.packageName);
                    }
                }
            }
            if (o != null && o.size() > 0) {
                for (com.excelliance.kxqp.platforms.d dVar : o) {
                    if (map.get(dVar.f12774a) != null) {
                        map2.put(dVar.f12774a, dVar.f12774a);
                    }
                }
            }
        }
        Iterator<Map.Entry<String, GameType>> it = map.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry<String, GameType> next = it.next();
            GameType value = next.getValue();
            if (value != null) {
                Integer main = value.getMain();
                if (main != null && 7 == main.intValue()) {
                    az.d("GSUtil", "addGameType  pkg:" + next.getKey() + " gametype type:" + next.getValue());
                    map2.put(next.getKey(), next.getKey());
                }
                Integer ext2 = value.getExt();
                if (ext2 != null && ((ext2.intValue() & 128) == 128 || (ext2.intValue() & 8192) == 8192 || (ext2.intValue() & 262144) == 262144 || (ext2.intValue() & 16384) == 16384)) {
                    az.d("GSUtil", "addGameType  pkg:" + next.getKey() + " ext type:" + next.getValue());
                    map2.put(next.getKey(), next.getKey());
                }
            }
            if (!map2.containsKey(next.getKey())) {
                it.remove();
            }
        }
    }

    public static void a(Context context, String str, com.excelliance.kxqp.gs.m.a.f fVar, AppDownLoadInfoBean appDownLoadInfoBean) {
        com.excelliance.kxqp.gs.multi.a.a a2 = com.excelliance.kxqp.gs.multi.a.a.a(context);
        a2.delete(str);
        if (fVar != null && !fVar.e()) {
            Iterator<com.excelliance.kxqp.gs.m.a.e> it = fVar.r.iterator();
            while (it.hasNext()) {
                a2.delete(it.next().i + ":" + fVar.f + ":" + fVar.c + ":split");
            }
        }
        if (fVar != null && !fVar.c()) {
            a2.delete("main." + fVar.p.i + "." + fVar.c);
        }
        if (fVar != null && !fVar.d()) {
            a2.delete("patch." + fVar.q.i + "." + fVar.c);
        }
        if (!com.excelliance.kxqp.util.d.b.c || appDownLoadInfoBean == null || appDownLoadInfoBean.splitInfoIsEmpty()) {
            return;
        }
        Iterator<AppDownLoadInfoChildBean> it2 = appDownLoadInfoBean.mSplits.iterator();
        while (it2.hasNext()) {
            a2.delete(it2.next().name + ":" + appDownLoadInfoBean.versionCode + ":" + appDownLoadInfoBean.pkg + ":split");
        }
    }

    public static void a(com.excelliance.kxqp.gs.m.a.f fVar, ExcellianceAppInfo excellianceAppInfo, Context context) {
        a(context, excellianceAppInfo.getAppPackageName(), fVar, (com.excelliance.kxqp.util.d.b.c && excellianceAppInfo.appId == 0) ? com.excelliance.kxqp.gs.d.a.a().a(context, excellianceAppInfo.getAppPackageName()) : null);
    }

    public static String a(Context context, JSONArray jSONArray) {
        if (jSONArray == null) {
            jSONArray = new JSONArray();
        }
        JSONObject i = cn.i(context);
        try {
            i.put("pkgs", jSONArray);
            i.put("controlapi", 1);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        String a2 = bd.a("https://api.ourplay.com.cn/apk/check-white", i.toString());
        String a3 = TextUtils.isEmpty(a2) ? null : bp.a(a2, "fuck_snsslmm_bslznw", "utf-8");
        az.d("GSUtil", "checkAppFromList result: " + a2 + "-----decodeResult:" + a3);
        return a3;
    }

    public static String a(Context context, String str, long j) {
        String a2 = ck.a(context, str, j);
        az.d("GSUtil", "getObbInfo---ObbInfo: " + a2);
        String a3 = bd.a("https://sdk.ourplay.com.cn/obbInfo.php", a2);
        String a4 = !TextUtils.isEmpty(a3) ? bp.a(a3, "fuck_snsslmm_bslznw", "utf-8") : null;
        az.d("GSUtil", "getObbInfo----result: " + a3 + " ----getObbInfo: " + a4);
        return a4;
    }

    public static String a(Context context, String str, long j, JSONObject jSONObject) {
        String a2 = ck.a(context, str, j, jSONObject);
        az.d("GSUtil", "getObbInfo---ObbInfo: " + a2);
        String a3 = bd.a("https://sdk.ourplay.com.cn/obbInfo.php", a2);
        String a4 = !TextUtils.isEmpty(a3) ? bp.a(a3, "fuck_snsslmm_bslznw", "utf-8") : null;
        az.d("GSUtil", "getObbInfo----result: " + a3 + " ----getObbInfo: " + a4);
        return a4;
    }

    public static ObbNativeInfo b(Context context, String str, long j) {
        return PatcherInstall.f15641a ? ck.b(context, str, j) : new ObbNativeInfo();
    }

    public static String c(Context context, String str) {
        String b2 = ck.b(context, str);
        az.d("GSUtil", "initialShareAppInfo----shareInfo: " + b2);
        String a2 = bd.a("https://sdk.ourplay.com.cn/apkip.php", b2);
        String a3 = !TextUtils.isEmpty(a2) ? bp.a(a2, "fuck_snsslmm_bslznw", "utf-8") : null;
        az.i("GSUtil", "initialShareAppInfo----result: " + a2 + "-----decodeResult:" + a3);
        return a3;
    }

    public static String a(Context context, int i, HashMap<String, String> hashMap) {
        String a2 = ck.a(context, i, hashMap);
        String a3 = bd.a("https://sdk.ourplay.com.cn/oauth_id.php", a2);
        az.d("GSUtil", "getOauthId: " + a3 + " oauthIdInfo: " + a2);
        if (TextUtils.isEmpty(a3)) {
            a3 = null;
        } else if (i == 1 || i == 5) {
            by.a(context, "sp_total_info").a("idAuth", a3);
            a3 = bp.a(a3, "fuck_snsslmm_bslznw", "utf-8");
        }
        az.d("GSUtil", "OauthId: " + a3);
        return a3;
    }

    public static String a(Context context, int i, List<String> list) {
        String a2 = ck.a(context, i, list);
        String a3 = bd.a("https://sdk.ourplay.com.cn/oauth_id.php", a2);
        az.d("GSUtil", "getOauthId2: " + a3 + " oauthIdInfo: " + a2);
        if (TextUtils.isEmpty(a3)) {
            a3 = null;
        } else if (i == 1 || i == 5) {
            by.a(context, "sp_total_info").a("idAuth", a3);
            a3 = bp.a(a3, "fuck_snsslmm_bslznw", "utf-8");
        }
        az.d("GSUtil", "OauthId2: " + a3);
        return a3;
    }

    public static String a(Context context, int i, Map<String, String> map) {
        String a2 = ck.a(context, i, map);
        String a3 = bd.a("https://sdk.ourplay.com.cn/card.php", a2);
        az.d("GSUtil", "getGoogleCard: " + a3 + " googlecardInfo: " + a2);
        String a4 = !TextUtils.isEmpty(a3) ? bp.a(a3, "fuck_snsslmm_bslznw", "utf-8") : null;
        az.d("GSUtil", "getGoogleCard: " + a4);
        return a4;
    }

    public static Map<String, com.excelliance.kxqp.gs.ui.gaccount.b> e(Context context) {
        String b2 = by.a(context, "sp_total_info").b(String.format("SP_SERVER_GOOGLE_ACCOUNT_AID_%S_RID_%S", GameUtil.getIntance().r(context), bx.a().a(context)), "");
        if (TextUtils.isEmpty(b2)) {
            return null;
        }
        try {
            String a2 = c.a(b2, "keics_e21p3kds8s");
            HashMap hashMap = new HashMap();
            if (!TextUtils.isEmpty(a2)) {
                for (com.excelliance.kxqp.gs.ui.gaccount.b bVar : ay.a(context, a2).b()) {
                    if (bVar != null) {
                        hashMap.put(bVar.d(), bVar);
                    }
                }
            }
            return hashMap;
        } catch (Exception e) {
            az.e("GSUtil", "getServerGoogleAccountCache/ex:" + e);
            return null;
        }
    }

    public static String b(Context context, int i, Map<String, String> map) {
        int i2;
        if (b.e(context)) {
            i2 = 1;
        } else if (b.g(context)) {
            i2 = 2;
        } else if (b.h(context)) {
            i2 = 3;
        } else {
            i2 = b.j(context) ? 4 : 0;
        }
        String a2 = ck.a(context, i, i2, map);
        String a3 = bd.a("https://api.ourplay.com.cn/coupon/get-combination-goods", a2);
        az.d("GSUtil", "getGoogleAccount: " + a3 + " googleaccount: " + a2);
        String str = null;
        az.d("GSUtil", "getGoogleAccount: " + a3 + " googleaccount: " + a2);
        if (!TextUtils.isEmpty(a3)) {
            str = bp.a(a3, "fuck_snsslmm_bslznw", "utf-8");
            if (!TextUtils.isEmpty(str)) {
                try {
                    new JSONObject(str);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        az.d("GSUtil", "getGoogleAccount: " + str);
        return str;
    }

    public static void f(Context context) {
        boolean z = true;
        String b2 = b(context, 1, (Map<String, String>) null);
        if (TextUtils.isEmpty(b2)) {
            return;
        }
        try {
            JSONObject jSONObject = new JSONObject(b2);
            if (jSONObject.has("data")) {
                int optInt = jSONObject.optJSONObject("data").optInt("combination_online");
                by a2 = by.a(context, "sp_total_info");
                if (optInt != 1) {
                    z = false;
                }
                a2.a("sp_key_gaccount_combine_vip_online_status", z);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static String g(Context context) {
        ResponseData responseData;
        long a2;
        com.excelliance.kxqp.api.c cVar = new com.excelliance.kxqp.api.c(context);
        cVar.a(ApiManager.getInstance().a(context, 15000L, 15000L, "https://gapi.ourplay.com.cn/").n(new q.a().a("areaVc", "1").a("isAct", com.excelliance.kxqp.util.ae.a(context)).a()));
        String str = null;
        try {
            responseData = cVar.b();
        } catch (Throwable th) {
            th.printStackTrace();
            responseData = null;
        }
        if (responseData != null && responseData.data != 0) {
            str = bp.a((String) responseData.data, "fuck_snsslmm_bslznw", "utf-8");
            if (!cd.a(str)) {
                try {
                    JSONObject jSONObject = new JSONObject(str);
                    JSONArray optJSONArray = jSONObject.optJSONArray("account");
                    if (optJSONArray != null && optJSONArray.length() > 0) {
                        by.a(context, "sp_total_info").a(String.format("SP_SERVER_GOOGLE_ACCOUNT_AID_%S_RID_%S", GameUtil.getIntance().r(context), bx.a().a(context)), c.a(str));
                        by.a(context, "sp_total_info").a("sp_key_bought_google_account_down", true);
                        com.excelliance.kxqp.gs.g.c.a().a("is_bought_google_acc", true);
                        if (com.excean.ab_builder.c.a.f(context) || com.excean.ab_builder.c.a.O(context)) {
                            com.excelliance.kxqp.bitmap.ui.b.a().a(new t.e(1, 1));
                        }
                    }
                    String optString = jSONObject.optString("qgk");
                    if (!TextUtils.isEmpty(optString)) {
                        by.a(context, "sp_total_info").a("google_account_sell_qq_qgk", optString);
                    }
                    long a3 = by.a(context, "sp_config").a("sp_key_kwai_activity_discount", (Long) (-1L));
                    if (ViewSwitcher.a(context).a()) {
                        long optInt = jSONObject.optInt("accActshow", 0);
                        int optInt2 = jSONObject.optInt("countDown", 0);
                        if (a3 == -1) {
                            a2 = (optInt << 60) | (ce.a(context) + (optInt2 * 1000));
                        } else {
                            a2 = (optInt << 60) | (by.a(context, "sp_config").a("sp_key_kwai_activity_discount", (Long) (-1L)) & (-1152921504606846977L));
                        }
                        by.a(context, "sp_config").a("sp_key_kwai_activity_discount", a2);
                        az.d("GSUtil", "getGoogleEntranceSwitch: kwaiValue::" + a2);
                        if (optInt != 0) {
                            com.excelliance.kxqp.bitmap.ui.b.a().a(new MainFragment.d(a2));
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        return str;
    }

    public static GGAccBean a(Context context, Map<String, String> map) {
        com.excelliance.kxqp.api.c cVar = new com.excelliance.kxqp.api.c(context);
        cVar.a(ApiManager.getInstance().a(context, 15000L, 15000L, "https://gapi.ourplay.com.cn/").o(new q.a().a("gganum", map != null ? map.get("gganum") : "").a("numFlag", "1").a("isAct", com.excelliance.kxqp.util.ae.a(context)).a()));
        GGAccBean gGAccBean = (GGAccBean) cVar.b().data;
        if (gGAccBean != null && gGAccBean.account != null) {
            gGAccBean.setMoney(gGAccBean.account.money);
            gGAccBean.setTotalNum(gGAccBean.account.number);
            gGAccBean.setThreshold(gGAccBean.account.threshold);
            gGAccBean.setDeduceAmount(gGAccBean.account.deduceAmount);
            gGAccBean.setVipDay(gGAccBean.account.vipDay);
            if (gGAccBean.account.actMoney > 0.0d) {
                gGAccBean.setActMoney(gGAccBean.account.actMoney);
            } else {
                gGAccBean.setActMoney(gGAccBean.account.money - gGAccBean.account.deduceAmount);
            }
            gGAccBean.setActSlogan(gGAccBean.account.actSlogan);
            if (gGAccBean.getAct() == 0) {
                long a2 = by.a(context, "sp_config").a("sp_key_kwai_activity_discount", (Long) (-1L));
                if (a2 != -1) {
                    by.a(context, "sp_config").a("sp_key_kwai_activity_discount", (a2 & (-1152921504606846977L)) | 0);
                }
            } else {
                String b2 = by.a(context, "sp_config").b("sp_key_kwai_activity_price_and_text", (String) null);
                if (!TextUtils.isEmpty(b2)) {
                    try {
                        String[] split = b2.split(File.pathSeparator);
                        double parseDouble = Double.parseDouble(split[0]);
                        if (parseDouble > 0.0d) {
                            gGAccBean.setActMoney(parseDouble);
                        }
                        gGAccBean.setActSlogan(split[1]);
                    } catch (Exception e) {
                        e.printStackTrace();
                        b(context, gGAccBean);
                    }
                } else {
                    b(context, gGAccBean);
                }
            }
            az.d("GSUtil", "ggAccBean: " + gGAccBean);
        }
        return gGAccBean;
    }

    private static void b(Context context, GGAccBean gGAccBean) {
        String valueOf = String.valueOf(gGAccBean.account.actMoney);
        String valueOf2 = String.valueOf(gGAccBean.account.actSlogan);
        by.a(context, "sp_config").a("sp_key_kwai_activity_price_and_text", valueOf + File.pathSeparator + valueOf2);
        gGAccBean.setActMoney(gGAccBean.account.actMoney);
        gGAccBean.setActSlogan(gGAccBean.account.actSlogan);
    }

    public static String h(Context context) {
        Response<String> a2 = ((com.excelliance.kxqp.api.b) com.zero.support.core.api.a.a(com.excelliance.kxqp.api.b.class)).a().c().a();
        az.d("GSUtil", "getGoogleAccountFromGc2 response:" + a2);
        if (a2.d() == null) {
            return null;
        }
        String a3 = bp.a(a2.d(), "fuck_snsslmm_bslznw", "utf-8");
        az.d("GSUtil", "getGoogleAccountFromGc2: result:" + a3);
        if (cd.a(a3)) {
            return a3;
        }
        try {
            JSONArray optJSONArray = new JSONObject(a3).optJSONArray("account");
            if (optJSONArray == null || optJSONArray.length() <= 0) {
                return a3;
            }
            by.a(context, "sp_total_info").a(String.format("SP_SERVER_GOOGLE_ACCOUNT_AID_%S_RID_%S", GameUtil.getIntance().r(context), bx.a().a(context)), c.a(a3));
            by.a(context, "sp_total_info").a("sp_key_bought_google_account_down", true);
            com.excelliance.kxqp.gs.g.c.a().a("is_bought_google_acc", true);
            if (!com.excean.ab_builder.c.a.f(context) && !com.excean.ab_builder.c.a.O(context)) {
                return a3;
            }
            com.excelliance.kxqp.bitmap.ui.b.a().a(new t.e(1, 1));
            return a3;
        } catch (Exception e) {
            e.printStackTrace();
            return a3;
        }
    }

    public static RiotAccountBean i(Context context) {
        JSONObject optJSONObject;
        String a2 = bd.a("https://api.ourplay.com.cn/coupon/get-riot-list", com.excelliance.kxqp.api.f.a(context).toString());
        RiotAccountBean riotAccountBean = new RiotAccountBean();
        if (a2 != null) {
            try {
                String b2 = com.excelliance.kxqp.task.store.c.b(a2);
                az.d("GSUtil", "getRiotAccountList: decodeGoogleAccount:" + b2);
                if (!cd.a(b2) && (optJSONObject = new JSONObject(b2).optJSONObject("data")) != null) {
                    JSONArray optJSONArray = optJSONObject.optJSONArray("riot_account_arr");
                    if (optJSONArray != null && optJSONArray.length() > 0) {
                        int length = optJSONArray.length();
                        for (int i = 0; i < length; i++) {
                            JSONObject jSONObject = optJSONArray.getJSONObject(i);
                            if (jSONObject != null) {
                                GameAccountBean gameAccountBean = new GameAccountBean();
                                gameAccountBean.account = jSONObject.optString("account");
                                gameAccountBean.email = jSONObject.optString("email");
                                gameAccountBean.password = jSONObject.optString("password");
                                gameAccountBean.buy_time = jSONObject.optString("buy_time");
                                gameAccountBean.type = 1;
                                riotAccountBean.accountList.add(gameAccountBean);
                            }
                        }
                    }
                    riotAccountBean.isShow = optJSONObject.optInt("bind");
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return riotAccountBean;
    }

    public static void a(final Context context, final boolean z) {
        tp.f(new Runnable() {
            @Override
            public void run() {
                PrepayInfoBean j = as.j(context);
                if (j.hasCombination || j.hasPreVip) {
                    as.a(context, z, 0);
                }
            }
        });
    }

    public static void a(final Context context, final boolean z, final int i) {
        tp.i(new Runnable() {
            @Override
            public void run() {
                bo.a(context, "", new Runnable() {
                    @Override
                    public void run() {
                        com.excelliance.kxqp.gs.router.a.a.f8074a.invokeLogin(new LoginRequest.Builder(context).setLoginFrom(i).build());
                        if (z) {
                            bz.a().a(context, 157000, 3, "会员开通页面-弹窗中点击确认登录");
                        }
                    }
                });
                if (z) {
                    bz.a().a(context, 157000, 2, "会员开通页面-付费 后温馨提示弹窗的展示");
                }
            }
        });
    }

    public static PrepayInfoBean j(Context context) {
        PrepayInfoBean prepayInfoBean = new PrepayInfoBean();
        String a2 = bd.a("https://api.ourplay.com.cn/coupon/get-prepay-info", com.excelliance.kxqp.api.f.a(context).toString());
        if (a2 != null) {
            try {
                String b2 = com.excelliance.kxqp.task.store.c.b(a2);
                if (!cd.a(b2)) {
                    JSONObject optJSONObject = new JSONObject(b2).optJSONObject("data");
                    prepayInfoBean.hasPreVip = optJSONObject.optInt("has_previp") == 1;
                    prepayInfoBean.hasCombination = optJSONObject.optInt("has_combination") == 1;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return prepayInfoBean;
    }

    public static void d(Context context, String str) {
        boolean z = false;
        if (!TextUtils.isEmpty(str)) {
            try {
                z = new JSONObject(str).optBoolean("show");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        az.d("GSUtil", "run allowShow: " + z);
        by.a(context, "sp_total_info").a("SP_GOOGLE_ACCOUNT_ENTRANCE", z);
    }

    public static String k(Context context) {
        String n = ck.n(context);
        az.d("GSUtil", "queryUploadTargetFile uploadNeedInfo: " + n);
        if (TextUtils.isEmpty(n)) {
            return "";
        }
        String a2 = bd.a("https://api.ourplay.com.cn/libcatch/index", n);
        az.d("GSUtil", "queryUploadTargetFile: " + a2 + " uploadNeedInfo: " + n);
        String a3 = TextUtils.isEmpty(a2) ? null : bp.a(a2, "fuck_snsslmm_bslznw", "utf-8");
        az.d("GSUtil", "queryUploadTargetFile: " + a3);
        return a3;
    }

    public static String a(int i, Context context) {
        try {
            JSONObject i2 = cn.i(context);
            i2.put("account", bx.a().a(context));
            i2.put("gc", 1);
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("gganum", i);
            i2.put("myggac", jSONObject);
            az.d("GSUtil", "request:" + i2.toString());
            az.d("GSUtil", "encrypt request:" + cn.b(i2.toString()));
            return bd.a("https://sdk.ourplay.com.cn/acc/ggcode.php", i2.toString());
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }

    public static Boolean a(boolean z) {
        try {
            if (k() || !z) {
                String a2 = bd.a("https://www.google.com.hk/", 5000, 5000);
                if (!cd.a(a2)) {
                    try {
                        boolean a3 = a(a2);
                        az.d("GSUtil", "ggWeb: " + a3);
                        if (a3) {
                            return false;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        az.d("GSUtil", "ggWeb: " + e.getMessage());
                    }
                }
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        return true;
    }

    public static boolean a(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        int indexOf = str.indexOf("<title>Google</title>");
        az.d("GSUtil", "ggWeb Title: " + indexOf);
        if (indexOf <= 0) {
            return false;
        }
        int c = cd.c(str, "google");
        az.d("GSUtil", "isggWeb: " + c);
        return c > 20;
    }

    public static String e(Context context, String str) {
        az.d("GSUtil", "reportGpDownloader: " + str);
        String c = bd.c("https://sdk.ourplay.com.cn/downloadlink.php", str);
        az.d("GSUtil", "reportGpDownloader: " + c);
        return c;
    }

    public static boolean a(Context context, String str, int i, String str2, int i2) {
        Map<String, String> a2 = ck.a(context, str, i, str2, i2);
        az.d("GSUtil", "reportComplaint: " + a2);
        String a3 = bd.a("https://sdk.ourplay.com.cn/userfeedback.php", a2, (Map<String, File>) null);
        az.d("GSUtil", "reportComplaint result: " + a3);
        if (TextUtils.isEmpty(a3)) {
            return false;
        }
        try {
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return new JSONObject(a3).getInt("code") == 1;
    }

    public static boolean a(Context context, int i, String str, String str2, String str3) {
        Map<String, String> a2 = ck.a(context, i, str, str2, str3);
        az.d("GSUtil", "reportApplyAccelerate: " + a2);
        String a3 = bd.a("https://sdk.ourplay.com.cn/userfeedback_new.php", a2, (Map<String, File>) null);
        az.d("GSUtil", "reportApplyAccelerate result: " + a3);
        return "success".equals(a3);
    }

    public static boolean a(Context context, Map<String, String> map, Map<String, File> map2) {
        Map<String, String> a2 = ck.a(context, map);
        for (String str : a2.keySet()) {
            az.d("GSUtil", "reportFeedBack: " + str + " value: " + a2.get(str));
        }
        String a3 = bd.a("https://sdk.ourplay.com.cn/userfeedback_new.php", a2, map2);
        az.d("GSUtil", "reportFeedBack result: " + a3);
        return !TextUtils.isEmpty(a3);
    }

    public static void f(Context context, String str) {
        az.d("GSUtil", "GameObbInfo: " + bd.c("https://sdk.ourplay.com.cn/v1/obbInfoCollect.php", str));
    }

    public static void l(Context context) {
        if (bf.e(context)) {
            az.d("GSUtil", "checkMarketUpdatePlugin enter ");
            String a2 = bd.a("https://api.ourplay.com.cn//gpushjar/isopen", cn.i(context).toString());
            az.d("GSUtil", "checkMarketUpdatePlugin result:" + a2);
            if (!cd.a(a2)) {
                a2 = cn.a(a2);
                az.d("GSUtil", "checkMarketUpdatePlugin de result:" + a2);
                if (a2 != null) {
                    try {
                        JSONObject jSONObject = new JSONObject(a2);
                        if (jSONObject.optInt("code") == 0) {
                            by a3 = by.a(context, "sp_market_jar_switch");
                            boolean booleanValue = a3.b("sp_key_yuedong_switch", false).booleanValue();
                            int optInt = jSONObject.optInt("yuedong_is_open");
                            az.d("GSUtil", "checkMarketUpdatePlugin yuedong_is_open :" + optInt);
                            a3.a("sp_key_yuedong_switch", optInt == 1);
                            if (!booleanValue && optInt == 1) {
                                az.d("GSUtil", "0 checkMarketUpdatePlugin yuedong_is_open :" + optInt);
                                com.excelliance.kxqp.gs.g.ac.a().b(context.getApplicationContext());
                            }
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                        az.d("GSUtil", "checkMarketUpdatePlugin decodeResult is null ");
                    }
                } else {
                    az.d("GSUtil", "checkMarketUpdatePlugin de json fail ");
                }
            }
            az.d("GSUtil", "checkMarketUpdatePlugin: " + a2);
        }
    }

    public static void m(Context context) {
        az.d("GSUtil", "getVendingWhiteUrlList enter pkgList");
        String a2 = bd.a("https://api.ourplay.com.cn//gwhitelist/whitelist", cn.i(context).toString());
        az.d("GSUtil", "getVendingWhiteUrlList result:" + a2);
        if (cd.a(a2)) {
            return;
        }
        String a3 = cn.a(a2);
        az.d("GSUtil", "getVendingWhiteUrlList de decodeResult:" + a3);
        if (a3 != null) {
            try {
                JSONObject jSONObject = new JSONObject(a3);
                if (jSONObject.optInt("code") == 0) {
                    JSONObject optJSONObject = jSONObject.optJSONObject("data");
                    if (optJSONObject != null) {
                        JSONArray optJSONArray = optJSONObject.optJSONArray("urls");
                        ArrayList<String> arrayList = new ArrayList<>();
                        if (optJSONArray != null && optJSONArray.length() > 0) {
                            for (int i = 0; i < optJSONArray.length(); i++) {
                                String optString = optJSONArray.optString(i);
                                if (!cd.a(optString)) {
                                    arrayList.add(optString);
                                    az.d("GSUtil", "getVendingWhiteUrlList url:" + optString);
                                }
                            }
                        }
                        if (arrayList.size() > 0) {
                            com.excelliance.kxqp.gs.g.y.a().a(arrayList);
                            return;
                        }
                        return;
                    }
                    az.d("GSUtil", "getVendingWhiteUrlList data is null ");
                    return;
                }
                return;
            } catch (JSONException e) {
                e.printStackTrace();
                az.d("GSUtil", "getVendingWhiteUrlList decodeResult is null ");
                return;
            }
        }
        az.d("GSUtil", "getVendingWhiteUrlList de json fail ");
    }

    public static List<ExcellianceAppInfo> n(Context context) {
        boolean z;
        az.d("GSUtil", String.format("GSUtil/getUserApp:thread(%s)", Thread.currentThread().getName()));
        VersionManager versionManager = VersionManager.getInstance();
        versionManager.a(context);
        ArrayList<ExcellianceAppInfo> a2 = InitialData.a(context).a();
        az.d("GSUtil", "--- getUseApp-size: " + a2.size());
        ListIterator<ExcellianceAppInfo> listIterator = a2.listIterator();
        while (listIterator.hasNext()) {
            ExcellianceAppInfo next = listIterator.next();
            String appPackageName = next.getAppPackageName();
            if (!TextUtils.equals(next.getGameType(), "5") || i(context, appPackageName)) {
                z = false;
            } else {
                az.i("GSUtil", "----pkgN: " + appPackageName);
                versionManager.d(appPackageName);
                b(context.getApplicationContext(), appPackageName, 1);
                PlatSdk.getInstance().b(context, appPackageName, 0);
                com.excelliance.kxqp.gs.gamelanguage.k.a(context.getApplicationContext()).b(appPackageName);
                c(context, appPackageName, false);
                listIterator.remove();
                if (next.getDownloadStatus() == 8 || TextUtils.equals(String.valueOf(5), next.gameType)) {
                    com.excelliance.kxqp.repository.a.a(context).a(new DeleteAppInfo(next, 13));
                }
                z = true;
            }
            if (bs.d(next.getAppPackageName()) && !bs.f(next.getAppPackageName()) && !z) {
                listIterator.remove();
            }
        }
        az.d("GSUtil", " -- final userApp:" + a2);
        return a2;
    }

    public static boolean o(Context context) {
        List<ExcellianceAppInfo> b2 = com.excelliance.kxqp.repository.a.a(context).b();
        ArrayList<ExcellianceAppInfo> arrayList = new ArrayList();
        for (ExcellianceAppInfo excellianceAppInfo : b2) {
            if (excellianceAppInfo.getTogp() == 1) {
                arrayList.add(excellianceAppInfo);
            }
        }
        if (arrayList.size() <= 0) {
            return false;
        }
        for (ExcellianceAppInfo excellianceAppInfo2 : arrayList) {
            az.d("GSUtil", "isToKill : " + excellianceAppInfo2);
            if (excellianceAppInfo2.getDownloadStatus() == 9 || excellianceAppInfo2.getDownloadStatus() == 0 || excellianceAppInfo2.getDownloadStatus() == 2) {
                az.d("GSUtil", "1 isToKill : " + excellianceAppInfo2);
                return true;
            }
        }
        return false;
    }

    public static List<String> p(Context context) {
        List<String> q = q(context);
        q.add("com.google.android.gms");
        q.add("com.google.android.play.games");
        q.add("com.android.vending");
        q.add("com.exce.wv");
        q.add("com.excean.android.vending");
        q.add("com.excean.safetynet");
        return q;
    }

    public static List<String> q(Context context) {
        ArrayList<ExcellianceAppInfo> a2 = InitialData.a(context).a();
        ArrayList arrayList = new ArrayList();
        Iterator<ExcellianceAppInfo> it = a2.iterator();
        while (it.hasNext()) {
            String appPackageName = it.next().getAppPackageName();
            if (!bs.d(appPackageName)) {
                arrayList.add(appPackageName);
            }
        }
        return arrayList;
    }

    public static ExcellianceAppInfo b(String str, Context context) {
        return com.excelliance.kxqp.repository.a.a(context).b(str);
    }

    public static ArrayList<VersionBean> r(Context context) {
        VersionBean versionBean;
        ArrayList<VersionBean> arrayList = new ArrayList<>();
        for (int i = 0; i < 11; i++) {
            String a2 = bs.a(i);
            try {
                ExcellianceAppInfo b2 = b(a2, context);
                if (b2 == null) {
                    arrayList.add(new VersionBean("", 0L, a2));
                } else {
                    String path = b2.getPath();
                    VersionBean g = g(context, path);
                    if (!g.isNull().booleanValue()) {
                        g.setPath(path);
                        arrayList.add(g);
                    } else {
                        PackageInfo a3 = com.excelliance.kxqp.wr.a.a().a(0, a2, 0);
                        if (a3 != null) {
                            versionBean = new VersionBean(a3.versionName, a3.versionCode, a2);
                        } else {
                            versionBean = new VersionBean("", 0L, a2);
                        }
                        versionBean.setPath(path);
                        arrayList.add(versionBean);
                    }
                }
            } catch (Exception unused) {
            }
        }
        return arrayList;
    }

    public static VersionBean g(Context context, String str) {
        PackageInfo a2 = a(context, str);
        if (a2 == null) {
            return new VersionBean("", 0L, null);
        }
        return new VersionBean(a2.versionName, a2.versionCode, a2.packageName);
    }

    public static int h(Context context, String str) {
        PackageInfo a2 = a(context, str);
        if (a2 != null) {
            return a2.versionCode;
        }
        return 0;
    }

    public static String c() {
        String str = null;
        try {
            String str2 = (String) Class.forName("android.os.SystemProperties").getMethod("get", String.class, String.class).invoke(null, "ro.yunos.version", null);
            try {
                str = !TextUtils.isEmpty(str2) ? str2.trim() : str2;
                az.d("GSUtil", "isYunOS:[" + str + "]");
            } catch (Exception e) {
                e = e;
                str = str2;
                e.printStackTrace();
                if (!TextUtils.isEmpty(str)) {
                }
            }
        } catch (Exception e2) {
            e = e2;
        }
        return !TextUtils.isEmpty(str) ? "" : str.trim();
    }

    public static boolean d() {
        if (f11802b != -1) {
            return f11802b == 1;
        }
        try {
            Class<?> cls = Class.forName("com.huawei.system.BuildEx");
            Method method = cls.getMethod("getOsBrand", new Class[0]);
            ClassLoader classLoader = cls.getClassLoader();
            if (classLoader != null && classLoader.getParent() == null) {
                boolean equals = "harmony".equals(method.invoke(cls, new Object[0]));
                f11802b = equals ? 1 : 0;
                return equals;
            }
        } catch (ClassNotFoundException | NoSuchMethodException | Exception unused) {
        }
        f11802b = 0;
        return false;
    }

    public static String e() {
        try {
            Class<?> cls = Class.forName("android.os.SystemProperties");
            return (String) cls.getDeclaredMethod("get", String.class).invoke(cls, "hw_sc.build.platform.version");
        } catch (Throwable th) {
            th.printStackTrace();
            return "";
        }
    }

    public static boolean i(Context context, String str) {
        try {
            return context.getPackageManager().getPackageInfo(str, 0) != null;
        } catch (Throwable unused) {
            return false;
        }
    }

    public static void b(final Context context, final String str, final int i) {
        az.d("GSUtil", String.format("GSUtil/uploadAPPRemove:thread(%s) pkg(%s) position(%s)", Thread.currentThread().getName(), str, Integer.valueOf(i)));
        tp.f(new Runnable() {
            @Override
            public void run() {
                az.d("GSUtil", "uploadAPPRemove enter ");
                JSONObject jSONObject = new JSONObject();
                try {
                    jSONObject.put(WebActionRouter.KEY_PKG, str);
                    jSONObject.put("position", i);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                StatisticsBuilder.getInstance().builder().setDescription("被动删除应用").setPriKey1(62000).setStringKey1(jSONObject.toString()).buildImmediate(context);
            }
        });
    }

    public static void a(final Context context, final String str, final String str2, final int i, final String str3, final int i2) {
        tp.f(new Runnable() {
            @Override
            public void run() {
                File[] listFiles;
                az.d("GSUtil", "uploadAPPRemove enter ");
                JSONObject jSONObject = new JSONObject();
                try {
                    if (str != null) {
                        jSONObject.put(WebActionRouter.KEY_PKG, str);
                    } else {
                        jSONObject.put(WebActionRouter.KEY_PKG, "null");
                    }
                    if (str2 != null) {
                        jSONObject.put("apkPath", str2);
                    } else {
                        jSONObject.put("apkPath", "null");
                    }
                    if (str3 != null) {
                        jSONObject.put("error_des", str3);
                    }
                    if (!cd.a(str2)) {
                        File file = new File(str2);
                        if (file.exists() && file.isDirectory() && (listFiles = file.listFiles()) != null) {
                            JSONArray jSONArray = new JSONArray();
                            for (File file2 : listFiles) {
                                if (file2.getName().endsWith(".apk")) {
                                    jSONArray.put(file2.getName());
                                }
                            }
                            jSONObject.put("apkPathDetail", jSONArray);
                        }
                    }
                    jSONObject.put("ret", i);
                    jSONObject.put("position", i2);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                az.d("GSUtil", "uploadAPPRemove jsonObject: " + jSONObject.toString());
                StatisticsBuilder.getInstance().builder().setDescription("卡在安装中").setPriKey1(68000).setStringKey1(jSONObject.toString()).buildImmediate(context);
            }
        });
    }

    public static String a(Exception exc) {
        StringWriter stringWriter = new StringWriter();
        PrintWriter printWriter = new PrintWriter(stringWriter);
        try {
            exc.printStackTrace(printWriter);
            String str = exc.getMessage() + ">>" + stringWriter.toString();
            printWriter.close();
            return str;
        } catch (Exception unused) {
            printWriter.close();
            return "";
        } catch (Throwable th) {
            printWriter.close();
            throw th;
        }
    }

    public static void a(final Context context, final String str, final GameAttrsRequest gameAttrsRequest, final JSONObject jSONObject, final int i) {
        az.d("GSUtil", "uploadAPPRemove enter ");
        if (gameAttrsRequest == null || jSONObject == null) {
            return;
        }
        tp.f(new Runnable() {
            @Override
            public void run() {
                az.d("GSUtil", "uploadAPPRemove enter 1");
                try {
                    if (!s.a(GameAttrsRequest.this.getPackageInfos())) {
                        for (GameAttrsRequest.PackageInfo packageInfo : GameAttrsRequest.this.getPackageInfos()) {
                            if (TextUtils.equals(packageInfo.getPkgName(), str)) {
                                jSONObject.put("sign", packageInfo.getSign());
                            }
                        }
                    }
                    jSONObject.put(WebActionRouter.KEY_PKG, str);
                    jSONObject.put("position", i);
                    az.d("GSUtil", "uploadAPPRemove reCheck: " + GameAttrsRequest.this.toString());
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                StatisticsBuilder.getInstance().builder().setDescription("被动删除应用").setPriKey1(64000).setStringKey1(jSONObject.toString()).buildImmediate(context);
            }
        });
    }

    public static int j(Context context, String str) {
        List<CityBean> a2 = ay.a(by.a(context, "sp_city_config").b("sp_city_config", ""), true);
        for (int i = 0; i < a2.size(); i++) {
            CityBean cityBean = a2.get(i);
            if (!TextUtils.isEmpty(cityBean.getId()) && cityBean.getId().equals(str)) {
                return i;
            }
        }
        return 0;
    }

    public static void k(Context context, String str) {
        az.d("GSUtil", "saveReginSpecialAreaId() regin" + str);
        by.a(context, "sp_config_vpn_regin_id").a("sp_city_last_special_area_id", str);
    }

    public static String s(Context context) {
        String b2 = by.a(context, "sp_config_vpn_regin_id").b("sp_city_last_special_area_id", "");
        az.d("GSUtil", "getPreReginSpecialAreaId() preReginSpecialAreaId:" + b2);
        return b2;
    }

    public static void a(Context context, int i) {
        if (i < 0) {
            Log.e("GSUtil", "saveReginVpnId() regin:" + i);
            return;
        }
        by.a(context, "sp_config_vpn_regin_id").a("sp_config_vpn_regin_id", i);
    }

    public static int t(Context context) {
        int c = by.a(context, "sp_config_vpn_regin_id").c("sp_config_vpn_regin_id", 0);
        az.d("GSUtil", "getPreReginVpnIndex()" + c);
        if (c >= 0) {
            return c;
        }
        Log.e("GSUtil", "getPreReginVpnIndex() preReginVpnIndex:" + c);
        return 0;
    }

    public static void b(Context context, int i) {
        az.d("GSUtil", "saveReginVpnIdShowOnly() " + i);
        if (i < 0) {
            by.a(context, "sp_config_vpn_regin_id").a("sp_config_vpn_regin_id_show_only");
        } else {
            by.a(context, "sp_config_vpn_regin_id").a("sp_config_vpn_regin_id_show_only", i);
        }
    }

    public static int u(Context context) {
        int c = by.a(context, "sp_config_vpn_regin_id").c("sp_config_vpn_regin_id_show_only", -1);
        az.d("GSUtil", "getPreReginVpnIndexShowOnly() " + c);
        return c;
    }

    public static String v(Context context) {
        int t = t(context);
        az.d("GSUtil", "GPonReceive index1: " + t);
        az.d("GSUtil", "GPonReceive index2: " + t);
        if (w(context)) {
            return w.e(context, "optimal_node");
        }
        if (by.a(context, "sp_total_info").b("sp_disconnectioin", false).booleanValue()) {
            return w.e(context, "noconnection");
        }
        String c = c(context, t);
        az.d("GSUtil", "GPonReceive reginName3: " + c);
        return c;
    }

    public static boolean w(Context context) {
        return by.a(context, "sp_proxy_delay_config").b("auto_connect_optimal_proxy_v2", true).booleanValue();
    }

    public static void x(Context context) {
        b(context, true);
    }

    public static void b(Context context, boolean z) {
        by.a(context, "sp_proxy_delay_config").a("auto_connect_optimal_proxy_v2", z);
    }

    public static boolean y(Context context) {
        return by.a(context, "sp_proxy_delay_config").b("auto_connect_optimal_proxy_v2", true).booleanValue();
    }

    public static String z(Context context) {
        List<CityBean> c;
        int t = t(context);
        String b2 = by.a(context, "sp_city_config").b("sp_city_config", "");
        if (!aq.v() && !aq.e()) {
            c = ay.a(context, ay.a(b2, true));
        } else {
            c = ay.c(b2);
        }
        return (c == null || c.size() <= 0 || c.size() <= t) ? "" : c.get(t).getId();
    }

    public static void l(Context context, String str) {
        by.a(context, "sp_config_vpn_regin_id").a("sp_key_config_vpn_available_regin_id", str);
    }

    public static String A(Context context) {
        return by.a(context, "sp_config_vpn_regin_id").b("sp_key_config_vpn_available_regin_id", "");
    }

    public static String c(Context context, int i) {
        List<CityBean> a2 = ay.a(context, ay.a(by.a(context, "sp_city_config").b("sp_city_config", ""), !aq.v()));
        return (a2 == null || a2.size() <= i || i < 0) ? "" : a2.get(i).getName();
    }

    public static void c(Context context, boolean z) {
        com.excelliance.kxqp.gs.launch.f.a().a(!z);
        by.a(context, ".sp.common.disposable.flag.info").a("sp_common_disposable_cache_prepare_environment_result", z);
    }

    public static boolean d(Context context, boolean z) {
        return by.a(context, ".sp.common.disposable.flag.info").b("sp_common_disposable_cache_prepare_environment_result", z).booleanValue();
    }

    public static String d(Context context, int i) {
        List<CityBean> a2;
        if (i < 0 || (a2 = ay.a(context, ay.a(by.a(context, "sp_city_config").b("sp_city_config", ""), !aq.v()))) == null || a2.size() <= 0) {
            return "";
        }
        for (int i2 = 0; i2 < a2.size(); i2++) {
            CityBean cityBean = a2.get(i2);
            az.i("GSUtil", "getReginIdByIndex: " + i2);
            if (i == i2) {
                return cityBean.getId();
            }
        }
        return "";
    }

    public static int m(Context context, String str) {
        List<CityBean> a2;
        if (TextUtils.isEmpty(str) || (a2 = ay.a(context, ay.a(by.a(context, "sp_city_config").b("sp_city_config", ""), !aq.v()))) == null || a2.size() <= 0) {
            return -1;
        }
        for (int i = 0; i < a2.size(); i++) {
            CityBean cityBean = a2.get(i);
            az.i("GSUtil", "GPonReceive----getReginId: " + cityBean);
            if (TextUtils.equals(str, cityBean.getId())) {
                return i;
            }
        }
        return -1;
    }

    public static Map<Integer, String> a(Context context, List<CityBean> list) {
        HashMap hashMap = new HashMap();
        if (list != null && list.size() > 0) {
            HashMap hashMap2 = new HashMap();
            for (int i = 0; i < list.size(); i++) {
                hashMap2.put(list.get(i).getId(), list.get(i));
            }
            List<CityBean> a2 = ay.a(context, ay.a(by.a(context, "sp_city_config").b("sp_city_config", ""), !aq.v()));
            if (a2 != null && a2.size() > 0) {
                for (int i2 = 0; i2 < a2.size(); i2++) {
                    CityBean cityBean = a2.get(i2);
                    az.i("GSUtil", "getReginIds----getReginId: " + cityBean);
                    if (hashMap2.containsKey(cityBean.getId())) {
                        az.i("GSUtil", "getReginIds----id: " + i2);
                        hashMap.put(Integer.valueOf(i2), cityBean.getId());
                    }
                }
            }
        }
        return hashMap;
    }

    public static int B(Context context) {
        return by.a(context, "global_config").c("SP_GLOBAL_KEY_LOGIN_GOOGLE_ACCOUNT_COUNT", 0);
    }

    public static void e(Context context, int i) {
        by.a(context, "global_config").a("SP_GLOBAL_KEY_LOGIN_GOOGLE_ACCOUNT_COUNT", i);
    }

    public static void b(Context context, List<com.excelliance.kxqp.gs.ui.account.c> list) {
        HashSet hashSet = new HashSet();
        Iterator<com.excelliance.kxqp.gs.ui.account.c> it = list.iterator();
        while (it.hasNext()) {
            String str = it.next().f8499b.name;
            if (str.contains("gmail")) {
                az.d("GSUtil", String.format("GSUtil/cacheGoogleAccounts:thread(%s) name(%s)", Thread.currentThread().getName(), str));
                hashSet.add(str);
            }
        }
        context.getSharedPreferences("name_google_account_name", 0).edit().putStringSet("key_google_accounts", hashSet).apply();
    }

    public static List<com.excelliance.kxqp.gs.ui.account.c> C(Context context) {
        Set<String> stringSet;
        if (context == null || (stringSet = com.excelliance.kxqp.gs.ui.medal.a.d.a(context).getSharedPreferences("name_google_account_name", 0).getStringSet("key_google_accounts", null)) == null || stringSet.size() == 0) {
            return null;
        }
        az.d("GSUtil", String.format("GSUtil/getGoogleAccountsCache:thread(%s) googleAccountList(%s)", Thread.currentThread().getName(), Integer.valueOf(stringSet.size())));
        ArrayList arrayList = new ArrayList();
        Iterator<String> it = stringSet.iterator();
        while (it.hasNext()) {
            arrayList.add(new com.excelliance.kxqp.gs.ui.account.c(SchedulerSupport.NONE, new Account(it.next(), "com.google")));
        }
        return arrayList;
    }

    public static List<com.excelliance.kxqp.gs.ui.account.c> f() {
        az.d("GSUtil", String.format("GSUtil/getAllAccounts:thread(%s)", Thread.currentThread().getName()));
        ArrayList arrayList = new ArrayList();
        com.excelliance.kxqp.wr.a a2 = com.excelliance.kxqp.wr.a.a();
        if (a2 != null) {
            HashMap<String, ArrayList<Account>> d = a2.d(0, "com.google", "*ALL*");
            if (d != null) {
                if (d.size() > 0) {
                    Set<Map.Entry<String, ArrayList<Account>>> entrySet = d.entrySet();
                    if (entrySet != null) {
                        if (entrySet.size() > 0) {
                            Iterator<Map.Entry<String, ArrayList<Account>>> it = entrySet.iterator();
                        }
                    }
                }
            }
        }
        return arrayList;
    }

    public static boolean g() {
        return !s.a(com.excelliance.kxqp.gs.receiver.a.f8002a.b());
    }

    public static String h() {
        return com.excelliance.kxqp.wr.a.a().c(0, "com.google");
    }

    public static void D(Context context) {
        String h = h();
        az.d("GSUtil", "---- currentConfig " + h);
        if (TextUtils.isEmpty(h)) {
            a(context, 0, SchedulerSupport.NONE);
        }
    }

    public static String E(Context context) {
        return n(context, null);
    }

    public static String n(Context context, String str) {
        if (TextUtils.isEmpty(str)) {
            str = h();
        }
        return (TextUtils.equals(SchedulerSupport.NONE, str) || TextUtils.equals(null, str)) ? F(context) : str;
    }

    public static boolean a(Context context, int i, String str) {
        az.d("GSUtil", "account type");
        o(context, str);
        return com.excelliance.kxqp.wr.a.a().c(i, "com.google", str);
    }

    public static void i() {
        if (TextUtils.equals(SchedulerSupport.NONE, h())) {
            j();
        }
    }

    public static void j() {
        com.excelliance.kxqp.wr.a a2 = com.excelliance.kxqp.wr.a.a();
        a2.f(0, "com.android.vending", "*CURRENT*");
        a2.f(0, "com.google.android.play.games", "*CURRENT*");
    }

    public static String F(Context context) {
        List<CityBean> a2 = ay.a(by.a(context, "sp_city_config").b("sp_city_config", ""), !aq.v());
        if (a2 == null || a2.size() <= 0) {
            return null;
        }
        return a2.get(0).getId();
    }

    public static void c(String str, Context context) {
        String h = h();
        com.excelliance.kxqp.wr.a a2 = com.excelliance.kxqp.wr.a.a();
        int a3 = bs.a(str);
        az.d("GSUtil", "----pkg:" + str + "----index: " + a3);
        boolean booleanValue = by.a(context, "sp_total_info").b("sp_key_support_new_data_isolation", false).booleanValue();
        az.d("GSUtil", "switchPackageData pkgName:" + str + "isNewDataIsolation:" + booleanValue);
        if (booleanValue) {
            if (TextUtils.equals(str, "com.android.vending")) {
                a2.a(0, str);
                a2.b(0, str, h);
                return;
            }
            return;
        }
        if (a3 > 0) {
            a2.a(0, str);
            a2.b(0, str, h);
            return;
        }
        String b2 = a2.b(0, str);
        az.d("GSUtil", "switchPackageData----pkgName:" + str + "----configSave: " + b2);
        if (TextUtils.isEmpty(h)) {
            return;
        }
        a2.a(0, str);
        a2.b(0, str, b2);
    }

    public static void o(Context context, String str) {
        ArrayList<ExcellianceAppInfo> a2 = InitialData.a(context).a();
        com.excelliance.kxqp.wr.a a3 = com.excelliance.kxqp.wr.a.a();
        boolean booleanValue = by.a(context, "sp_total_info").b("sp_key_support_new_data_isolation", false).booleanValue();
        az.d("GSUtil", "switchAllPkgData isNewDataIsolation:" + booleanValue);
        Iterator<ExcellianceAppInfo> it = a2.iterator();
        while (it.hasNext()) {
            String appPackageName = it.next().getAppPackageName();
            int a4 = bs.a(appPackageName);
            if (booleanValue) {
                if (TextUtils.equals(appPackageName, "com.android.vending")) {
                    a3.a(0, appPackageName);
                    a3.b(0, appPackageName, str);
                    return;
                }
            } else if (a4 > 0) {
                a3.a(0, appPackageName);
                a3.b(0, appPackageName, str);
            } else {
                String b2 = a3.b(0, appPackageName);
                az.d("GSUtil", "switchAllPkgData ----pkgName:" + appPackageName + "----configSave: " + b2);
                if (!TextUtils.isEmpty(str)) {
                    a3.a(0, appPackageName);
                    a3.b(0, appPackageName, b2);
                }
            }
        }
    }

    public static void G(Context context) {
        by a2 = by.a(context, "sp_register_ui_event");
        a2.b("sp_register_ui_event", false);
        com.excelliance.kxqp.wr.a a3 = com.excelliance.kxqp.wr.a.a();
        boolean b2 = a3.b(0, "com.android.vending", 1L, false);
        boolean b3 = a3.b(0, "com.android.vending", 4L, false);
        a2.a("sp_register_ui_event", b2);
        az.d("", "REGISTER_UI_EVENT: " + b2 + "  " + b3);
    }

    public static void a(List<AddGameBean> list) {
        Collections.sort(list, new Comparator<AddGameBean>() {
            @Override
            public int compare(AddGameBean addGameBean, AddGameBean addGameBean2) {
                return addGameBean.order - addGameBean2.order;
            }
        });
    }

    public static void a(DownBean downBean) {
        if (downBean.size > 20971520) {
            downBean.threadNum = 5;
            long j = downBean.size / downBean.threadNum;
            long j2 = 2 * j;
            long j3 = 3 * j;
            long j4 = 4 * j;
            downBean.startPos = new long[]{0, j, j2, j3, j4};
            downBean.endPos = new long[]{j - 1, j2 - 1, j3 - 1, j4 - 1, downBean.size - 1};
            return;
        }
        if (downBean.size > 10485760) {
            downBean.threadNum = 3;
            long j5 = downBean.size / downBean.threadNum;
            long j6 = 2 * j5;
            downBean.startPos = new long[]{0, j5, j6};
            downBean.endPos = new long[]{j5 - 1, j6 - 1, downBean.size - 1};
            return;
        }
        downBean.threadNum = 1;
        downBean.startPos = new long[]{0};
        downBean.endPos = new long[]{downBean.size - 1};
    }

    public static void p(Context context, String str) {
        ProxyDelayService.b(context, str);
        try {
            au a2 = au.a();
            if (a2.d(str, context)) {
                try {
                    PlatSdk.getInstance().a(bn.k(context, str), str, context);
                    b(context.getApplicationContext(), str, 17);
                    context.sendBroadcast(new Intent(context.getPackageName() + VersionManager.q));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            a2.g(str, context);
            GameAttributesHelper.getInstance().b(str);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        com.excelliance.kxqp.wr.a a3 = com.excelliance.kxqp.wr.a.a();
        try {
            for (String str2 : new String[]{"com.google.android.projection.gearhead"}) {
                if (TextUtils.equals(str2, str)) {
                    az.d("GSUtil", " " + str + " " + a3.a(0, str, 1073741824L, false));
                }
            }
        } catch (Exception unused) {
        }
        try {
            az.d("GSUtil", "initAfterGameInstalled  " + str);
            b(context, str, true);
        } catch (Exception unused2) {
        }
        try {
            for (String str3 : new String[]{"com.google.android.apps.photos"}) {
                if (TextUtils.equals(str, str3)) {
                    az.d("", "REGISTER_UI_EVENT: " + a3.b(0, str3, 4L, false) + " libName: " + str);
                }
            }
        } catch (Exception e3) {
            e3.printStackTrace();
        }
        try {
            a3.b(0, str, 8L, false);
            a3.b(0, str, 1L, false);
        } catch (Exception e4) {
            e4.printStackTrace();
        }
    }

    @Deprecated
    public static boolean b(Context context, String str, boolean z) {
        if (!TextUtils.equals(str, "com.google.android.play.games")) {
            return false;
        }
        by.a(context, "sp_total_info").a(str + ".sp.show.game.affix", z);
        az.d("GSUtil", "showOrHideGame " + z);
        return true;
    }

    public static String b(Context context, String str, String str2) {
        String f = bn.f(context, str);
        an.a(str2, f);
        return f;
    }

    public static void q(Context context, String str) {
        File file = new File(bn.f(context, str));
        if (file.exists()) {
            an.c(file.getParentFile().getAbsolutePath());
            az.d("Install", "Install delete");
        }
    }

    public static void b(String str) {
        com.excelliance.kxqp.wr.a.a().a(0, str);
    }

    public static String r(Context context, String str) {
        String a2 = ck.a(context, str);
        az.d("GSUtil", "Tourist----playAppNeededInfo: " + a2);
        String a3 = bd.a("https://sdk.ourplay.com.cn/mulobbInfo.php", a2, 120000, 60000);
        String a4 = !TextUtils.isEmpty(a3) ? bp.a(a3, "fuck_snsslmm_bslznw", "utf-8") : null;
        az.d("GSUtil", "getObbInfo----result: " + a3 + " ----getObbInfo: " + a4);
        return a4;
    }

    public static boolean a(int i) {
        boolean z;
        String[] strArr;
        if (Build.VERSION.SDK_INT < 21 || (strArr = Build.SUPPORTED_64_BIT_ABIS) == null) {
            z = false;
        } else {
            z = false;
            for (String str : strArr) {
                if (!TextUtils.isEmpty(str) && str.contains("64")) {
                    z = true;
                }
            }
        }
        return i != 2 || z;
    }

    public static int H(Context context) {
        if (aq.v() || aq.e()) {
            return 0;
        }
        int t = t(context);
        List<CityBean> a2 = ay.a(context, ay.a(by.a(context, "sp_city_config").b("sp_city_config", ""), true));
        if (a2 == null || a2.size() <= 0 || a2.size() <= t) {
            return 0;
        }
        return a2.get(t).getType();
    }

    public static void c(Context context, String str, String str2) {
        String str3;
        String str4;
        int i;
        StringBuilder sb = new StringBuilder();
        sb.append("mockGame packageName: ");
        String str5 = str;
        sb.append(str5);
        sb.append(" apkPath: ");
        sb.append(str2);
        az.d("GSUtil", sb.toString());
        VersionManager versionManager = VersionManager.getInstance();
        String str6 = "";
        PackageInfo a2 = a(context, str2);
        if (a2 != null) {
            str5 = a2.packageName;
            String str7 = a2.versionName;
            int i2 = a2.versionCode;
            ApplicationInfo applicationInfo = a2.applicationInfo;
            if (applicationInfo != null) {
                applicationInfo.sourceDir = str2;
                applicationInfo.publicSourceDir = str2;
                str6 = applicationInfo.loadLabel(context.getPackageManager()).toString();
            }
            az.d("GSUtil", "mockGame verN:" + str7 + "-verC:" + i2 + " ppa: " + str6);
            str3 = str6;
            str4 = str7;
            i = i2;
        } else {
            str3 = "";
            str4 = null;
            i = 0;
        }
        StringBuilder sb2 = new StringBuilder();
        sb2.append((str3 + str5).hashCode());
        sb2.append("");
        com.excelliance.kxqp.y yVar = new com.excelliance.kxqp.y(sb2.toString(), str4, "0", str3, str5, 1, 1, 0, 1);
        yVar.i = i + "";
        yVar.x = 1;
        yVar.l = versionManager.a(yVar);
        yVar.s = "";
        yVar.q = "";
        yVar.r = "";
        yVar.t = false;
        yVar.k = "0";
        yVar.g = str2;
        yVar.p = false;
        yVar.u = "";
        yVar.v = "";
        yVar.j = "1";
        com.excelliance.kxqp.j a3 = com.excelliance.kxqp.util.o.a(yVar);
        a3.e = 7;
        ExcellianceAppInfo a4 = com.excelliance.kxqp.util.o.a(context, a3);
        ExcellianceAppInfo a5 = InitialData.a(context).a(-1, a4.getUid(), a4.getAppPackageName());
        if (a5 != null) {
            a4.setDownloadStatus(a5.getDownloadStatus());
        }
        a4.setVersionCode(i);
        a4.setGameType("1");
        az.d("GSUtil", "mockGame appInfo: " + a4);
        versionManager.a(a4, 0, false, false);
        au.a().a(context, "apk", 0, str5);
    }

    public static boolean k() {
        try {
            Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
            if (networkInterfaces == null) {
                return false;
            }
            Iterator it = Collections.list(networkInterfaces).iterator();
            while (it.hasNext()) {
                NetworkInterface networkInterface = (NetworkInterface) it.next();
                if (networkInterface.isUp() && networkInterface.getInterfaceAddresses().size() != 0) {
                    az.o("GSUtil", "" + networkInterface.getName());
                    if ("tun0".equals(networkInterface.getName()) || "ppp0".equals(networkInterface.getName())) {
                        return true;
                    }
                }
            }
            return false;
        } catch (Throwable th) {
            th.printStackTrace();
            return false;
        }
    }

    public static void s(Context context, String str) {
        try {
            boolean a2 = PlatSdk.getInstance().a(com.excelliance.kxqp.wr.a.a(), 0, str);
            Log.i("GSUtil", "compatible: " + a2);
            by.a(context, "GAME_ABI_UNCOMPATIBLE").a(str, a2);
            by.a(context, "GAME_ABI_UNCOMPATIBLE_IGNORE").a(str, false);
        } catch (Exception e) {
            e.printStackTrace();
            Log.i("GSUtil", "compatible: " + e.getMessage());
        }
    }

    public static String c(String str) {
        return (TextUtils.isEmpty(str) || new File(str).exists()) ? str : "";
    }

    public static boolean d(String str) {
        try {
            Iterator<com.excelliance.kxqp.gs.ui.account.c> it = f().iterator();
            while (it.hasNext()) {
                if (TextUtils.equals(str, it.next().f8499b.name)) {
                    return true;
                }
            }
            return false;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    public static void t(Context context, String str) {
        az.d("GSUtil", "beforeGameInstalled:" + str);
        az.a();
        ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b(str);
        if (b2 == null || b2.getTogp() == 1) {
            return;
        }
        ExcellianceAppInfo a2 = InitialData.a(context).a(-1, 0, str);
        az.d("GSUtil", "beforeGameInstalled excellianceAppInfo:" + a2);
        if (a2 != null) {
            int downloadStatus = a2.getDownloadStatus();
            String gameType = a2.getGameType();
            if (String.valueOf(7).equals(gameType) && downloadStatus == 1) {
                VersionManager.a(context, a2, 14);
                az.d("GSUtil", "GAME_TYPE_TOURIST update success:" + n(context));
                c(context, str, 14);
                return;
            }
            if (String.valueOf(5).equals(gameType) && downloadStatus == 8) {
                VersionManager.a(context, a2, 14);
                az.d("GSUtil", "GAME_TYPE_IMPORT update success:" + n(context));
                c(context, str, 14);
                return;
            }
            az.d("GSUtil", "gameType:" + gameType + " downloadStatus:" + downloadStatus);
            StringBuilder sb = new StringBuilder();
            sb.append("userApp:");
            sb.append(n(context));
            az.d("GSUtil", sb.toString());
        }
    }

    public static void c(Context context, String str, int i) {
        Intent intent = new Intent(context.getPackageName() + VersionManager.q);
        intent.putExtra("installingPackageName", str);
        intent.putExtra("downloadStatus", i);
        context.sendBroadcast(intent);
    }

    public static boolean l() {
        return !s.a(f());
    }

    public static void a(Context context, ExcellianceAppInfo excellianceAppInfo) {
        az.d("GSUtil", String.format("deleteObb/mainObb:%s patchObb:%s native install:%b", excellianceAppInfo.getMainObb(), excellianceAppInfo.getPatchObb(), Boolean.valueOf(i(context, excellianceAppInfo.getAppPackageName()))));
        if (!b(context, excellianceAppInfo) || i(context, excellianceAppInfo.getAppPackageName())) {
            return;
        }
        if (TextUtils.equals(excellianceAppInfo.getGameType(), String.valueOf(7))) {
            if (!TextUtils.isEmpty(excellianceAppInfo.getMainObb())) {
                an.c(bn.a(context, excellianceAppInfo.getAppPackageName(), excellianceAppInfo.getMainObb()));
            }
            if (TextUtils.isEmpty(excellianceAppInfo.getPatchObb())) {
                return;
            }
            an.c(bn.a(context, excellianceAppInfo.getAppPackageName(), excellianceAppInfo.getPatchObb()));
            return;
        }
        an.a(new File(bn.c(context, excellianceAppInfo.getAppPackageName())));
    }

    public static boolean b(Context context, ExcellianceAppInfo excellianceAppInfo) {
        return excellianceAppInfo.hasObb() || new File(bn.c(context, excellianceAppInfo.getAppPackageName())).exists();
    }

    public static CityBean I(Context context) {
        List<CityBean> a2 = ay.a(context, ay.a(by.a(context, "sp_city_config").b("sp_city_config", ""), true));
        int t = t(context);
        if (a2 == null || a2.size() <= t) {
            return null;
        }
        return a2.get(t);
    }

    public static boolean J(Context context) {
        boolean z;
        String displayName = Locale.getDefault().getDisplayName();
        String displayLanguage = Locale.getDefault().getDisplayLanguage();
        boolean g = ViewSwitcher.a(context).g();
        az.d("GSUtil", "isAvailable/feature:" + displayName + ", language = " + displayLanguage + ", all = " + g);
        boolean z2 = (((displayName == null || !displayName.contains("中文")) && (displayLanguage == null || !displayLanguage.startsWith("zh"))) || displayName.contains("繁體") || displayName.contains("台灣") || displayName.contains("香港") || displayName.contains("澳门")) ? false : true;
        az.d("GSUtil", "isAvailable/isSimpleZh:" + z2);
        if (ae.a(context)) {
            az.d("GSUtil", "当前为模拟器");
            return z2 || g;
        }
        ArrayList<String> arrayList = new ArrayList();
        int a2 = ae.a(context, 0);
        int a3 = ae.a(context, 1);
        String str = null;
        String b2 = (a2 == 1 || a2 == 0) ? null : ae.b(context, 0);
        if (a3 != 1 && a3 != 0) {
            str = ae.b(context, 1);
        }
        az.d("GSUtil", "isAvailable/simOperator1:" + b2 + ", simOperator2 = " + str);
        arrayList.add(b2);
        arrayList.add(str);
        Iterator it = arrayList.iterator();
        while (true) {
            if (!it.hasNext()) {
                z = false;
                break;
            }
            if (!TextUtils.isEmpty((String) it.next())) {
                z = true;
                break;
            }
        }
        if (!z) {
            return z2 || g;
        }
        for (String str2 : arrayList) {
            if (!TextUtils.isEmpty(str2) && str2.startsWith(UploadstaticData.FUN_ID_460)) {
                return true;
            }
        }
        if (g) {
            return g;
        }
        return false;
    }

    public static String K(Context context) {
        JSONObject jSONObject = new JSONObject();
        String displayName = Locale.getDefault().getDisplayName();
        String displayLanguage = Locale.getDefault().getDisplayLanguage();
        try {
            jSONObject.put("feature", displayName);
            jSONObject.put(com.umeng.analytics.pro.am.N, displayLanguage);
            jSONObject.put("isSimulator", ae.a(context));
            jSONObject.put("rid", ay.a(bx.a().a(context), 0));
            JSONArray jSONArray = new JSONArray();
            for (int i = 0; i < 2; i++) {
                int a2 = ae.a(context, i);
                if (a2 != 1 && a2 != 0) {
                    jSONArray.put(ae.b(context, i));
                }
            }
            jSONObject.put("simOperators", jSONArray);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return jSONObject.toString();
    }

    public static void c(final Context context, final String str, final long j) {
        tp.f(new Runnable() {
            @Override
            public void run() {
                JSONObject i = cn.i(context);
                if (i != null) {
                    try {
                        JSONArray jSONArray = new JSONArray();
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("lib", str);
                        jSONObject.put(RankingItem.KEY_VER, j);
                        jSONArray.put(jSONObject);
                        i.put("pkgs", jSONArray);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    az.d("GSUtil", " uploadObbVersionDifferentButMd5Same requestParams:" + i.toString());
                    bd.a("https://api.ourplay.com.cn/apk/obbcheck", i.toString());
                }
            }
        });
    }

    public static void b(List<ExcellianceAppInfo> list) {
        if (list == null || list.size() <= 0) {
            return;
        }
        Iterator<ExcellianceAppInfo> it = list.iterator();
        while (it.hasNext()) {
            if (it.next().market_install_local == 1) {
                it.remove();
            }
        }
    }

    public static void L(final Context context) {
        az.d("GSUtil", "resumeUploadMarketAppAndRemoveMarketNoshort enter");
        List<ExcellianceAppInfo> b2 = com.excelliance.kxqp.repository.a.a(context).b();
        if (b2 == null && b2.size() == 0) {
            return;
        }
        ArrayList<ExcellianceAppInfo> arrayList = new ArrayList();
        for (ExcellianceAppInfo excellianceAppInfo : b2) {
            if ((bs.a(excellianceAppInfo.getAppPackageName()) == -1 && excellianceAppInfo.market_install_local == 1) || ((excellianceAppInfo.shortcut_type & 4) == 4 && excellianceAppInfo.market_install_local_upload != 1)) {
                arrayList.add(excellianceAppInfo);
            }
        }
        if (arrayList.size() > 0) {
            for (final ExcellianceAppInfo excellianceAppInfo2 : arrayList) {
                if (excellianceAppInfo2.market_install_local == 1 && excellianceAppInfo2.haveApkInstalled()) {
                    try {
                        if (context.getPackageManager().getPackageInfo(excellianceAppInfo2.getAppPackageName(), 0) != null) {
                            bz.a().a(context, excellianceAppInfo2.getAppPackageName(), false);
                        }
                        VersionManager versionManager = VersionManager.getInstance();
                        versionManager.a(context);
                        versionManager.d(excellianceAppInfo2.getAppPackageName());
                        by.a(context, "sp_flow_plugin_version").a(excellianceAppInfo2.getAppPackageName());
                        bn.b(context, excellianceAppInfo2.getAppPackageName(), excellianceAppInfo2.getPatch());
                        by.a(context, "sp_total_info").a(excellianceAppInfo2.getAppPackageName() + ".allow.open");
                        au.a().a(excellianceAppInfo2.getAppPackageName(), context);
                    } catch (PackageManager.NameNotFoundException unused) {
                    }
                } else if ((excellianceAppInfo2.shortcut_type & 4) == 4 && excellianceAppInfo2.market_install_local_upload != 1 && excellianceAppInfo2.haveApkInstalled()) {
                    bz.a().a(context, excellianceAppInfo2.getAppPackageName(), false);
                    com.excelliance.kxqp.repository.a.a(context).a().runInTransaction(new Runnable() {
                        @Override
                        public void run() {
                            ExcellianceAppInfo b3 = com.excelliance.kxqp.repository.a.a(context).b(excellianceAppInfo2.getAppPackageName());
                            az.i("GSUtil", "install success lastInfo:" + b3);
                            if (b3 != null) {
                                b3.market_install_local_upload = 1;
                                com.excelliance.kxqp.repository.a.a(context).a(b3);
                            }
                        }
                    });
                }
            }
        }
    }

    public static void u(final Context context, final String str) {
        az.d("GSUtil", "uploadMarketAppAndRemoveMarketNoshort: pkg = " + str);
        tp.f(new Runnable() {
            @Override
            public void run() {
                az.d("GSUtil", "uploadMarketAppAndRemoveMarketNoshort:1 pkg = " + str);
                final ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b(str);
                if (b2 != null) {
                    az.d("GSUtil", "uploadMarketAppAndRemoveMarketNoshort: excellianceAppInfo = " + b2);
                    if (b2.market_install_local == 1 && b2.haveApkInstalled()) {
                        az.d("GSUtil", "uploadMarketAppAndRemoveMarketNoshort: 1 excellianceAppInfo = " + b2);
                        bz.a().a(context, b2.getAppPackageName(), false);
                        VersionManager versionManager = VersionManager.getInstance();
                        versionManager.a(context);
                        versionManager.d(b2.getAppPackageName());
                        by.a(context, "sp_flow_plugin_version").a(b2.getAppPackageName());
                        bn.b(context, b2.getAppPackageName(), b2.getPatch());
                        by.a(context, "sp_total_info").a(b2.getAppPackageName() + ".allow.open");
                        au.a().a(b2.getAppPackageName(), context);
                        return;
                    }
                    if ((b2.shortcut_type & 4) == 4 && b2.market_install_local_upload != 1 && b2.haveApkInstalled()) {
                        bz.a().a(context, b2.getAppPackageName(), false);
                        com.excelliance.kxqp.repository.a.a(context).a().runInTransaction(new Runnable() {
                            @Override
                            public void run() {
                                ExcellianceAppInfo b3 = com.excelliance.kxqp.repository.a.a(context).b(b2.getAppPackageName());
                                az.i("GSUtil", "install success lastInfo:" + b3);
                                if (b3 != null) {
                                    b3.market_install_local_upload = 1;
                                    com.excelliance.kxqp.repository.a.a(context).a(b3);
                                }
                            }
                        });
                    }
                }
            }
        });
    }

    public static List<CityBean> c(Context context, List<String> list) {
        List<CityBean> a2 = ay.a(by.a(context, "sp_city_config").b("sp_city_config", ""), true);
        if (!s.a(a2)) {
            ListIterator<CityBean> listIterator = a2.listIterator();
            while (listIterator.hasNext()) {
                if (!list.contains(listIterator.next().getId())) {
                    listIterator.remove();
                }
            }
        }
        return a2;
    }

    public static CityBean v(Context context, String str) {
        List<CityBean> a2 = ay.a(by.a(context, "sp_city_config").b("sp_city_config", ""), true);
        if (s.a(a2)) {
            return null;
        }
        ListIterator<CityBean> listIterator = a2.listIterator();
        while (listIterator.hasNext()) {
            CityBean next = listIterator.next();
            if (TextUtils.equals(str, next.getId())) {
                return next;
            }
        }
        return null;
    }

    public static void M(final Context context) {
        az.d("GSUtil", " getNativeAppinfos enter");
        tp.f(new Runnable() {
            @Override
            public void run() {
                List<ExcellianceAppInfo> b2 = com.excelliance.kxqp.repository.a.a(context).b();
                HashMap hashMap = new HashMap();
                HashMap hashMap2 = new HashMap();
                if (b2 != null && b2.size() > 0) {
                    Iterator<ExcellianceAppInfo> it = b2.iterator();
                    while (it.hasNext()) {
                        ExcellianceAppInfo next = it.next();
                        az.d("GSUtil", " getNativeAppinfos appInfo:" + next);
                        if (bm.a(next.getAppPackageName()) || bs.a(next.getAppPackageName()) != -1 || next.market_install_local == 1 || next.shortcut_type > 0) {
                            it.remove();
                        } else if (next.isInstalled()) {
                            az.d("GSUtil", " getNativeAppinfos 1 appInfo:" + next);
                            hashMap.put(next.getAppPackageName(), next);
                            if (next.gameType.equals("5")) {
                                hashMap2.put(next.getAppPackageName(), next);
                            }
                        }
                    }
                }
                if (hashMap.size() > 0) {
                    ArrayList arrayList = new ArrayList();
                    context.getPackageManager();
                    List<PackageInfo> b3 = com.excelliance.kxqp.gs.l.f.a(context).b(context, true);
                    String packageName = context.getPackageName();
                    GameUtil intance = GameUtil.getIntance();
                    intance.q(context);
                    for (PackageInfo packageInfo : b3) {
                        az.d("GSUtil", " getNativeAppinfos 1 pkg:" + packageInfo.packageName);
                        if (hashMap.containsKey(packageInfo.packageName) && (packageInfo.applicationInfo.flags & 1) <= 0 && as.i(context, packageInfo.packageName)) {
                            String str = packageInfo.packageName;
                            if (packageName.contains(str) || str.contains(packageName)) {
                                az.d("GSUtil", " getNativeAppinfos 4 pkg:" + packageInfo.packageName);
                            } else {
                                ApplicationInfo applicationInfo = packageInfo.applicationInfo;
                                az.d("GSUtil", " getNativeAppinfos 5 pkg:" + packageInfo.packageName);
                                AppNativeInfo appNativeInfo = new AppNativeInfo();
                                appNativeInfo.packageName = packageInfo.packageName;
                                appNativeInfo.version_code = packageInfo.versionCode;
                                String[] i = intance.i(packageInfo.packageName);
                                if (i != null && i.length > 0) {
                                    az.d("GSUtil", " getNativeAppinfos 6 pkg:" + packageInfo.packageName);
                                    for (String str2 : i) {
                                        az.d("GSUtil", " getNativeAppinfos path:" + str2);
                                    }
                                    if (i.length > 1) {
                                        appNativeInfo.file_path = new File(i[0]).getParent();
                                    } else {
                                        appNativeInfo.file_path = new File(i[0]).getAbsolutePath();
                                    }
                                    if (!cd.a(appNativeInfo.file_path)) {
                                        arrayList.add(appNativeInfo);
                                    }
                                    az.d("GSUtil", " appNativeinfo:" + appNativeInfo);
                                }
                            }
                        }
                    }
                    if (arrayList.size() > 0) {
                        com.excelliance.kxqp.repository.a.a(context).j();
                        com.excelliance.kxqp.repository.a.a(context).b(arrayList);
                    }
                    as.a(hashMap2, context);
                }
            }
        });
    }

    public static void a(Map<String, ExcellianceAppInfo> map, Context context) {
        az.d("GSUtil", String.format("GSUtil/actionImportNativeUpdateAutoInstall:thread(%s)", Thread.currentThread().getName()));
        List<AppNativeInfo> i = com.excelliance.kxqp.repository.a.a(context).i();
        ArrayList arrayList = new ArrayList();
        if (i != null && i.size() > 0) {
            for (AppNativeInfo appNativeInfo : i) {
                if (map.containsKey(appNativeInfo.packageName) && appNativeInfo.version_code > map.get(appNativeInfo.packageName).getVersionCode()) {
                    arrayList.add(appNativeInfo);
                }
            }
        }
        if (arrayList.size() > 0) {
            StringBuilder sb = new StringBuilder();
            for (int i2 = 0; i2 < arrayList.size(); i2++) {
                String str = ((AppNativeInfo) arrayList.get(i2)).packageName;
                if (i2 == arrayList.size() - 1) {
                    sb.append(str);
                } else {
                    sb.append(str);
                    sb.append(com.alipay.sdk.util.i.f491b);
                }
            }
            Intent intent = new Intent("com.excelliance.kxqp.action.addApps");
            intent.setComponent(new ComponentName(context.getPackageName(), "com.excelliance.kxqp.SmtServService"));
            az.d("GSUtil", String.format("GSUtil/actionImportNativeUpdateAutoInstall:thread(%s) pkg(%s)", Thread.currentThread().getName(), sb.toString()));
            ImportParams importParams = new ImportParams();
            importParams.setPkgs(sb.toString());
            intent.putExtra(ImportParams.INTENT_KEY, importParams);
            try {
                context.startService(intent);
            } catch (Exception unused) {
            }
        }
    }

    public static void N(Context context) {
        az.d("GSUtil", String.format("GSUtil/getWhiteNativeInfos:thread(%s)", Thread.currentThread().getName()));
        List<ExcellianceAppInfo> b2 = com.excelliance.kxqp.repository.a.a(context).b();
        HashMap hashMap = new HashMap();
        if (b2 != null && b2.size() > 0) {
            for (ExcellianceAppInfo excellianceAppInfo : b2) {
                hashMap.put(excellianceAppInfo.getAppPackageName(), excellianceAppInfo);
            }
        }
        List<DeleteAppInfo> s = com.excelliance.kxqp.repository.a.a(context).s();
        HashMap hashMap2 = new HashMap();
        if (s != null && s.size() > 0) {
            for (DeleteAppInfo deleteAppInfo : s) {
                hashMap2.put(deleteAppInfo.packageName, deleteAppInfo);
            }
        }
        PackageManager packageManager = context.getPackageManager();
        List<PackageInfo> b3 = com.excelliance.kxqp.gs.l.f.a(context).b(context, true);
        String packageName = context.getPackageName();
        GameUtil.getIntance().q(context);
        ArrayList arrayList = new ArrayList();
        HashMap hashMap3 = new HashMap();
        HashMap hashMap4 = new HashMap();
        az.d("GSUtil", " getWhiteNativeInfos read local start");
        for (PackageInfo packageInfo : b3) {
            if (!bm.a(packageInfo.packageName) && bs.a(packageInfo.packageName) == -1 && !hashMap2.containsKey(packageInfo.packageName) && !hashMap.containsKey(packageInfo.packageName) && (packageInfo.applicationInfo.flags & 1) <= 0 && i(context, packageInfo.packageName)) {
                String str = packageInfo.packageName;
                if (!packageName.contains(str) && !str.contains(packageName)) {
                    if (!TextUtils.isEmpty(str) && str.equals("com.hotplaygames.gt")) {
                        bz.a().a(context, 89000, "GT安装");
                    }
                    arrayList.add(packageInfo.packageName);
                    hashMap3.put(packageInfo.packageName, packageInfo);
                    hashMap4.put(packageInfo.packageName, packageInfo.packageName);
                }
            }
        }
        az.d("GSUtil", " getWhiteNativeInfos read local end pkg_native_list size =  " + arrayList.size());
        ArrayList arrayList2 = new ArrayList();
        if (arrayList.size() > 0) {
            az.d("GSUtil", "白名发送数据是" + new Gson().a(arrayList));
            ResponseData<List<WhiteNativeInfo>> d = d(context, arrayList);
            az.d("GSUtil", "白名单返回数据是" + new Gson().a(d));
            if (d.code == 0) {
                for (WhiteNativeInfo whiteNativeInfo : d.data) {
                    if (hashMap3.containsKey(whiteNativeInfo.getPkgName())) {
                        az.d("GSUtil", "getWhiteNativeInfos add pkg:" + whiteNativeInfo.getPkgName());
                        PackageInfo packageInfo2 = (PackageInfo) hashMap3.get(whiteNativeInfo.getPkgName());
                        String str2 = bn.j(context) + whiteNativeInfo.getPkgName() + ".png";
                        if (!new File(str2).exists()) {
                            at.a(packageManager, packageInfo2.applicationInfo, str2);
                        }
                        AppNativeImportWhiteGame appNativeImportWhiteGame = new AppNativeImportWhiteGame();
                        appNativeImportWhiteGame.app_Name = packageInfo2.applicationInfo.loadLabel(packageManager).toString();
                        appNativeImportWhiteGame.packageName = packageInfo2.packageName;
                        appNativeImportWhiteGame.is_White = 1;
                        appNativeImportWhiteGame.icon_Path = str2;
                        appNativeImportWhiteGame.autoImport = whiteNativeInfo.getIsquick();
                        az.d("GSUtil", "getWhiteNativeInfos appNativeImportWhiteGame:" + appNativeImportWhiteGame);
                        arrayList2.add(appNativeImportWhiteGame);
                    }
                }
                az.d("GSUtil", "保存白名单数据大小是 :" + arrayList2.size());
                if (com.excean.ab_builder.c.a.h(context)) {
                    g(context, arrayList2);
                } else {
                    g(context, arrayList2);
                    i(context, h(context, arrayList2));
                }
            }
        } else {
            List<AppNativeImportWhiteGame> h = h(context, arrayList2);
            g(context, arrayList2);
            i(context, h);
        }
        az.d("GSUtil", " getWhiteNativeInfos end ");
    }

    public static void O(Context context) {
        PackageManager packageManager = context.getPackageManager();
        List<PackageInfo> b2 = com.excelliance.kxqp.gs.l.f.a(context).b(context, true);
        GameUtil.getIntance().q(context);
        ArrayList arrayList = new ArrayList();
        HashMap hashMap = new HashMap();
        az.d("GSUtil", " getWhiteNativeInfos read local start");
        for (PackageInfo packageInfo : b2) {
            arrayList.add(packageInfo.packageName);
            hashMap.put(packageInfo.packageName, packageInfo);
        }
        az.d("GSUtil", " getStartPageNativeInfo read local end pkg_native_list size =  " + arrayList.size());
        ArrayList arrayList2 = new ArrayList();
        if (arrayList.size() > 0) {
            az.d("GSUtil", "getStartPageNativeInfo req ---- " + new Gson().a(arrayList));
            ResponseData<List<WhiteNativeInfo>> e = e(context, arrayList);
            az.d("GSUtil", "getStartPageNativeInfo res ----" + new Gson().a(e));
            if (e.code == 0) {
                for (WhiteNativeInfo whiteNativeInfo : e.data) {
                    if (hashMap.containsKey(whiteNativeInfo.getPkgName())) {
                        az.d("GSUtil", "getStartPageNativeInfo add pkg:" + whiteNativeInfo.getPkgName());
                        PackageInfo packageInfo2 = (PackageInfo) hashMap.get(whiteNativeInfo.getPkgName());
                        String str = bn.j(context) + whiteNativeInfo.getPkgName() + ".png";
                        if (!new File(str).exists()) {
                            at.a(packageManager, packageInfo2.applicationInfo, str);
                        }
                        AppNativeImportWhiteGame appNativeImportWhiteGame = new AppNativeImportWhiteGame();
                        appNativeImportWhiteGame.app_Name = packageInfo2.applicationInfo.loadLabel(packageManager).toString();
                        appNativeImportWhiteGame.packageName = packageInfo2.packageName;
                        appNativeImportWhiteGame.is_White = 1;
                        appNativeImportWhiteGame.icon_Path = str;
                        appNativeImportWhiteGame.autoImport = whiteNativeInfo.getIsquick();
                        appNativeImportWhiteGame.apkFrom = whiteNativeInfo.getApkFrom();
                        appNativeImportWhiteGame.isLocalExist = 1;
                        arrayList2.add(appNativeImportWhiteGame);
                    }
                }
                az.d("GSUtil", "getStartPageNativeInfo :" + arrayList2.size());
                f(context, arrayList2);
                com.excelliance.kxqp.gs.l.f.a(context).a(true);
            }
        }
        az.d("GSUtil", " getStartPageNativeInfo end ");
    }

    public static void P(final Context context) {
        az.d("GSUtil", String.format("GSUtil/checkNativeHuaWeiSpecialApp:thread(%s)", Thread.currentThread().getName()));
        tp.d(new Runnable() {
            @Override
            public void run() {
                boolean z;
                try {
                } catch (Exception e) {
                    az.d("GSUtil", String.format("GSUtil/checkNativeHuaWeiSpecialApp:thread(%s) get info fail", Thread.currentThread().getName()));
                    e.printStackTrace();
                }
                if (com.excelliance.kxqp.wr.a.a().a(0, "com.huawei.hwid", 0) != null) {
                    z = true;
                    az.d("GSUtil", String.format("GSUtil/checkNativeHuaWeiSpecialApp:thread(%s)  hasInstall(%s)", Thread.currentThread().getName(), Boolean.valueOf(z)));
                    if (z) {
                        tp.f(new Runnable() {
                            @Override
                            public void run() {
                                try {
                                    if (context.getPackageManager().getPackageInfo("com.huawei.hwid", 0) != null) {
                                        GameUtil.getIntance().n(context, "com.huawei.hwid");
                                    }
                                } catch (Exception e2) {
                                    az.d("GSUtil", String.format("GSUtil/checkNativeHuaWeiSpecialApp:thread(%s) get native info or install  fail e(%s)", Thread.currentThread().getName(), e2.getMessage()));
                                }
                            }
                        });
                        return;
                    }
                    return;
                }
                z = false;
                az.d("GSUtil", String.format("GSUtil/checkNativeHuaWeiSpecialApp:thread(%s)  hasInstall(%s)", Thread.currentThread().getName(), Boolean.valueOf(z)));
                if (z) {
                }
            }
        });
    }

    private static void f(final Context context, List<AppNativeImportWhiteGame> list) {
        final List<com.excelliance.kxqp.platforms.d> d = d(list);
        com.excelliance.kxqp.repository.a.a(context).a().runInTransaction(new Runnable() {
            @Override
            public void run() {
                com.excelliance.kxqp.repository.a.a(context).p();
                if (d.size() > 0) {
                    com.excelliance.kxqp.repository.a.a(context).c(d);
                }
            }
        });
    }

    private static List<com.excelliance.kxqp.platforms.d> d(List<AppNativeImportWhiteGame> list) {
        ArrayList arrayList = new ArrayList();
        if (list == null || list.size() == 0) {
            return arrayList;
        }
        for (AppNativeImportWhiteGame appNativeImportWhiteGame : list) {
            com.excelliance.kxqp.platforms.d dVar = new com.excelliance.kxqp.platforms.d();
            dVar.f12775b = appNativeImportWhiteGame.version_code;
            dVar.f12774a = appNativeImportWhiteGame.packageName;
            dVar.c = appNativeImportWhiteGame.is_White;
            dVar.d = appNativeImportWhiteGame.app_Name;
            dVar.e = appNativeImportWhiteGame.icon_Path;
            dVar.f = appNativeImportWhiteGame.isRecommendApp;
            dVar.g = appNativeImportWhiteGame.size;
            dVar.h = appNativeImportWhiteGame.apkFrom;
            dVar.i = appNativeImportWhiteGame.lowgms;
            dVar.j = appNativeImportWhiteGame.status;
            dVar.k = appNativeImportWhiteGame.market_install_local;
            dVar.l = appNativeImportWhiteGame.autoImport;
            dVar.m = appNativeImportWhiteGame.isShow;
            dVar.n = appNativeImportWhiteGame.free;
            dVar.o = appNativeImportWhiteGame.hasThirdDomin;
            dVar.p = appNativeImportWhiteGame.downloadButtonVisible;
            dVar.r = appNativeImportWhiteGame.isLocalExist;
            dVar.s = appNativeImportWhiteGame.appUpdateTime;
            dVar.t = appNativeImportWhiteGame.datafinder_game_id;
            dVar.u = appNativeImportWhiteGame.serverVc;
            dVar.v = appNativeImportWhiteGame.maxShowTimes;
            dVar.w = appNativeImportWhiteGame.seat;
            dVar.x = appNativeImportWhiteGame.buttonText;
            dVar.y = appNativeImportWhiteGame.buttonStatus;
            dVar.z = appNativeImportWhiteGame.webUrl;
            arrayList.add(dVar);
        }
        return arrayList;
    }

    public static List<AppNativeImportWhiteGame> c(List<com.excelliance.kxqp.platforms.d> list) {
        ArrayList arrayList = new ArrayList();
        if (list == null || list.size() == 0) {
            return arrayList;
        }
        for (com.excelliance.kxqp.platforms.d dVar : list) {
            AppNativeImportWhiteGame appNativeImportWhiteGame = new AppNativeImportWhiteGame();
            appNativeImportWhiteGame.version_code = dVar.f12775b;
            appNativeImportWhiteGame.packageName = dVar.f12774a;
            appNativeImportWhiteGame.is_White = dVar.c;
            appNativeImportWhiteGame.app_Name = dVar.d;
            appNativeImportWhiteGame.icon_Path = dVar.e;
            appNativeImportWhiteGame.isRecommendApp = dVar.f;
            appNativeImportWhiteGame.size = dVar.g;
            appNativeImportWhiteGame.apkFrom = dVar.h;
            appNativeImportWhiteGame.lowgms = dVar.i;
            appNativeImportWhiteGame.status = dVar.j;
            appNativeImportWhiteGame.market_install_local = dVar.k;
            appNativeImportWhiteGame.autoImport = dVar.l;
            appNativeImportWhiteGame.isShow = dVar.m;
            appNativeImportWhiteGame.free = dVar.n;
            appNativeImportWhiteGame.hasThirdDomin = dVar.o;
            appNativeImportWhiteGame.downloadButtonVisible = dVar.p;
            appNativeImportWhiteGame.isLocalExist = dVar.r;
            appNativeImportWhiteGame.appUpdateTime = dVar.s;
            appNativeImportWhiteGame.datafinder_game_id = dVar.t;
            appNativeImportWhiteGame.serverVc = dVar.u;
            appNativeImportWhiteGame.maxShowTimes = dVar.v;
            appNativeImportWhiteGame.seat = dVar.w;
            appNativeImportWhiteGame.buttonText = dVar.x;
            appNativeImportWhiteGame.buttonStatus = dVar.y;
            appNativeImportWhiteGame.webUrl = dVar.z;
            appNativeImportWhiteGame.webUrl = dVar.z;
            arrayList.add(appNativeImportWhiteGame);
        }
        return arrayList;
    }

    private static void g(final Context context, final List<AppNativeImportWhiteGame> list) {
        az.d("GSUtil", "saveDataBaseToWhiteNativeAppInfo appNativeImportWhiteGames enter");
        com.excelliance.kxqp.repository.a.a(context).a().runInTransaction(new Runnable() {
            @Override
            public void run() {
                if (list.size() == 0) {
                    az.d("GSUtil", "saveDataBaseToWhiteNativeAppInfo appNativeImportWhiteGames is null");
                    com.excelliance.kxqp.repository.a.a(context).q();
                    return;
                }
                List<AppNativeImportWhiteGame> k = com.excelliance.kxqp.repository.a.a(context).k();
                if (k != null && k.size() > 0) {
                    HashMap hashMap = new HashMap();
                    for (AppNativeImportWhiteGame appNativeImportWhiteGame : list) {
                        hashMap.put(appNativeImportWhiteGame.packageName, appNativeImportWhiteGame);
                    }
                    Iterator<AppNativeImportWhiteGame> it = k.iterator();
                    while (it.hasNext()) {
                        AppNativeImportWhiteGame next = it.next();
                        if (!next.isRecommendApp && !hashMap.containsKey(next.packageName)) {
                            az.d("GSUtil", "saveDataBaseToWhiteNativeAppInfo remove appNativeinfo:" + next);
                            it.remove();
                            com.excelliance.kxqp.repository.a.a(context).i(next.packageName);
                        } else if (cd.a(next.packageName)) {
                            it.remove();
                        }
                    }
                }
                com.excelliance.kxqp.repository.a.a(context).d(list);
            }
        });
    }

    private static List<AppNativeImportWhiteGame> h(Context context, List<AppNativeImportWhiteGame> list) {
        ArrayList arrayList = new ArrayList();
        if (s.a(list)) {
            return arrayList;
        }
        List<ExcellianceAppInfo> b2 = com.excelliance.kxqp.repository.a.a(context).b();
        HashMap hashMap = new HashMap();
        for (ExcellianceAppInfo excellianceAppInfo : b2) {
            hashMap.put(excellianceAppInfo.getAppPackageName(), excellianceAppInfo);
        }
        ListIterator<AppNativeImportWhiteGame> listIterator = list.listIterator();
        while (listIterator.hasNext()) {
            AppNativeImportWhiteGame next = listIterator.next();
            if (!hashMap.containsKey(next.packageName) && next.isAutoImport()) {
                next.status = 8;
                arrayList.add(next);
            }
        }
        return arrayList;
    }

    private static void i(Context context, List<AppNativeImportWhiteGame> list) {
        az.d("GSUtil", "GSUtil/autoImportWhiteNativeAppList() called with: thread = 【" + Thread.currentThread() + "】, context = 【" + context + "】, appNativeImportWhiteGames = 【" + list + "】");
        if (s.a(list)) {
            return;
        }
        StringBuilder sb = new StringBuilder();
        ListIterator<AppNativeImportWhiteGame> listIterator = list.listIterator();
        while (listIterator.hasNext()) {
            sb.append(listIterator.next().packageName);
            sb.append(com.alipay.sdk.util.i.f491b);
        }
        if (sb.toString().split(com.alipay.sdk.util.i.f491b).length < 1) {
            return;
        }
        ImportParams importParams = new ImportParams();
        importParams.setPkgs(sb.toString());
        importParams.setCopyApk(false);
        importParams.setPosition(8);
        com.excelliance.kxqp.b.k.a(context).a(importParams);
    }

    public static ResponseData<List<WhiteNativeInfo>> d(Context context, List<String> list) {
        JSONArray optJSONArray;
        az.d("GSUtil", "getWhiteNativeInfoToServer enter ");
        ResponseData<List<WhiteNativeInfo>> responseData = new ResponseData<>();
        ?? arrayList = new ArrayList();
        responseData.data = arrayList;
        responseData.code = 1;
        if (!bf.e(context)) {
            az.d("GSUtil", "getWhiteNativeInfoToServer no net ");
            return responseData;
        }
        JSONObject i = cn.i(context);
        try {
            JSONArray jSONArray = new JSONArray();
            Iterator<String> it = list.iterator();
            while (it.hasNext()) {
                jSONArray.put(it.next());
            }
            i.put("pkgs", jSONArray);
            i.put("isnew", 1);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        az.d("GSUtil", "getWhiteNativeInfoToServer params:" + i);
        String a2 = bd.a("https://api.ourplay.com.cn//check/compliancelist", i.toString());
        az.d("GSUtil", "getWhiteNativeInfoToServer result:" + a2);
        if (!cd.a(a2)) {
            a2 = cn.a(a2);
            az.d("GSUtil", "getWhiteNativeInfoToServer de result:" + a2);
            if (a2 != null) {
                try {
                    JSONObject jSONObject = new JSONObject(a2);
                    int optInt = jSONObject.optInt("code");
                    responseData.code = optInt;
                    if (optInt == 0 && (optJSONArray = jSONObject.optJSONArray("data")) != null && optJSONArray.length() > 0) {
                        for (int i2 = 0; i2 < optJSONArray.length(); i2++) {
                            JSONObject optJSONObject = optJSONArray.optJSONObject(i2);
                            if (optJSONObject != null) {
                                String optString = optJSONObject.optString(WebActionRouter.KEY_PKG);
                                int optInt2 = optJSONObject.optInt("isquick");
                                if (!cd.a(optString)) {
                                    az.d("GSUtil", "getWhiteNativeInfoToServer add pkg:" + optString);
                                    WhiteNativeInfo whiteNativeInfo = new WhiteNativeInfo();
                                    whiteNativeInfo.setPkgName(optString);
                                    whiteNativeInfo.setIsquick(optInt2);
                                    arrayList.add(whiteNativeInfo);
                                }
                            }
                        }
                    }
                } catch (JSONException e2) {
                    e2.printStackTrace();
                    az.d("GSUtil", "getWhiteNativeInfoToServer decodeResult is null ");
                }
            } else {
                az.d("GSUtil", "getWhiteNativeInfoToServer de json fail ");
            }
        }
        az.d("GSUtil", "getWhiteNativeInfoToServer: " + a2);
        az.d("GSUtil", " getWhiteNativeInfos read local end");
        return responseData;
    }

    public static ResponseData<List<WhiteNativeInfo>> e(Context context, List<String> list) {
        JSONArray optJSONArray;
        az.d("GSUtil", "getWhiteNativeInfoToServerSpec enter ");
        ResponseData<List<WhiteNativeInfo>> responseData = new ResponseData<>();
        ?? arrayList = new ArrayList();
        responseData.data = arrayList;
        responseData.code = 1;
        if (!bf.e(context)) {
            az.d("GSUtil", "getWhiteNativeInfoToServerSpec no net ");
            return responseData;
        }
        JSONObject i = cn.i(context);
        try {
            JSONArray jSONArray = new JSONArray();
            Iterator<String> it = list.iterator();
            while (it.hasNext()) {
                jSONArray.put(it.next());
            }
            i.put("pkgs", jSONArray);
            i.put("isnew", 1);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        az.d("GSUtil", "getWhiteNativeInfoToServerSpec params:" + i);
        String a2 = bd.a("https://api.ourplay.com.cn/check/get-local-accelerate", i.toString());
        az.d("GSUtil", "getWhiteNativeInfoToServerSpec result:" + a2);
        if (!cd.a(a2)) {
            a2 = cn.a(a2);
            az.d("GSUtil", "getWhiteNativeInfoToServerSpec de result:" + a2);
            if (a2 != null) {
                try {
                    JSONObject jSONObject = new JSONObject(a2);
                    int optInt = jSONObject.optInt("code");
                    responseData.code = optInt;
                    if (optInt == 0 && (optJSONArray = jSONObject.optJSONArray("data")) != null && optJSONArray.length() > 0) {
                        for (int i2 = 0; i2 < optJSONArray.length(); i2++) {
                            JSONObject optJSONObject = optJSONArray.optJSONObject(i2);
                            if (optJSONObject != null) {
                                String optString = optJSONObject.optString(WebActionRouter.KEY_PKG);
                                int optInt2 = optJSONObject.optInt("isquick");
                                String optString2 = optJSONObject.optString("apkfrom");
                                int intValue = !cd.a(optString2) ? Integer.valueOf(optString2).intValue() : 0;
                                if (!cd.a(optString)) {
                                    az.d("GSUtil", "getWhiteNativeInfoToServerSpec add pkg:" + optString);
                                    WhiteNativeInfo whiteNativeInfo = new WhiteNativeInfo();
                                    whiteNativeInfo.setPkgName(optString);
                                    whiteNativeInfo.setIsquick(optInt2);
                                    whiteNativeInfo.setApkFrom(intValue);
                                    arrayList.add(whiteNativeInfo);
                                }
                            }
                        }
                    }
                } catch (Exception e2) {
                    e2.printStackTrace();
                    az.d("GSUtil", "getWhiteNativeInfoToServerSpec decodeResult is null ");
                }
            } else {
                az.d("GSUtil", "getWhiteNativeInfoToServerSpec de json fail ");
            }
        }
        az.d("GSUtil", "getWhiteNativeInfoToServer: " + a2);
        az.d("GSUtil", " getWhiteNativeInfos read local end");
        return responseData;
    }

    public static void Q(Context context) {
        List<ExcellianceAppInfo> b2 = com.excelliance.kxqp.repository.a.a(context).b();
        HashMap hashMap = new HashMap();
        if (b2 != null && b2.size() > 0) {
            for (ExcellianceAppInfo excellianceAppInfo : b2) {
                hashMap.put(excellianceAppInfo.getAppPackageName(), excellianceAppInfo);
            }
        }
        List<AppNativeImportWhiteGame> m = com.excelliance.kxqp.repository.a.a(context).m();
        HashMap hashMap2 = new HashMap();
        if (m.size() > 0) {
            for (AppNativeImportWhiteGame appNativeImportWhiteGame : m) {
                hashMap2.put(appNativeImportWhiteGame.packageName, appNativeImportWhiteGame);
            }
        }
        List<AppNativeImportWhiteGame> R = R(context);
        if (R.size() > 0) {
            Iterator<AppNativeImportWhiteGame> it = R.iterator();
            if (hashMap.size() > 0) {
                while (it.hasNext()) {
                    AppNativeImportWhiteGame next = it.next();
                    if (next != null && !cd.a(next.packageName)) {
                        if (hashMap.containsKey(next.packageName)) {
                            it.remove();
                        } else if (hashMap2.containsKey(next.packageName)) {
                            it.remove();
                        }
                    } else if (next != null && cd.a(next.packageName)) {
                        it.remove();
                    }
                }
            }
            if (R.size() > 0) {
                com.excelliance.kxqp.repository.a.a(context).d(new ArrayList(R));
            }
        }
    }

    public static List<AppNativeImportWhiteGame> R(Context context) {
        RequestData requestData;
        ResponseData responseData;
        az.d("GSUtil", "get recommend apps in set up zone");
        com.excelliance.kxqp.api.c cVar = new com.excelliance.kxqp.api.c(context);
        ArrayList arrayList = new ArrayList();
        try {
            com.excelliance.kxqp.api.f a2 = com.excelliance.kxqp.api.f.a(context);
            a2.put("user_native_list", ad(context));
            a2.put("pkgname", ae(context));
            requestData = (RequestData) new Gson().a(a2.toString(), new TypeToken<RequestData>() {
            }.getType());
        } catch (Exception e) {
            e.printStackTrace();
            az.d("GSUtil", String.format("UpdateManager/getWePlayData:thread(%s)", Thread.currentThread().getName()));
            requestData = null;
        }
        if (requestData == null) {
            requestData = new RequestData();
        }
        try {
            cVar.a(ApiManager.getInstance().c(context, 15000L, 15000L, "https://api.ourplay.com.cn/").b(requestData));
        } catch (Error e2) {
            e2.printStackTrace();
        }
        try {
            responseData = cVar.b();
        } catch (Exception e3) {
            e3.printStackTrace();
            responseData = null;
        }
        if (responseData != null) {
            List list = (List) responseData.data;
            boolean equals = "success".equals(responseData.msg);
            if (list != null && list.size() > 0) {
                Iterator it = list.iterator();
                while (it.hasNext()) {
                    arrayList.add(a((AppInfo) it.next()));
                }
            }
            if (equals) {
                j(context, (List<AppInfo>) list);
            }
        }
        return arrayList;
    }

    public static List<CloudGameInfo> f(Context context, int i) {
        az.d("GSUtil", "getCloudGameList page = " + i);
        com.excelliance.kxqp.api.c cVar = new com.excelliance.kxqp.api.c(context);
        a.q a2 = new q.a().a("page", String.valueOf(i)).a("pageSize", "5").a();
        ArrayList arrayList = new ArrayList();
        if (a2 == null) {
            a2 = new q.a().a("page", String.valueOf(i)).a("pageSize", "5").a();
        }
        try {
            cVar.a(ApiManager.getInstance().a(context, 15000L, 15000L, "https://api.ourplay.com.cn/").S(a2));
        } catch (Error e) {
            e.printStackTrace();
        }
        ResponseData responseData = null;
        try {
            responseData = cVar.b();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        az.d("GSUtil", "getCloudGameList responseData=" + responseData);
        if (responseData != null) {
            return responseData.code == 1 ? ((CloudGameList) responseData.data).list : arrayList;
        }
        return arrayList;
    }

    private static void j(Context context, List<AppInfo> list) {
        DeleteAppInfo deleteAppInfo;
        List<AppNativeImportWhiteGame> l = com.excelliance.kxqp.repository.a.a(context).l();
        List<DeleteAppInfo> s = com.excelliance.kxqp.repository.a.a(context).s();
        if (s != null && s.size() > 0 && l != null && l.size() > 0) {
            HashMap hashMap = new HashMap();
            for (DeleteAppInfo deleteAppInfo2 : s) {
                hashMap.put(deleteAppInfo2.packageName, deleteAppInfo2);
            }
            for (AppNativeImportWhiteGame appNativeImportWhiteGame : l) {
                if (hashMap.containsKey(appNativeImportWhiteGame.packageName) && (deleteAppInfo = (DeleteAppInfo) hashMap.get(appNativeImportWhiteGame.packageName)) != null) {
                    deleteAppInfo.isRecommendApp = true;
                    com.excelliance.kxqp.repository.a.a(context).b(deleteAppInfo);
                }
            }
        }
        List<DeleteAppInfo> t = com.excelliance.kxqp.repository.a.a(context).t();
        if (list == null || list.size() == 0) {
            if (t != null && t.size() > 0) {
                Iterator<DeleteAppInfo> it = t.iterator();
                while (it.hasNext()) {
                    com.excelliance.kxqp.repository.a.a(context).k(it.next().packageName);
                }
            }
            if (l == null || l.size() <= 0) {
                return;
            }
            Iterator<AppNativeImportWhiteGame> it2 = l.iterator();
            while (it2.hasNext()) {
                com.excelliance.kxqp.repository.a.a(context).i(it2.next().packageName);
            }
            return;
        }
        HashMap hashMap2 = new HashMap();
        for (AppInfo appInfo : list) {
            hashMap2.put(appInfo.packageName, appInfo);
        }
        if (t != null && t.size() > 0) {
            for (DeleteAppInfo deleteAppInfo3 : t) {
                if (!hashMap2.containsKey(deleteAppInfo3.packageName)) {
                    com.excelliance.kxqp.repository.a.a(context).k(deleteAppInfo3.packageName);
                }
            }
        }
        if (l == null || l.size() <= 0) {
            return;
        }
        for (AppNativeImportWhiteGame appNativeImportWhiteGame2 : l) {
            if (!hashMap2.containsKey(appNativeImportWhiteGame2.packageName)) {
                com.excelliance.kxqp.repository.a.a(context).i(appNativeImportWhiteGame2.packageName);
            }
        }
    }

    public static AppNativeImportWhiteGame a(AppInfo appInfo) {
        float f;
        AppNativeImportWhiteGame appNativeImportWhiteGame = new AppNativeImportWhiteGame();
        appNativeImportWhiteGame.packageName = appInfo.packageName;
        appNativeImportWhiteGame.app_Name = appInfo.name;
        appNativeImportWhiteGame.is_White = 1;
        appNativeImportWhiteGame.icon_Path = appInfo.icon;
        appNativeImportWhiteGame.apkFrom = appInfo.apkFrom;
        appNativeImportWhiteGame.buttonStatus = appInfo.buttonStatus;
        appNativeImportWhiteGame.buttonText = appInfo.buttonText;
        if (!TextUtils.isEmpty(appInfo.lowgms)) {
            appNativeImportWhiteGame.lowgms = Integer.parseInt(appInfo.lowgms);
        }
        if (!TextUtils.isEmpty(appInfo.size)) {
            try {
                appNativeImportWhiteGame.size = Long.parseLong(appInfo.size);
            } catch (Exception e) {
                az.d("GSUtil", "NumberFormatException:" + e.getMessage());
            }
        }
        appNativeImportWhiteGame.isRecommendApp = true;
        appNativeImportWhiteGame.market_install_local = appInfo.market_install_local;
        appNativeImportWhiteGame.isShow = appInfo.isShow;
        try {
            f = Float.parseFloat(appInfo.price);
        } catch (Exception e2) {
            e2.printStackTrace();
            f = 0.0f;
        }
        appNativeImportWhiteGame.free = f == 0.0f;
        appNativeImportWhiteGame.hasThirdDomin = appInfo.hasThirdDomin;
        appNativeImportWhiteGame.downloadButtonVisible = appInfo.downloadButtonVisible;
        appNativeImportWhiteGame.subscribe = appInfo.subscribe;
        appNativeImportWhiteGame.datafinder_game_id = appInfo.datafinder_game_id;
        appNativeImportWhiteGame.appUpdateTime = appInfo.appUpdateTime;
        appNativeImportWhiteGame.serverVc = appInfo.apk_update_version;
        appNativeImportWhiteGame.maxShowTimes = appInfo.maxShowTimes;
        appNativeImportWhiteGame.seat = appInfo.seat;
        return appNativeImportWhiteGame;
    }

    public static boolean m() {
        try {
            Application n = n();
            Class<?> cls = Class.forName("com.excelliance.kxqp.KXQPApplication");
            az.d("GSUtil", String.format("BaseDialogFragment/getFragmentManagerByReflect:thread(%s)  application = %s", Thread.currentThread(), n.getClass().getSimpleName()));
            if (n.getClass() == cls) {
                az.d("GSUtil", "isAppVisible isVisible 0");
                Object invoke = cls.getDeclaredMethod("isApplicationInForeground", new Class[0]).invoke(n, new Object[0]);
                az.d("GSUtil", "isAppVisible isVisible 0");
                if (invoke instanceof Boolean) {
                    az.d("GSUtil", "isAppVisible isVisible:" + invoke);
                    return ((Boolean) invoke).booleanValue();
                }
            }
        } catch (Exception e) {
            az.d("GSUtil", "isAppVisible exception");
            e.printStackTrace();
        }
        return false;
    }

    public static Application n() {
        try {
            Class<?> cls = Class.forName("android.app.ActivityThread");
            Object invoke = cls.getMethod("getApplication", new Class[0]).invoke(cls.getMethod("currentActivityThread", new Class[0]).invoke(null, new Object[0]), new Object[0]);
            if (invoke == null) {
                throw new NullPointerException("u should init first");
            }
            return (Application) invoke;
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            throw new NullPointerException("u should init first");
        } catch (IllegalAccessException e2) {
            e2.printStackTrace();
            throw new NullPointerException("u should init first");
        } catch (NoSuchMethodException e3) {
            e3.printStackTrace();
            throw new NullPointerException("u should init first");
        } catch (InvocationTargetException e4) {
            e4.printStackTrace();
            throw new NullPointerException("u should init first");
        }
    }

    public static void w(final Context context, final String str) {
        az.d("GSUtil", "startInstallLocalActivity: pkg = " + str);
        tp.f(new Runnable() {
            @Override
            public void run() {
                az.d("GSUtil", "startInstallLocalActivity:1 pkg = " + str);
                ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b(str);
                boolean a2 = bm.a(str);
                if (b2 == null && bs.a(str) == -1 && !a2) {
                    try {
                        PackageManager packageManager = context.getPackageManager();
                        PackageInfo packageInfo = packageManager.getPackageInfo(str, 0);
                        if (packageInfo != null) {
                            az.d("GSUtil", "startInstallLocalActivity:pkgInfo != null pkg" + str);
                            String charSequence = packageInfo.applicationInfo.loadLabel(packageManager).toString();
                            ArrayList arrayList = new ArrayList();
                            arrayList.add(str);
                            ResponseData<List<WhiteNativeInfo>> d = as.d(context, arrayList);
                            if (d.code == 0 && d.data.size() == 1) {
                                WhiteNativeInfo whiteNativeInfo = d.data.get(0);
                                az.d("GSUtil", "startInstallLocalActivity whiteNativeInfo:" + whiteNativeInfo);
                                if (whiteNativeInfo != null && TextUtils.equals(str, whiteNativeInfo.getPkgName())) {
                                    InstallLocalActivity.a(context, charSequence, str);
                                }
                            }
                        } else {
                            az.d("GSUtil", "startInstallLocalActivity:1 pkgInfo == null " + str);
                        }
                    } catch (PackageManager.NameNotFoundException e) {
                        e.printStackTrace();
                        az.d("GSUtil", "startInstallLocalActivity:NameNotFoundException pkg:" + str);
                    } catch (Exception e2) {
                        az.d("GSUtil", "startInstallLocalActivity:Exception pkg:" + str);
                        e2.printStackTrace();
                    }
                }
            }
        });
    }

    public static boolean S(Context context) {
        String str = Build.MANUFACTURER;
        if (!cd.a(str)) {
            String lowerCase = str.toLowerCase();
            if ((lowerCase.equals("vivo") || lowerCase.equals("xiaomi")) && !by.a(context, "sp_total_info").b("key_background_show_view_permission_switch", false).booleanValue()) {
                return true;
            }
        }
        return false;
    }

    public static void T(Context context) {
        az.d("GSUtil", "disableGpAndGpGame: enter");
        ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b("com.android.vending");
        ExcellianceAppInfo b3 = com.excelliance.kxqp.repository.a.a(context).b("com.google.android.play.games");
        if (b2 != null) {
            az.d("GSUtil", "disableGpAndGpGame: excellianceAppInfo_GP:" + b2);
            bt.a().a(b2.getAppPackageName());
        }
        if (b3 != null) {
            az.d("GSUtil", "disableGpAndGpGame: excellianceAppInfo_GP_GAME:" + b3);
            bt.a().a(b3.getAppPackageName());
        }
    }

    public static void U(Context context) {
        az.d("GSUtil", "enableGpAndGpGame: enter");
        ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b("com.android.vending");
        ExcellianceAppInfo b3 = com.excelliance.kxqp.repository.a.a(context).b("com.google.android.play.games");
        if (b2 != null) {
            az.d("GSUtil", "enableGpAndGpGame: excellianceAppInfo_GP:" + b2);
            bt.a().b(context, b2.getAppPackageName());
        }
        if (b3 != null) {
            az.d("GSUtil", "enableGpAndGpGame: excellianceAppInfo_GP_GAME:" + b3);
            bt.a().b(context, b3.getAppPackageName());
        }
    }

    public static void a(Context context, boolean z, boolean z2) {
        try {
            az.d("GSUtil", "killGpAndGpGame:enter force:" + z + " speed:" + z2);
            ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b("com.android.vending");
            ExcellianceAppInfo b3 = com.excelliance.kxqp.repository.a.a(context).b("com.google.android.play.games");
            com.excelliance.kxqp.wr.a a2 = com.excelliance.kxqp.wr.a.a();
            boolean a3 = PlatSdk.getInstance().a("com.android.vending");
            boolean d = bt.a().d("com.android.vending") ^ true;
            az.d("GSUtil", "killGpAndGpGame: gp_run:" + a3 + " isSpeedGP:" + d + " speed:" + z2);
            if (b2 != null && a3 && (z2 != d || z)) {
                az.d("GSUtil", "killGpAndGpGame: 1 gp_run:" + a3 + " isSpeedGP:" + d + " speed:" + z2);
                a2.a(0, "com.android.vending");
            }
            boolean a4 = PlatSdk.getInstance().a("com.google.android.play.games");
            boolean z3 = !bt.a().d("com.google.android.play.games");
            az.d("GSUtil", "killGpAndGpGame: pg_run:" + a4 + " isSpeedPG:" + z3 + " speed:" + z2);
            if (b3 == null || !a4) {
                return;
            }
            if (z2 != z3 || z) {
                az.d("GSUtil", "killGpAndGpGame: 1 pg_run:" + a4 + " isSpeedPG:" + z3 + " speed:" + z2);
                a2.a(0, "com.google.android.play.games");
            }
        } catch (Exception e) {
            e.printStackTrace();
            az.d("GSUtil", "killGpAndGpGame:" + e.toString());
        }
    }

    public static void V(Context context) {
        try {
            az.d("GSUtil", "killGp:enter ");
            ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b("com.android.vending");
            com.excelliance.kxqp.wr.a a2 = com.excelliance.kxqp.wr.a.a();
            boolean a3 = PlatSdk.getInstance().a("com.android.vending");
            az.d("GSUtil", "killGp: gp_run:" + a3);
            if (b2 == null || !a3) {
                return;
            }
            az.d("GSUtil", "killGp: 1 gp_run:" + a3);
            a2.a(0, "com.android.vending");
        } catch (Exception e) {
            e.printStackTrace();
            az.d("GSUtil", "killGp:" + e.toString());
        }
    }

    public static void W(Context context) {
        az.d("GSUtil", String.format("GSUtil/notSpeedToSppedKillGpAndPlayGame:thread(%s)", Thread.currentThread().getName()));
        bs.b(context, true);
        by.a(context, "sp_total_info").a("gp_and_gpgame_due_disconnection", false);
        a(context, false, true);
        U(context);
    }

    public static void x(Context context, String str) {
        az.d("GSUtil", "whenSpeedStartGpOrPG enter");
        by.a(context, "sp_total_info").a("gp_and_gpgame_due_disconnection", true);
        bs.b(context, false);
        az.d("GSUtil", "whenSpeedStartGpOrPG startAppGame  pkg: " + str + " disconnect:" + by.a(context, "sp_total_info").b("sp_disconnectioin", false).booleanValue());
        a(context, true, false);
        T(context);
    }

    public static void y(Context context, String str) {
        az.d("GSUtil", "whenSpeedStartAppActionGpOrPG enter");
        bs.b(context, true);
        boolean booleanValue = by.a(context, "sp_total_info").b("gp_and_gpgame_due_disconnection", false).booleanValue();
        boolean booleanValue2 = by.a(context, ".sp.common.disposable.flag.info").b("sp_common_disposable_key_global_has_vpn_proxy", false).booleanValue();
        az.d("GSUtil", "whenSpeedStartAppActionGpOrPG startAppGame  other pkg: " + str + " gp_and_play_game_due_dis:" + booleanValue + " vpn_switch:" + booleanValue2);
        if (!booleanValue2 && booleanValue) {
            by.a(context, "sp_proxy_delay_config").a("auto_connect_optimal_proxy_v2", true);
        }
        if (!booleanValue2 && booleanValue) {
            a(context.getApplicationContext(), false, true);
        }
        U(context.getApplicationContext());
        by.a(context, "sp_total_info").a("gp_and_gpgame_due_disconnection", false);
    }

    public static Intent e(String str) {
        return InstallActivity.a(str);
    }

    public static void z(Context context, String str) {
        String str2;
        az.d("GSUtil", " getNativeUnableAndInstallNativeVpnApkGameType enter 0");
        JSONArray jSONArray = new JSONArray();
        String l = GameUtil.getIntance().l(context, str);
        HashMap hashMap = new HashMap();
        try {
            JSONObject jSONObject = new JSONObject();
            String g = cd.g(bs.c(context, l));
            jSONObject.put("lib", str);
            jSONObject.put("sign", g);
            hashMap.put(str, g);
            az.d("GSUtil", " getNativeUnableAndInstallNativeVpnApkGameType pkg:" + str + " object:" + jSONObject.toString());
            jSONArray.put(jSONObject);
        } catch (Exception e) {
            e.printStackTrace();
            az.d("GSUtil", " getNativeUnableAndInstallNativeVpnApkGameType error pkg:" + str);
        }
        az.d("GSUtil", " getNativeUnableAndInstallNativeVpnApkGameType pkgInfo:" + jSONArray.toString());
        ExcellianceAppInfo b2 = !TextUtils.isEmpty(str) ? com.excelliance.kxqp.repository.a.a(context).b(str) : null;
        ArrayList arrayList = new ArrayList();
        if (b2 != null) {
            arrayList.add(b2);
        }
        List<GameAttrsResponse.PkgsBean> pkgs = GameAttributesHelper.getInstance().a(context, GameAttrsRequest.Factory.create(context, arrayList)).getPkgs();
        JSONObject jSONObject2 = new JSONObject();
        GameAttrsResponse.PkgsBean pkgsBean = pkgs.size() > 0 ? pkgs.get(0) : null;
        if (pkgsBean != null) {
            az.d("GSUtil", " getNativeUnableAndInstallNativeVpnApkGameType pkg:" + str + ", pkgBean=" + pkgsBean.toString());
            try {
                jSONObject2.put("gametype", pkgsBean.getGametype());
                jSONObject2.put("attr", pkgsBean.getAttr());
                jSONObject2.put("vmType", pkgsBean.getVmType());
                jSONObject2.put("vmType", pkgsBean.getIncompatible());
                jSONObject2.put("isremind", pkgsBean.getIsremind());
                jSONObject2.put("virtualOrder", pkgsBean.getVirtualOrder());
                jSONObject2.put("is_guide_otherpkg", pkgsBean.getIs_guide_otherpkg());
                if (!TextUtils.isEmpty(pkgsBean.getRecheck())) {
                    jSONObject2.put("recheck", pkgsBean.getRecheck());
                }
                JSONObject jSONObject3 = new JSONObject();
                jSONObject3.put(str, jSONObject2);
                JSONObject jSONObject4 = new JSONObject();
                jSONObject4.put("game", jSONObject3);
                str2 = jSONObject4.toString();
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
            ArrayList arrayList2 = new ArrayList();
            arrayList2.add(str);
            az.d("GSUtil", " getNativeUnableAndInstallNativeVpnApkGameType pkg:" + str + ",result:" + str2);
            if (TextUtils.isEmpty(str2)) {
                ay.a(str2, arrayList2, context, hashMap);
                return;
            }
            az.d("GSUtil", " getNativeUnableAndInstallNativeVpnApkGameType result is null pkgInfo:" + jSONArray.toString());
            return;
        }
        str2 = null;
        ArrayList arrayList22 = new ArrayList();
        arrayList22.add(str);
        az.d("GSUtil", " getNativeUnableAndInstallNativeVpnApkGameType pkg:" + str + ",result:" + str2);
        if (TextUtils.isEmpty(str2)) {
        }
    }

    public static void A(Context context, String str) {
        try {
            az.d("GSUtil", "sendBrowser url:" + str);
            Uri parse = Uri.parse(str);
            Intent intent = new Intent();
            intent.setAction("android.intent.action.VIEW");
            intent.setData(parse);
            context.startActivity(intent);
        } catch (Exception e) {
            az.d("GSUtil", "sendBrowser error" + e.getMessage());
            e.printStackTrace();
        }
    }

    public static void X(final Context context) {
        tp.d(new Runnable() {
            @Override
            public void run() {
                HashMap hashMap = new HashMap();
                hashMap.put("com.android.chrome", "com.android.chrome");
                hashMap.put("com.facebook.katana", "com.facebook.katana");
                hashMap.put("com.facebook.lite", "com.facebook.lite");
                hashMap.put("com.facebook.orca", "com.facebook.orca");
                hashMap.put("com.twitter.android", "com.twitter.android");
                com.excelliance.kxqp.wr.a a2 = com.excelliance.kxqp.wr.a.a();
                List<ExcellianceAppInfo> b2 = com.excelliance.kxqp.repository.a.a(context).b();
                if (b2 != null && b2.size() > 0) {
                    String[] strArr = {"__EXTERNAL__:com.twitter.android", "__EXTERNAL__:com.facebook.katana", "__EXTERNAL__:com.facebook.lite", "__EXTERNAL__:com.facebook.orca", "__EXTERNAL__:com.android.chrome"};
                    for (ExcellianceAppInfo excellianceAppInfo : b2) {
                        String appPackageName = excellianceAppInfo.getAppPackageName();
                        boolean a3 = bm.a(appPackageName);
                        if (excellianceAppInfo.isApkInstalled() && !a3 && bs.a(appPackageName) == -1 && !bs.d(appPackageName)) {
                            az.d("GSUtil", "setForbidSocialSoftwareExternalStart set forbid pkg:" + appPackageName);
                            as.a(a2, appPackageName, strArr, true, "GSUtil");
                        }
                        if (hashMap.containsKey(appPackageName)) {
                            hashMap.remove(appPackageName);
                        }
                    }
                }
                for (Map.Entry entry : hashMap.entrySet()) {
                    az.d("GSUtil", "setForbidSocialSoftwareExternalStart pkg" + ((String) entry.getKey()));
                    PackageInfo a4 = a2.a(0, (String) entry.getKey(), 0);
                    az.d("GSUtil", "setForbidSocialSoftwareExternalStart pkg" + ((String) entry.getKey()) + " info:" + a4);
                    if (a4 != null) {
                        PlatSdk.getInstance().b(context, (String) entry.getKey(), 0);
                    }
                }
            }
        });
    }

    public static void a(com.excelliance.kxqp.wr.a aVar, String str, String[] strArr, boolean z, String str2) {
        VMExternalArrayResult b2;
        az.d(str2, "setForbidExternalStart pkg" + str + " isAdd:" + z);
        String[] g = aVar.g(0, str);
        if (z) {
            b2 = a(g, strArr);
        } else {
            b2 = b(g, strArr);
        }
        if (b2.toChange) {
            az.d(str2, "setForbidExternalStart pkg" + str + " forbidPkgExternalSet:" + Arrays.toString(b2.newArray) + " isAdd:" + z);
            aVar.b(0, str, a(str, b2.newArray, str2));
        }
    }

    public static String[] a(String str, String[] strArr, String str2) {
        PackageInfo o;
        az.d(str2, "removeChrome pkg" + str);
        if (!TextUtils.equals(str, "com.riotgames.league.wildrift") && !TextUtils.equals(str, "com.riotgames.league.wildrifttw")) {
            return strArr;
        }
        ArrayList arrayList = new ArrayList();
        if (strArr != null && strArr.length > 0) {
            az.d(str2, "removeChrome pkg" + str + " saveArray:" + Arrays.toString(strArr));
            for (int i = 0; i < strArr.length; i++) {
                if (strArr[i] != null && !strArr[i].endsWith("com.android.chrome")) {
                    arrayList.add(strArr[i]);
                } else if (strArr[i] != null && strArr[i].endsWith("com.android.chrome") && ((o = o()) == null || !TextUtils.equals(o.packageName, "com.android.chrome"))) {
                    arrayList.add(strArr[i]);
                }
            }
        }
        if (!s.a(arrayList)) {
            strArr = new String[arrayList.size()];
            for (int i2 = 0; i2 < arrayList.size(); i2++) {
                strArr[i2] = (String) arrayList.get(i2);
            }
        }
        az.d(str2, "removeChrome pkg" + str + " newArry:" + Arrays.toString(strArr));
        return strArr;
    }

    public static PackageInfo o() {
        if (Build.VERSION.SDK_INT >= 26) {
            return WebView.getCurrentWebViewPackage();
        }
        if (Build.VERSION.SDK_INT < 21) {
            return null;
        }
        try {
            return (PackageInfo) Class.forName("android.webkit.WebViewFactory").getMethod("getLoadedPackageInfo", new Class[0]).invoke(null, new Object[0]);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static VMExternalArrayResult a(String[] strArr, String[] strArr2) {
        VMExternalArrayResult vMExternalArrayResult = new VMExternalArrayResult();
        int i = 0;
        boolean z = strArr == null || strArr.length == 0;
        boolean z2 = strArr2 == null || strArr2.length == 0;
        if (z && !z2) {
            vMExternalArrayResult.newArray = strArr2;
            vMExternalArrayResult.toChange = true;
            return vMExternalArrayResult;
        }
        if (z && z2) {
            vMExternalArrayResult.toChange = false;
            return vMExternalArrayResult;
        }
        if (!z && z2) {
            vMExternalArrayResult.newArray = strArr;
            vMExternalArrayResult.toChange = false;
            return vMExternalArrayResult;
        }
        boolean z3 = strArr.length == strArr2.length;
        ArrayList arrayList = new ArrayList();
        HashMap hashMap = new HashMap();
        for (String str : strArr2) {
            hashMap.put(str, str);
        }
        boolean z4 = z3;
        for (String str2 : strArr) {
            if (hashMap.containsKey(str2)) {
                hashMap.remove(str2);
            } else {
                z4 = false;
            }
            arrayList.add(str2);
        }
        if (!z4) {
            if (hashMap.size() > 0) {
                Iterator it = hashMap.entrySet().iterator();
                while (it.hasNext()) {
                    arrayList.add(((Map.Entry) it.next()).getKey());
                }
            }
            String[] strArr3 = new String[arrayList.size()];
            Iterator it2 = arrayList.iterator();
            while (it2.hasNext()) {
                strArr3[i] = (String) it2.next();
                i++;
            }
            vMExternalArrayResult.newArray = strArr3;
            vMExternalArrayResult.toChange = true;
        } else {
            vMExternalArrayResult.newArray = strArr2;
            vMExternalArrayResult.toChange = false;
        }
        return vMExternalArrayResult;
    }

    public static VMExternalArrayResult b(String[] strArr, String[] strArr2) {
        int i = 0;
        boolean z = strArr == null || strArr.length == 0;
        boolean z2 = strArr2 == null || strArr2.length == 0;
        VMExternalArrayResult vMExternalArrayResult = new VMExternalArrayResult();
        if (z2) {
            vMExternalArrayResult.newArray = strArr2;
            vMExternalArrayResult.toChange = true;
            return vMExternalArrayResult;
        }
        if (z) {
            vMExternalArrayResult.newArray = strArr;
            vMExternalArrayResult.toChange = false;
            return vMExternalArrayResult;
        }
        ArrayList arrayList = new ArrayList();
        HashMap hashMap = new HashMap();
        for (String str : strArr2) {
            hashMap.put(str, str);
        }
        for (String str2 : strArr) {
            if (!hashMap.containsKey(str2)) {
                arrayList.add(str2);
            }
        }
        if (arrayList.size() != 0) {
            String[] strArr3 = new String[arrayList.size()];
            Iterator it = arrayList.iterator();
            while (it.hasNext()) {
                strArr3[i] = (String) it.next();
                i++;
            }
            vMExternalArrayResult.newArray = strArr;
            vMExternalArrayResult.toChange = true;
            return vMExternalArrayResult;
        }
        vMExternalArrayResult.newArray = new String[0];
        vMExternalArrayResult.toChange = true;
        return vMExternalArrayResult;
    }

    public static void Y(final Context context) {
        tp.f(new Runnable() {
            @Override
            public void run() {
                az.d("GSUtil", "intDataIsolation enter");
                by a2 = by.a(context, "sp_total_info");
                boolean booleanValue = a2.b("sp_key_support_new_data_isolation", false).booleanValue();
                az.d("GSUtil", "intDataIsolation isNewDataIsolation:" + booleanValue);
                if (booleanValue) {
                    return;
                }
                List<com.excelliance.kxqp.gs.ui.account.c> f = as.f();
                if (f == null || f.size() <= 0) {
                    az.d("GSUtil", "intDataIsolation 2 isNewDataIsolation:" + booleanValue);
                    a2.a("sp_key_support_new_data_isolation", true);
                }
            }
        });
    }

    public static void c(final Context context, final ExcellianceAppInfo excellianceAppInfo) {
        az.e("GSUtil", "GSUtil/reinstallInfiniteflight enter appinfo" + excellianceAppInfo);
        tp.d(new Runnable() {
            @Override
            public void run() {
                if (ExcellianceAppInfo.this.gameType.equals(String.valueOf(5))) {
                    az.e("GSUtil", "GSUtil/reinstallInfiniteflight import install appinfo" + ExcellianceAppInfo.this);
                    ImportParams importParams = new ImportParams();
                    importParams.setPkgs(ExcellianceAppInfo.this.getAppPackageName());
                    importParams.setCopyApk(false);
                    importParams.setPosition(6);
                    com.excelliance.kxqp.b.k.a(context).a(importParams);
                    return;
                }
                az.e("GSUtil", "GSUtil/reinstallInfiniteflight path install appinfo" + ExcellianceAppInfo.this);
                Intent intent = new Intent("com.excelliance.kxqp.action.installDownApps");
                intent.setComponent(new ComponentName(context, (Class<?>) SmtServService.class));
                Bundle bundle = new Bundle();
                bundle.putString(WebActionRouter.KEY_PKG, ExcellianceAppInfo.this.getAppPackageName());
                bundle.putString("apkPath", ExcellianceAppInfo.this.getPath());
                bundle.putInt("installType", 1);
                intent.putExtra("bundle", bundle);
                try {
                    context.startService(intent);
                } catch (Exception e) {
                    az.e("GSUtil", "GSUtil/reinstallInfiniteflight run:" + e.toString());
                }
            }
        });
    }

    public static void d(Context context, String str, int i) {
        az.e("GSUtil", "getStartGameAboutFlag pkg:" + str + " type:" + i);
        if (TextUtils.isEmpty(str)) {
            return;
        }
        if (i == 1) {
            by.a(context, "sp_total_info").a("sp_key_start_app_need_assistant", str + com.alipay.sdk.util.i.f491b + System.currentTimeMillis());
            return;
        }
        if (i == 2) {
            by.a(context, "sp_total_info").a("sp_key_start_app_need_accelerator", str + com.alipay.sdk.util.i.f491b + System.currentTimeMillis());
        }
    }

    public static String g(Context context, int i) {
        String b2;
        String str = null;
        if (i == 1) {
            b2 = by.a(context, "sp_total_info").b("sp_key_start_app_need_assistant", "");
        } else {
            b2 = i == 2 ? by.a(context, "sp_total_info").b("sp_key_start_app_need_accelerator", "") : null;
        }
        az.e("GSUtil", "getStartGameAboutFlag flag:" + b2);
        if (!TextUtils.isEmpty(b2)) {
            String[] split = b2.split(com.alipay.sdk.util.i.f491b);
            if (split.length == 2 && !TextUtils.isEmpty(split[0])) {
                try {
                    if (System.currentTimeMillis() - Long.parseLong(split[1]) <= 21600000) {
                        str = split[0];
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            if (i == 1) {
                by.a(context, "sp_total_info").a("sp_key_start_app_need_assistant", "");
            } else if (i == 2) {
                by.a(context, "sp_total_info").a("sp_key_start_app_need_accelerator", "");
            }
        }
        return str;
    }

    public static void B(final Context context, final String str) {
        tp.f(new Runnable() {
            @Override
            public void run() {
                ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b(str);
                if (b2 == null || !b2.isInstalled()) {
                    return;
                }
                bz.a().d(context, 3, str);
            }
        });
    }

    public static WebDownBean C(Context context, String str) {
        WebDownBean webDownBean = new WebDownBean();
        String b2 = by.a(context, "global_config").b("sp_key_banner_bind_pkg", "");
        az.d("GSUtil", "getWebDownloadInfo  pkg:" + str + " fixedConfig:" + b2);
        if (TextUtils.isEmpty(b2)) {
            return webDownBean;
        }
        try {
            JSONObject jSONObject = new JSONObject(b2);
            webDownBean.bannerId = jSONObject.optString(str);
            webDownBean.fromServerDownloadPkg = str;
            az.d("GSUtil", "getWebDownloadInfo webDownBean:" + webDownBean);
            jSONObject.remove(str);
            by.a(context, "global_config").a("sp_key_banner_bind_pkg", jSONObject.toString());
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return webDownBean;
    }

    public static void d(Context context, String str, String str2) {
        az.d("GSUtil", "putWebDownloadInfo pkg:" + str + " bannerId:" + str2);
        String b2 = by.a(context, "global_config").b("sp_key_banner_bind_pkg", "");
        try {
            JSONObject jSONObject = new JSONObject();
            if (!TextUtils.isEmpty(b2)) {
                jSONObject = new JSONObject(b2);
                jSONObject.put(str, str2);
            } else {
                jSONObject.put(str, str2);
            }
            az.d("GSUtil", "putWebDownloadInfo pkg:" + str + " bannerId:" + str2 + " jsonObject:" + jSONObject.toString());
            by.a(context, "global_config").a("sp_key_banner_bind_pkg", jSONObject.toString());
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public static void D(final Context context, final String str) {
        tp.f(new Runnable() {
            @Override
            public void run() {
                WebDownBean C = as.C(context, str);
                if (TextUtils.isEmpty(C.bannerId)) {
                    return;
                }
                bz.a().b(context, 4, str, C.bannerId);
            }
        });
    }

    public static ProxyServerCheckResult a(Context context, ProxyServerCheckRequest proxyServerCheckRequest) {
        com.excelliance.kxqp.api.c cVar = new com.excelliance.kxqp.api.c(context);
        cVar.a(ApiManager.getInstance().c(context, 15000L, 15000L, "https://api.ourplay.com.cn/").a(proxyServerCheckRequest));
        ResponseData b2 = cVar.b();
        az.d("GSUtil", "checkProxyServer response:" + b2);
        return (ProxyServerCheckResult) b2.data;
    }

    public static String f(String str) {
        if (!TextUtils.isEmpty(str) && str.endsWith("_1")) {
            String substring = str.substring(0, str.lastIndexOf("_1"));
            az.d("GSUtil", "fromVipAreaGetCommonArea onlyAreaStr:" + substring);
            if (!TextUtils.isEmpty(substring)) {
                String str2 = substring + "_0";
                az.d("GSUtil", "fromVipAreaGetCommonArea commonArea:" + str2);
                return str2;
            }
        }
        return null;
    }

    public static void h(final Context context, final int i) {
        try {
            ((com.excelliance.kxqp.api.b) com.zero.support.core.api.a.a(com.excelliance.kxqp.api.b.class)).a(WXconfig.typeToKey(i)).a(new com.zero.support.core.observable.d<Response<WXconfig>>() {
                @Override
                public void a(Response<WXconfig> response) {
                    WXconfig d;
                    az.d("GSUtil", "run: getWxConfig::" + response.d());
                    if (response.d() == null || response.f() != 1 || (d = response.d()) == null) {
                        return;
                    }
                    d.type = i;
                    by.a(context, "sp_config").a("sp_key_get_vip_access_dialog_config_info" + i, new Gson().a(d));
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void c(Context context, String str, boolean z) {
        by.a(context, "extractInfo").a("sp_key_native_vpn_and_op_unable_started_" + str, z);
    }

    public static boolean Z(Context context) {
        return by.a(context.getApplicationContext(), "sp_total_info").b("sp_key_bought_google_account_down", false).booleanValue();
    }

    public static boolean aa(Context context) {
        return (by.a(context.getApplicationContext(), "sp_total_info").b("sp_key_bought_google_account_down", false).booleanValue() || by.a(context.getApplicationContext(), "sp_total_info").b("sp_key_bought_ratio_account", false).booleanValue() || bx.a().n(context)) ? false : true;
    }

    public static boolean ab(Context context) {
        return (context instanceof Activity) && !((Activity) context).isFinishing();
    }

    public static boolean ac(Context context) {
        return by.a(context, "sp_total_info").b("SP_GOOGLE_ACCOUNT_ENTRANCE", false).booleanValue();
    }

    public static JSONArray ad(Context context) {
        List<AppLocalInfo> w = com.excelliance.kxqp.repository.a.a(context).w();
        JSONArray jSONArray = new JSONArray();
        if (w != null) {
            Iterator<AppLocalInfo> it = w.iterator();
            while (it.hasNext()) {
                jSONArray.put(it.next().packageName);
            }
        }
        az.d("GSUtil", "getNativeAppList/nativeArray: " + jSONArray);
        return jSONArray;
    }

    public static JSONArray ae(Context context) {
        JSONArray jSONArray = new JSONArray();
        List<ExcellianceAppInfo> b2 = com.excelliance.kxqp.repository.a.a(context).b();
        if (b2 != null && b2.size() > 0) {
            for (ExcellianceAppInfo excellianceAppInfo : b2) {
                boolean a2 = bm.a(excellianceAppInfo.getAppPackageName());
                if (!bs.d(excellianceAppInfo.getAppPackageName()) && bs.a(excellianceAppInfo.getAppPackageName()) == -1 && !a2 && excellianceAppInfo.market_install_local != 1) {
                    jSONArray.put(excellianceAppInfo.getAppPackageName());
                }
            }
        }
        return jSONArray;
    }

    public static RankingDetailInfo F(final Context context, String str) {
        RankingDetailInfo rankingDetailInfo;
        JSONObject i = cn.i(context);
        try {
            i.put(com.umeng.analytics.pro.am.aE, 2);
            i.put("id", str);
            i.put("branch", by.a(context, "global_config").c("defDisplayStyle", -1));
            i.put("userid", bx.a().a(context));
            i.put(AppAreaBean.AREAS, "1");
            if (com.excelliance.kxqp.util.d.b.c) {
                i.put("supportMulti", "1");
            }
            i.put("controlapi", 1);
            if (b.bh(context)) {
                i.put("isFromDomestic", "1");
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        com.excelliance.kxqp.gs.discover.model.ResponseData a2 = new com.excelliance.kxqp.gs.discover.bbs.c(context.getApplicationContext()).a(i.toString(), bc.c, new com.excelliance.kxqp.gs.discover.a.c<RankingDetailInfo>() {
            @Override
            public com.excelliance.kxqp.gs.discover.model.ResponseData<RankingDetailInfo> a(String str2) {
                try {
                    az.d("GSUtil", "queryGameDetail response = " + str2);
                    return as.G(context, str2);
                } catch (Exception e2) {
                    e2.printStackTrace();
                    return null;
                }
            }
        });
        if (a2 != null) {
            az.d("GSUtil", "queryGameDetail response data = " + a2.data);
            rankingDetailInfo = (RankingDetailInfo) a2.data;
        } else {
            Log.d("GSUtil", "queryGameDetail response null");
            rankingDetailInfo = null;
        }
        az.d("GSUtil", "queryGameDetail final appInfo = " + rankingDetailInfo);
        return rankingDetailInfo;
    }

    public static com.excelliance.kxqp.gs.discover.model.ResponseData<RankingDetailInfo> G(Context context, String str) throws Exception {
        int i;
        float parseFloat;
        String optString;
        float parseFloat2;
        String optString2;
        String str2;
        float f;
        JSONObject optJSONObject;
        JSONArray optJSONArray;
        JSONArray optJSONArray2;
        JSONArray optJSONArray3;
        float parseFloat3;
        Context context2;
        List<CC1Tag> list;
        az.d("GSUtil", "parseRankingDetail/response: " + str);
        JSONObject jSONObject = new JSONObject(str);
        com.excelliance.kxqp.gs.discover.model.ResponseData<RankingDetailInfo> responseData = new com.excelliance.kxqp.gs.discover.model.ResponseData<>();
        responseData.code = jSONObject.optInt("code");
        responseData.msg = jSONObject.optString("msg");
        responseData.data = new RankingDetailInfo();
        JSONObject optJSONObject2 = jSONObject.optJSONObject("data");
        String optString3 = optJSONObject2.optString("apksize");
        optJSONObject2.optString(AppExtraBean.KEY_AREA);
        String optString4 = optJSONObject2.optString("compatibility");
        String optString5 = optJSONObject2.optString("content");
        optJSONObject2.optString("created");
        String optString6 = optJSONObject2.optString("desc");
        String optString7 = optJSONObject2.optString("developer");
        String optString8 = optJSONObject2.optString(UMUnionConstants.DOWNLOAD_NOTIFICATION_CHANNEL_ID);
        boolean z = optJSONObject2.optInt(AppExtraBean.KEY_GMS) == 1;
        String optString9 = optJSONObject2.optString("goodtext");
        String optString10 = optJSONObject2.optString(RankingItem.KEY_ICON);
        String optString11 = optJSONObject2.optString("id");
        String optString12 = optJSONObject2.optString("imglist");
        int optInt = optJSONObject2.optInt("isgood");
        String optString13 = optJSONObject2.optString("name");
        optJSONObject2.optString("new");
        String optString14 = optJSONObject2.optString("obbsize");
        String optString15 = optJSONObject2.optString("plateid");
        String optString16 = optJSONObject2.optString(ClientCookie.COMMENT_ATTR);
        String optString17 = optJSONObject2.optString("grade");
        int optInt2 = optJSONObject2.optInt("attention");
        int optInt3 = optJSONObject2.optInt(RankingItem.KEY_ONLINE);
        long optLong = optJSONObject2.optLong("orderno");
        String optString18 = optJSONObject2.optString("pkgname");
        String optString19 = optJSONObject2.optString("publisher");
        long optLong2 = optJSONObject2.optLong("rank_id");
        String optString20 = optJSONObject2.optString("qq");
        String optString21 = optJSONObject2.optString("qqkey");
        int optInt4 = optJSONObject2.optInt("minsdk");
        int optInt5 = optJSONObject2.optInt("cpu");
        String optString22 = optJSONObject2.optString("minsdkName");
        String optString23 = optJSONObject2.optString("imgsize");
        int optInt6 = optJSONObject2.optInt("lowgms");
        long optLong3 = optJSONObject2.optLong(RankingItem.KEY_SIZE);
        int optInt7 = optJSONObject2.optInt("apkfrom", -1);
        boolean z2 = z;
        int optInt8 = optJSONObject2.optInt("isshowload", 1);
        int optInt9 = optJSONObject2.optInt("market_strategy");
        int optInt10 = optJSONObject2.optInt("market_install_local");
        int optInt11 = optJSONObject2.optInt("hasOnlineStrategy");
        String optString24 = optJSONObject2.optString("newsLink");
        String optString25 = optJSONObject2.optString("strategyVideosize");
        String optString26 = optJSONObject2.optString("strategyTitlepic");
        String optString27 = optJSONObject2.optString("strategyVideo");
        int optInt12 = optJSONObject2.optInt("isStrategy");
        int optInt13 = optJSONObject2.optInt("hasappointment");
        int optInt14 = optJSONObject2.optInt("isSubscribe");
        int optInt15 = optJSONObject2.optInt("isOpLy");
        int optInt16 = optJSONObject2.optInt("playable");
        if (!cd.a(optJSONObject2.optString(RankingItem.KEY_STAR))) {
            try {
                i = optInt16;
                parseFloat = Float.parseFloat(optJSONObject2.optString(RankingItem.KEY_STAR));
            } catch (Exception e) {
                e.printStackTrace();
            }
            optString = optJSONObject2.optString("xsstar");
            if (!TextUtils.isEmpty(optString)) {
                try {
                    parseFloat2 = Float.parseFloat(optString);
                } catch (Exception e2) {
                    e2.printStackTrace();
                }
                double optDouble = optJSONObject2.optDouble("sub1", 0.0d);
                double optDouble2 = optJSONObject2.optDouble("sub2", 0.0d);
                double optDouble3 = optJSONObject2.optDouble("sub3", 0.0d);
                double optDouble4 = optJSONObject2.optDouble("sub4", 0.0d);
                int optInt17 = optJSONObject2.optInt("apktype");
                String g = g(optJSONObject2.optString(CategoryListActivity.TAG_NAME));
                String optString28 = optJSONObject2.optString("updatetime");
                String optString29 = optJSONObject2.optString(ClientCookie.VERSION_ATTR);
                String optString30 = optJSONObject2.optString("video");
                String optString31 = optJSONObject2.optString("generalize");
                String optString32 = optJSONObject2.optString("titlepic");
                String optString33 = optJSONObject2.optString(AvdSplashCallBackImp.KEY_PRICE);
                JSONArray optJSONArray4 = optJSONObject2.optJSONArray("formatTag");
                optString2 = optJSONObject2.optString("goodTag");
                String optString34 = optJSONObject2.optString("version_updatetime");
                String optString35 = optJSONObject2.optString("datafinder_game_id");
                int optInt18 = optJSONObject2.optInt("apk_update_version");
                if (b.bb(context)) {
                    if (optJSONArray4 != null) {
                        list = new ArrayList<>();
                        str2 = optString28;
                        f = parseFloat;
                        int i2 = 0;
                        while (i2 < optJSONArray4.length()) {
                            CC1Tag valueOf = CC1Tag.valueOf(optJSONArray4.getJSONObject(i2));
                            JSONArray jSONArray = optJSONArray4;
                            if (!TextUtils.isEmpty(valueOf.tag)) {
                                list.add(valueOf);
                            }
                            i2++;
                            optJSONArray4 = jSONArray;
                        }
                    } else {
                        str2 = optString28;
                        f = parseFloat;
                        list = null;
                    }
                    RankingDetailInfo rankingDetailInfo = responseData.data;
                    if (list == null) {
                        list = CC1Tag.asList(g);
                    }
                    rankingDetailInfo.setCc1TagList(list);
                } else {
                    str2 = optString28;
                    f = parseFloat;
                }
                if (b.bM(context) && !TextUtils.isEmpty(optString2)) {
                    responseData.data.setHighQuality(optString2);
                }
                optJSONObject = optJSONObject2.optJSONObject("rank");
                az.d("GSUtil", "parseRankingDetail/rankObj: " + optJSONObject);
                if (optJSONObject != null) {
                    RankingDetailInfo.Rank rank = new RankingDetailInfo.Rank();
                    rank.f14364a = optJSONObject.optInt("cateid");
                    rank.f14365b = optJSONObject.optString("catename");
                    rank.c = optJSONObject.optInt("ordernum");
                    responseData.data.setRank(rank);
                }
                optJSONArray = optJSONObject2.optJSONArray("recommend");
                az.d("GSUtil", "parseDetail/recommendArr: " + optJSONArray);
                if (optJSONArray != null && optJSONArray.length() > 0) {
                    try {
                        responseData.data.setRecommendList((List) new Gson().a(optJSONArray.toString(), new TypeToken<List<AppInfo>>() {
                        }.getType()));
                    } catch (Exception e3) {
                        Log.e("GSUtil", "parseDetail/ex:" + e3);
                    }
                }
                optJSONArray2 = optJSONObject2.optJSONArray("third_domin");
                az.d("GSUtil", "parseDetail/thirdLink thirdArry: " + optJSONArray2);
                if (optJSONArray2 != null && optJSONArray2.length() > 0) {
                    try {
                        responseData.data.thirdLink = (List) new Gson().a(optJSONArray2.toString(), new TypeToken<List<ThirdLink>>() {
                        }.getType());
                    } catch (Exception e4) {
                        Log.e("GSUtil", "parseDetail/thirdLink ex:" + e4);
                    }
                }
                if (!s.a(responseData.data.thirdLink) && !TextUtils.isEmpty(optString18)) {
                    for (ThirdLink thirdLink : responseData.data.thirdLink) {
                        if (thirdLink.isOurSelf == 1 && !cd.a(thirdLink.url)) {
                            thirdLink.url += optString18;
                            thirdLink.pkgName = optString18;
                            thirdLink.sourceFromMarket = optInt9 == 1 ? 1 : 0;
                        }
                    }
                }
                optJSONArray3 = optJSONObject2.optJSONArray("gift_code");
                az.d("GSUtil", "parseDetail/gitPackArry gitPackArry: " + optJSONArray3);
                if (optJSONArray3 != null && optJSONArray3.length() > 0) {
                    try {
                        responseData.data.mGiftPackBeanList = (List) new Gson().a(optJSONArray3.toString(), new TypeToken<List<GiftPackBean>>() {
                        }.getType());
                    } catch (Exception e5) {
                        Log.e("GSUtil", "parseDetail/gitPackArry ex:" + e5);
                    }
                }
                if (b.cn(context)) {
                    try {
                        JSONArray optJSONArray5 = optJSONObject2.optJSONArray("agent_recharge");
                        az.d("GSUtil", "getAgentRecharge/response: " + optJSONArray5);
                        if (optJSONArray5 != null && optJSONArray5.length() > 0) {
                            responseData.data.mEntrancesList = (List) new Gson().a(optJSONArray5.toString(), new TypeToken<List<Entrance>>() {
                            }.getType());
                        }
                    } catch (Exception e6) {
                        Log.e("GSUtil", "parseDetail/gitPackArry ex:" + e6);
                    }
                }
                if (b.co(context)) {
                    try {
                        JSONObject optJSONObject3 = optJSONObject2.optJSONObject("rank");
                        if (optJSONObject3 != null) {
                            responseData.data.mRankBean = (RankBean) new Gson().a(optJSONObject3.toString(), new TypeToken<RankBean>() {
                            }.getType());
                        }
                    } catch (Exception e7) {
                        e7.printStackTrace();
                    }
                }
                responseData.data.privacy = optJSONObject2.optString("privacy");
                responseData.data.permission = optJSONObject2.optString("permission");
                responseData.data.mGameGroupUrl = optJSONObject2.optString("qw_qrcode");
                float f2 = Float.valueOf(optString33).floatValue();
                responseData.data.setFree(f2 == 0.0f);
                responseData.data.setForumId(optString15);
                if (!TextUtils.isEmpty(optString17)) {
                    try {
                        parseFloat3 = Float.parseFloat(optString17);
                    } catch (Exception e8) {
                        e8.printStackTrace();
                    }
                    responseData.data.setScore(parseFloat3);
                    responseData.data.setComment(optString16);
                    responseData.data.setSize(optLong3);
                    responseData.data.setIcon(optString10);
                    responseData.data.setName(optString13);
                    responseData.data.setApksize(optString3);
                    responseData.data.setArea(com.excelliance.kxqp.gs.appstore.recommend.e.a.a(optJSONObject2));
                    responseData.data.setCompatibility(optString4);
                    responseData.data.setContent(optString5);
                    responseData.data.setDesc(optString6);
                    responseData.data.setDeveloper(optString7);
                    responseData.data.setPublisher(optString19);
                    responseData.data.setDownload(optString8);
                    responseData.data.setGms(z2);
                    responseData.data.setId(optString11);
                    responseData.data.setImglist(optString12);
                    responseData.data.setIsgood(optInt);
                    responseData.data.setObbsize(optString14);
                    responseData.data.setOnline(optInt3);
                    responseData.data.setLowGms(optInt6);
                    responseData.data.setOrderno(optLong);
                    responseData.data.setPkgname(optString18);
                    responseData.data.setRank_id(optLong2);
                    responseData.data.setQq(optString20);
                    responseData.data.setQqKey(optString21);
                    responseData.data.setGp_score(f);
                    responseData.data.setXs_score(parseFloat2);
                    responseData.data.setTag(g);
                    responseData.data.setUpdatetime(str2);
                    responseData.data.setVersion(optString29);
                    responseData.data.setVideoUrl(optString30);
                    responseData.data.setGoodtext(optString9);
                    responseData.data.setAttention(optInt2);
                    responseData.data.setGeneralize(optString31);
                    responseData.data.setTitlepic(optString32);
                    responseData.data.setImageSize(optString23);
                    responseData.data.setCpu(optInt5);
                    responseData.data.setMinSdk(optInt4);
                    responseData.data.setMinSdkName(optString22);
                    responseData.data.setIsStrategy(optInt12);
                    responseData.data.apkFrom = optInt7;
                    responseData.data.isWhite = 1;
                    responseData.data.sub1 = (float) optDouble;
                    responseData.data.sub2 = (float) optDouble2;
                    responseData.data.sub3 = (float) optDouble3;
                    responseData.data.sub4 = (float) optDouble4;
                    responseData.data.apkType = optInt17;
                    responseData.data.downloadButtonVisible = optInt8;
                    responseData.data.market_strategy = optInt9;
                    responseData.data.market_install_local = optInt10;
                    responseData.data.price = f2;
                    responseData.data.apkFrom = optInt7;
                    responseData.data.hasOnlineStrategy = optInt11;
                    responseData.data.newsLink = optString24;
                    responseData.data.strategyVideo = optString27;
                    responseData.data.strategyVideoSize = optString25;
                    responseData.data.strategyTitlePic = optString26;
                    responseData.data.subscribeState = optInt13;
                    responseData.data.subscribe = optInt14;
                    responseData.data.playable = i;
                    responseData.data.appUpdateTime = optString34;
                    responseData.data.datafinder_game_id = optString35;
                    responseData.data.apk_update_version = optInt18;
                    responseData.data.isOpLy = optInt15;
                    if (optString20 != null) {
                        context2 = context;
                        responseData.data.setQq(by.a(context2, "appsConfig").b("qq_group_num_app_" + optString18, (String) null));
                    } else {
                        context2 = context;
                    }
                    if (optString21 == null) {
                        responseData.data.setQqKey(by.a(context2, "appsConfig").b("qq_group_key_app_" + optString18, (String) null));
                    }
                    a(context2, responseData.data);
                    return responseData;
                }
                parseFloat3 = 0.0f;
                responseData.data.setScore(parseFloat3);
                responseData.data.setComment(optString16);
                responseData.data.setSize(optLong3);
                responseData.data.setIcon(optString10);
                responseData.data.setName(optString13);
                responseData.data.setApksize(optString3);
                responseData.data.setArea(com.excelliance.kxqp.gs.appstore.recommend.e.a.a(optJSONObject2));
                responseData.data.setCompatibility(optString4);
                responseData.data.setContent(optString5);
                responseData.data.setDesc(optString6);
                responseData.data.setDeveloper(optString7);
                responseData.data.setPublisher(optString19);
                responseData.data.setDownload(optString8);
                responseData.data.setGms(z2);
                responseData.data.setId(optString11);
                responseData.data.setImglist(optString12);
                responseData.data.setIsgood(optInt);
                responseData.data.setObbsize(optString14);
                responseData.data.setOnline(optInt3);
                responseData.data.setLowGms(optInt6);
                responseData.data.setOrderno(optLong);
                responseData.data.setPkgname(optString18);
                responseData.data.setRank_id(optLong2);
                responseData.data.setQq(optString20);
                responseData.data.setQqKey(optString21);
                responseData.data.setGp_score(f);
                responseData.data.setXs_score(parseFloat2);
                responseData.data.setTag(g);
                responseData.data.setUpdatetime(str2);
                responseData.data.setVersion(optString29);
                responseData.data.setVideoUrl(optString30);
                responseData.data.setGoodtext(optString9);
                responseData.data.setAttention(optInt2);
                responseData.data.setGeneralize(optString31);
                responseData.data.setTitlepic(optString32);
                responseData.data.setImageSize(optString23);
                responseData.data.setCpu(optInt5);
                responseData.data.setMinSdk(optInt4);
                responseData.data.setMinSdkName(optString22);
                responseData.data.setIsStrategy(optInt12);
                responseData.data.apkFrom = optInt7;
                responseData.data.isWhite = 1;
                responseData.data.sub1 = (float) optDouble;
                responseData.data.sub2 = (float) optDouble2;
                responseData.data.sub3 = (float) optDouble3;
                responseData.data.sub4 = (float) optDouble4;
                responseData.data.apkType = optInt17;
                responseData.data.downloadButtonVisible = optInt8;
                responseData.data.market_strategy = optInt9;
                responseData.data.market_install_local = optInt10;
                responseData.data.price = f2;
                responseData.data.apkFrom = optInt7;
                responseData.data.hasOnlineStrategy = optInt11;
                responseData.data.newsLink = optString24;
                responseData.data.strategyVideo = optString27;
                responseData.data.strategyVideoSize = optString25;
                responseData.data.strategyTitlePic = optString26;
                responseData.data.subscribeState = optInt13;
                responseData.data.subscribe = optInt14;
                responseData.data.playable = i;
                responseData.data.appUpdateTime = optString34;
                responseData.data.datafinder_game_id = optString35;
                responseData.data.apk_update_version = optInt18;
                responseData.data.isOpLy = optInt15;
                if (optString20 != null) {
                }
                if (optString21 == null) {
                }
                a(context2, responseData.data);
                return responseData;
            }
            parseFloat2 = 0.0f;
            double optDouble5 = optJSONObject2.optDouble("sub1", 0.0d);
            double optDouble22 = optJSONObject2.optDouble("sub2", 0.0d);
            double optDouble32 = optJSONObject2.optDouble("sub3", 0.0d);
            double optDouble42 = optJSONObject2.optDouble("sub4", 0.0d);
            int optInt172 = optJSONObject2.optInt("apktype");
            String g2 = g(optJSONObject2.optString(CategoryListActivity.TAG_NAME));
            String optString282 = optJSONObject2.optString("updatetime");
            String optString292 = optJSONObject2.optString(ClientCookie.VERSION_ATTR);
            String optString302 = optJSONObject2.optString("video");
            String optString312 = optJSONObject2.optString("generalize");
            String optString322 = optJSONObject2.optString("titlepic");
            String optString332 = optJSONObject2.optString(AvdSplashCallBackImp.KEY_PRICE);
            JSONArray optJSONArray42 = optJSONObject2.optJSONArray("formatTag");
            optString2 = optJSONObject2.optString("goodTag");
            String optString342 = optJSONObject2.optString("version_updatetime");
            String optString352 = optJSONObject2.optString("datafinder_game_id");
            int optInt182 = optJSONObject2.optInt("apk_update_version");
            if (b.bb(context)) {
            }
            if (b.bM(context)) {
                responseData.data.setHighQuality(optString2);
            }
            optJSONObject = optJSONObject2.optJSONObject("rank");
            az.d("GSUtil", "parseRankingDetail/rankObj: " + optJSONObject);
            if (optJSONObject != null) {
            }
            optJSONArray = optJSONObject2.optJSONArray("recommend");
            az.d("GSUtil", "parseDetail/recommendArr: " + optJSONArray);
            if (optJSONArray != null) {
                responseData.data.setRecommendList((List) new Gson().a(optJSONArray.toString(), new TypeToken<List<AppInfo>>() {
                }.getType()));
            }
            optJSONArray2 = optJSONObject2.optJSONArray("third_domin");
            az.d("GSUtil", "parseDetail/thirdLink thirdArry: " + optJSONArray2);
            if (optJSONArray2 != null) {
                responseData.data.thirdLink = (List) new Gson().a(optJSONArray2.toString(), new TypeToken<List<ThirdLink>>() {
                }.getType());
            }
            if (!s.a(responseData.data.thirdLink)) {
                while (r0.hasNext()) {
                }
            }
            optJSONArray3 = optJSONObject2.optJSONArray("gift_code");
            az.d("GSUtil", "parseDetail/gitPackArry gitPackArry: " + optJSONArray3);
            if (optJSONArray3 != null) {
                responseData.data.mGiftPackBeanList = (List) new Gson().a(optJSONArray3.toString(), new TypeToken<List<GiftPackBean>>() {
                }.getType());
            }
            if (b.cn(context)) {
            }
            if (b.co(context)) {
            }
            responseData.data.privacy = optJSONObject2.optString("privacy");
            responseData.data.permission = optJSONObject2.optString("permission");
            responseData.data.mGameGroupUrl = optJSONObject2.optString("qw_qrcode");
            float f22 = Float.valueOf(optString332).floatValue();
            responseData.data.setFree(f22 == 0.0f);
            responseData.data.setForumId(optString15);
            if (!TextUtils.isEmpty(optString17)) {
            }
            parseFloat3 = 0.0f;
            responseData.data.setScore(parseFloat3);
            responseData.data.setComment(optString16);
            responseData.data.setSize(optLong3);
            responseData.data.setIcon(optString10);
            responseData.data.setName(optString13);
            responseData.data.setApksize(optString3);
            responseData.data.setArea(com.excelliance.kxqp.gs.appstore.recommend.e.a.a(optJSONObject2));
            responseData.data.setCompatibility(optString4);
            responseData.data.setContent(optString5);
            responseData.data.setDesc(optString6);
            responseData.data.setDeveloper(optString7);
            responseData.data.setPublisher(optString19);
            responseData.data.setDownload(optString8);
            responseData.data.setGms(z2);
            responseData.data.setId(optString11);
            responseData.data.setImglist(optString12);
            responseData.data.setIsgood(optInt);
            responseData.data.setObbsize(optString14);
            responseData.data.setOnline(optInt3);
            responseData.data.setLowGms(optInt6);
            responseData.data.setOrderno(optLong);
            responseData.data.setPkgname(optString18);
            responseData.data.setRank_id(optLong2);
            responseData.data.setQq(optString20);
            responseData.data.setQqKey(optString21);
            responseData.data.setGp_score(f);
            responseData.data.setXs_score(parseFloat2);
            responseData.data.setTag(g2);
            responseData.data.setUpdatetime(str2);
            responseData.data.setVersion(optString292);
            responseData.data.setVideoUrl(optString302);
            responseData.data.setGoodtext(optString9);
            responseData.data.setAttention(optInt2);
            responseData.data.setGeneralize(optString312);
            responseData.data.setTitlepic(optString322);
            responseData.data.setImageSize(optString23);
            responseData.data.setCpu(optInt5);
            responseData.data.setMinSdk(optInt4);
            responseData.data.setMinSdkName(optString22);
            responseData.data.setIsStrategy(optInt12);
            responseData.data.apkFrom = optInt7;
            responseData.data.isWhite = 1;
            responseData.data.sub1 = (float) optDouble5;
            responseData.data.sub2 = (float) optDouble22;
            responseData.data.sub3 = (float) optDouble32;
            responseData.data.sub4 = (float) optDouble42;
            responseData.data.apkType = optInt172;
            responseData.data.downloadButtonVisible = optInt8;
            responseData.data.market_strategy = optInt9;
            responseData.data.market_install_local = optInt10;
            responseData.data.price = f22;
            responseData.data.apkFrom = optInt7;
            responseData.data.hasOnlineStrategy = optInt11;
            responseData.data.newsLink = optString24;
            responseData.data.strategyVideo = optString27;
            responseData.data.strategyVideoSize = optString25;
            responseData.data.strategyTitlePic = optString26;
            responseData.data.subscribeState = optInt13;
            responseData.data.subscribe = optInt14;
            responseData.data.playable = i;
            responseData.data.appUpdateTime = optString342;
            responseData.data.datafinder_game_id = optString352;
            responseData.data.apk_update_version = optInt182;
            responseData.data.isOpLy = optInt15;
            if (optString20 != null) {
            }
            if (optString21 == null) {
            }
            a(context2, responseData.data);
            return responseData;
        }
        i = optInt16;
        parseFloat = 0.0f;
        optString = optJSONObject2.optString("xsstar");
        if (!TextUtils.isEmpty(optString)) {
        }
        parseFloat2 = 0.0f;
        double optDouble52 = optJSONObject2.optDouble("sub1", 0.0d);
        double optDouble222 = optJSONObject2.optDouble("sub2", 0.0d);
        double optDouble322 = optJSONObject2.optDouble("sub3", 0.0d);
        double optDouble422 = optJSONObject2.optDouble("sub4", 0.0d);
        int optInt1722 = optJSONObject2.optInt("apktype");
        String g22 = g(optJSONObject2.optString(CategoryListActivity.TAG_NAME));
        String optString2822 = optJSONObject2.optString("updatetime");
        String optString2922 = optJSONObject2.optString(ClientCookie.VERSION_ATTR);
        String optString3022 = optJSONObject2.optString("video");
        String optString3122 = optJSONObject2.optString("generalize");
        String optString3222 = optJSONObject2.optString("titlepic");
        String optString3322 = optJSONObject2.optString(AvdSplashCallBackImp.KEY_PRICE);
        JSONArray optJSONArray422 = optJSONObject2.optJSONArray("formatTag");
        optString2 = optJSONObject2.optString("goodTag");
        String optString3422 = optJSONObject2.optString("version_updatetime");
        String optString3522 = optJSONObject2.optString("datafinder_game_id");
        int optInt1822 = optJSONObject2.optInt("apk_update_version");
        if (b.bb(context)) {
        }
        if (b.bM(context)) {
        }
        optJSONObject = optJSONObject2.optJSONObject("rank");
        az.d("GSUtil", "parseRankingDetail/rankObj: " + optJSONObject);
        if (optJSONObject != null) {
        }
        optJSONArray = optJSONObject2.optJSONArray("recommend");
        az.d("GSUtil", "parseDetail/recommendArr: " + optJSONArray);
        if (optJSONArray != null) {
        }
        optJSONArray2 = optJSONObject2.optJSONArray("third_domin");
        az.d("GSUtil", "parseDetail/thirdLink thirdArry: " + optJSONArray2);
        if (optJSONArray2 != null) {
        }
        if (!s.a(responseData.data.thirdLink)) {
        }
        optJSONArray3 = optJSONObject2.optJSONArray("gift_code");
        az.d("GSUtil", "parseDetail/gitPackArry gitPackArry: " + optJSONArray3);
        if (optJSONArray3 != null) {
        }
        if (b.cn(context)) {
        }
        if (b.co(context)) {
        }
        responseData.data.privacy = optJSONObject2.optString("privacy");
        responseData.data.permission = optJSONObject2.optString("permission");
        responseData.data.mGameGroupUrl = optJSONObject2.optString("qw_qrcode");
        float f222 = Float.valueOf(optString3322).floatValue();
        responseData.data.setFree(f222 == 0.0f);
        responseData.data.setForumId(optString15);
        if (!TextUtils.isEmpty(optString17)) {
        }
        parseFloat3 = 0.0f;
        responseData.data.setScore(parseFloat3);
        responseData.data.setComment(optString16);
        responseData.data.setSize(optLong3);
        responseData.data.setIcon(optString10);
        responseData.data.setName(optString13);
        responseData.data.setApksize(optString3);
        responseData.data.setArea(com.excelliance.kxqp.gs.appstore.recommend.e.a.a(optJSONObject2));
        responseData.data.setCompatibility(optString4);
        responseData.data.setContent(optString5);
        responseData.data.setDesc(optString6);
        responseData.data.setDeveloper(optString7);
        responseData.data.setPublisher(optString19);
        responseData.data.setDownload(optString8);
        responseData.data.setGms(z2);
        responseData.data.setId(optString11);
        responseData.data.setImglist(optString12);
        responseData.data.setIsgood(optInt);
        responseData.data.setObbsize(optString14);
        responseData.data.setOnline(optInt3);
        responseData.data.setLowGms(optInt6);
        responseData.data.setOrderno(optLong);
        responseData.data.setPkgname(optString18);
        responseData.data.setRank_id(optLong2);
        responseData.data.setQq(optString20);
        responseData.data.setQqKey(optString21);
        responseData.data.setGp_score(f);
        responseData.data.setXs_score(parseFloat2);
        responseData.data.setTag(g22);
        responseData.data.setUpdatetime(str2);
        responseData.data.setVersion(optString2922);
        responseData.data.setVideoUrl(optString3022);
        responseData.data.setGoodtext(optString9);
        responseData.data.setAttention(optInt2);
        responseData.data.setGeneralize(optString3122);
        responseData.data.setTitlepic(optString3222);
        responseData.data.setImageSize(optString23);
        responseData.data.setCpu(optInt5);
        responseData.data.setMinSdk(optInt4);
        responseData.data.setMinSdkName(optString22);
        responseData.data.setIsStrategy(optInt12);
        responseData.data.apkFrom = optInt7;
        responseData.data.isWhite = 1;
        responseData.data.sub1 = (float) optDouble52;
        responseData.data.sub2 = (float) optDouble222;
        responseData.data.sub3 = (float) optDouble322;
        responseData.data.sub4 = (float) optDouble422;
        responseData.data.apkType = optInt1722;
        responseData.data.downloadButtonVisible = optInt8;
        responseData.data.market_strategy = optInt9;
        responseData.data.market_install_local = optInt10;
        responseData.data.price = f222;
        responseData.data.apkFrom = optInt7;
        responseData.data.hasOnlineStrategy = optInt11;
        responseData.data.newsLink = optString24;
        responseData.data.strategyVideo = optString27;
        responseData.data.strategyVideoSize = optString25;
        responseData.data.strategyTitlePic = optString26;
        responseData.data.subscribeState = optInt13;
        responseData.data.subscribe = optInt14;
        responseData.data.playable = i;
        responseData.data.appUpdateTime = optString3422;
        responseData.data.datafinder_game_id = optString3522;
        responseData.data.apk_update_version = optInt1822;
        responseData.data.isOpLy = optInt15;
        if (optString20 != null) {
        }
        if (optString21 == null) {
        }
        a(context2, responseData.data);
        return responseData;
    }

    private static ExcellianceAppInfo a(Context context, RankingDetailInfo rankingDetailInfo) {
        int size;
        ArrayList<ExcellianceAppInfo> a2 = InitialData.a(context).a();
        HashMap hashMap = new HashMap();
        Iterator<ExcellianceAppInfo> it = a2.iterator();
        while (it.hasNext()) {
            ExcellianceAppInfo next = it.next();
            hashMap.put(next.getAppPackageName(), next);
        }
        ExcellianceAppInfo excellianceAppInfo = (ExcellianceAppInfo) hashMap.get(rankingDetailInfo.getPkgname());
        if (excellianceAppInfo == null) {
            String pkgname = rankingDetailInfo.getPkgname();
            String name = rankingDetailInfo.getName();
            StringBuilder sb = new StringBuilder();
            sb.append((rankingDetailInfo.getName() + rankingDetailInfo.getPkgname()).hashCode());
            sb.append("");
            excellianceAppInfo = new ExcellianceAppInfo(context, pkgname, name, null, "", "", "", "7", sb.toString(), 0L);
        }
        if (excellianceAppInfo.getAppSize() == 0) {
            excellianceAppInfo.setAppSize(rankingDetailInfo.getSize());
        }
        excellianceAppInfo.setStar(rankingDetailInfo.getGp_score());
        excellianceAppInfo.setIconDownloadPath(rankingDetailInfo.getIcon());
        excellianceAppInfo.setDesc(rankingDetailInfo.getDesc());
        excellianceAppInfo.setVersionName(rankingDetailInfo.getVersion());
        excellianceAppInfo.setOnline(Integer.valueOf(rankingDetailInfo.getOnline()).intValue());
        excellianceAppInfo.setLowGms(Integer.valueOf(rankingDetailInfo.getLowGms()).intValue());
        if (rankingDetailInfo.getArea() != null && (size = rankingDetailInfo.getArea().size()) > 0) {
            excellianceAppInfo.areas = new String[size];
            for (int i = 0; i < size; i++) {
                excellianceAppInfo.areas[i] = rankingDetailInfo.getArea().get(i);
            }
        }
        excellianceAppInfo.minSdk = rankingDetailInfo.getMinSdk();
        excellianceAppInfo.minSdkName = rankingDetailInfo.getMinSdkName();
        excellianceAppInfo.gms = rankingDetailInfo.isGms();
        excellianceAppInfo.cpu = rankingDetailInfo.getCpu();
        excellianceAppInfo.free = rankingDetailInfo.isFree();
        excellianceAppInfo.apkFrom = rankingDetailInfo.apkFrom;
        excellianceAppInfo.isWhite = rankingDetailInfo.isWhite;
        excellianceAppInfo.downloadButtonVisible = rankingDetailInfo.downloadButtonVisible;
        excellianceAppInfo.market_strategy = rankingDetailInfo.market_strategy;
        excellianceAppInfo.market_install_local = rankingDetailInfo.market_install_local;
        excellianceAppInfo.isLy = rankingDetailInfo.isOpLy;
        excellianceAppInfo.appUpdateTime = rankingDetailInfo.appUpdateTime;
        excellianceAppInfo.serverVc = rankingDetailInfo.apk_update_version;
        excellianceAppInfo.datafinder_game_id = rankingDetailInfo.datafinder_game_id;
        excellianceAppInfo.noDLAntiAddiction = rankingDetailInfo.noDLAntiAddiction;
        try {
            excellianceAppInfo.appId = Integer.parseInt(rankingDetailInfo.getId());
        } catch (Exception e) {
            e.printStackTrace();
        }
        excellianceAppInfo.subscribeState = rankingDetailInfo.subscribeState;
        excellianceAppInfo.subscribe = rankingDetailInfo.subscribe;
        if (b.bh(context)) {
            excellianceAppInfo.apkFrom = rankingDetailInfo.apkFrom;
            excellianceAppInfo.price = rankingDetailInfo.price;
            AppBuyBean l = com.excelliance.kxqp.repository.a.a(context).l(excellianceAppInfo.getAppPackageName());
            if (l != null) {
                l.initData();
                excellianceAppInfo.isBuy = l.isBuy(context) ? 1 : 0;
            }
        }
        rankingDetailInfo.setAppInfo(excellianceAppInfo);
        return excellianceAppInfo;
    }

    private static String g(String str) {
        String[] split = str.split(StatisticsManager.COMMA);
        StringBuilder sb = new StringBuilder();
        boolean z = true;
        for (String str2 : split) {
            if (!TextUtils.isEmpty(str2) && z) {
                sb.append(str2);
                z = false;
            } else if (!TextUtils.isEmpty(str2)) {
                sb.append(StatisticsManager.COMMA + str2);
            }
        }
        return sb.toString();
    }

    public static void af(final Context context) {
        if (!ViewSwitcher.a(context).a()) {
            by.a(context, "sp_config").a("sp_key_voucher_info", "");
        } else {
            tp.f(new Runnable() {
                @Override
                public void run() {
                    try {
                        com.excelliance.kxqp.api.c cVar = new com.excelliance.kxqp.api.c(context);
                        cVar.a(ApiManager.getInstance().a(context, 15000L, 15000L, "https://api.ourplay.com.cn/").h());
                        ResponseData b2 = cVar.b();
                        az.d("GSUtil", "run: getVoucherInfo::" + b2);
                        if (b2.code != 1 || b2.data == 0 || ((CouponServerBean) b2.data).couponBeans == null) {
                            return;
                        }
                        com.excelliance.kxqp.gs.ui.MyVoucher.a.a(context, ((CouponServerBean) b2.data).couponBeans);
                    } catch (Exception e) {
                        e.printStackTrace();
                        Log.d("GSUtil", "run: " + e.toString());
                    }
                }
            });
        }
    }

    public static void a(Context context, GGAccBean gGAccBean) {
        az.d("GSUtil", String.format("saveCouponsGoogleAccount:thread(%s) (%s)", Thread.currentThread().getName(), gGAccBean));
        by.a(context, "sp_config").a("sp_key_game_inner_login_google_account_page_show_buy_google_info", new Gson().a(gGAccBean));
    }

    public static GGAccBean ag(Context context) {
        String b2 = by.a(context, "sp_config").b("sp_key_game_inner_login_google_account_page_show_buy_google_info", "");
        az.d("GSUtil", String.format("getCouponsGoogleAccount:thread(%s) (%S)", Thread.currentThread().getName(), b2));
        if (!cd.a(b2)) {
            try {
                return (GGAccBean) new Gson().a(b2.toString(), new TypeToken<GGAccBean>() {
                }.getType());
            } catch (Exception e) {
                e.printStackTrace();
                az.d("GSUtil", String.format("getCouponsGoogleAccount:thread(%s)", Thread.currentThread().getName()));
            }
        }
        return null;
    }

    public static void a(Context context, BuyGoogleAccountSupportPayResult buyGoogleAccountSupportPayResult) {
        az.d("GSUtil", String.format("saveBuyGoogleAccountSupportPayList:thread(%s) (%S)", Thread.currentThread().getName(), buyGoogleAccountSupportPayResult));
        by.a(context, "sp_config").a("sp_key_buy_google_account_pay_way_info", new Gson().a(buyGoogleAccountSupportPayResult));
    }

    public static BuyGoogleAccountSupportPayResult ah(Context context) {
        String b2 = by.a(context, "sp_config").b("sp_key_buy_google_account_pay_way_info", "");
        az.d("GSUtil", String.format("getBuyGoogleAccountSupportPayList:thread(%s) (%S)", Thread.currentThread().getName(), b2));
        if (!cd.a(b2)) {
            try {
                return (BuyGoogleAccountSupportPayResult) new Gson().a(b2.toString(), new TypeToken<BuyGoogleAccountSupportPayResult>() {
                }.getType());
            } catch (Exception e) {
                e.printStackTrace();
                az.d("GSUtil", String.format("getBuyGoogleAccountSupportPayList:thread(%s)", Thread.currentThread().getName()));
            }
        }
        return null;
    }

    public static boolean d(Context context, ExcellianceAppInfo excellianceAppInfo) {
        String[] strArr;
        boolean z = false;
        if (context == null || excellianceAppInfo == null || !(TextUtils.equals(excellianceAppInfo.getAppPackageName(), "com.pubg.newstate") || TextUtils.equals(excellianceAppInfo.getAppPackageName(), "com.square_enix.android_googleplay.ff7fsww") || TextUtils.equals(excellianceAppInfo.getAppPackageName(), "com.square_enix.android_googleplay.ff7fsjp") || TextUtils.equals(excellianceAppInfo.getAppPackageName(), "com.arm.game.alphaace") || TextUtils.equals(excellianceAppInfo.getAppPackageName(), "com.dreamotion.ronin"))) {
            return false;
        }
        az.d("GSUtil", String.format("isInvalidImportSplitPubg:thread(%s), appInfo(%s)", Thread.currentThread().getName(), excellianceAppInfo));
        String path = excellianceAppInfo.getPath();
        String appPackageName = excellianceAppInfo.getAppPackageName();
        az.d("GSUtil", "isInvalidImportSplitPubg: path = " + path);
        try {
            if (!TextUtils.isEmpty(path) && !path.contains(context.getPackageName())) {
                ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(appPackageName, 0);
                boolean z2 = (applicationInfo == null || (strArr = applicationInfo.splitSourceDirs) == null || strArr.length <= 0) ? false : true;
                az.d("GSUtil", "isInvalidImportSplitPubg:path = " + path + ", validSplit = " + z2);
                if (!z2) {
                    File file = new File(path);
                    Log.d("GSUtil", "isInvalidImportSplitPubg:path = " + path + ", exists = " + file.exists() + ", isFile = " + file.isFile() + ", length = " + file.length());
                    if (file.exists() && file.isFile()) {
                        if (file.length() < 104857600) {
                            z = true;
                        }
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        Log.d("GSUtil", "isInvalidImportSplitPubg:final path = " + path + ", invalid = " + z);
        return z;
    }

    public static boolean e(Context context, ExcellianceAppInfo excellianceAppInfo) {
        boolean z;
        boolean z2 = false;
        if (context == null || excellianceAppInfo == null || !ViewSwitcher.a(context).f()) {
            return false;
        }
        az.d("GSUtil", String.format("isInvalidSplitApk:thread(%s), appInfo(%s)", Thread.currentThread().getName(), excellianceAppInfo));
        String path = excellianceAppInfo.getPath();
        String appPackageName = excellianceAppInfo.getAppPackageName();
        az.d("GSUtil", "isInvalidSplitApk: path = " + path);
        try {
            if (!TextUtils.isEmpty(path) && !path.contains(context.getPackageName())) {
                String str = null;
                ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(appPackageName, 0);
                if (applicationInfo != null) {
                    str = applicationInfo.sourceDir;
                    String[] strArr = applicationInfo.splitSourceDirs;
                    if (strArr != null && strArr.length > 0) {
                        z = true;
                        az.d("GSUtil", "isInvalidSplitApk:path = " + path + ", splitApk = " + z + ", baseApkPath = " + str);
                        if (!z) {
                            if (!TextUtils.isEmpty(str)) {
                                try {
                                    com.excelliance.kxqp.apkparser.a.a a2 = new com.excelliance.kxqp.apkparser.b(new File(str)).a();
                                    StringBuilder sb = new StringBuilder();
                                    sb.append("isInvalidSplitApk base isSplitRequired:");
                                    sb.append(a2 != null ? Boolean.valueOf(a2.b()) : "null");
                                    sb.append(", baseApkPath = ");
                                    sb.append(str);
                                    az.d("GSUtil", sb.toString());
                                    if (a2.b()) {
                                        az.d("GSUtil", "isInvalidSplitApk base isSplitRequired pkg = " + appPackageName + ", baseApkPath = " + str);
                                        z2 = true;
                                    }
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                            }
                            az.d("GSUtil", "isInvalidSplitApk:path = " + path + ", baseApkPath = " + str + ", invalid = " + z2);
                        }
                    }
                }
                z = false;
                az.d("GSUtil", "isInvalidSplitApk:path = " + path + ", splitApk = " + z + ", baseApkPath = " + str);
                if (!z) {
                }
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        az.d("GSUtil", "isInvalidSplitApk:final path = " + path + ", invalid = " + z2);
        return z2;
    }

    public static void H(Context context, String str) {
        az.d("GSUtil", "checkBackgroudGame:pkg = " + str);
        f11801a = str;
        if (context == null) {
            return;
        }
        try {
            if (TextUtils.isEmpty(str)) {
                return;
            }
            Map<String, GameType> b2 = au.b();
            az.d("GSUtil", "checkBackgroudGame:pkgForground = " + str + ", gameTypeMap size = " + b2.size());
            GameType gameType = b2.get(str);
            boolean z = (((gameType == null || gameType.getExt() == null) ? 0 : gameType.getExt().intValue()) & 2097152) == 2097152;
            az.d("GSUtil", "checkBackgroudGame:pkg = " + str + ", check = " + z + ", currentGt = " + gameType);
            if (z) {
                for (ExcellianceAppInfo excellianceAppInfo : com.excelliance.kxqp.repository.a.a(context).b()) {
                    if (!TextUtils.equals(str, excellianceAppInfo.getAppPackageName()) && !bs.n(excellianceAppInfo.getAppPackageName()) && !bs.r(excellianceAppInfo.getAppPackageName()) && !bs.o(excellianceAppInfo.getAppPackageName())) {
                        GameType gameType2 = b2.get(excellianceAppInfo.getAppPackageName());
                        boolean z2 = (((gameType2 == null || gameType2.getExt() == null) ? 0 : gameType2.getExt().intValue()) & 4194304) == 4194304;
                        GameAttributesHelper.getInstance().c(context, excellianceAppInfo.getAppPackageName());
                        if (gameType2 == null || (((gameType2.getMain() == null || gameType2.getMain().intValue() == 0) && (gameType2.getExt() == null || gameType2.getExt().intValue() == 0)) || !z2)) {
                            az.d("GSUtil", "checkBackgroudGame:stop pkg = " + excellianceAppInfo.getAppPackageName() + ", gt = " + gameType2);
                            PlatSdk.getInstance().a(context, excellianceAppInfo.getAppPackageName(), 0);
                        }
                    }
                }
            }
        } catch (Exception unused) {
        }
    }

    public static String p() {
        return f11801a;
    }

    public static boolean I(Context context, String str) {
        boolean z = false;
        if (context == null || TextUtils.isEmpty(str)) {
            return false;
        }
        if (TextUtils.equals(str, p())) {
            String m = GameUtil.m(context);
            az.d("GSUtil", "isGameRunningForground:stop pkg = " + str + ", topActivity = " + m);
            if (!TextUtils.isEmpty(m) && m.contains("com.excelliance.kxqp.platform.proxy.gameplugin")) {
                z = true;
            }
        }
        az.d("GSUtil", "isGameRunningForground:stop pkg = " + str + ", running = " + z + ", getForgroundGame = " + p());
        return z;
    }

    public static void J(Context context, String str) {
        Exception e;
        BufferedReader bufferedReader;
        if (context == 0 && !TextUtils.equals(str, "com.ea.gp.apexlegendsmobilefps")) {
            return;
        }
        BufferedReader bufferedReader2 = null;
        boolean z = false;
        try {
            try {
                try {
                    context = context.getFilesDir().getParent() + File.separator + "gameplugins" + File.separator + str + File.separator + "files/UE4Game/AClient/AClient/Saved/Logs/AClient.log";
                    try {
                        az.d("GSUtil", "checkApexCrashLog:path = " + ((String) context));
                        File file = new File((String) context);
                        if (!file.exists() || file.length() >= PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED) {
                            bufferedReader = null;
                        } else {
                            az.d("GSUtil", "checkApexCrashLog:file exists");
                            bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
                            while (true) {
                                try {
                                    String readLine = bufferedReader.readLine();
                                    if (readLine == null) {
                                        break;
                                    } else if (readLine.contains("Error: RestoreGLProgramFromBinary : Failed to restore GL program from binary data")) {
                                        break;
                                    }
                                } catch (Exception e2) {
                                    bufferedReader2 = bufferedReader;
                                    e = e2;
                                    e.printStackTrace();
                                    if (bufferedReader2 != null) {
                                        bufferedReader2.close();
                                        context = context;
                                    }
                                    az.d("GSUtil", "checkApexCrashLog:found = " + z);
                                    if (z) {
                                    }
                                } catch (Throwable th) {
                                    th = th;
                                    bufferedReader2 = bufferedReader;
                                    if (bufferedReader2 != null) {
                                        try {
                                            bufferedReader2.close();
                                        } catch (IOException e3) {
                                            e3.printStackTrace();
                                        }
                                    }
                                    throw th;
                                }
                            }
                        }
                    } catch (Exception e4) {
                        e = e4;
                    }
                } catch (IOException e5) {
                    e5.printStackTrace();
                }
            } catch (Exception e6) {
                e = e6;
                context = "";
            }
            if (bufferedReader != null) {
                bufferedReader.close();
                context = context;
            }
            az.d("GSUtil", "checkApexCrashLog:found = " + z);
            if (z) {
                return;
            }
            try {
                an.c(context);
            } catch (Exception unused) {
            }
        } catch (Throwable th2) {
            th = th2;
        }
    }

    public static String a(Context context, be beVar) {
        if (beVar == null) {
            return "Unknown Error";
        }
        if (beVar.f11889a == 0) {
            return "Success";
        }
        if (beVar.f11889a == -1) {
            String str = beVar.f11890b;
            if (TextUtils.isEmpty(str)) {
                str = "Unknown";
            }
            return String.format(context.getString(R.string.network_error_msg), str);
        }
        return String.format(context.getString(R.string.server_error_msg), beVar.f11889a + "-" + beVar.f11890b);
    }
}