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

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


package com.excelliance.kxqp.utils;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Environment;
import android.os.Process;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.util.Xml;
import com.android.spush.util.WebActionRouter;
import com.excelliance.kxqp.GameUtilBuild;
import com.excelliance.kxqp.gs.util.bd;
import com.excelliance.kxqp.platforms.ExcellianceAppInfo;
import com.tencent.connect.common.Constants;
import com.tencent.open.SocialConstants;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.lang.reflect.Method;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
import org.apache.http.HttpHost;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class ac {
    private static int H = -1;
    private static long I = 0;
    private static boolean J = false;
    private static String K = "";
    private static long L = 0;
    private static boolean M = false;
    private static long N = 0;
    private static int O = 0;

    public static boolean f15128a = false;

    public static boolean f15129b = false;
    public static boolean c = false;
    public static boolean d = false;
    public static String e = ".action.dlist";
    public static int f = 0;
    public static int g = 1;
    public static int h = 2;
    public static int i = 3;
    public static int j = 4;
    public static int k = 5;
    public static int l = 6;
    public static boolean m = false;
    public static boolean n = true;
    public static int o = 0;
    public static int p = 1;
    public static int q = 2;
    public static String t;
    private static ac u;
    private static boolean v;
    private static boolean w;
    private static boolean x;
    public final boolean r = false;
    Pattern s = Pattern.compile("^[-\\+]?[\\d]*$");
    private Context y = null;
    private String z = null;
    private String A = null;
    private String B = null;
    private Object C = new Object();
    private boolean D = false;
    private boolean E = false;
    private Object F = new Object();
    private boolean G = false;

    private ac() {
    }

    public static synchronized ac a() {
        ac acVar;
        synchronized (ac.class) {
            if (u == null) {
                u = new ac();
            }
            acVar = u;
        }
        return acVar;
    }

    public static String a(String str) {
        try {
            Method declaredMethod = Class.forName("android.os.SystemProperties").getDeclaredMethod("get", String.class, String.class);
            declaredMethod.setAccessible(true);
            String str2 = (String) declaredMethod.invoke(null, str, "");
            return str2 != null ? str2 : "";
        } catch (Exception unused) {
            return "";
        }
    }

    public void a(Context context) {
        if (context == null) {
            return;
        }
        this.y = context.getApplicationContext();
        if (this.y == null) {
            this.y = context;
        }
    }

    public synchronized String b(String str) {
        String str2;
        str2 = "";
        File file = new File(str);
        if (file.exists()) {
            try {
                InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file), "UTF-8");
                BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    str2 = str2 + readLine;
                }
                inputStreamReader.close();
            } catch (Exception e2) {
                Log.d("VersionManagerExt", "getAppListFileContent: Exception = " + str2);
                e2.printStackTrace();
            }
        }
        if (str2.length() == 0) {
            str2 = null;
        }
        return str2;
    }

    public List<s> a(int i2, int i3, boolean z) {
        s sVar;
        s sVar2;
        int remoteRunningPid;
        ByteArrayInputStream byteArrayInputStream;
        int eventType;
        Log.d("VersionManagerExt", "xui entered");
        ArrayList arrayList = new ArrayList();
        GameUtilBuild intance = GameUtilBuild.getIntance();
        StringBuilder sb = new StringBuilder("http://folder.appota.cn/chksdkupdate.php");
        sb.append("?sdkver=" + GameUtilBuild.getOTAVersion(this.y));
        sb.append("&vn=" + GameUtilBuild.getApkVersionName(this.y, this.y.getPackageName()));
        sb.append("&compver=" + b(this.y));
        sb.append("&apkver=" + com.excelliance.kxqp.util.a.a.getApkVersion(this.y));
        sb.append("&mainver=" + GameUtilBuild.getCurrentMainVersion(this.y));
        sb.append("&current_apkver=" + com.excelliance.kxqp.util.a.a.getApkVersion(this.y));
        sb.append("&current_mainver=" + GameUtilBuild.getCurrentMainVersion(this.y));
        sb.append("&chid=" + GameUtilBuild.getApkMainCh(this.y));
        sb.append("&subchid=" + GameUtilBuild.getApkSubCh(this.y));
        sb.append("&type=" + GameUtilBuild.getPlatformType());
        int i4 = 2;
        sb.append("&uflag=" + (GameUtilBuild.checkWifiState(this.y) ? 2 : 0));
        sb.append("&pkg=" + this.y.getPackageName());
        sb.append("&targetSdkVer=" + GameUtilBuild.getTargetSdkVersion(this.y));
        sb.append(f(this.y, z));
        List<w> b2 = b(false);
        int c2 = c(this.y);
        for (int i5 = 1; i5 < c2 + 1; i5++) {
            b2.addAll(a(false, i5));
        }
        StringBuilder sb2 = new StringBuilder();
        HashMap hashMap = new HashMap();
        if (b2 != null) {
            for (int i6 = 0; i6 < b2.size(); i6++) {
                try {
                    w wVar = b2.get(i6);
                    if (!hashMap.containsKey(wVar.f15150b)) {
                        hashMap.put(wVar.f15150b, wVar.f15150b);
                        if (i6 != 0) {
                            sb2.append(com.alipay.sdk.util.i.f491b);
                        }
                        sb2.append(wVar.f15150b);
                    }
                } catch (Exception e2) {
                    e2.printStackTrace();
                }
            }
        }
        sb.append("&api=" + Build.VERSION.SDK_INT);
        sb.append("&release=" + Build.VERSION.RELEASE);
        try {
            sb.append("&abi=" + URLEncoder.encode(Build.CPU_ABI, "UTF-8").replaceAll("\\+", "%20"));
            sb.append("&abi2=" + URLEncoder.encode(Build.CPU_ABI2, "UTF-8").replaceAll("\\+", "%20"));
            sb.append("&abilist=" + URLEncoder.encode(a("ro.product.cpu.abilist"), "UTF-8").replaceAll("\\+", "%20"));
            sb.append("&abilist32=" + URLEncoder.encode(a("ro.product.cpu.abilist32"), "UTF-8").replaceAll("\\+", "%20"));
            sb.append("&abilist64=" + URLEncoder.encode(a("ro.product.cpu.abilist64"), "UTF-8").replaceAll("\\+", "%20"));
            sb.append("&brand=" + URLEncoder.encode(Build.BRAND, "UTF-8").replaceAll("\\+", "%20"));
            sb.append("&manufacturer=" + URLEncoder.encode(Build.MANUFACTURER, "UTF-8").replaceAll("\\+", "%20"));
            sb.append("&model=" + URLEncoder.encode(Build.MODEL, "UTF-8").replaceAll("\\+", "%20"));
            sb.append("&product=" + URLEncoder.encode(Build.PRODUCT, "UTF-8").replaceAll("\\+", "%20"));
        } catch (Exception unused) {
        }
        sb.append("&issl=1");
        sb.append("&ent=2");
        try {
            sb.append("&opl=" + URLEncoder.encode(Base64.encodeToString(sb2.toString().getBytes(), 0), "UTF-8"));
        } catch (Exception e3) {
            e3.printStackTrace();
            Log.e("VersionManagerExt", "UnsupportedEncodingException");
        }
        sb.append("&sign=" + intance.getSignature(this.y));
        s sVar3 = null;
        String str = null;
        try {
            Log.d("VersionManagerExt", "export xui getURL:" + sb.toString());
            String a2 = a(sb.toString(), false, i2, i3);
            if (a2 != null && a2.length() > 0) {
                Log.d("VersionManagerExt", "xui result:" + a2);
                if (a2 == null) {
                    a2 = "";
                }
                if (a2 == null || a2.length() == 0) {
                    this.y.getSharedPreferences("updateInfo", 0).edit().putString("updateInfo", "").commit();
                    return arrayList;
                }
                if (a2 != null) {
                    try {
                        if (!a2.trim().equals("")) {
                            byteArrayInputStream = new ByteArrayInputStream(a2.getBytes());
                            XmlPullParser newPullParser = Xml.newPullParser();
                            newPullParser.setInput(byteArrayInputStream, "UTF-8");
                            eventType = newPullParser.getEventType();
                            s sVar4 = null;
                            while (eventType != 1) {
                                if (eventType != 0 && eventType == i4) {
                                    try {
                                        if (newPullParser.getName().equalsIgnoreCase("info")) {
                                            String attributeValue = newPullParser.getAttributeValue(str, "tp");
                                            String attributeValue2 = newPullParser.getAttributeValue(str, "flag");
                                            String attributeValue3 = newPullParser.getAttributeValue(str, SocialConstants.PARAM_SOURCE);
                                            String attributeValue4 = newPullParser.getAttributeValue(str, "vcode");
                                            String attributeValue5 = newPullParser.getAttributeValue(str, "vsize");
                                            String attributeValue6 = newPullParser.getAttributeValue(str, "vmd5");
                                            if (attributeValue == null || attributeValue2 == null || attributeValue3 == null || attributeValue4 == null || attributeValue5 == null || attributeValue6 == null) {
                                                sVar3 = sVar4;
                                            } else {
                                                Log.d("VersionManagerExt", "queryUpdateInfo flag=" + attributeValue2 + ", source=" + attributeValue3 + ", vcode=" + attributeValue4 + ", vsize=" + attributeValue5 + ", vmd5=" + attributeValue6 + ", type=" + attributeValue);
                                                sVar3 = new s(attributeValue, attributeValue2.equals("1"), attributeValue3, attributeValue4, attributeValue5, attributeValue6);
                                                arrayList.add(sVar3);
                                            }
                                            sVar4 = sVar3;
                                        } else {
                                            continue;
                                        }
                                    } catch (Exception e4) {
                                        e = e4;
                                        sVar = sVar4;
                                        Log.d("VersionManagerExt", "queryUpdateInfo e=" + e);
                                        e.printStackTrace();
                                        sVar2 = sVar;
                                        if (sVar2 != null) {
                                        }
                                        if (arrayList.size() == 0) {
                                        }
                                        return arrayList;
                                    }
                                }
                                eventType = newPullParser.next();
                                str = null;
                                i4 = 2;
                            }
                            byteArrayInputStream.close();
                            sVar = sVar4;
                        }
                    } catch (Exception e5) {
                        e = e5;
                        sVar = sVar3;
                        Log.d("VersionManagerExt", "queryUpdateInfo e=" + e);
                        e.printStackTrace();
                        sVar2 = sVar;
                        if (sVar2 != null) {
                        }
                        if (arrayList.size() == 0) {
                        }
                        return arrayList;
                    }
                }
                byteArrayInputStream = null;
                XmlPullParser newPullParser2 = Xml.newPullParser();
                newPullParser2.setInput(byteArrayInputStream, "UTF-8");
                eventType = newPullParser2.getEventType();
                s sVar42 = null;
                while (eventType != 1) {
                }
                byteArrayInputStream.close();
                sVar = sVar42;
            } else {
                Log.d("VersionManagerExt", "queryUpdateInfo error");
                sVar = null;
            }
        } catch (Exception e6) {
            e = e6;
            sVar = null;
        }
        sVar2 = sVar;
        if (sVar2 != null) {
            if (sVar2.f15154a.equals("apk")) {
                this.y.getSharedPreferences("updateInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putString("updateInfo", "type=" + sVar2.f15154a + ";force=" + sVar2.f15155b + ";url=" + sVar2.c + ";version=" + sVar2.d + ";size=" + sVar2.e + ";md5=" + sVar2.f + com.alipay.sdk.util.i.f491b).commit();
            }
            String string = this.y.getSharedPreferences("prompt", Build.VERSION.SDK_INT < 11 ? 0 : 4).getString("lastSdkVersion", "");
            Log.d("VersionManagerExt", "queryUpdateInfo lastVersion:" + string);
            if (!string.equals(sVar2.d) && sVar2.f15154a.equals("apk")) {
                Log.d("VersionManagerExt", "queryUpdateInfo lastVersion:" + string + " updateInfo.version:" + sVar2.d);
                this.y.getSharedPreferences("prompt", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putString("lastSdkVersion", sVar2.d).commit();
                this.y.getSharedPreferences("prompt", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putBoolean("sdkUpdate", false).commit();
            }
        } else {
            this.y.getSharedPreferences("updateInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putString("updateInfo", "").commit();
        }
        if (arrayList.size() == 0) {
            SharedPreferences sharedPreferences = this.y.getSharedPreferences(Constants.PARAM_PLATFORM, Build.VERSION.SDK_INT < 11 ? 0 : 4);
            int parseInt = Integer.parseInt(sharedPreferences.getString("update_info", "0"));
            if ((parseInt & 4) != 0 && !GameUtilBuild.getIntance().isTop(this.y) && (remoteRunningPid = GameUtilBuild.getIntance().remoteRunningPid(this.y)) != 0) {
                SharedPreferences.Editor edit = sharedPreferences.edit();
                edit.putString("update_info", String.valueOf(parseInt & (-5)));
                edit.commit();
                Process.killProcess(remoteRunningPid);
            }
        }
        return arrayList;
    }

    public String b() {
        if (this.z != null) {
            return this.z;
        }
        if (this.y == null) {
            return this.z;
        }
        this.z = this.y.getSharedPreferences("userInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4).getString("uid", null);
        if (this.z != null) {
            return this.z;
        }
        return this.z;
    }

    public String a(boolean z) {
        String packageName = this.y.getPackageName();
        String str = null;
        if (z) {
            if (!GameUtilBuild.getIntance().hasExternalStorage()) {
                return null;
            }
            str = Environment.getExternalStorageDirectory().toString() + "/.dygameres.apps/";
        }
        if (str != null) {
            return str;
        }
        return "/data/data/" + packageName + "/.dygameres.apps/";
    }

    public String a(Context context, boolean z) {
        String packageName = context.getPackageName();
        String str = null;
        if (z) {
            if (!GameUtilBuild.getIntance().hasExternalStorage()) {
                return null;
            }
            str = Environment.getExternalStorageDirectory().toString() + "/.dygameres.apps/";
        }
        if (str != null) {
            return str;
        }
        return "/data/data/" + packageName + "/.dygameres.apps/";
    }

    public String b(Context context) {
        File file;
        String string;
        int i2;
        String str = "";
        try {
            file = new File(context.getFilesDir() + "/game_res/compVersion");
            string = context.getSharedPreferences(Constants.PARAM_PLATFORM, Build.VERSION.SDK_INT < 11 ? 0 : 4).getString("current_version", "0");
        } catch (Exception e2) {
            e = e2;
        }
        try {
            try {
                i2 = Integer.parseInt(string);
            } catch (Exception e3) {
                Log.e("VersionManagerExt", "getCompVersion: has exception = " + e3.getMessage());
                i2 = 0;
            }
            Log.e("VersionManagerExt", "getCompVersion: compVersion = " + string + ", compV = " + i2);
            if (i2 <= 0) {
                try {
                    if (file.exists()) {
                        InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file), "UTF-8");
                        String readLine = new BufferedReader(inputStreamReader).readLine();
                        try {
                            inputStreamReader.close();
                            string = readLine;
                        } catch (Exception e4) {
                            e = e4;
                            string = readLine;
                            e.printStackTrace();
                            int compVersion = GameUtilBuild.getCompVersion(context);
                            Log.e("VersionManagerExt", "getCompVersion: compVersion = " + string + ", compV = " + i2 + ", manifestCompVersion = " + compVersion);
                            if (string != null) {
                                return string;
                            }
                            str = String.valueOf(GameUtilBuild.getCompVersion(context));
                            c(str);
                            return str;
                        }
                    }
                } catch (Exception e5) {
                    e = e5;
                }
            }
            int compVersion2 = GameUtilBuild.getCompVersion(context);
            Log.e("VersionManagerExt", "getCompVersion: compVersion = " + string + ", compV = " + i2 + ", manifestCompVersion = " + compVersion2);
            if (string != null && string.length() > 0 && Integer.parseInt(string) >= compVersion2) {
                return string;
            }
            str = String.valueOf(GameUtilBuild.getCompVersion(context));
            c(str);
            return str;
        } catch (Exception e6) {
            e = e6;
            str = string;
            e.printStackTrace();
            return str;
        }
    }

    public void c(String str) {
        if (str == null || str.trim().length() <= 0) {
            return;
        }
        File file = new File(this.y.getFilesDir() + "/game_res/compVersion");
        try {
            this.y.getSharedPreferences(Constants.PARAM_PLATFORM, Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putString("current_version", str).commit();
            Log.e("VersionManagerExt", "saveCompVersionToFile: result = " + str + ", getCompVersion = " + b(this.y));
            if (file.exists()) {
                file.delete();
            }
            file.getParentFile().mkdirs();
            FileOutputStream fileOutputStream = new FileOutputStream(file);
            fileOutputStream.write(str.getBytes());
            fileOutputStream.flush();
            fileOutputStream.close();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public void d(String str) {
        StringBuilder sb;
        int indexOf;
        int indexOf2;
        if (str == null || str.trim().length() <= 0) {
            return;
        }
        String str2 = "";
        File file = new File(this.y.getFilesDir() + "/game_res/verinfo.cfg");
        try {
            this.y.getSharedPreferences(Constants.PARAM_PLATFORM, Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putString("current_main_version", str).commit();
            if (file.exists()) {
                InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file), "UTF-8");
                BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    str2 = str2 + readLine;
                }
                inputStreamReader.close();
                if (str2.length() > 0 && (indexOf = (sb = new StringBuilder(str2)).indexOf("<main")) >= 0 && (indexOf2 = sb.indexOf("version=", indexOf + 5)) >= 0) {
                    int indexOf3 = sb.indexOf("\"", indexOf2);
                    int i2 = indexOf3 + 1;
                    int indexOf4 = sb.indexOf("\"", i2);
                    if (indexOf3 >= 0 && indexOf4 >= 0) {
                        sb.delete(i2, indexOf4);
                        sb.insert(i2, str);
                        str2 = sb.toString();
                    }
                }
            }
            if (str2.length() == 0) {
                StringBuilder sb2 = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
                sb2.append("<verinfo>\n");
                sb2.append("<main version=\"" + str + "\" />\n");
                sb2.append("</verinfo>");
                str2 = sb2.toString();
            }
            if (!file.exists()) {
                file.getParentFile().mkdirs();
                file.createNewFile();
            } else {
                file.delete();
            }
            BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
            bufferedWriter.write(str2);
            bufferedWriter.close();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public void a(String str, String str2) {
        GameUtilBuild.saveVersionToFileByKey(this.y, str, str2);
    }

    public List<w> b(boolean z) {
        return a(z, 0);
    }

    public List<w> a(boolean z, int i2) {
        return a(z, i2, false);
    }

    public List<w> a(boolean z, int i2, boolean z2) {
        int i3;
        XmlPullParser xmlPullParser;
        ByteArrayInputStream byteArrayInputStream;
        w wVar;
        int i4 = i2;
        ArrayList arrayList = new ArrayList();
        String b2 = b(a(z2) + "game_res/3rd/config/" + a(i4));
        if (b2 == null || b2.length() == 0) {
            return arrayList;
        }
        this.y.getPackageManager();
        if (b2 != null) {
            try {
                if (!b2.trim().equals("")) {
                    if (!b2.contains("&amp;")) {
                        b2 = b2.replaceAll(com.alipay.sdk.sys.a.f472b, "&amp;");
                    }
                    ByteArrayInputStream byteArrayInputStream2 = new ByteArrayInputStream(b2.getBytes());
                    XmlPullParser newPullParser = Xml.newPullParser();
                    try {
                        try {
                            newPullParser.setInput(byteArrayInputStream2, "UTF-8");
                            int eventType = newPullParser.getEventType();
                            while (eventType != 1) {
                                if (eventType != 0 && eventType == 2 && newPullParser.getName().equalsIgnoreCase("glist")) {
                                    String attributeValue = newPullParser.getAttributeValue(null, "gid");
                                    String attributeValue2 = newPullParser.getAttributeValue(null, "gver");
                                    String attributeValue3 = newPullParser.getAttributeValue(null, "glvl");
                                    String replaceAll = newPullParser.getAttributeValue(null, "gname").replaceAll("&amp;", com.alipay.sdk.sys.a.f472b);
                                    String attributeValue4 = newPullParser.getAttributeValue(null, "glib");
                                    String attributeValue5 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_SAVEPATH);
                                    String attributeValue6 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PPATH);
                                    String attributeValue7 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GTYPE);
                                    newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PATCH);
                                    newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GSIZE);
                                    newPullParser.getAttributeValue(null, "omd5");
                                    newPullParser.getAttributeValue(null, "dmd5");
                                    String attributeValue8 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_DSTATUS);
                                    String attributeValue9 = newPullParser.getAttributeValue(null, "flag");
                                    String attributeValue10 = newPullParser.getAttributeValue(null, "gtime");
                                    newPullParser.getAttributeValue(null, "gsid");
                                    newPullParser.getAttributeValue(null, "gfup");
                                    newPullParser.getAttributeValue(null, "gvername");
                                    newPullParser.getAttributeValue(null, "gcate");
                                    String attributeValue11 = newPullParser.getAttributeValue(null, "tm");
                                    String attributeValue12 = newPullParser.getAttributeValue(null, "gcid");
                                    if (TextUtils.isEmpty(attributeValue12)) {
                                        attributeValue12 = "3";
                                    }
                                    byteArrayInputStream = byteArrayInputStream2;
                                    String attributeValue13 = newPullParser.getAttributeValue(null, "gprc");
                                    if (TextUtils.isEmpty(attributeValue13)) {
                                        attributeValue13 = "0";
                                    }
                                    ArrayList arrayList2 = arrayList;
                                    try {
                                        try {
                                            String attributeValue14 = newPullParser.getAttributeValue(null, "adt");
                                            newPullParser.getAttributeValue(null, "adp");
                                            String attributeValue15 = newPullParser.getAttributeValue(null, "getime");
                                            newPullParser.getAttributeValue(null, "promsg");
                                            newPullParser.getAttributeValue(null, "proic");
                                            if (attributeValue != null) {
                                                try {
                                                    if (attributeValue.length() > 0) {
                                                        if (z) {
                                                            if ((attributeValue8 != null && attributeValue8.equals(String.valueOf(5)) && attributeValue7 != null && (attributeValue7.equals(String.valueOf(2)) || attributeValue7.equals(String.valueOf(4)))) || (attributeValue12 != null && !String.valueOf(0).equals(attributeValue12) && attributeValue5 != null && attributeValue5.length() > 0 && Integer.parseInt(attributeValue) >= 100000)) {
                                                                String str = attributeValue12;
                                                                w wVar2 = new w(attributeValue, attributeValue2, attributeValue3, replaceAll, attributeValue4, 0, 0, 0, 0);
                                                                wVar2.g = attributeValue5;
                                                                if (attributeValue8 != null && attributeValue8.length() > 0) {
                                                                    wVar2.x = Integer.parseInt(attributeValue8);
                                                                }
                                                                wVar2.l = attributeValue6;
                                                                wVar2.A = attributeValue11;
                                                                if (attributeValue7 != null && attributeValue7.length() > 0) {
                                                                    wVar2.e = Integer.parseInt(attributeValue7);
                                                                }
                                                                if (attributeValue9 != null && attributeValue9.length() > 0) {
                                                                    wVar2.w = Integer.parseInt(attributeValue9);
                                                                }
                                                                wVar2.m = Integer.parseInt(str);
                                                                wVar2.G = Integer.parseInt(attributeValue13);
                                                                wVar2.z = Integer.parseInt(attributeValue10);
                                                                wVar2.D = attributeValue14;
                                                                wVar2.E = attributeValue15;
                                                                try {
                                                                    wVar2.F = i2;
                                                                    try {
                                                                        arrayList2.add(wVar2);
                                                                    } catch (XmlPullParserException e2) {
                                                                        e = e2;
                                                                        arrayList = arrayList2;
                                                                        e.printStackTrace();
                                                                        Log.d("VersionManagerExt", "getAllProviderApps appList.size = " + arrayList.size());
                                                                        return arrayList;
                                                                    } catch (Exception unused) {
                                                                    }
                                                                    arrayList = arrayList2;
                                                                    xmlPullParser = newPullParser;
                                                                    i3 = i2;
                                                                } catch (Exception unused2) {
                                                                    xmlPullParser = newPullParser;
                                                                    i3 = i2;
                                                                    arrayList = arrayList2;
                                                                }
                                                            }
                                                        } else {
                                                            String str2 = attributeValue12;
                                                            try {
                                                                try {
                                                                    xmlPullParser = newPullParser;
                                                                    try {
                                                                        wVar = new w(attributeValue, attributeValue2, attributeValue3, replaceAll, attributeValue4, 0, 0, 0, 0);
                                                                        wVar.g = attributeValue5;
                                                                        if (attributeValue8 != null && attributeValue8.length() > 0) {
                                                                            wVar.x = Integer.parseInt(attributeValue8);
                                                                        }
                                                                        wVar.l = attributeValue6;
                                                                        wVar.A = attributeValue11;
                                                                        if (attributeValue7 != null && attributeValue7.length() > 0) {
                                                                            wVar.e = Integer.parseInt(attributeValue7);
                                                                        }
                                                                        if (attributeValue9 != null && attributeValue9.length() > 0) {
                                                                            wVar.w = Integer.parseInt(attributeValue9);
                                                                        }
                                                                        wVar.m = Integer.parseInt(str2);
                                                                        wVar.G = Integer.parseInt(attributeValue13);
                                                                        wVar.z = Integer.parseInt(attributeValue10);
                                                                        wVar.D = attributeValue14;
                                                                        wVar.E = attributeValue15;
                                                                        i3 = i2;
                                                                    } catch (Exception unused3) {
                                                                        arrayList = arrayList2;
                                                                    }
                                                                } catch (Exception unused4) {
                                                                    xmlPullParser = newPullParser;
                                                                    i3 = i2;
                                                                }
                                                                try {
                                                                    wVar.F = i3;
                                                                    arrayList = arrayList2;
                                                                    try {
                                                                        arrayList.add(wVar);
                                                                    } catch (Exception unused5) {
                                                                    }
                                                                } catch (Exception unused6) {
                                                                    arrayList = arrayList2;
                                                                    eventType = xmlPullParser.next();
                                                                    i4 = i3;
                                                                    byteArrayInputStream2 = byteArrayInputStream;
                                                                    newPullParser = xmlPullParser;
                                                                }
                                                            } catch (XmlPullParserException e3) {
                                                                e = e3;
                                                                arrayList = arrayList2;
                                                                e.printStackTrace();
                                                                Log.d("VersionManagerExt", "getAllProviderApps appList.size = " + arrayList.size());
                                                                return arrayList;
                                                            }
                                                        }
                                                    }
                                                } catch (Exception unused7) {
                                                }
                                            }
                                            xmlPullParser = newPullParser;
                                            arrayList = arrayList2;
                                            i3 = i2;
                                        } catch (Exception e4) {
                                            e = e4;
                                            arrayList = arrayList2;
                                            e.printStackTrace();
                                            Log.d("VersionManagerExt", "getAllProviderApps appList.size = " + arrayList.size());
                                            return arrayList;
                                        }
                                    } catch (XmlPullParserException e5) {
                                        e = e5;
                                        arrayList = arrayList2;
                                    }
                                } else {
                                    i3 = i4;
                                    xmlPullParser = newPullParser;
                                    byteArrayInputStream = byteArrayInputStream2;
                                }
                                eventType = xmlPullParser.next();
                                i4 = i3;
                                byteArrayInputStream2 = byteArrayInputStream;
                                newPullParser = xmlPullParser;
                            }
                            byteArrayInputStream2.close();
                        } catch (Exception e6) {
                            e = e6;
                        }
                    } catch (XmlPullParserException e7) {
                        e = e7;
                    }
                    Log.d("VersionManagerExt", "getAllProviderApps appList.size = " + arrayList.size());
                    return arrayList;
                }
            } catch (Exception e8) {
                Log.d("VersionManagerExt", "getAllProviderApps e" + e8);
                e8.printStackTrace();
                return arrayList;
            }
        }
        return arrayList;
    }

    public String a(int i2) {
        String str = "app_list";
        if (i2 > 0) {
            str = "app_list" + i2;
        }
        return str + ".config";
    }

    public String a(String str, boolean z, int i2, int i3) {
        if (str == null) {
            return null;
        }
        if (!str.toLowerCase().startsWith(HttpHost.DEFAULT_SCHEME_NAME) && !str.toLowerCase().startsWith("https")) {
            return null;
        }
        if (z) {
            return bd.b(str, "", i2, i3);
        }
        return bd.a(str, i2, i3);
    }

    private String f(Context context, boolean z) {
        boolean z2;
        boolean z3;
        int apkVersion;
        StringBuilder sb = new StringBuilder();
        String str = "0";
        try {
            sb.append("&imei=");
            sb.append("&aid=");
            if (context != null) {
                if (!c(context, false) && !e(context, false)) {
                    z2 = false;
                    z3 = d(context);
                }
                z2 = true;
                z3 = d(context);
            } else {
                z2 = false;
                z3 = false;
            }
            sb.append("&uid=" + b());
            if (z2) {
                str = v.a().a(context);
                if ((TextUtils.isEmpty(str) || TextUtils.equals(str, "0")) && (z2 || z3)) {
                    str = "-1";
                }
            } else if (z3) {
                str = "-1";
            }
            sb.append("&rid=" + str);
            String a2 = x.a(context, "ext_app_info", WebActionRouter.KEY_PKG, "");
            if (!TextUtils.isEmpty(a2) && (apkVersion = GameUtilBuild.getApkVersion(context, a2)) > 0) {
                sb.append("&mpkg=" + a2);
                sb.append("&mvc=" + apkVersion);
            }
            sb.append("&vipType=" + context.getSharedPreferences("hello", Build.VERSION.SDK_INT < 11 ? 0 : 4).getInt("vipType", 0));
            sb.append("&abTest=" + GameUtilBuild.getGroup(context));
        } catch (Exception e2) {
            Log.e("VersionManagerExt", "getUserDevInfo: has exception = " + e2.getMessage());
        }
        return sb.toString();
    }

    public static int c(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences(Constants.PARAM_PLATFORM, Build.VERSION.SDK_INT < 11 ? 0 : 4);
        if (H < 0) {
            H = sharedPreferences.getInt("user_max", -1);
            if (H < 0) {
                H = o(context);
            }
        }
        return H;
    }

    private static int o(Context context) {
        return Math.max(g(context, false), g(context, true));
    }

    private static int g(Context context, boolean z) {
        File[] listFiles;
        int lastIndexOf;
        File file = new File(a().a(context, z) + "game_res" + File.separator + "3rd" + File.separator + "config");
        int i2 = 0;
        if (file.exists() && (listFiles = file.listFiles()) != null) {
            int length = listFiles.length;
            int i3 = 0;
            while (i2 < length) {
                String absolutePath = listFiles[i2].getAbsolutePath();
                if (absolutePath != null && (lastIndexOf = absolutePath.lastIndexOf("app_list")) > 0 && lastIndexOf < absolutePath.length() - 9) {
                    try {
                        int parseInt = Integer.parseInt(e(absolutePath.substring(lastIndexOf + 8, absolutePath.length())));
                        if (parseInt > i3) {
                            i3 = parseInt;
                        }
                    } catch (Exception unused) {
                    }
                }
                i2++;
            }
            i2 = i3;
        }
        Log.d("VersionManagerExt", "max:" + i2);
        H = i2;
        return i2;
    }

    private static String e(String str) {
        try {
            return Pattern.compile("[^0-9]").matcher(str).replaceAll("").trim();
        } catch (Exception e2) {
            e2.printStackTrace();
            return "0";
        }
    }

    public static boolean d(Context context) {
        return a(context, false, true);
    }

    public static boolean a(Context context, boolean z, boolean z2) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("alipay", Build.VERSION.SDK_INT < 11 ? 0 : 4);
        context.getSharedPreferences("global_config", Build.VERSION.SDK_INT < 11 ? 0 : 4).getInt("defDisplayStyle", -1);
        if (!z) {
            long currentTimeMillis = System.currentTimeMillis() - L;
            if (L > 0 && Math.abs(currentTimeMillis) < 1000) {
                return M;
            }
        }
        boolean f2 = f(context);
        int e2 = e(context) * 86400;
        int i2 = sharedPreferences.getInt("free_time", 0);
        int i3 = sharedPreferences.getInt("free_time_change", 0);
        int i4 = sharedPreferences.getInt("free_pay_flag", 0);
        if (i2 == 0) {
            f2 = false;
        }
        int currentTimeMillis2 = (int) (System.currentTimeMillis() / 1000);
        Log.d("VersionManagerExt", "current:" + currentTimeMillis2 + "  free_time_change:" + i3 + ", free_time = " + i2 + ", outTime = " + e2 + ", free_pay_flag = " + i4);
        boolean z3 = true;
        if (i3 >= currentTimeMillis2 ? Math.abs(i3 - i2) >= e2 : Math.abs(currentTimeMillis2 - i2) >= e2 && i4 != 1) {
            z3 = f2;
        }
        L = System.currentTimeMillis();
        M = z3;
        Log.d("VersionManagerExt", "checkFreePay: result = " + z3);
        if (z2) {
            b(context, z3);
        } else {
            a(context, r.a().b().a(com.alipay.sdk.util.l.c, z3 + "").c());
        }
        return z3;
    }

    private static void a(Context context, String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        try {
            Intent intent = new Intent(context.getPackageName() + GameUtilBuild.ACTION_WRITE_INFO);
            intent.setComponent(new ComponentName(context.getPackageName(), "com.excelliance.kxqp.SmtServService"));
            intent.putExtra("type", 2);
            intent.putExtra("info", str);
            context.startService(intent);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static void b(Context context, boolean z) {
        if (z) {
            if (x.b(context, "open_freePay", "free_pay_is_vip_time", 0L) == 0) {
                x.a(context, "open_freePay", "free_pay_is_vip_time", System.currentTimeMillis());
            }
            x.a(context, "open_freePay", "free_pay_is_vip_due_time");
            return;
        }
        long b2 = x.b(context, "open_freePay", "free_pay_is_vip_due_time", 0L);
        long b3 = x.b(context, "open_freePay", "free_pay_is_vip_time", 0L);
        Log.d("VersionManagerExt", "checkFreePay: due = " + b2 + ", time = " + b3);
        if (b2 != 0 || b3 == 0) {
            return;
        }
        x.a(context, "open_freePay", "free_pay_is_vip_due_time", System.currentTimeMillis());
    }

    public static int e(Context context) {
        context.getSharedPreferences("global_config", Build.VERSION.SDK_INT < 11 ? 0 : 4).getInt("defDisplayStyle", -1);
        return 3;
    }

    public static boolean f(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("alipay", Build.VERSION.SDK_INT < 11 ? 0 : 4);
        if (t == null) {
            t = v.a().a(context);
        }
        Log.d("VersionManagerExt", "sRid = " + t);
        if (TextUtils.isEmpty(t)) {
            return false;
        }
        int i2 = sharedPreferences.getInt(t, 0);
        Log.d("VersionManagerExt", "activity_free_time = " + i2);
        return i2 > 0;
    }

    public static boolean c(Context context, boolean z) {
        boolean g2;
        if (z) {
            boolean g3 = g(context);
            J = g3;
            Log.d("VersionManagerExt", "isPay = " + J);
            return g3;
        }
        long currentTimeMillis = System.currentTimeMillis();
        if (I == 0 || Math.abs(currentTimeMillis - I) >= 1000) {
            g2 = g(context);
            J = g2;
            I = currentTimeMillis;
        } else {
            g2 = J;
        }
        Log.d("VersionManagerExt", "isPay flag = " + g2);
        return g2;
    }

    public static boolean g(Context context) {
        return h(context);
    }

    public static boolean h(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("special", Build.VERSION.SDK_INT < 11 ? 0 : 4);
        String string = sharedPreferences.getString("cid", null);
        if (!TextUtils.isEmpty(string)) {
            if (b(context, string)) {
                return true;
            }
            Log.d("VersionManagerExt", "sp is not multi");
        } else {
            Log.d("VersionManagerExt", "sp is empty");
        }
        File file = new File(k(context));
        if (file.exists()) {
            String str = "";
            try {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    str = str + readLine;
                }
                bufferedReader.close();
                if (!TextUtils.isEmpty(str) && b(context, str.trim())) {
                    sharedPreferences.edit().putString("cid", str.trim()).apply();
                    return true;
                }
            } catch (Exception e2) {
                e2.printStackTrace();
                Log.d("VersionManagerExt", "检查文件时异常");
            }
        } else {
            Log.d("VersionManagerExt", "本地不存在文件");
        }
        return false;
    }

    private static boolean b(Context context, String str) {
        String i2 = i(context);
        if (TextUtils.isEmpty(i2)) {
            return false;
        }
        if (TextUtils.equals(GameUtilBuild.encrypt(i2.trim()), str)) {
            return true;
        }
        String encrypt = GameUtilBuild.encrypt(com.excelliance.kxqp.util.a.b.e(context));
        if (encrypt != null) {
            encrypt = encrypt.trim();
        }
        if (str.equals(encrypt)) {
            return true;
        }
        Iterator<String> it = j(context).iterator();
        while (it.hasNext()) {
            String encrypt2 = GameUtilBuild.encrypt(it.next());
            if (encrypt2 != null && str.equals(encrypt2.trim())) {
                return true;
            }
        }
        return false;
    }

    public static String i(Context context) {
        String str;
        try {
            str = com.excelliance.kxqp.util.a.b.c(context);
        } catch (Exception e2) {
            e2.printStackTrace();
            str = null;
        }
        return (str == null || str.length() == 0) ? com.excelliance.kxqp.util.a.b.e(context) : str;
    }

    public static List<String> j(Context context) {
        p(context);
        ArrayList arrayList = new ArrayList();
        if (context != null && Build.VERSION.SDK_INT >= 23 && context.getApplicationInfo().targetSdkVersion >= 23 && context.checkSelfPermission("android.permission.READ_PHONE_STATE") != 0) {
            return arrayList;
        }
        String c2 = com.excelliance.kxqp.util.a.b.c(context);
        if (!TextUtils.isEmpty(c2)) {
            arrayList.add(c2);
        }
        List<String> n2 = com.excelliance.kxqp.util.a.b.n(context);
        if (n2 != null && n2.size() > 0) {
            for (int i2 = 0; i2 < n2.size(); i2++) {
                String str = n2.get(i2);
                if (!TextUtils.isEmpty(str)) {
                    a(str, arrayList);
                }
            }
        }
        return arrayList;
    }

    private static int p(Context context) {
        try {
            TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
            int parseInt = Integer.parseInt(Class.forName(telephonyManager.getClass().getName()).getMethod("getPhoneCount", new Class[0]).invoke(telephonyManager, new Object[0]).toString());
            if (parseInt > 4) {
                return 4;
            }
            return parseInt;
        } catch (Exception unused) {
            return 2;
        }
    }

    private static List<String> a(String str, List<String> list) {
        if (!TextUtils.isEmpty(str)) {
            boolean z = false;
            Iterator<String> it = list.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                if (str.trim().equals(it.next().trim())) {
                    z = true;
                    break;
                }
            }
            if (z) {
                return list;
            }
            list.add(str);
        }
        return list;
    }

    public static String k(Context context) {
        String str;
        String packageName = context.getPackageName();
        if (Environment.getExternalStorageState().equals("mounted")) {
            str = Environment.getExternalStorageDirectory().toString() + "/.android/.system/";
        } else {
            str = "/data/data/" + packageName + "/";
        }
        return str + ".pay_special_result";
    }

    public static int l(Context context) {
        return d(context, false);
    }

    public static int d(Context context, boolean z) {
        long currentTimeMillis = System.currentTimeMillis();
        if (Math.abs(currentTimeMillis - N) < 1000) {
            return O;
        }
        N = currentTimeMillis;
        O = v.a().b(context);
        Log.d("VersionManagerExt", "value = " + O);
        if (O != 4) {
            a(context, O);
        }
        return O;
    }

    public static boolean e(Context context, boolean z) {
        return b(context, z, true);
    }

    public static boolean b(Context context, boolean z, boolean z2) {
        return a(context, z, true, false);
    }

    public static boolean a(Context context, boolean z, boolean z2, boolean z3) {
        int l2;
        if ((z && a(context, false, z3)) || (l2 = l(context)) == 1 || l2 == 2 || l2 == 3 || n(context)) {
            return true;
        }
        return z2 && m(context);
    }

    public static boolean m(Context context) {
        return l(context) == 7;
    }

    public static boolean n(Context context) {
        return l(context) == 6;
    }

    public static void a(Context context, int i2) {
        x.a(context, "v_p_temp", "v_p_last_type", i2);
    }
}