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

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


package com.excelliance.kxqp;

import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Process;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.util.Xml;
import com.android.spush.FakeServiceHelper;
import com.android.spush.util.WebActionRouter;
import com.excean.bytedancebi.manager.BiManager;
import com.excelliance.kxqp.api.ApiManager;
import com.excelliance.kxqp.api.model.AppCacheClearResult;
import com.excelliance.kxqp.avds.AvdSplashCallBackImp;
import com.excelliance.kxqp.bitmap.bean.RankingItem;
import com.excelliance.kxqp.gs.appstore.model.ResponseData;
import com.excelliance.kxqp.gs.bean.AppVersionBean;
import com.excelliance.kxqp.gs.discover.model.request.RequestData;
import com.excelliance.kxqp.gs.multi.down.model.DownBean;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.ui.medal.datasource.MedalSource;
import com.excelliance.kxqp.gs.util.an;
import com.excelliance.kxqp.gs.util.as;
import com.excelliance.kxqp.gs.util.au;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.bd;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.gs.util.cd;
import com.excelliance.kxqp.gs.util.cn;
import com.excelliance.kxqp.info.DualaidApkInfoUser;
import com.excelliance.kxqp.platforms.ExcellianceAppInfo;
import com.excelliance.kxqp.push.bean.PushBean;
import com.excelliance.kxqp.sdk.StatisticsBuilder;
import com.excelliance.kxqp.splash.bean.ParallelStrategyBean;
import com.excelliance.kxqp.splash.bean.ResponseAdConfigData;
import com.excelliance.kxqp.splash.bean.ResponseAdConstantData;
import com.excelliance.kxqp.splash.bean.ResponseAdData;
import com.excelliance.kxqp.splash.bean.ResponseAdJarData;
import com.excelliance.kxqp.ui.InitialData;
import com.excelliance.kxqp.util.ac;
import com.excelliance.kxqp.util.ar;
import com.excelliance.staticslio.StatisticsManager;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.tencent.connect.common.Constants;
import com.tencent.open.SocialConstants;
import com.umeng.analytics.pro.am;
import com.umeng.union.UMUnionConstants;
import com.zero.support.core.task.Response;
import io.github.prototypez.appjoint.AppJoint;
import io.github.prototypez.service.adModule.IAdModule;
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.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.RandomAccessFile;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
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 java.util.regex.Pattern;
import org.apache.http.HttpHost;
import org.apache.http.cookie.ClientCookie;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class VersionManager implements l {
    public static final int CHANNEL = 0;

    public static final String f2372a = null;

    public static String f2373b = "opvm.jar";
    private static final String[] u = {"com.studiowildcard.wardrumstudios.ark", "com.gameloft.android.ANMP.GloftA9HM", "jp.pokemon.pokemonquest", "jp.pxv.android", "com.google.earth", "tv.danmaku.bili", "com.picacomic.fregata", "com.gameloft.android.ANMP.GloftA8HM", "com.tencent.ig", "com.gameloft.android.ANMP.GloftM5HM", "com.valvesoftware.android.steam.community", "com.wallpaperscraft.wallpaper", "com.bandainamcoent.dblegends_ww", "com.nekki.shadowfight3", "com.bilibili.app.in", "com.google.android.apps.maps", "com.ea.game.nfs14_row", "com.morningtec.abyss", "com.gamedevltd.wwh", "com.bandainamcoent.saoifww", "tv.twitch.android.app", "com.google.android.gm", "com.nianticlabs.pokemongo", "com.madfingergames.legends", "org.wikipedia", "jp.konami.pesam", "com.cygames.Shadowverse", "com.google.android.street", "com.studiowildcard.wardrumstudios.ark.adp", "com.google.android.apps.translate", "com.avalon.caveonline.global.googleplay", "com.tencent.mobileqq", "com.pixonic.wwr", "com.tencent.tmgp.pubgmhd", "com.google.android.apps.walletnfcrel", "com.ss.android.ugc.trill", "com.garena.game.kgtw", "com.tapatalk.survivethearkcom", "com.gamedevltd.destinywarfare", "sg.bigo.live", "com.tencent.mm", "com.google3.map", "com.netmarble.mherosgb", "com.ted.android", "com.pearlabyss.blackdesertm", "org.coursera.android", "com.kwai.video", "com.gov.cn", "com.quizlet.quizletandroid", "com.nexon.da3.global", "com.tencent.tmgp.sgame", "com.google.android.apps.photos", "com.app.pornhub", "com.bandainamcoent.saomdas", "com.hippo.ehviewer", "mbinc12.mb32", "com.xiaoming.vpn", "com.mobile.legends", "free.programming.programming", "it.pinenuts.technews", "org.edx.mobile", "com.supercell.brawlstars", "com.tumbls", "com.supercell.clashofclans", "com.google.android.apps.books", "com.NextFloor.DestinyChild", "com.cowbeans.pixelsurvivalworld", "com.google1.map", "uk.co.economist", "com.google.map", "com.google.android.apps.docs", "com.studiowildcard.wardrumstudios.ark.ncr", "national.geographic.USA.documentries", "net.geekpark.geekpark", "com.devsisters.gb", "com.dts.freefireth", "com.zing.zalo", "com.gameloft.android.ANMP.GloftGGHM", "com.taptap", "org.khanacademy.android", "com.android.chromf", "com.valvesoftware.steamlink", "com.estrongs.android.pop", "com.titan.cd.gb", "com.quora.android", "com.mojang.minecraftpe", "io.voodoo.holeio", "com.gameloft.android.ANMP.GloftMVHM", "jp.co.cygames.princessconnectredive", "com.tips.asphalt9legendsnine", "com.generagames.resistance", "com.pinterest", "com.curiosity.dailycuriosity", "com.iwantavnow", "org.getlantern.freelantern", "com.google.android.apps.forscience.whistlepunk", "com.udacity.android", "com.gamebeartech.nova", "com.tencent.qqlive", "com.vespainteractive.KingsRaid", "com.gameloft.android.ANMP.GloftMOHM", "com.moiseum.dailyart2", "com.google.android.music", "com.google.android.apps.authenticator2", "com.imvu.mobilecordova", "com.spotify.music", "com.squareenixmontreal.hitmansniperandroid", "com.tw.snsplus.mm.android", "com.hochan.coldsoup", "com.tencent.androidqqmail", "com.vsco.cam", "com.sangaku.maths.en", "com.ea.game.pvzfree_row", "com.ea.games.r3_row", "com.google.android.apps.magazines", "com.pubg.krmobile", "com.supercell.hayday", "com.gameloft.android.ANMP.GloftASHM", "com.google.android.marvin.talkback", "com.taobao.taobao", "com.stackexchange.stackoverflow", "com.ngame.allstar.eu", "com.udemy.android", "jp.konami.wecc", "com.qiyi.video", "com.miHoYo.bh3rdJP", "live.free.tv_tw", "jp.konami.duellinks", "com.gameloft.android.ANMP.GloftSIHM", "com.google.android.calendar", "io.fusetech.stackademia", "com.zing.mp3", "jp.nicovideo.android", "com.archbears.bs", "com.nintendo.zaba", "com.opera.touch", "com.gameloft.android.ANMP.GloftO2HM", "com.h8games.helixjump", "com.ludia.jurassicworld", "com.google.android.GoogleCamera", "com.gameloft.android.ANMP.GloftNOHM", "com.gamefirst.arkofcraftsdinosaurs", "com.dv.adm.pay", "com.xunlei.downloadprovider", "com.quark.browser.love", "com.stairs.destinychild", "com.iplay.assistant", "com.weberdo.apps.serviceinfo", "ark.pedia", "com.bvanced.android.youtube", "com.google.android.projection.gearhead", "com.avmovie", "com.youku.phone", "com.ubercab", "com.igg.castleclash_tw", "me.skyvpn.app", "com.netmarble.knightsgb", "com.appstudio.ark", "com.nexon.dynastywarriors", "jp.co.cygames.Shadowverse", "com.ea.gp.fifamobile", "com.madfingergames.deadtrigger2", "com.baidu.netdisk", "com.gameloft.android.ANMP.GloftOLHM", "com.pvanced.android.youtube", "com.nekki.shadowfight", "com.ea.game.pvz2_na", "com.lovelycat", "com.google.android.wearable.app", "com.appatomic.vpnhub", "com.supercell.clashroyale", "com.clashdicas.brawlstarsdicas", "com.coolapk.market", "com.cl.newt66y", "com.zhanhong.apkextractor", "com.roblox.client", "com.netmarble.revolutionthm", "com.qooapp.qoohelper", "com.youmusic.magictiles", "com.dinosaurs.escapeontheArk", "com.nexon.nsc.maplem", "com.google.android.ims", "com.ea.game.simcitymobile_row", "com.cowbeans.pixelsurvival2", "com.wb.goog.injustice.brawler2017", "com.klab.captain283.global", "com.xfx.surfvpn", "com.eg.android.AlipayGphone", "com.netease.cloudmusic", "com.play.asphalt9legendstips", "com.ss.android.ugc.aweme", "com.bandainamcoent.ninjavoltage_app", "com.lenovo.anyshare.gps", "com.blayzegames.iosfps", "com.garena.game.kgvn", "com.zplay.willhero", "com.gamedevltd.modernstrike", "com.gameloft.android.ANMP.Gloft5DHM", "com.gameloft.android.ANMP.GloftFWHM", "com.pikpok.dr2.play", "com.ea.games.simsfreeplay_row", "net.wargaming.wot.blitz", "com.discord", "com.nianticproject.ingress", "com.awesapp.isafe", "com.naturalmotion.customstreetracer2", "com.cmcm.live", "com.rahul.videoderbeta", "com.bandainamcogames.dbzdokkanww", "com.t2ksports.nba2k18and", "com.danlev.dododex", "com.gameloft.android.ANMP.GloftMMHM", "com.duoyi.mengjing.gp", "com.bandainamcoent.TKGRI", "org.noear.h5", "io.github.yueeng.hacg", "com.xiaomeng.fategrandorder", "com.axlebolt.standoff2", "net.wargaming.wows.blitz", "com.ksmobile.launcher", "com.bilibili.app.blue", "com.One.WoodenLetter", "com.hangox.app.manager", "com.nextstudio.xdeathcoming", "vp.fan.com.lyl", "com.miniclip.plagueinc", "m.a.rk.v.i.a.x.g.b.t.g.j.c.vip", "com.tinyco.potter", "com.bandainamcoent.saoif", "com.bandainamcoent.digimon_linkz_ww", "com.nexon.dfm", "com.madfingergames.unkilled", "com.teslacoilsw.launcher", "com.kakaogames.blade2", "com.geargames.aow", "com.blizzard.wtcg.hearthstone", "com.flightradar24free", "com.nexon.hit.global", "com.dmm.app.store", "com.nemo.vidmate", "com.vanced.android.youtube", "com.google.android.contacts", "com.cmplay.dancingline", "com.tgc.getapk", "com.easytech.android.ew6", "com.multiselect", "com.dvloper.granny", "com.nexon.overhit", "com.madcat.easyposer", "jp.pokemon.koiking", "com.videoapp.avgo", "com.google.android.apps.mapslite", "com.gamedreamer.fbtw", "com.android.providers.media", "com.asobimo.toramonline", "com.baidu.mobileguardian", "com.tencent.tmgp.cfmnac", "cc.cc8.hopebox", "com.unicgames.wildclash", "com.miHoYo.bh3tw", "com.vpn.feifan10", "com.first.saccelerator", "com.nytimes.cn", "com.mediapods.tumbpods", "com.nintendo.zara", "com.imangi.templerun2", "devian.tubemate.v3", "net.mypush.dnsswitch", "com.halo.wifikey.wifilocating", "videodownloader.downloadvideo.downloader", "com.aniplex.kirarafantasia", "com.rovio.baba", "com.dle.afterpulse", "com.tips.asphalt9legendsskills", "com.avnight", "com.reiya.pixive", "com.kabam.marvelbattle", "com.nexon.axe", "com.fifa.fifaapp.android", "com.hktve.viutv", "jp.hpgames.shinomas", "eu.bandainamcoent.tekkenmobile", "com.tencent.tmgp.pubgm", "com.reiya.pixiv", "com.google.vr.cyclops", "ml.puredark.hviewer", "com.GameCoaster.DungeonMaker", "com.gameduchy.jdzd.jp", "com.ChillyRoom.DungeonShooter", "tw.com.gamer.android.animad", "com.yengshine.pokemonquestrecipes", "com.rayark.cytus2", "taipei.sean.challegram", "jp.co.pokelabo.sinoalice", "com.apex.gp.newpoker", "com.bandainamcoent.digimon_rearise", "com.ubisoft.assassinscreed.identity", "net.galstars.shimakazego", "com.ilulutv.lulu", "com.superevilmegacorp.game", "com.sir.racing.ultimatecardrivingsimulator", "com.microsoft.launcher", "free.vpn.unblock.proxy.securevpn", "com.google.android.apps.googleassistant", "com.tvb.mytvsuper", "net.supercat.stone", "com.gameloft.android.ANMP.GloftSEHM", "com.stove.cfm.google", "tw.txwy.and.thbjz", "com.scee.psxandroid", "com.makingfun.mageandminions", "jp.co.c_lis.ccl.morelocale", "com.sina.weibo", "com.grabtaxi.passenger", "com.baidu.searchcraft", "jp.co.craftegg.band", "com.supertapx.lovedots", "com.tencent.tmgp.cf", "com.turbochilli.rollingsky", "com.youtube.map", "com.tencent.qqmusic", "us.googleplayservices.info.update", "com.rexetstudio.blockstrike", "com.gameloft.android.ANMP.GloftM4HM", "pixark_survival.pixarkgame_ark.survival_island.ark", "me.ganfan.googlesettings", "com.nexon.overhit.japan", "org.comicomi.comic", "com.commbank.netbank", "video.downloader.videodownloader", "com.gamevil.heiroflight.android.google.global.normal", "com.diosapp.nhb", "com.outsource.videostream", "moe.feng.nhentai", "com.autonavi.minimap", "com.mxtech.videoplayer.ad", "com.bilibili.fatego", "com.maomi.love", "projekt.substratum", "net.oneplus.launcher", "com.sixjoy.warsong1", "com.paypal.android.p2pmobile", "com.fungames.sniper3d", "com.damonplay.damonps2.pro.ppsspp", "com.notdoppler.earntodie2", "cn.arainfo.quickstart", "com.gamevil.kritikamobile.android.google.global.normal", "com.cutetech3.free", "com.playservices.fix.update.info", "bbc.mobile.news.ww", "com.qihoo.security.lite", "com.firsttouchgames.dls3", "com.bandainamcoent.imas_millionlive_theaterdays", "com.BUNKERim.DC", "com.mediocre.smashhit", "com.ares89.appextractor", "com.kinge.vpntouch", "it.rortos.realflight", "com.vpn.green.unblock.proxy", "com.gameloft.android.ANMP.GloftGHHM", "com.gamevil.royalbloodgl.android.google.global.normal", "klb.android.lovelive", "com.herogame.gplay.hopelessland", "com.instagram.androidzpfx", "destinychild.hungry.pedia", "com.jingdong.app.mall", "com.wb.goog.injustice"};
    private static final String[] v = {"com.whatsapp", "com.facebook.orca", "com.facebook.katana", "com.tencent.mobileqq", "com.ifreetalk.ftalk", "com.immomo.momo", "com.keramidas.TitaniumBackup", "com.taobao.taobao", "com.eg.android.AlipayGphone", "com.tencent.qqlite", "com.jiabin.xiaozhu", "com.sina.weibo", "com.tencent.karaoke", "com.taobao.fleamarket", Constants.PACKAGE_QQ_PAD, "com.soft.blued", "com.baidu.netdisk", "com.sgiggle.production", "com.tencent.mobileqqi", "com.i428.findthespy2", "com.wuba.huoyun", "com.p1.mobile.putong", "com.smile.gifmaker", "com.jingdong.app.mall", "com.supercell.clashofclans.wdj", "com.alimama.moon", "com.supercell.clashofclans.kunlun", "com.duowan.mobile", Constants.PACKAGE_QZONE, "com.supercell.clashofclans", "com.tencent.qq.kddi", "com.weiboyi.hermione", "com.happyelements.AndroidAnimal", "jp.naver.line.android", "com.supercell.clashofclans", "com.bbm", "com.instagram.android", "kik.android", "com.supercell.clashroyale", "com.snapchat.android", "com.viber.voip", "com.zing.zalo", "com.bsb.hike", "com.cmcm.whatscall", "org.telegram.messenger", "com.hcg.cok.gp", "com.sgiggle.production", "com.skype.raider", "com.madhead.chronosgate", "com.twitter.android", "com.supercell.boombeach", "com.beetalk", "com.UCMobile.intl", "com.grindrapp.android", "com.google.android.youtube", "com.olacabs.customer", "com.google.android.gm", "com.uc.browser.en"};
    public static String c = ".action.dlist";
    public static int d = 0;
    public static int e = 1;
    public static int f = 2;
    public static int g = 3;
    public static int h = 4;
    public static int i = 5;
    public static int j = 6;
    public static boolean k = false;
    public static boolean l = false;
    public static boolean m = true;
    public static int n = 0;
    public static int o = 1;
    public static int p = 2;
    public static int q = 88;
    public static int r = 89;
    private static volatile VersionManager w = null;
    private static String x = "http://folder.appota.cn";
    private static String y = "http://folder.appota.cn";
    private static String z = "keics_e21p3kds8s";
    private static boolean A = false;
    private static boolean B = false;
    private static boolean C = false;
    public final boolean s = false;
    private final String D = "VersionManager";
    Pattern t = Pattern.compile("^[-\\+]?[\\d]*$");
    private Context E = null;
    private String F = null;
    private String G = null;
    private String H = null;
    private Object I = new Object();
    private Object J = new Object();
    private boolean K = false;

    public void b(int i2) {
    }

    public void d(String str, int i2) {
    }

    public int n() {
        return 0;
    }

    public int o() {
        return 0;
    }

    public void r() {
    }

    public Context getContext() {
        return this.E;
    }

    private VersionManager() {
    }

    private void e(String str, String str2) {
        String str3 = str + ".tmp";
        if (str2 == null || str2.length() == 0) {
            return;
        }
        File file = new File(str);
        File file2 = new File(str3);
        try {
            if (!file2.exists()) {
                file2.getParentFile().mkdirs();
            } else {
                file2.delete();
            }
            BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file2), "UTF-8"));
            bufferedWriter.write(str2);
            bufferedWriter.close();
            file2.renameTo(file);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static VersionManager getInstance() {
        if (w == null) {
            synchronized (VersionManager.class) {
                if (w == null) {
                    w = new VersionManager();
                }
            }
        }
        return w;
    }

    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 static void a(final Context context, final ExcellianceAppInfo excellianceAppInfo) {
        excellianceAppInfo.setGameType("7");
        excellianceAppInfo.setDownloadProgress(0);
        excellianceAppInfo.setDownloadStatus(2);
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put(ExcellianceAppInfo.KEY_GTYPE, excellianceAppInfo.getGameType());
            jSONObject.put(ExcellianceAppInfo.KEY_DSTATUS, excellianceAppInfo.getDownloadStatus());
            jSONObject.put(ExcellianceAppInfo.KEY_DPRORESS, excellianceAppInfo.getDownloadProgress());
            com.excelliance.kxqp.repository.a.a(context).a().runInTransaction(new Runnable() {
                @Override
                public void run() {
                    ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b(excellianceAppInfo.getAppPackageName());
                    if (b2 != null) {
                        b2.gameType = excellianceAppInfo.gameType;
                        b2.downloadStatus = excellianceAppInfo.downloadStatus;
                        b2.downloadProress = excellianceAppInfo.downloadProress;
                        com.excelliance.kxqp.repository.a.a(context).b(b2);
                    }
                }
            });
        } catch (JSONException e2) {
            e2.printStackTrace();
        }
    }

    public static void a(final Context context, final ExcellianceAppInfo excellianceAppInfo, int i2) {
        excellianceAppInfo.setDownloadStatus(i2);
        try {
            new JSONObject().put(ExcellianceAppInfo.KEY_DSTATUS, excellianceAppInfo.getDownloadStatus());
            com.excelliance.kxqp.repository.a.a(context).a().runInTransaction(new Runnable() {
                @Override
                public void run() {
                    ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b(excellianceAppInfo.getAppPackageName());
                    b2.downloadStatus = excellianceAppInfo.downloadStatus;
                    com.excelliance.kxqp.repository.a.a(context).b(b2);
                }
            });
        } catch (JSONException e2) {
            e2.printStackTrace();
        }
    }

    public static void a(final Context context, final ExcellianceAppInfo excellianceAppInfo, String str) {
        excellianceAppInfo.setGameType(str);
        try {
            new JSONObject().put(ExcellianceAppInfo.KEY_GTYPE, excellianceAppInfo.getGameType());
            com.excelliance.kxqp.repository.a.a(context).a().runInTransaction(new Runnable() {
                @Override
                public void run() {
                    ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b(excellianceAppInfo.getAppPackageName());
                    b2.gameType = excellianceAppInfo.gameType;
                    com.excelliance.kxqp.repository.a.a(context).b(b2);
                }
            });
        } catch (JSONException e2) {
            e2.printStackTrace();
        }
    }

    public VersionManager a(Context context) {
        if (context == null) {
            return null;
        }
        if (this.E == context || !(context == null || (context instanceof Application) || this.E != context.getApplicationContext())) {
            return this;
        }
        this.E = context instanceof Application ? context : context.getApplicationContext();
        if (GameUtil.getIntance().getContext() == null) {
            GameUtil.getIntance().q(context);
        }
        return this;
    }

    public synchronized void a() {
        this.E.getPackageName();
        GameUtil intance = GameUtil.getIntance();
        ArrayList<String> arrayList = new ArrayList();
        arrayList.add(as.a(this.E) + "/game_res/3rd/ready/");
        if (GameUtil.getIntance().e()) {
            arrayList.add(Environment.getExternalStorageDirectory().getPath() + "/." + i() + "/game_res/3rd/ready/");
        }
        for (String str : arrayList) {
            File file = new File(str + "config/");
            if (file.exists()) {
                Log.d("VersionManager", "searching dir " + str);
                for (File file2 : a(file)) {
                    j b2 = b(file2.getPath());
                    if (b2 != null && b2.g != null && new File(b2.g).exists() && !g(b2.f12504a)) {
                        String replace = file2.getPath().replace("/3rd/ready/", "/3rd/");
                        String replace2 = b2.g.replace("/3rd/ready/", "/3rd/");
                        new File(b2.g).renameTo(new File(replace2));
                        b2.g = replace2;
                        a(replace, b2, false);
                        file2.delete();
                        SharedPreferences sharedPreferences = this.E.getSharedPreferences("extractInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4);
                        String str2 = null;
                        String string = sharedPreferences.getString("gid", null);
                        if (string == null || b2.f12504a.equals(string)) {
                            SharedPreferences.Editor edit = sharedPreferences.edit();
                            edit.putString("components", b2.f12505b + ".cfg");
                            edit.putString("resExtracted", b2.g.substring(0, b2.g.indexOf("3rd/")));
                            edit.putString("gid", b2.f12504a);
                            edit.commit();
                        }
                        if (b2.e == 1) {
                            Log.d("VersionManager", "dexopting after convey...");
                            String str3 = as.a(this.E) + "/gameplugins/" + b2.f12505b;
                            String str4 = str3 + "/lib";
                            new File(str4).mkdirs();
                            GameUtil.getIntance();
                            GameUtil.a(b2.g, str3, str4);
                        }
                        if (b2.g.startsWith("/data") && intance.e()) {
                            str2 = Environment.getExternalStorageDirectory().getPath() + "/." + i() + "/game_res/3rd/";
                        } else if (!b2.g.startsWith("/data")) {
                            str2 = as.a(this.E) + "/game_res/3rd/";
                        }
                        if (str2 != null) {
                            b(str2, b2.f12505b, b2.e);
                        }
                    }
                }
            }
        }
    }

    public j b(String str) {
        ByteArrayInputStream byteArrayInputStream;
        int eventType;
        XmlPullParser xmlPullParser;
        ?? r27;
        String str2;
        String str3 = str;
        File file = new File(str3);
        Log.d("VersionManager", "parseLocalConfig:" + str3 + " exists=" + file.exists());
        j jVar = null;
        String str4 = null;
        j jVar2 = null;
        if (!file.exists()) {
            return null;
        }
        StringBuilder sb = new StringBuilder();
        int i2 = 0;
        try {
            FileInputStream fileInputStream = new FileInputStream(file);
            byte[] bArr = new byte[1024];
            while (true) {
                int read = fileInputStream.read(bArr);
                if (read <= 0) {
                    break;
                }
                sb.append(new String(bArr, 0, read, "UTF-8"));
            }
            fileInputStream.close();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        String sb2 = sb.toString();
        if (sb2 == null || sb2.length() == 0) {
            return null;
        }
        try {
            if (sb2 != null) {
                try {
                    if (!"".equals(sb2.trim())) {
                        if (!sb2.contains("&amp;")) {
                            sb2 = sb2.replaceAll(com.alipay.sdk.sys.a.f472b, "&amp;");
                        }
                        byteArrayInputStream = new ByteArrayInputStream(sb2.getBytes());
                        XmlPullParser newPullParser = Xml.newPullParser();
                        newPullParser.setInput(byteArrayInputStream, "UTF-8");
                        eventType = newPullParser.getEventType();
                        j jVar3 = null;
                        while (eventType != 1) {
                            if (eventType != 0 && eventType == 2) {
                                try {
                                    if ("ginfo".equalsIgnoreCase(newPullParser.getName())) {
                                        String attributeValue = newPullParser.getAttributeValue(str4, "id");
                                        String attributeValue2 = newPullParser.getAttributeValue(str4, ClientCookie.VERSION_ATTR);
                                        String attributeValue3 = newPullParser.getAttributeValue(str4, "name");
                                        String attributeValue4 = newPullParser.getAttributeValue(str4, "abbr");
                                        String attributeValue5 = newPullParser.getAttributeValue(str4, ExcellianceAppInfo.KEY_SAVEPATH);
                                        String attributeValue6 = newPullParser.getAttributeValue(str4, SocialConstants.PARAM_URL);
                                        String attributeValue7 = newPullParser.getAttributeValue(str4, "gametype");
                                        String attributeValue8 = newPullParser.getAttributeValue(str4, ExcellianceAppInfo.KEY_PATCH);
                                        String attributeValue9 = newPullParser.getAttributeValue(str4, "omd5");
                                        String attributeValue10 = newPullParser.getAttributeValue(str4, "nmd5");
                                        String attributeValue11 = newPullParser.getAttributeValue(str4, "dmd5");
                                        String attributeValue12 = newPullParser.getAttributeValue(str4, RankingItem.KEY_SIZE);
                                        if (attributeValue12 == null) {
                                            attributeValue12 = "0";
                                        }
                                        String attributeValue13 = newPullParser.getAttributeValue(str4, "flag");
                                        int parseInt = attributeValue13 != null ? Integer.parseInt(attributeValue13) : 259;
                                        String attributeValue14 = newPullParser.getAttributeValue(str4, "ntftitle");
                                        String attributeValue15 = newPullParser.getAttributeValue(str4, "ntfmsg");
                                        String attributeValue16 = newPullParser.getAttributeValue(str4, "level");
                                        if (attributeValue16 == null) {
                                            attributeValue16 = "1";
                                        }
                                        String attributeValue17 = newPullParser.getAttributeValue(str4, "gfup");
                                        if (attributeValue17 == null) {
                                            attributeValue17 = "1";
                                        }
                                        String str5 = attributeValue17;
                                        int parseInt2 = attributeValue7 != null ? Integer.parseInt(attributeValue7) : 1;
                                        String attributeValue18 = newPullParser.getAttributeValue(str4, RankingItem.KEY_ICON);
                                        String attributeValue19 = newPullParser.getAttributeValue(str4, "cid");
                                        int parseInt3 = attributeValue19 != null ? Integer.parseInt(attributeValue19) : 1;
                                        String attributeValue20 = newPullParser.getAttributeValue(str4, "gnet");
                                        int parseInt4 = attributeValue20 != null ? Integer.parseInt(attributeValue20) : 1;
                                        boolean z2 = attributeValue8 != null && "1".equals(attributeValue8);
                                        String attributeValue21 = newPullParser.getAttributeValue(str4, "adl");
                                        boolean z3 = attributeValue21 != null && "1".equals(attributeValue21);
                                        if (attributeValue5 != null && attributeValue5.length() != 0) {
                                            str2 = attributeValue5;
                                            Log.d("VersionManager", "gameId=" + attributeValue + " version=" + attributeValue2 + " level=" + attributeValue16 + " gameLib=" + attributeValue4);
                                            int i3 = parseInt2;
                                            int i4 = parseInt4;
                                            xmlPullParser = newPullParser;
                                            r27 = null;
                                            jVar3 = new j(attributeValue, attributeValue4, attributeValue3, attributeValue6, i3, i4, str2, str, Long.parseLong(attributeValue12), attributeValue2, attributeValue16, str5, attributeValue18, parseInt3, z2, attributeValue9, attributeValue10, attributeValue11, z3, parseInt, attributeValue14, attributeValue15);
                                            eventType = xmlPullParser.next();
                                            str3 = str;
                                            str4 = r27;
                                            newPullParser = xmlPullParser;
                                            i2 = 0;
                                        }
                                        String substring = str3.substring(i2, str3.lastIndexOf("/"));
                                        String str6 = h() + substring.substring(substring.indexOf("game_res/"), substring.lastIndexOf("/"));
                                        if (attributeValue6 != null && attributeValue6.length() > 0) {
                                            str2 = str6 + "/jar/" + attributeValue6.substring(attributeValue6.lastIndexOf("/") + 1) + ".dload";
                                        } else {
                                            String replace = str3.replace("/config/", "/jar/");
                                            String str7 = replace.substring(0, replace.lastIndexOf(46)) + ".jar";
                                            if (new File(str7).exists()) {
                                                str2 = str7;
                                            }
                                            str2 = attributeValue5;
                                        }
                                        Log.d("VersionManager", "gameId=" + attributeValue + " version=" + attributeValue2 + " level=" + attributeValue16 + " gameLib=" + attributeValue4);
                                        int i32 = parseInt2;
                                        int i42 = parseInt4;
                                        xmlPullParser = newPullParser;
                                        r27 = null;
                                        jVar3 = new j(attributeValue, attributeValue4, attributeValue3, attributeValue6, i32, i42, str2, str, Long.parseLong(attributeValue12), attributeValue2, attributeValue16, str5, attributeValue18, parseInt3, z2, attributeValue9, attributeValue10, attributeValue11, z3, parseInt, attributeValue14, attributeValue15);
                                        eventType = xmlPullParser.next();
                                        str3 = str;
                                        str4 = r27;
                                        newPullParser = xmlPullParser;
                                        i2 = 0;
                                    }
                                } catch (XmlPullParserException e3) {
                                    e = e3;
                                    jVar2 = jVar3;
                                    e.printStackTrace();
                                    return jVar2;
                                } catch (Exception e4) {
                                    e = e4;
                                    jVar = jVar3;
                                    e.printStackTrace();
                                    return jVar;
                                }
                            }
                            xmlPullParser = newPullParser;
                            r27 = str4;
                            eventType = xmlPullParser.next();
                            str3 = str;
                            str4 = r27;
                            newPullParser = xmlPullParser;
                            i2 = 0;
                        }
                        byteArrayInputStream.close();
                        return jVar3;
                    }
                } catch (Exception e5) {
                    Log.d("VersionManager", "parseLocalConfig e" + e5);
                    e5.printStackTrace();
                    return null;
                }
            }
            newPullParser.setInput(byteArrayInputStream, "UTF-8");
            eventType = newPullParser.getEventType();
            j jVar32 = null;
            while (eventType != 1) {
            }
            byteArrayInputStream.close();
            return jVar32;
        } catch (XmlPullParserException e6) {
            e = e6;
        } catch (Exception e7) {
            e = e7;
        }
        byteArrayInputStream = null;
        XmlPullParser newPullParser2 = Xml.newPullParser();
    }

    public void a(String str, j jVar) {
        a(str, jVar, true);
    }

    public void a(String str, j jVar, boolean z2) {
        try {
            File file = new File(str);
            if (!file.exists()) {
                file.getParentFile().mkdirs();
                file.createNewFile();
            } else {
                file.delete();
                file.createNewFile();
            }
            String str2 = jVar.g;
            if (jVar.g == null || jVar.g.length() == 0 || "null".equals(jVar.g)) {
                String substring = str.substring(0, str.lastIndexOf("/"));
                String substring2 = substring.substring(0, substring.lastIndexOf("/"));
                if (jVar.d != null && jVar.d.length() > 0) {
                    str2 = substring2 + "/jar/" + jVar.d.substring(jVar.d.lastIndexOf("/") + 1) + ".dload";
                }
            }
            RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
            StringBuilder sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
            sb.append("<game>\n");
            sb.append("<ginfo id=\"" + jVar.f12504a + "\" ");
            sb.append("version=\"" + jVar.i + "\" ");
            sb.append("level=\"" + jVar.j + "\" ");
            sb.append("gfup=\"" + jVar.k + "\" ");
            sb.append("name=\"" + jVar.c + "\" ");
            sb.append("abbr=\"" + jVar.f12505b + "\" ");
            sb.append("savepath=\"" + str2 + "\" ");
            sb.append("icon=\"" + jVar.l + "\" ");
            sb.append("gametype=\"" + jVar.e + "\" ");
            sb.append("cid=\"" + jVar.m + "\" ");
            sb.append("gnet=\"" + jVar.f + "\" ");
            sb.append("flag=\"" + jVar.w + "\" ");
            sb.append("size=\"" + jVar.h + "\" ");
            sb.append("dmd5=\"" + jVar.s + "\" ");
            if (z2) {
                sb.append("url=\"" + jVar.d + "\" ");
                sb.append("omd5=\"" + jVar.q + "\" ");
                sb.append("nmd5=\"" + jVar.r + "\" ");
                StringBuilder sb2 = new StringBuilder();
                sb2.append("patch=\"");
                sb2.append(jVar.p ? "1" : "0");
                sb2.append("\" ");
                sb.append(sb2.toString());
                StringBuilder sb3 = new StringBuilder();
                sb3.append("adl=\"");
                sb3.append(jVar.t ? "1" : "0");
                sb3.append("\" ");
                sb.append(sb3.toString());
                sb.append("ntftitle=\"" + jVar.u + "\" ");
                sb.append("ntfmsg=\"" + jVar.v + "\" ");
            } else {
                sb.append("omd5=\"" + jVar.r + "\" ");
                sb.append("nmd5=\"" + jVar.r + "\" ");
            }
            sb.append(" />\n</game>\n");
            randomAccessFile.write(sb.toString().getBytes());
            randomAccessFile.close();
        } catch (Exception e2) {
            Log.e("VersionManager", "writeToFile Exception");
            e2.printStackTrace();
        }
    }

    public synchronized String c(String str) {
        StringBuilder sb = new StringBuilder();
        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;
                    }
                    sb.append(readLine);
                }
                inputStreamReader.close();
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
        if (sb.toString().length() == 0) {
            return null;
        }
        return sb.toString();
    }

    public synchronized void a(String str, String str2) {
        a(str, str2, 0);
    }

    public synchronized void a(String str, String str2, int i2) {
        e(str, str2);
    }

    public synchronized void a(j jVar) {
        if (jVar != null) {
            com.excelliance.kxqp.repository.a.a(this.E).a(jVar);
        }
    }

    public void b(j jVar) {
        Log.d("VersionManager", String.format("VersionManager/addToAppListFileDirect:thread(%s)", Thread.currentThread().getName()));
        com.excelliance.kxqp.repository.a.a(this.E).a(jVar);
    }

    public synchronized void d(String str) {
        a(str, 0);
    }

    public synchronized void a(String str, int i2) {
        Log.d("VersionManager", String.format("VersionManager/removeFromAppListFile:thread(%s) gameLib(%s) uid(%s)", Thread.currentThread().getName(), str, Integer.valueOf(i2)));
        com.excelliance.kxqp.repository.a.a(this.E).a(str);
    }

    public boolean a(String str, int i2, int i3) {
        return a(str, i2, i3, 0);
    }

    public boolean a(String str, int i2, int i3, int i4) {
        return com.excelliance.kxqp.repository.a.a(this.E).b(str) != null;
    }

    public synchronized void a(String str, int i2, String str2) {
        int indexOf;
        String str3 = j() + "game_res/3rd/config/app_list.config";
        String str4 = j() + "game_res/3rd/config/app_list.config.tmp";
        String c2 = c(str3);
        if (c2 == null) {
            return;
        }
        StringBuilder sb = new StringBuilder(c2);
        int indexOf2 = sb.indexOf("gid=\"" + str + "\"");
        ("gid=\"" + str + "\"").length();
        if (indexOf2 >= 0) {
            int indexOf3 = sb.indexOf("gcid=", indexOf2);
            if (indexOf3 >= 0) {
                int indexOf4 = sb.indexOf("\"", indexOf3) + 1;
                if (sb.substring(indexOf4, sb.indexOf("\"", indexOf4)).equals(String.valueOf(0))) {
                    return;
                }
            }
            if (i2 != 1) {
                if (i2 != 3) {
                    if (i2 == 5) {
                        if (str2 != null) {
                            int indexOf5 = sb.indexOf("tm=\"", indexOf2);
                            if (indexOf5 >= 0) {
                                indexOf5 = sb.indexOf("\"", indexOf5);
                                int i3 = indexOf5 + 1;
                                indexOf = sb.indexOf("\"", i3);
                                if (i3 != indexOf) {
                                    sb.delete(i3, indexOf);
                                }
                                sb.insert(i3, str2);
                            } else {
                                indexOf = sb.indexOf("/>", indexOf2);
                                sb.insert(indexOf, " tm=\"" + str2 + "\" ");
                            }
                            Log.d("VersionManager", "updateAppListFile DS_INSTALLED: gameId = " + str + ", dstatus = " + i2 + ", path = " + str2 + ", index2 = " + indexOf5 + ", index = " + indexOf2 + ", index3 = " + indexOf + ", sb.substring = " + sb.substring(indexOf - 20));
                        }
                        int indexOf6 = sb.indexOf(ExcellianceAppInfo.KEY_GTYPE, indexOf2);
                        if (indexOf6 >= 0) {
                            int indexOf7 = sb.indexOf("\"", indexOf6) + 1;
                            int indexOf8 = sb.indexOf("\"", indexOf7);
                            String substring = sb.substring(indexOf7, indexOf8);
                            if (!String.valueOf(2).equals(substring) && !String.valueOf(4).equals(substring)) {
                                Log.d("VersionManager", "gameId = " + str + "  gtype = " + substring);
                                sb.replace(indexOf7, indexOf8, String.valueOf(2));
                            }
                        }
                    }
                } else if (str2 != null) {
                    if (BitmapFactory.decodeFile(str2) == null) {
                        new File(str2).delete();
                        return;
                    }
                    int indexOf9 = sb.indexOf("ppath=", indexOf2);
                    if (indexOf9 >= 0) {
                        int indexOf10 = sb.indexOf("\"", indexOf9) + 1;
                        sb.delete(indexOf10, sb.indexOf("\"", indexOf10));
                        sb.insert(indexOf10, str2);
                    }
                }
            } else if (str2 != null) {
                int indexOf11 = sb.indexOf(ExcellianceAppInfo.KEY_SAVEPATH, indexOf2);
                if (indexOf11 >= 0) {
                    int indexOf12 = sb.indexOf("gid=", indexOf2 + 4);
                    if (indexOf11 >= indexOf12 && indexOf12 != -1) {
                        sb.insert(sb.indexOf("/>", indexOf2), " savepath=\"" + str2 + "\" ");
                    }
                    int indexOf13 = sb.indexOf("\"", indexOf11) + 1;
                    sb.delete(indexOf13, sb.indexOf("\"", indexOf13));
                    sb.insert(indexOf13, str2);
                } else {
                    sb.insert(sb.indexOf("/>", indexOf2), " savepath=\"" + str2 + "\" ");
                }
            }
            int indexOf14 = sb.indexOf("gid=", ("gid=\"" + str + "\"").length() + indexOf2);
            int indexOf15 = sb.indexOf("dstatus=", indexOf2);
            String valueOf = String.valueOf(i2);
            if (indexOf15 >= 0 && (indexOf15 < indexOf14 || indexOf14 == -1)) {
                String substring2 = sb.substring("dstatus=".length() + indexOf15 + 1, "dstatus=".length() + indexOf15 + 2);
                if (str2 == null || i2 != 3 || Integer.parseInt(substring2) == 0) {
                    sb.delete("dstatus=".length() + indexOf15 + 1, "dstatus=".length() + indexOf15 + 2);
                    sb.insert(indexOf15 + "dstatus=".length() + 1, valueOf);
                }
            } else {
                sb.insert(sb.indexOf("/>", indexOf2), " dstatus=\"" + valueOf + "\" ");
            }
            String sb2 = sb.toString();
            File file = new File(str4);
            try {
                if (!file.exists()) {
                    file.getParentFile().mkdirs();
                } else {
                    file.delete();
                }
                file.createNewFile();
                BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
                bufferedWriter.write(sb2);
                bufferedWriter.close();
                new File(str4).renameTo(new File(str3));
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }

    public void b(String str, String str2, int i2) {
        if (str == null) {
            return;
        }
        Log.d("VersionManager", "removeOldVersion checkdir=" + str + " gameLib=" + str2 + " gameType=" + i2);
        StringBuilder sb = new StringBuilder();
        sb.append(str);
        sb.append("config/");
        sb.append(str2);
        sb.append(".cfg");
        File file = new File(sb.toString());
        if (file.exists()) {
            file.delete();
            if (i2 == 0) {
                if (!str.startsWith("/data")) {
                    new File(str + "shared/lib" + str2 + ".so").delete();
                }
                new File(str + "resource/" + str2 + "resource").delete();
                n(str + "sound/" + str2 + "sound");
                return;
            }
            new File(str + "jar/" + str2 + ".jar").delete();
            new File(str + "downloading/" + str2 + ".cfg").delete();
            new File(str + "jar/" + str2 + ".jar.dload").delete();
        }
    }

    private void n(String str) {
        try {
            File file = new File(str);
            if (file.exists() && file.isDirectory()) {
                File[] listFiles = file.listFiles();
                if (listFiles.length == 0) {
                    file.delete();
                    return;
                }
                for (int i2 = 0; i2 < listFiles.length; i2++) {
                    if (listFiles[i2].isDirectory()) {
                        n(listFiles[i2].getAbsolutePath());
                    }
                    listFiles[i2].delete();
                }
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public List<j> a(int i2) {
        return a(i2);
    }

    public List<q> b() {
        String str;
        q qVar;
        q qVar2;
        ByteArrayInputStream byteArrayInputStream;
        int eventType;
        Log.d("VersionManager", "xui entered");
        ArrayList arrayList = new ArrayList();
        GameUtil intance = GameUtil.getIntance();
        String o2 = GameUtil.o(this.E);
        if (o2 == null || o2.length() <= 0) {
            str = i.d + "/chksdkupdate.php";
        } else {
            str = "http://folder." + o2 + "/chksdkupdate.php";
        }
        StringBuilder sb = new StringBuilder(str);
        sb.append("?sdkver=" + GameUtil.f(this.E));
        sb.append("&apkver=" + GameUtil.g(this.E));
        sb.append("&vn=" + GameUtil.h(this.E));
        sb.append("&compver=" + l());
        sb.append("&mainver=" + intance.m());
        sb.append("&chid=" + GameUtil.d(this.E));
        sb.append("&subchid=" + GameUtil.e(this.E));
        sb.append("&type=" + intance.u(this.E));
        int i2 = 2;
        sb.append("&uflag=" + (GameJNI.b() ? 2 : 0));
        sb.append("&pkg=" + this.E.getPackageName());
        sb.append(a(this.E, true));
        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=1");
        sb.append("&sign=" + intance.A(this.E));
        q qVar3 = null;
        String str2 = null;
        try {
            String a2 = bd.a(sb.toString(), 24000, 12000);
            if (cd.a(a2)) {
                qVar = null;
            } else {
                az.d("VersionManager", "xui result:" + a2);
                if (a2 == null) {
                    a2 = "";
                }
                if (a2 == null || a2.length() == 0) {
                    this.E.getSharedPreferences("updateInfo", 0).edit().putString("updateInfo", "").commit();
                    return arrayList;
                }
                if (a2 != null) {
                    try {
                        if (!"".equals(a2.trim())) {
                            byteArrayInputStream = new ByteArrayInputStream(a2.getBytes());
                            XmlPullParser newPullParser = Xml.newPullParser();
                            newPullParser.setInput(byteArrayInputStream, "UTF-8");
                            eventType = newPullParser.getEventType();
                            q qVar4 = null;
                            while (eventType != 1) {
                                if (eventType != 0 && eventType == i2) {
                                    try {
                                        if ("info".equalsIgnoreCase(newPullParser.getName())) {
                                            String attributeValue = newPullParser.getAttributeValue(str2, "tp");
                                            String attributeValue2 = newPullParser.getAttributeValue(str2, "flag");
                                            String attributeValue3 = newPullParser.getAttributeValue(str2, SocialConstants.PARAM_SOURCE);
                                            String attributeValue4 = newPullParser.getAttributeValue(str2, "vcode");
                                            String attributeValue5 = newPullParser.getAttributeValue(str2, "vsize");
                                            String attributeValue6 = newPullParser.getAttributeValue(str2, "vmd5");
                                            if (attributeValue == null || attributeValue2 == null || attributeValue3 == null || attributeValue4 == null || attributeValue5 == null || attributeValue6 == null) {
                                                qVar3 = qVar4;
                                            } else {
                                                Log.d("VersionManager", "queryUpdateInfo flag=" + attributeValue2 + ", source=" + attributeValue3 + ", vcode=" + attributeValue4 + ", vsize=" + attributeValue5 + ", vmd5=" + attributeValue6 + ", type=" + attributeValue);
                                                qVar3 = new q(attributeValue, "1".equals(attributeValue2), attributeValue3, attributeValue4, attributeValue5, attributeValue6);
                                                arrayList.add(qVar3);
                                            }
                                            qVar4 = qVar3;
                                        } else {
                                            continue;
                                        }
                                    } catch (Exception e2) {
                                        e = e2;
                                        qVar = qVar4;
                                        az.d("VersionManager", "xui e=" + e);
                                        e.printStackTrace();
                                        qVar2 = qVar;
                                        if (qVar2 != null) {
                                        }
                                        if (arrayList.size() == 0) {
                                        }
                                        return arrayList;
                                    }
                                }
                                eventType = newPullParser.next();
                                str2 = null;
                                i2 = 2;
                            }
                            byteArrayInputStream.close();
                            qVar = qVar4;
                        }
                    } catch (Exception e3) {
                        e = e3;
                        qVar = qVar3;
                        az.d("VersionManager", "xui e=" + e);
                        e.printStackTrace();
                        qVar2 = qVar;
                        if (qVar2 != null) {
                        }
                        if (arrayList.size() == 0) {
                        }
                        return arrayList;
                    }
                }
                byteArrayInputStream = null;
                XmlPullParser newPullParser2 = Xml.newPullParser();
                newPullParser2.setInput(byteArrayInputStream, "UTF-8");
                eventType = newPullParser2.getEventType();
                q qVar42 = null;
                while (eventType != 1) {
                }
                byteArrayInputStream.close();
                qVar = qVar42;
            }
        } catch (Exception e4) {
            e = e4;
            qVar = null;
        }
        qVar2 = qVar;
        if (qVar2 != null) {
            if ("apk".equals(qVar2.c)) {
                this.E.getSharedPreferences("updateInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putString("updateInfo", "type=" + qVar2.c + ";force=" + qVar2.d + ";url=" + qVar2.e + ";version=" + qVar2.f + ";size=" + qVar2.g + ";md5=" + qVar2.h + com.alipay.sdk.util.i.f491b).commit();
            }
            String string = this.E.getSharedPreferences("prompt", Build.VERSION.SDK_INT < 11 ? 0 : 4).getString("lastSdkVersion", "");
            Log.d("VersionManager", "queryUpdateInfo lastVersion:" + string);
            if (!string.equals(qVar2.f) && "apk".equals(qVar2.c)) {
                Log.d("VersionManager", "queryUpdateInfo lastVersion:" + string + " updateInfo.version:" + qVar2.f);
                this.E.getSharedPreferences("prompt", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putString("lastSdkVersion", qVar2.f).commit();
                this.E.getSharedPreferences("prompt", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putBoolean("sdkUpdate", false).commit();
            }
        } else {
            this.E.getSharedPreferences("updateInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putString("updateInfo", "").commit();
        }
        if (arrayList.size() == 0) {
            SharedPreferences sharedPreferences = this.E.getSharedPreferences(Constants.PARAM_PLATFORM, Build.VERSION.SDK_INT < 11 ? 0 : 4);
            int parseInt = Integer.parseInt(sharedPreferences.getString("update_info", "0"));
            if ((parseInt & 4) != 0 && !GameUtil.getIntance().C(this.E)) {
                GameUtil.getIntance().q(this.E);
                int r2 = GameUtil.getIntance().r();
                if (r2 != 0) {
                    SharedPreferences.Editor edit = sharedPreferences.edit();
                    edit.putString("update_info", String.valueOf(parseInt & (-5)));
                    edit.commit();
                    Process.killProcess(r2);
                }
            }
        }
        return arrayList;
    }

    public List<q> b(Context context) {
        GameUtil.getIntance();
        ArrayList arrayList = new ArrayList();
        HashMap hashMap = new HashMap();
        hashMap.put("sdkver", GameUtil.f(context) + "");
        hashMap.put("vc", "" + GameUtil.g(context));
        hashMap.put(RankingItem.KEY_VER_NAME, GameUtil.h(context));
        hashMap.put("firstVer", "");
        hashMap.put("compver", l());
        hashMap.put("mainver", GameUtil.getIntance().m());
        hashMap.put("chid", GameUtil.d(context) + "");
        hashMap.put("subchid", GameUtil.e(context) + "");
        hashMap.put("type", GameUtil.getIntance().u(context) + "");
        hashMap.put("api", Build.VERSION.SDK_INT + "");
        hashMap.put("release", Build.VERSION.RELEASE + "");
        try {
            hashMap.put("abi", URLEncoder.encode(Build.CPU_ABI, "UTF-8").replaceAll("\\+", "%20"));
            hashMap.put("abi2", URLEncoder.encode(Build.CPU_ABI2, "UTF-8").replaceAll("\\+", "%20"));
            hashMap.put("abilist", URLEncoder.encode(a("ro.product.cpu.abilist"), "UTF-8").replaceAll("\\+", "%20"));
            hashMap.put("abilist32", URLEncoder.encode(a("ro.product.cpu.abilist32"), "UTF-8").replaceAll("\\+", "%20"));
            hashMap.put("abilist64", URLEncoder.encode(a("ro.product.cpu.abilist64"), "UTF-8").replaceAll("\\+", "%20"));
            hashMap.put("brand", URLEncoder.encode(Build.BRAND, "UTF-8").replaceAll("\\+", "%20"));
            hashMap.put("manufacturer", URLEncoder.encode(Build.MANUFACTURER, "UTF-8").replaceAll("\\+", "%20"));
            hashMap.put("model", URLEncoder.encode(Build.MODEL, "UTF-8").replaceAll("\\+", "%20"));
            hashMap.put("product", URLEncoder.encode(Build.PRODUCT, "UTF-8").replaceAll("\\+", "%20"));
        } catch (UnsupportedEncodingException e2) {
            e2.printStackTrace();
        }
        hashMap.put("memory", "");
        hashMap.put("uid", com.quick.sdk.passport.c.c.b() + "");
        hashMap.put("rid", bx.a().a(context));
        hashMap.put(WebActionRouter.KEY_PKG, context.getPackageName());
        hashMap.put("aid", com.excelliance.kxqp.util.a.b.e(context));
        hashMap.put("issl", "1");
        hashMap.put(AvdSplashCallBackImp.KEY_OAID, com.quick.sdk.passport.c.b.c());
        hashMap.put(am.x, com.quick.sdk.passport.c.b.a() ? "harmony" : "android");
        hashMap.put("vmJarName", f2373b);
        JSONArray c2 = c(context);
        com.excelliance.user.account.f.e.a("VersionManagerDoThis==>", "VersionManager.java/queryUpdateInfoV2: multiPkgList  " + c2.toString());
        JSONObject jSONObject = new JSONObject(hashMap);
        try {
            jSONObject.put("multiPkgList", c2);
        } catch (JSONException e3) {
            e3.printStackTrace();
        }
        String jSONObject2 = jSONObject.toString();
        com.excelliance.user.account.f.e.a("VersionManagerDoThis==>", "VersionManager.java/queryUpdateInfoV2: request  " + jSONObject2);
        String str = new String(Base64.encode(jSONObject2.getBytes(), 2));
        com.excelliance.user.account.f.e.a("VersionManagerDoThis==>", "VersionManager.java/queryUpdateInfoV2: EN request  " + str);
        a.ab a2 = a.ab.a(a.v.a("application/json; charset=utf-8"), str);
        q qVar = null;
        com.zero.support.core.api.a.a(MedalSource.BASE_URL);
        com.excelliance.user.account.f.e.a("VersionManager", "VersionManager.java/queryUpdateInfoV2: thread " + Thread.currentThread().getName());
        com.zero.support.core.observable.c<Response<q>> c3 = ((com.excelliance.kxqp.api.b) com.zero.support.core.api.a.a(com.excelliance.kxqp.api.b.class)).a(a2).c();
        Log.d("VersionManager", "queryUpdateInfoV2:2 " + c3.a().toString());
        if (c3.a() != null && c3.a().f() == 1) {
            qVar = c3.a().d();
            qVar.c = q.f12853b;
            if (!cd.a(qVar.j)) {
                context.getSharedPreferences("kxqp", 4).edit().putString("sp_key_update_vm_msg", qVar.j).commit();
            } else {
                context.getSharedPreferences("kxqp", 4).edit().putString("sp_key_update_vm_msg", "").commit();
            }
            context.getSharedPreferences("kxqp", 4).edit().putInt("sp_key_update_force_update_vm", qVar.i).commit();
            arrayList.add(qVar);
            new Gson().a(qVar);
        } else {
            context.getSharedPreferences("kxqp", 4).edit().putString("sp_key_update_vm_msg", "").commit();
            context.getSharedPreferences("kxqp", 4).edit().putInt("sp_key_update_force_update_vm", 0).commit();
        }
        if (qVar == null) {
            SharedPreferences sharedPreferences = context.getSharedPreferences(Constants.PARAM_PLATFORM, Build.VERSION.SDK_INT >= 11 ? 4 : 0);
            int parseInt = Integer.parseInt(sharedPreferences.getString("update_info", "0"));
            if ((parseInt & 4) != 0 && !GameUtil.getIntance().C(context)) {
                GameUtil.getIntance().q(context);
                int r2 = GameUtil.getIntance().r();
                Log.d("VersionManager", "VersionManager.java/queryUpdateInfoV2: rpid  " + r2 + " settings  " + parseInt);
                if (r2 != 0) {
                    int i2 = parseInt & (-5);
                    SharedPreferences.Editor edit = sharedPreferences.edit();
                    edit.putString("update_info", String.valueOf(i2));
                    Log.d("VersionManager", "VersionManager.java/queryUpdateInfoV2: save " + i2);
                    edit.commit();
                    Process.killProcess(r2);
                }
            }
        }
        Intent intent = new Intent(context.getPackageName() + ".ACTION_HAS_NEW_VM");
        intent.putExtra("type", q.f12853b);
        context.sendBroadcast(intent);
        return arrayList;
    }

    public JSONArray c(Context context) {
        JSONArray jSONArray = new JSONArray();
        for (ExcellianceAppInfo excellianceAppInfo : com.excelliance.kxqp.repository.a.a(context).b()) {
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put(WebActionRouter.KEY_PKG, excellianceAppInfo.appPackageName);
                jSONObject.put(RankingItem.KEY_VER, excellianceAppInfo.getVersionCode());
                jSONObject.put("abi", Build.CPU_ABI);
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
            jSONArray.put(jSONObject);
        }
        return jSONArray;
    }

    public List<q> a(int i2, int i3) {
        ListIterator listIterator;
        String a2;
        q a3;
        String str;
        UnsupportedEncodingException e2;
        Log.d("VersionManager", "queryUpdateInfoOfDynamic");
        ArrayList arrayList = new ArrayList();
        GameUtil intance = GameUtil.getIntance();
        GameUtil.o(this.E);
        ar arVar = new ar();
        arVar.a("https://api.ourplay.com.cn//gpushjar/jartest");
        arVar.a("sdkver", String.valueOf(DualaidApkInfoUser.getOTAVersion(this.E)));
        arVar.a(RankingItem.KEY_VER_NAME, String.valueOf(DualaidApkInfoUser.getApkVersionName(this.E)));
        arVar.a("compver", l());
        arVar.a("current_apkver", String.valueOf(DualaidApkInfoUser.getApkVersion(this.E)));
        arVar.a("current_mainver", DualaidApkInfoUser.getCurrentMainVersion(this.E));
        arVar.a("apkver", String.valueOf(GameUtil.g(this.E)));
        arVar.a("mainver", String.valueOf(intance.m()));
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("yuedong", intance.e("yuedong"));
            jSONObject.put("baseJar", intance.e("baseJar"));
            az.v("VersionManager", "ver source:" + jSONObject.toString());
            String encodeToString = Base64.encodeToString(jSONObject.toString().getBytes(), 8);
            try {
                str = URLEncoder.encode(encodeToString, "UTF-8");
                try {
                    az.v("VersionManager", "ver :" + str);
                } catch (UnsupportedEncodingException e3) {
                    e2 = e3;
                    e2.printStackTrace();
                    az.e("VersionManager", "UnsupportedEncodingException");
                    arVar.a(RankingItem.KEY_VER, str);
                    arVar.a("chid", String.valueOf(DualaidApkInfoUser.getApkMainCh(this.E)));
                    arVar.a("subchid", String.valueOf(DualaidApkInfoUser.getApkSubCh(this.E)));
                    arVar.a("type", DualaidApkInfoUser.getPlatformType(this.E));
                    arVar.a("uflag", String.valueOf(!GameJNI.b() ? 2 : 0));
                    arVar.a(WebActionRouter.KEY_PKG, this.E.getPackageName());
                    arVar.a("api", String.valueOf(Build.VERSION.SDK_INT));
                    arVar.a("release", String.valueOf(Build.VERSION.RELEASE));
                    arVar.a("abi", URLEncoder.encode(Build.CPU_ABI, "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("abi2", URLEncoder.encode(Build.CPU_ABI2, "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("abilist", URLEncoder.encode(a("ro.product.cpu.abilist"), "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("abilist32", URLEncoder.encode(a("ro.product.cpu.abilist32"), "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("abilist64", URLEncoder.encode(a("ro.product.cpu.abilist64"), "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("brand", URLEncoder.encode(Build.BRAND, "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("manufacturer", URLEncoder.encode(Build.MANUFACTURER, "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("model", URLEncoder.encode(Build.MODEL, "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("product", URLEncoder.encode(Build.PRODUCT, "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("issl", "1");
                    arVar.a("sign", intance.A(this.E));
                    a2 = a(arVar.a(), false, i2, i3);
                    if (a2 == null) {
                    }
                    az.d("VersionManager", "queryUpdateInfoOfDynamic error");
                    listIterator = arrayList.listIterator();
                    while (listIterator.hasNext()) {
                    }
                    return arrayList;
                }
            } catch (UnsupportedEncodingException e4) {
                str = encodeToString;
                e2 = e4;
            }
            arVar.a(RankingItem.KEY_VER, str);
        } catch (Exception e5) {
            e5.printStackTrace();
        }
        arVar.a("chid", String.valueOf(DualaidApkInfoUser.getApkMainCh(this.E)));
        arVar.a("subchid", String.valueOf(DualaidApkInfoUser.getApkSubCh(this.E)));
        arVar.a("type", DualaidApkInfoUser.getPlatformType(this.E));
        arVar.a("uflag", String.valueOf(!GameJNI.b() ? 2 : 0));
        arVar.a(WebActionRouter.KEY_PKG, this.E.getPackageName());
        arVar.a("api", String.valueOf(Build.VERSION.SDK_INT));
        arVar.a("release", String.valueOf(Build.VERSION.RELEASE));
        try {
            arVar.a("abi", URLEncoder.encode(Build.CPU_ABI, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abi2", URLEncoder.encode(Build.CPU_ABI2, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abilist", URLEncoder.encode(a("ro.product.cpu.abilist"), "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abilist32", URLEncoder.encode(a("ro.product.cpu.abilist32"), "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abilist64", URLEncoder.encode(a("ro.product.cpu.abilist64"), "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("brand", URLEncoder.encode(Build.BRAND, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("manufacturer", URLEncoder.encode(Build.MANUFACTURER, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("model", URLEncoder.encode(Build.MODEL, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("product", URLEncoder.encode(Build.PRODUCT, "UTF-8").replaceAll("\\+", "%20"));
        } catch (Exception e6) {
            az.e("VersionManager", e6.getLocalizedMessage());
        }
        arVar.a("issl", "1");
        arVar.a("sign", intance.A(this.E));
        try {
            a2 = a(arVar.a(), false, i2, i3);
            if (a2 == null && a2.length() > 0) {
                if (a2 == null) {
                    a2 = "";
                }
                az.d("VersionManager", "xml=" + a2);
                if (a2 != null && a2.length() != 0) {
                    ByteArrayInputStream byteArrayInputStream = null;
                    if (a2 != null && !a2.trim().equals("")) {
                        byteArrayInputStream = new ByteArrayInputStream(a2.getBytes());
                    }
                    XmlPullParser newPullParser = Xml.newPullParser();
                    newPullParser.setInput(byteArrayInputStream, "UTF-8");
                    for (int eventType = newPullParser.getEventType(); eventType != 1; eventType = newPullParser.next()) {
                        if (eventType != 0 && eventType == 2 && newPullParser.getName().equalsIgnoreCase("info") && (a3 = q.a(newPullParser, "VersionManager")) != null) {
                            arrayList.add(a3);
                        }
                    }
                    byteArrayInputStream.close();
                }
                this.E.getSharedPreferences("updateInfo", 0).edit().putString("updateInfo", "").commit();
                return arrayList;
            }
            az.d("VersionManager", "queryUpdateInfoOfDynamic error");
        } catch (Exception e7) {
            az.d("VersionManager", "queryUpdateInfoOfDynamic e=" + e7);
            e7.printStackTrace();
        }
        listIterator = arrayList.listIterator();
        while (listIterator.hasNext()) {
            q qVar = (q) listIterator.next();
            if (intance.e(qVar.c.replace("_jar", "")).equals(qVar.f)) {
                listIterator.remove();
            }
        }
        return arrayList;
    }

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

    public List<q> c() {
        String str;
        String attributeValue;
        String attributeValue2;
        String attributeValue3;
        String str2;
        String str3;
        SharedPreferences sharedPreferences;
        SharedPreferences.Editor edit;
        String str4;
        String str5;
        String[] split;
        Log.d("VersionManager", "xpgi entered");
        ArrayList arrayList = new ArrayList();
        GameUtil intance = GameUtil.getIntance();
        String o2 = GameUtil.o(this.E);
        StringBuilder sb = new StringBuilder((o2 == null || o2.length() <= 0) ? "http://mto.multiopen.cn/offlinepkg.php" : "http://" + o2 + "/offlinepkg.php");
        sb.append("?sdkver=" + GameUtil.f(this.E));
        sb.append("&apkver=" + GameUtil.g(this.E));
        sb.append("&vn=" + GameUtil.h(this.E));
        sb.append("&compver=" + l());
        sb.append("&mainver=" + intance.m());
        sb.append("&pver=" + intance.e("plugin"));
        sb.append("&chid=" + GameUtil.d(this.E));
        sb.append("&subchid=" + GameUtil.e(this.E));
        sb.append("&type=" + intance.u(this.E));
        int i2 = 2;
        sb.append("&uflag=" + (GameJNI.b() ? 2 : 0));
        sb.append("&pkg=" + this.E.getPackageName());
        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("&sign=" + intance.A(this.E));
        try {
            az.d("VersionManager", "------getURL: " + sb.toString());
            String a2 = bd.a(sb.toString(), 24000, 12000);
            if (!cd.a(a2)) {
                if (a2 != null && a2.length() != 0) {
                    String str6 = null;
                    ByteArrayInputStream byteArrayInputStream = (a2 == null || "".equals(a2.trim())) ? null : new ByteArrayInputStream(a2.getBytes());
                    XmlPullParser newPullParser = Xml.newPullParser();
                    newPullParser.setInput(byteArrayInputStream, "UTF-8");
                    int eventType = newPullParser.getEventType();
                    while (true) {
                        boolean z2 = true;
                        if (eventType == 1) {
                            break;
                        }
                        if (eventType != 0 && eventType == i2 && "glist".equalsIgnoreCase(newPullParser.getName())) {
                            String attributeValue4 = newPullParser.getAttributeValue(str6, "tp");
                            if (attributeValue4 != null) {
                                if (attributeValue4.length() == 0) {
                                }
                                str = attributeValue4;
                                attributeValue = newPullParser.getAttributeValue(str6, "flag");
                                String attributeValue5 = newPullParser.getAttributeValue(str6, UMUnionConstants.DOWNLOAD_NOTIFICATION_CHANNEL_ID);
                                String attributeValue6 = newPullParser.getAttributeValue(str6, "pver");
                                String attributeValue7 = newPullParser.getAttributeValue(str6, RankingItem.KEY_SIZE);
                                String attributeValue8 = newPullParser.getAttributeValue(str6, "md5");
                                attributeValue2 = newPullParser.getAttributeValue(str6, "info");
                                attributeValue3 = newPullParser.getAttributeValue(str6, "filter");
                                if (str != null || attributeValue5 == null || attributeValue5.length() <= 0 || attributeValue6 == null || attributeValue7 == null || attributeValue8 == null) {
                                    str2 = attributeValue3;
                                    str3 = attributeValue2;
                                } else {
                                    str2 = attributeValue3;
                                    str3 = attributeValue2;
                                    arrayList.add(new q(str, "1".equals(attributeValue), attributeValue5, attributeValue6, attributeValue7, attributeValue8));
                                }
                                sharedPreferences = this.E.getSharedPreferences("feature_all", Build.VERSION.SDK_INT >= 11 ? 0 : 4);
                                edit = sharedPreferences.edit();
                                if (attributeValue == null && attributeValue.length() > 0 && (Integer.parseInt(attributeValue) & 1) == 1) {
                                    edit.putInt("flag", Integer.parseInt(attributeValue)).commit();
                                } else {
                                    edit.putInt("flag", 0).commit();
                                }
                                str4 = str3;
                                if (str4 == null) {
                                    edit.putString("info", str4).commit();
                                } else {
                                    edit.remove("info").commit();
                                }
                                str5 = str2;
                                if (str5 != null && str5.length() > 0) {
                                    String string = sharedPreferences.getString("flt", "");
                                    split = string.split(com.alipay.sdk.util.i.f491b);
                                    if (split != null) {
                                        for (String str7 : split) {
                                            if (str5.equals(str7)) {
                                                break;
                                            }
                                        }
                                    }
                                    z2 = false;
                                    if (!z2) {
                                        if (string.length() > 0) {
                                            string = string + com.alipay.sdk.util.i.f491b;
                                        }
                                        edit.putString("flt", string + str5).commit();
                                    }
                                }
                            }
                            attributeValue4 = "plugin_jar";
                            str = attributeValue4;
                            attributeValue = newPullParser.getAttributeValue(str6, "flag");
                            String attributeValue52 = newPullParser.getAttributeValue(str6, UMUnionConstants.DOWNLOAD_NOTIFICATION_CHANNEL_ID);
                            String attributeValue62 = newPullParser.getAttributeValue(str6, "pver");
                            String attributeValue72 = newPullParser.getAttributeValue(str6, RankingItem.KEY_SIZE);
                            String attributeValue82 = newPullParser.getAttributeValue(str6, "md5");
                            attributeValue2 = newPullParser.getAttributeValue(str6, "info");
                            attributeValue3 = newPullParser.getAttributeValue(str6, "filter");
                            if (str != null) {
                            }
                            str2 = attributeValue3;
                            str3 = attributeValue2;
                            sharedPreferences = this.E.getSharedPreferences("feature_all", Build.VERSION.SDK_INT >= 11 ? 0 : 4);
                            edit = sharedPreferences.edit();
                            if (attributeValue == null) {
                            }
                            edit.putInt("flag", 0).commit();
                            str4 = str3;
                            if (str4 == null) {
                            }
                            str5 = str2;
                            if (str5 != null) {
                                String string2 = sharedPreferences.getString("flt", "");
                                split = string2.split(com.alipay.sdk.util.i.f491b);
                                if (split != null) {
                                }
                                z2 = false;
                                if (!z2) {
                                }
                            }
                        }
                        eventType = newPullParser.next();
                        str6 = null;
                        i2 = 2;
                    }
                    byteArrayInputStream.close();
                }
                this.E.getSharedPreferences("updateInfo", 0).edit().putString("updateInfo", "").commit();
                return arrayList;
            }
        } catch (Exception e2) {
            Log.d("VersionManager", "xpi e=" + e2);
            e2.printStackTrace();
        }
        return arrayList;
    }

    public List<q> b(int i2, int i3) {
        String a2;
        String str;
        UnsupportedEncodingException e2;
        Log.d("VersionManager", "queryUpdateInfoOfAdv");
        ArrayList arrayList = new ArrayList();
        GameUtil intance = GameUtil.getIntance();
        GameUtil.o(this.E);
        ar arVar = new ar();
        arVar.a("http://api.ourplay.com.cn/push/get-mpush-jar");
        arVar.a("sdkver", String.valueOf(DualaidApkInfoUser.getOTAVersion(this.E)));
        arVar.a("apkver", String.valueOf(DualaidApkInfoUser.getApkVersion(this.E)));
        arVar.a(RankingItem.KEY_VER_NAME, String.valueOf(DualaidApkInfoUser.getApkVersionName(this.E)));
        arVar.a("compver", l());
        arVar.a("mainver", DualaidApkInfoUser.getCurrentMainVersion(this.E));
        JSONObject jSONObject = new JSONObject();
        try {
            if (com.excelliance.kxqp.gs.util.b.W(this.E)) {
                String b2 = com.excelliance.kxqp.push.c.a().b();
                if (!cd.a(b2)) {
                    jSONObject.put(b2, intance.e(b2));
                }
            }
            Log.v("VersionManager", "ver source:" + jSONObject.toString());
            String encodeToString = Base64.encodeToString(jSONObject.toString().getBytes(), 8);
            try {
                str = URLEncoder.encode(encodeToString, "UTF-8");
                try {
                    Log.v("VersionManager", "ver :" + str);
                } catch (UnsupportedEncodingException e3) {
                    e2 = e3;
                    e2.printStackTrace();
                    Log.e("VersionManager", "UnsupportedEncodingException");
                    arVar.a(RankingItem.KEY_VER, str);
                    arVar.a("chid", String.valueOf(DualaidApkInfoUser.getApkMainCh(this.E)));
                    arVar.a("subchid", String.valueOf(DualaidApkInfoUser.getApkSubCh(this.E)));
                    arVar.a("type", DualaidApkInfoUser.getPlatformType(this.E));
                    arVar.a("uflag", String.valueOf(!GameJNI.b() ? 2 : 0));
                    arVar.a(WebActionRouter.KEY_PKG, this.E.getPackageName());
                    arVar.a("api", String.valueOf(Build.VERSION.SDK_INT));
                    arVar.a("release", String.valueOf(Build.VERSION.RELEASE));
                    arVar.a("abi", URLEncoder.encode(Build.CPU_ABI, "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("abi2", URLEncoder.encode(Build.CPU_ABI2, "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("abilist", URLEncoder.encode(a("ro.product.cpu.abilist"), "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("abilist32", URLEncoder.encode(a("ro.product.cpu.abilist32"), "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("abilist64", URLEncoder.encode(a("ro.product.cpu.abilist64"), "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("brand", URLEncoder.encode(Build.BRAND, "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("manufacturer", URLEncoder.encode(Build.MANUFACTURER, "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("model", URLEncoder.encode(Build.MODEL, "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("product", URLEncoder.encode(Build.PRODUCT, "UTF-8").replaceAll("\\+", "%20"));
                    arVar.a("issl", "1");
                    arVar.a("sign", intance.A(this.E));
                    a2 = bd.a(arVar.a(), i2, i3);
                    if (a2 == null) {
                    }
                    Log.d("VersionManager", "queryUpdateInfoOfAdv error");
                    return arrayList;
                }
            } catch (UnsupportedEncodingException e4) {
                str = encodeToString;
                e2 = e4;
            }
            arVar.a(RankingItem.KEY_VER, str);
        } catch (Exception e5) {
            e5.printStackTrace();
        }
        arVar.a("chid", String.valueOf(DualaidApkInfoUser.getApkMainCh(this.E)));
        arVar.a("subchid", String.valueOf(DualaidApkInfoUser.getApkSubCh(this.E)));
        arVar.a("type", DualaidApkInfoUser.getPlatformType(this.E));
        arVar.a("uflag", String.valueOf(!GameJNI.b() ? 2 : 0));
        arVar.a(WebActionRouter.KEY_PKG, this.E.getPackageName());
        arVar.a("api", String.valueOf(Build.VERSION.SDK_INT));
        arVar.a("release", String.valueOf(Build.VERSION.RELEASE));
        try {
            arVar.a("abi", URLEncoder.encode(Build.CPU_ABI, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abi2", URLEncoder.encode(Build.CPU_ABI2, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abilist", URLEncoder.encode(a("ro.product.cpu.abilist"), "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abilist32", URLEncoder.encode(a("ro.product.cpu.abilist32"), "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abilist64", URLEncoder.encode(a("ro.product.cpu.abilist64"), "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("brand", URLEncoder.encode(Build.BRAND, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("manufacturer", URLEncoder.encode(Build.MANUFACTURER, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("model", URLEncoder.encode(Build.MODEL, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("product", URLEncoder.encode(Build.PRODUCT, "UTF-8").replaceAll("\\+", "%20"));
        } catch (Exception e6) {
            Log.e("VersionManager", e6.getLocalizedMessage());
        }
        arVar.a("issl", "1");
        arVar.a("sign", intance.A(this.E));
        try {
            a2 = bd.a(arVar.a(), i2, i3);
            if (a2 == null && a2.length() > 0) {
                if (a2 == null) {
                    a2 = "";
                }
                Log.d("VersionManager", "response xml=" + a2);
                if (a2 != null && a2.length() != 0) {
                    arrayList.addAll(q.a(a2, "VersionManager"));
                }
                this.E.getSharedPreferences("updateInfo", 0).edit().putString("updateInfo", "").commit();
                return arrayList;
            }
            Log.d("VersionManager", "queryUpdateInfoOfAdv error");
        } catch (Exception e7) {
            Log.d("VersionManager", "queryUpdateInfoOfAdv e=" + e7);
            e7.printStackTrace();
        }
        return arrayList;
    }

    public List<q> d() {
        String a2;
        String str;
        UnsupportedEncodingException e2;
        Log.d("VersionManager", "queryUpdateInfoOfResources");
        ArrayList arrayList = new ArrayList();
        ByteArrayInputStream byteArrayInputStream = null;
        if (!com.excelliance.kxqp.background_resident.a.m.a(this.E)) {
            Log.v("VersionManager", "queryUpdateInfoOfResources: no matching app set exist ");
            return null;
        }
        GameUtil intance = GameUtil.getIntance();
        String o2 = GameUtil.o(this.E);
        if (o2 == null || o2.length() <= 0) {
            String str2 = i.d + "/chksdkupdate.php";
        } else {
            String str3 = "http://folder." + o2 + "/chksdkupdate.php";
        }
        ar arVar = new ar();
        arVar.a("http://sdk.ourplay.com.cn/dynamicphoneres.php");
        arVar.a("sdkver", String.valueOf(GameUtil.f(this.E)));
        arVar.a("vc", String.valueOf(GameUtil.g(this.E)));
        arVar.a(RankingItem.KEY_VER_NAME, String.valueOf(GameUtil.h(this.E)));
        arVar.a("compver", l());
        arVar.a("mainver", intance.m());
        JSONObject jSONObject = new JSONObject();
        try {
            String a3 = com.excelliance.kxqp.background_resident.b.a(this.E, "_launch");
            String e3 = intance.e(a3);
            if ("-1".equals(e3)) {
                e3 = "0";
            }
            jSONObject.put(a3, e3);
            String e4 = com.excelliance.kxqp.swipe.b.e(this.E, "_applist");
            String e5 = intance.e(e4);
            if ("-1".equals(e5)) {
                e5 = "0";
            }
            jSONObject.put(e4, e5);
            String a4 = com.excelliance.kxqp.background_resident.b.a(this.E, "_association_start");
            String e6 = intance.e(a4);
            if ("-1".equals(e6)) {
                e6 = "0";
            }
            jSONObject.put(a4, e6);
            Log.v("VersionManager", "ver source:" + jSONObject.toString());
            String encodeToString = Base64.encodeToString(jSONObject.toString().getBytes(), 8);
            try {
                str = URLEncoder.encode(encodeToString, "UTF-8");
            } catch (UnsupportedEncodingException e7) {
                str = encodeToString;
                e2 = e7;
            }
        } catch (Exception e8) {
            e8.printStackTrace();
        }
        try {
            Log.v("VersionManager", "ver :" + str);
        } catch (UnsupportedEncodingException e9) {
            e2 = e9;
            e2.printStackTrace();
            Log.e("VersionManager", "UnsupportedEncodingException");
            arVar.a(RankingItem.KEY_VER, str);
            arVar.a("chid", String.valueOf(GameUtil.d(this.E)));
            arVar.a("subchid", String.valueOf(GameUtil.e(this.E)));
            arVar.a("type", intance.u(this.E));
            arVar.a("uflag", String.valueOf(GameJNI.b() ? 2 : 0));
            arVar.a(WebActionRouter.KEY_PKG, this.E.getPackageName());
            arVar.a("api", String.valueOf(Build.VERSION.SDK_INT));
            arVar.a("release", String.valueOf(Build.VERSION.RELEASE));
            arVar.a("abi", URLEncoder.encode(Build.CPU_ABI, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abi2", URLEncoder.encode(Build.CPU_ABI2, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abilist", URLEncoder.encode(a("ro.product.cpu.abilist"), "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abilist32", URLEncoder.encode(a("ro.product.cpu.abilist32"), "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abilist64", URLEncoder.encode(a("ro.product.cpu.abilist64"), "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("brand", URLEncoder.encode(Build.BRAND, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("manufacturer", URLEncoder.encode(Build.MANUFACTURER, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("model", URLEncoder.encode(Build.MODEL, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("product", URLEncoder.encode(Build.PRODUCT, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("sign", intance.A(this.E));
            a2 = bd.a(arVar.a(), 24000, 12000);
            if (!cd.a(a2)) {
            }
            return arrayList;
        }
        arVar.a(RankingItem.KEY_VER, str);
        arVar.a("chid", String.valueOf(GameUtil.d(this.E)));
        arVar.a("subchid", String.valueOf(GameUtil.e(this.E)));
        arVar.a("type", intance.u(this.E));
        arVar.a("uflag", String.valueOf(GameJNI.b() ? 2 : 0));
        arVar.a(WebActionRouter.KEY_PKG, this.E.getPackageName());
        arVar.a("api", String.valueOf(Build.VERSION.SDK_INT));
        arVar.a("release", String.valueOf(Build.VERSION.RELEASE));
        try {
            arVar.a("abi", URLEncoder.encode(Build.CPU_ABI, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abi2", URLEncoder.encode(Build.CPU_ABI2, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abilist", URLEncoder.encode(a("ro.product.cpu.abilist"), "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abilist32", URLEncoder.encode(a("ro.product.cpu.abilist32"), "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("abilist64", URLEncoder.encode(a("ro.product.cpu.abilist64"), "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("brand", URLEncoder.encode(Build.BRAND, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("manufacturer", URLEncoder.encode(Build.MANUFACTURER, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("model", URLEncoder.encode(Build.MODEL, "UTF-8").replaceAll("\\+", "%20"));
            arVar.a("product", URLEncoder.encode(Build.PRODUCT, "UTF-8").replaceAll("\\+", "%20"));
        } catch (Exception e10) {
            Log.e("VersionManager", e10.getLocalizedMessage());
        }
        arVar.a("sign", intance.A(this.E));
        a2 = bd.a(arVar.a(), 24000, 12000);
        if (!cd.a(a2)) {
            if (a2 == null) {
                a2 = "";
            }
            Log.d("VersionManager", "xml=" + a2);
            if (a2 != null && a2.length() != 0) {
                if (a2 != null && !"".equals(a2.trim())) {
                    byteArrayInputStream = new ByteArrayInputStream(a2.getBytes());
                }
                XmlPullParser newPullParser = Xml.newPullParser();
                newPullParser.setInput(byteArrayInputStream, "UTF-8");
                JSONObject jSONObject2 = new JSONObject();
                for (int eventType = newPullParser.getEventType(); eventType != 1; eventType = newPullParser.next()) {
                    if (eventType != 0 && eventType == 2 && "info".equalsIgnoreCase(newPullParser.getName())) {
                        q a5 = q.a(newPullParser, "VersionManager");
                        if (a5 != null) {
                            arrayList.add(a5);
                        }
                        jSONObject2.put(a5.c, a5.e);
                    }
                }
                byteArrayInputStream.close();
                com.excelliance.kxqp.swipe.b.a(this.E, jSONObject2);
            }
            return arrayList;
        }
        return arrayList;
    }

    public static HashMap<String, Integer> d(Context context) {
        List<String> e2 = e(context);
        HashMap<String, Integer> hashMap = new HashMap<>();
        int size = e2.size();
        for (int i2 = 0; i2 < size; i2++) {
            hashMap.put(e2.get(i2), Integer.valueOf(i2));
        }
        return hashMap;
    }

    public static List<String> e(Context context) {
        List<String> a2 = an.a(context, context.getPackageName());
        if (a2 == null || a2.isEmpty()) {
            a2 = new ArrayList<>();
            Collections.addAll(a2, u);
        }
        if (com.excelliance.kxqp.gs.util.b.aD(context)) {
            List<String> m2 = m(context);
            az.d("getTopApps", "getTopApps/serverTopList: " + m2);
            if (!com.excelliance.kxqp.gs.util.s.a(m2)) {
                a2.addAll(0, m2);
            }
        }
        return a2;
    }

    private static List<String> m(Context context) {
        String b2 = by.a(context, "global_config").b("sp_key_import_local_sort_list", "");
        if (TextUtils.isEmpty(b2)) {
            return null;
        }
        try {
            JSONArray optJSONArray = new JSONObject(b2).optJSONObject("data").optJSONArray("allpkg");
            ArrayList arrayList = new ArrayList();
            for (int i2 = 0; i2 < optJSONArray.length(); i2++) {
                arrayList.add(optJSONArray.optString(i2));
            }
            return arrayList;
        } catch (Exception e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public String e() {
        String r2 = GameUtil.getIntance().r(this.E);
        if (this.F == null) {
            this.F = this.E.getSharedPreferences("userInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4).getString("uid", null);
        }
        if (this.G == null) {
            this.G = this.E.getSharedPreferences("userInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4).getString("aid", null);
        }
        if (this.H == null) {
            this.H = this.E.getSharedPreferences("userInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4).getString("did", null);
        }
        if (this.F != null && r2 != null && this.G != null && this.G.equals(r2) && this.H != null) {
            return this.F;
        }
        this.F = this.E.getSharedPreferences("userInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4).getString("uid", null);
        if (this.F != null && this.H != null) {
            return this.F;
        }
        g();
        return this.F;
    }

    public String f() {
        if (this.F != null) {
            return this.F;
        }
        if (this.E == null) {
            return this.F;
        }
        this.F = this.E.getSharedPreferences("userInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4).getString("uid", null);
        if (this.F != null) {
            return this.F;
        }
        new Thread() {
            @Override
            public void run() {
                VersionManager.this.g();
            }
        }.start();
        return this.F;
    }

    public void g() {
        String str;
        String string;
        String a2;
        String v2;
        String r2;
        int eventType;
        synchronized (this.I) {
            GameUtil intance = GameUtil.getIntance();
            String o2 = GameUtil.o(intance.getContext());
            if (o2 != null && o2.length() > 0) {
                str = "http://folder." + o2 + "/ggsgenuser.php?";
                StringBuilder sb = new StringBuilder(str);
                sb.append("chid=");
                sb.append(intance.h());
                sb.append("&subchid=");
                sb.append(intance.i());
                sb.append("&vc=");
                sb.append(GameUtil.g(this.E));
                sb.append("&type=4");
                sb.append("&data=" + intance.f());
                SharedPreferences sharedPreferences = this.E.getSharedPreferences("extractInfo", Build.VERSION.SDK_INT >= 11 ? 0 : 4);
                string = sharedPreferences.getString("resExtracted", null);
                String string2 = sharedPreferences.getString("components", "");
                if (string != null) {
                    j b2 = b(string + "3rd/config/" + string2);
                    if (b2 != null && b2.g != null && new File(b2.g).exists()) {
                        sb.append("&gver=" + b2.i);
                        sb.append("&glvl=" + b2.j);
                    }
                }
                a2 = bd.a(sb.toString(), 30000, 30000);
                if (!cd.a(a2) && a2.length() > 0) {
                    XmlPullParser newPullParser = Xml.newPullParser();
                    newPullParser.setInput(new StringReader(a2));
                    for (eventType = newPullParser.getEventType(); eventType != 1; eventType = newPullParser.next()) {
                        if (eventType != 0 && eventType == 2 && "info".equalsIgnoreCase(newPullParser.getName())) {
                            this.F = newPullParser.getAttributeValue(null, "uid");
                            Log.d("VersionManager", "uid=" + this.F);
                        }
                    }
                }
                if (this.F != null && this.F.length() > 0 && !"0".equals(this.F)) {
                    SharedPreferences.Editor edit = this.E.getSharedPreferences("userInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit();
                    edit.putString("uid", this.F);
                    edit.commit();
                    v2 = intance.v(this.E);
                    r2 = intance.r(this.E);
                    if (v2 == null && v2.length() > 0) {
                        edit.putString("did", v2).commit();
                        this.H = v2;
                    } else if (this.G != null) {
                        edit.putString("did", "").commit();
                        this.H = "";
                    }
                    if (r2 != null) {
                        edit.putString("aid", r2).commit();
                        this.G = r2;
                    }
                }
            }
            str = y + "/ggsgenuser.php?";
            StringBuilder sb2 = new StringBuilder(str);
            sb2.append("chid=");
            sb2.append(intance.h());
            sb2.append("&subchid=");
            sb2.append(intance.i());
            sb2.append("&vc=");
            sb2.append(GameUtil.g(this.E));
            sb2.append("&type=4");
            sb2.append("&data=" + intance.f());
            SharedPreferences sharedPreferences2 = this.E.getSharedPreferences("extractInfo", Build.VERSION.SDK_INT >= 11 ? 0 : 4);
            string = sharedPreferences2.getString("resExtracted", null);
            String string22 = sharedPreferences2.getString("components", "");
            if (string != null) {
            }
            a2 = bd.a(sb2.toString(), 30000, 30000);
            if (!cd.a(a2)) {
                XmlPullParser newPullParser2 = Xml.newPullParser();
                newPullParser2.setInput(new StringReader(a2));
                while (eventType != 1) {
                }
            }
            if (this.F != null) {
                SharedPreferences.Editor edit2 = this.E.getSharedPreferences("userInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit();
                edit2.putString("uid", this.F);
                edit2.commit();
                v2 = intance.v(this.E);
                r2 = intance.r(this.E);
                if (v2 == null) {
                }
                if (this.G != null) {
                }
                if (r2 != null) {
                }
            }
        }
    }

    public String a(long j2) {
        String str;
        this.E.getPackageName();
        if (!GameUtil.getIntance().e() || GameUtil.a(Environment.getExternalStorageDirectory()) <= j2) {
            str = null;
        } else {
            str = Environment.getExternalStorageDirectory().toString() + "/." + i() + "/";
        }
        if (str != null || GameUtil.a(new File("/data/data/")) <= j2 + 20971520) {
            return str;
        }
        return as.a(this.E) + "/";
    }

    public String h() {
        String str;
        this.E.getPackageName();
        if (GameUtil.getIntance().e()) {
            str = Environment.getExternalStorageDirectory().toString() + "/." + i() + "/";
        } else {
            str = null;
        }
        return str == null ? as.a(this.E) : str;
    }

    public String i() {
        if (m) {
            return "dygameres.apps";
        }
        try {
            return this.E.getPackageName();
        } catch (Exception unused) {
            return "";
        }
    }

    public String j() {
        if (this.E == null) {
            return "";
        }
        this.E.getPackageName();
        return as.a(this.E) + "/.dygameres.apps/";
    }

    public String f(Context context) {
        context.getPackageName();
        return as.a(context) + "/.dygameres.apps/";
    }

    public String k() {
        String str;
        String packageName = this.E.getPackageName();
        if (GameUtil.getIntance().e()) {
            str = Environment.getExternalStorageDirectory().toString() + "/." + packageName + "/";
        } else {
            str = null;
        }
        if (str != null) {
            return str;
        }
        return as.a(this.E) + "/";
    }

    public String l() {
        int i2;
        String str = "";
        try {
            File file = new File(this.E.getFilesDir() + "/game_res/compVersion");
            String string = this.E.getSharedPreferences(Constants.PARAM_PLATFORM, Build.VERSION.SDK_INT < 11 ? 0 : 4).getString("current_version", "0");
            try {
                i2 = Integer.parseInt(string);
            } catch (Exception unused) {
                i2 = 0;
            }
            if (i2 <= 0) {
                try {
                    if (file.exists()) {
                        try {
                            InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file), "UTF-8");
                            String readLine = new BufferedReader(inputStreamReader).readLine();
                            try {
                                inputStreamReader.close();
                                str = readLine;
                            } catch (Exception unused2) {
                                string = readLine;
                            }
                        } catch (Exception unused3) {
                        }
                        int s = GameUtil.getIntance().s(this.E);
                        if (str == null && str.length() > 0 && Integer.parseInt(str) >= s) {
                            return str;
                        }
                        string = String.valueOf(GameUtil.getIntance().s(this.E));
                        e(string);
                        return string;
                    }
                } catch (Exception e2) {
                    String str2 = string;
                    e = e2;
                    str = str2;
                    e.printStackTrace();
                    return str;
                }
            }
            str = string;
            int s2 = GameUtil.getIntance().s(this.E);
            if (str == null) {
            }
            string = String.valueOf(GameUtil.getIntance().s(this.E));
            e(string);
            return string;
        } catch (Exception e3) {
            e = e3;
        }
    }

    public void e(String str) {
        if (str == null || str.trim().length() <= 0) {
            return;
        }
        File file = new File(this.E.getFilesDir() + "/game_res/compVersion");
        try {
            this.E.getSharedPreferences(Constants.PARAM_PLATFORM, Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putString("current_version", str).commit();
            if (file.exists()) {
                file.delete();
            }
            file.getParentFile().mkdirs();
            FileOutputStream fileOutputStream = new FileOutputStream(file);
            fileOutputStream.write(str.getBytes());
            a(fileOutputStream);
        } catch (Exception unused) {
        }
    }

    private void a(OutputStream outputStream) {
        try {
            outputStream.flush();
            outputStream.close();
        } catch (Exception unused) {
        }
    }

    public void f(String str) {
        StringBuilder sb;
        int indexOf;
        int indexOf2;
        if (str == null || str.trim().length() <= 0) {
            return;
        }
        String str2 = "";
        File file = new File(this.E.getFilesDir() + "/game_res/verinfo.cfg");
        try {
            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();
            }
            a(file, new StringBuilder(str2));
            this.E.getSharedPreferences(Constants.PARAM_PLATFORM, Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putString("current_main_version", str).commit();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    private void a(File file, StringBuilder sb) {
        try {
            BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
            bufferedWriter.write(sb.toString());
            bufferedWriter.close();
        } catch (Exception unused) {
        }
    }

    public void b(String str, String str2) {
        GameUtil.a(this.E, str, str2);
    }

    private Map<String, j> v() {
        HashMap hashMap = new HashMap();
        this.E.getPackageName();
        ArrayList<String> arrayList = new ArrayList();
        if (GameUtil.getIntance().e()) {
            arrayList.add(Environment.getExternalStorageDirectory().toString() + "/." + i() + "/game_res/3rd/downloading/");
        }
        arrayList.add(as.a(this.E) + "/game_res/3rd/downloading/");
        for (String str : arrayList) {
            File file = new File(str);
            if (file.exists()) {
                Log.d("VersionManager", "getPartialDownload file exists " + str);
                File[] a2 = a(file);
                if (a2 != null) {
                    for (File file2 : a2) {
                        j b2 = b(file2.getPath());
                        if (b2 == null) {
                            file2.delete();
                        } else {
                            b2.n = file2.getPath();
                            if (hashMap.containsKey(b2.f12504a)) {
                                j jVar = (j) hashMap.get(b2.f12504a);
                                int parseInt = Integer.parseInt(jVar.i);
                                int parseInt2 = Integer.parseInt(b2.i);
                                int parseInt3 = jVar.j == null ? 1 : Integer.parseInt(jVar.j);
                                int parseInt4 = b2.j != null ? Integer.parseInt(b2.j) : 1;
                                if (parseInt < parseInt2 || (parseInt == parseInt2 && (parseInt3 < parseInt4 || jVar.g.startsWith("/data")))) {
                                    hashMap.put(b2.f12504a, b2);
                                }
                            } else {
                                hashMap.put(b2.f12504a, b2);
                            }
                        }
                    }
                }
            }
        }
        return hashMap;
    }

    private File[] a(File file) {
        ArrayList arrayList = new ArrayList();
        File[] listFiles = file.listFiles();
        if (listFiles != null && listFiles.length > 0) {
            int length = listFiles.length;
            for (int i2 = 0; i2 < length; i2++) {
                String name = listFiles[i2] != null ? listFiles[i2].getName() : null;
                if (name != null && name.endsWith(".cfg")) {
                    arrayList.add(listFiles[i2]);
                }
            }
        }
        if (listFiles == null) {
            return new File[0];
        }
        return (File[]) arrayList.toArray(listFiles);
    }

    public boolean g(String str) {
        boolean z2 = false;
        String string = this.E.getSharedPreferences("gameInfo", Build.VERSION.SDK_INT < 11 ? 0 : 4).getString("currentGameId", null);
        if (str != null && str.equals(string)) {
            z2 = true;
        }
        Log.d("VersionManager", "gameRunning gameId " + str + "=" + z2 + " currentGameId=" + string);
        return z2;
    }

    @Override
    public Map<String, Object> getAppDetails(String str) {
        if (str == null || str.length() == 0) {
            return null;
        }
        return b(o(str));
    }

    @Override
    public Map<String, Map> getLocalAppList() {
        ArrayList<a> p2 = p(j() + "game_res/3rd/config/app_list.config");
        HashMap hashMap = new HashMap();
        for (int i2 = 0; i2 < p2.size(); i2++) {
            a aVar = p2.get(i2);
            hashMap.put(aVar.f2386b, b(aVar));
        }
        return hashMap;
    }

    @Override
    public Map<String, Map> getServerAppList() {
        List<a> e2 = e(3);
        HashMap hashMap = new HashMap();
        for (int i2 = 0; i2 < e2.size(); i2++) {
            a aVar = e2.get(i2);
            hashMap.put(aVar.f2386b, b(aVar));
        }
        Log.d("VersionManager", "getServerAppList mAppList.size = " + e2.size());
        return hashMap;
    }

    @Override
    public Map<String, Map> getAllAppList() {
        ArrayList arrayList;
        int i2;
        ByteArrayInputStream byteArrayInputStream;
        String str;
        String str2;
        int i3;
        File file;
        int length;
        int i4;
        String str3 = j() + "game_res/3rd/config/app_list.config";
        ArrayList arrayList2 = new ArrayList();
        File file2 = new File(str3);
        if (file2.exists()) {
            String str4 = "";
            try {
                InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file2), "UTF-8");
                BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    str4 = str4 + readLine;
                }
                inputStreamReader.close();
            } catch (Exception e2) {
                Log.d("VersionManager", "e=" + e2);
            }
            this.E.getPackageManager();
            if (str4 != null) {
                try {
                    if (!"".equals(str4.trim())) {
                        ByteArrayInputStream byteArrayInputStream2 = new ByteArrayInputStream(str4.getBytes());
                        XmlPullParser newPullParser = Xml.newPullParser();
                        try {
                            newPullParser.setInput(byteArrayInputStream2, "UTF-8");
                            int eventType = newPullParser.getEventType();
                            while (eventType != 1) {
                                if (eventType != 0 && eventType == 2) {
                                    if ("glist".equalsIgnoreCase(newPullParser.getName())) {
                                        String attributeValue = newPullParser.getAttributeValue(null, "gid");
                                        String attributeValue2 = newPullParser.getAttributeValue(null, "gver");
                                        String attributeValue3 = newPullParser.getAttributeValue(null, "gname");
                                        String attributeValue4 = newPullParser.getAttributeValue(null, "glib");
                                        String attributeValue5 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_SAVEPATH);
                                        String attributeValue6 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GPATH);
                                        String attributeValue7 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GTYPE);
                                        String attributeValue8 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PATCH);
                                        String attributeValue9 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GSIZE);
                                        String attributeValue10 = newPullParser.getAttributeValue(null, "omd5");
                                        String attributeValue11 = newPullParser.getAttributeValue(null, "dmd5");
                                        String attributeValue12 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_DSTATUS);
                                        String attributeValue13 = newPullParser.getAttributeValue(null, "flag");
                                        byteArrayInputStream = byteArrayInputStream2;
                                        String attributeValue14 = newPullParser.getAttributeValue(null, "gtime");
                                        ArrayList arrayList3 = arrayList2;
                                        try {
                                            newPullParser.getAttributeValue(null, "gsid");
                                            String attributeValue15 = newPullParser.getAttributeValue(null, "gfup");
                                            String attributeValue16 = newPullParser.getAttributeValue(null, "ntftitle");
                                            String attributeValue17 = newPullParser.getAttributeValue(null, "ntfmsg");
                                            String attributeValue18 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PPATH);
                                            String attributeValue19 = newPullParser.getAttributeValue(null, "gcid");
                                            if (attributeValue15 != null) {
                                                if (attributeValue15.length() == 0) {
                                                }
                                                String str5 = attributeValue15;
                                                int parseInt = attributeValue13 == null ? Integer.parseInt(attributeValue13) : 259;
                                                if (attributeValue12 != null && !attributeValue12.equals(String.valueOf(1))) {
                                                    attributeValue12.equals(String.valueOf(5));
                                                }
                                                String substring = str3.substring(0, str3.lastIndexOf("/"));
                                                String str6 = substring + "/" + attributeValue4 + ".cfg";
                                                if (attributeValue5 != null && attributeValue5.length() != 0) {
                                                    str2 = attributeValue5;
                                                    if (str2 != null || !new File(str2).exists()) {
                                                        if (!str2.contains("/ready/")) {
                                                            if (new File(str2.replace("/ready/", "/")).exists()) {
                                                            }
                                                            i3 = 0;
                                                        } else {
                                                            if (new File(str2.replace("/jar/", "/ready/jar/")).exists()) {
                                                            }
                                                            i3 = 0;
                                                        }
                                                        if (attributeValue12 == null) {
                                                            attributeValue12 = i3 != 0 ? "1" : "0";
                                                        }
                                                        if (i3 != 0) {
                                                            if (Integer.parseInt(attributeValue12) != 5 && Integer.parseInt(attributeValue12) != 1) {
                                                                attributeValue12 = "1";
                                                            }
                                                        } else if (attributeValue12 != null && (attributeValue12.equals(String.valueOf(1)) || attributeValue12.equals(String.valueOf(5)))) {
                                                            if (attributeValue18 != null && !attributeValue18.startsWith(HttpHost.DEFAULT_SCHEME_NAME)) {
                                                                a(attributeValue, 3, (String) null);
                                                                attributeValue12 = "3";
                                                            }
                                                            a(attributeValue, 0, (String) null);
                                                            attributeValue12 = "1";
                                                        }
                                                        int i5 = i3 ^ 1;
                                                        int parseInt2 = attributeValue7 != null ? Integer.parseInt(attributeValue7) : 0;
                                                        int parseInt3 = attributeValue19 != null ? Integer.parseInt(attributeValue19) : 1;
                                                        String attributeValue20 = newPullParser.getAttributeValue(null, "gnet");
                                                        int parseInt4 = attributeValue20 != null ? Integer.parseInt(attributeValue20) : 1;
                                                        boolean z2 = attributeValue8 == null && "1".equals(attributeValue8);
                                                        if (attributeValue18 != null) {
                                                            attributeValue18.toLowerCase().startsWith(HttpHost.DEFAULT_SCHEME_NAME);
                                                        }
                                                        try {
                                                            if ((Integer.parseInt(attributeValue12) != 2 || Integer.parseInt(attributeValue12) == 4 || Integer.parseInt(attributeValue12) == 6) && str2 != null) {
                                                                StringBuilder sb = new StringBuilder();
                                                                str = str3;
                                                                sb.append(str2.substring(0, str2.lastIndexOf("/") + 1));
                                                                sb.append(attributeValue4);
                                                                sb.append(".jar");
                                                                sb.append(".dload");
                                                                file = new File(sb.toString());
                                                                if (file.exists()) {
                                                                    length = (int) ((((float) file.length()) / Integer.parseInt(attributeValue9)) * 100.0f);
                                                                    i4 = length;
                                                                    a aVar = new a(attributeValue, attributeValue4, attributeValue3, attributeValue6, parseInt2, parseInt4, str2, str6, 0L, attributeValue2, "1", str5, attributeValue18, parseInt3, z2, attributeValue10, "", attributeValue11, false, parseInt, attributeValue16, attributeValue17);
                                                                    aVar.c(Integer.parseInt(attributeValue14));
                                                                    aVar.a(Integer.parseInt(attributeValue12));
                                                                    if (i4 != -1) {
                                                                        aVar.b(i4);
                                                                    }
                                                                    aVar.f2385a = i5;
                                                                    arrayList = arrayList3;
                                                                    arrayList.add(aVar);
                                                                    eventType = newPullParser.next();
                                                                    arrayList2 = arrayList;
                                                                    byteArrayInputStream2 = byteArrayInputStream;
                                                                    str3 = str;
                                                                } else {
                                                                    Log.d("VersionManager", "parseAppDetails savePath DS_ONGOING not exist gameLib = " + attributeValue4);
                                                                }
                                                            } else {
                                                                str = str3;
                                                            }
                                                            arrayList.add(aVar);
                                                            eventType = newPullParser.next();
                                                            arrayList2 = arrayList;
                                                            byteArrayInputStream2 = byteArrayInputStream;
                                                            str3 = str;
                                                        } catch (XmlPullParserException e3) {
                                                            e = e3;
                                                            e.printStackTrace();
                                                            Log.d("VersionManager", "all size = " + arrayList.size());
                                                            HashMap hashMap = new HashMap();
                                                            while (i2 < arrayList.size()) {
                                                            }
                                                            return hashMap;
                                                        } catch (Exception e4) {
                                                            e = e4;
                                                            e.printStackTrace();
                                                            Log.d("VersionManager", "all size = " + arrayList.size());
                                                            HashMap hashMap2 = new HashMap();
                                                            while (i2 < arrayList.size()) {
                                                            }
                                                            return hashMap2;
                                                        }
                                                        length = -1;
                                                        i4 = length;
                                                        a aVar2 = new a(attributeValue, attributeValue4, attributeValue3, attributeValue6, parseInt2, parseInt4, str2, str6, 0L, attributeValue2, "1", str5, attributeValue18, parseInt3, z2, attributeValue10, "", attributeValue11, false, parseInt, attributeValue16, attributeValue17);
                                                        aVar2.c(Integer.parseInt(attributeValue14));
                                                        aVar2.a(Integer.parseInt(attributeValue12));
                                                        if (i4 != -1) {
                                                        }
                                                        aVar2.f2385a = i5;
                                                        arrayList = arrayList3;
                                                    }
                                                    i3 = 1;
                                                    if (attributeValue12 == null) {
                                                    }
                                                    if (i3 != 0) {
                                                    }
                                                    int i52 = i3 ^ 1;
                                                    if (attributeValue7 != null) {
                                                    }
                                                    if (attributeValue19 != null) {
                                                    }
                                                    String attributeValue202 = newPullParser.getAttributeValue(null, "gnet");
                                                    if (attributeValue202 != null) {
                                                    }
                                                    if (attributeValue8 == null) {
                                                    }
                                                    if (attributeValue18 != null) {
                                                    }
                                                    if (Integer.parseInt(attributeValue12) != 2) {
                                                    }
                                                    StringBuilder sb2 = new StringBuilder();
                                                    str = str3;
                                                    sb2.append(str2.substring(0, str2.lastIndexOf("/") + 1));
                                                    sb2.append(attributeValue4);
                                                    sb2.append(".jar");
                                                    sb2.append(".dload");
                                                    file = new File(sb2.toString());
                                                    if (file.exists()) {
                                                    }
                                                }
                                                str2 = substring.substring(0, substring.lastIndexOf("/")) + "/jar/" + attributeValue4 + ".jar";
                                                if (str2 != null) {
                                                }
                                                if (!str2.contains("/ready/")) {
                                                }
                                                if (attributeValue12 == null) {
                                                }
                                                if (i3 != 0) {
                                                }
                                                int i522 = i3 ^ 1;
                                                if (attributeValue7 != null) {
                                                }
                                                if (attributeValue19 != null) {
                                                }
                                                String attributeValue2022 = newPullParser.getAttributeValue(null, "gnet");
                                                if (attributeValue2022 != null) {
                                                }
                                                if (attributeValue8 == null) {
                                                }
                                                if (attributeValue18 != null) {
                                                }
                                                if (Integer.parseInt(attributeValue12) != 2) {
                                                }
                                                StringBuilder sb22 = new StringBuilder();
                                                str = str3;
                                                sb22.append(str2.substring(0, str2.lastIndexOf("/") + 1));
                                                sb22.append(attributeValue4);
                                                sb22.append(".jar");
                                                sb22.append(".dload");
                                                file = new File(sb22.toString());
                                                if (file.exists()) {
                                                }
                                            }
                                            attributeValue15 = "0";
                                            String str52 = attributeValue15;
                                            if (attributeValue13 == null) {
                                            }
                                            if (attributeValue12 != null) {
                                                attributeValue12.equals(String.valueOf(5));
                                            }
                                            String substring2 = str3.substring(0, str3.lastIndexOf("/"));
                                            String str62 = substring2 + "/" + attributeValue4 + ".cfg";
                                            if (attributeValue5 != null) {
                                                str2 = attributeValue5;
                                                if (str2 != null) {
                                                }
                                                if (!str2.contains("/ready/")) {
                                                }
                                                if (attributeValue12 == null) {
                                                }
                                                if (i3 != 0) {
                                                }
                                                int i5222 = i3 ^ 1;
                                                if (attributeValue7 != null) {
                                                }
                                                if (attributeValue19 != null) {
                                                }
                                                String attributeValue20222 = newPullParser.getAttributeValue(null, "gnet");
                                                if (attributeValue20222 != null) {
                                                }
                                                if (attributeValue8 == null) {
                                                }
                                                if (attributeValue18 != null) {
                                                }
                                                if (Integer.parseInt(attributeValue12) != 2) {
                                                }
                                                StringBuilder sb222 = new StringBuilder();
                                                str = str3;
                                                sb222.append(str2.substring(0, str2.lastIndexOf("/") + 1));
                                                sb222.append(attributeValue4);
                                                sb222.append(".jar");
                                                sb222.append(".dload");
                                                file = new File(sb222.toString());
                                                if (file.exists()) {
                                                }
                                            }
                                            str2 = substring2.substring(0, substring2.lastIndexOf("/")) + "/jar/" + attributeValue4 + ".jar";
                                            if (str2 != null) {
                                            }
                                            if (!str2.contains("/ready/")) {
                                            }
                                            if (attributeValue12 == null) {
                                            }
                                            if (i3 != 0) {
                                            }
                                            int i52222 = i3 ^ 1;
                                            if (attributeValue7 != null) {
                                            }
                                            if (attributeValue19 != null) {
                                            }
                                            String attributeValue202222 = newPullParser.getAttributeValue(null, "gnet");
                                            if (attributeValue202222 != null) {
                                            }
                                            if (attributeValue8 == null) {
                                            }
                                            if (attributeValue18 != null) {
                                            }
                                            if (Integer.parseInt(attributeValue12) != 2) {
                                            }
                                            StringBuilder sb2222 = new StringBuilder();
                                            str = str3;
                                            sb2222.append(str2.substring(0, str2.lastIndexOf("/") + 1));
                                            sb2222.append(attributeValue4);
                                            sb2222.append(".jar");
                                            sb2222.append(".dload");
                                            file = new File(sb2222.toString());
                                            if (file.exists()) {
                                            }
                                        } catch (XmlPullParserException e5) {
                                            e = e5;
                                            arrayList = arrayList3;
                                            e.printStackTrace();
                                            Log.d("VersionManager", "all size = " + arrayList.size());
                                            HashMap hashMap22 = new HashMap();
                                            while (i2 < arrayList.size()) {
                                            }
                                            return hashMap22;
                                        } catch (Exception e6) {
                                            e = e6;
                                            arrayList = arrayList3;
                                            e.printStackTrace();
                                            Log.d("VersionManager", "all size = " + arrayList.size());
                                            HashMap hashMap222 = new HashMap();
                                            while (i2 < arrayList.size()) {
                                            }
                                            return hashMap222;
                                        }
                                    }
                                }
                                byteArrayInputStream = byteArrayInputStream2;
                                str = str3;
                                arrayList = arrayList2;
                                eventType = newPullParser.next();
                                arrayList2 = arrayList;
                                byteArrayInputStream2 = byteArrayInputStream;
                                str3 = str;
                            }
                            arrayList = arrayList2;
                            byteArrayInputStream2.close();
                        } catch (XmlPullParserException e7) {
                            e = e7;
                            arrayList = arrayList2;
                        } catch (Exception e8) {
                            e = e8;
                            arrayList = arrayList2;
                        }
                    }
                } catch (Exception e9) {
                    Log.d("VersionManager", "parseDownloadedAppListConfig e" + e9);
                    e9.printStackTrace();
                    return new HashMap();
                }
            }
            return new HashMap();
        }
        arrayList = arrayList2;
        Log.d("VersionManager", "all size = " + arrayList.size());
        HashMap hashMap2222 = new HashMap();
        for (i2 = 0; i2 < arrayList.size(); i2++) {
            a aVar3 = (a) arrayList.get(i2);
            hashMap2222.put(aVar3.f2386b, b(aVar3));
        }
        return hashMap2222;
    }

    @Override
    public boolean downloadApp(String str) {
        NetworkInfo activeNetworkInfo = ((ConnectivityManager) this.E.getSystemService(FakeServiceHelper.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();
        if (!(activeNetworkInfo != null && activeNetworkInfo.isAvailable() && activeNetworkInfo.isConnected())) {
            return false;
        }
        String str2 = j() + "game_res/3rd/config/app_list.config";
        ArrayList<a> q2 = q(str2);
        if (q2 != null) {
            Log.d("VersionManager", "downloadApp autoList.size = " + q2.size());
            for (a aVar : q2) {
                if (aVar.f2386b.equals(str)) {
                    String substring = str2.substring(0, str2.lastIndexOf("/"));
                    if (aVar.h == null || aVar.h.length() == 0) {
                        aVar.h = substring.substring(0, substring.lastIndexOf("/")) + "/jar/" + aVar.c + ".jar.dload";
                    }
                    String str3 = aVar.f == 0 ? aVar.h.substring(0, aVar.h.lastIndexOf("/")) + "/" + aVar.c + ".cfg" : aVar.h.substring(0, aVar.h.indexOf("jar/")) + "downloading/" + aVar.c + ".cfg";
                    if (!new File(str3).exists()) {
                        a(str3, aVar);
                    }
                    Intent intent = new Intent(this.E.getPackageName() + ".action.downloadcomp");
                    intent.putExtra("gameid", aVar.f2386b);
                    intent.putExtra(ClientCookie.VERSION_ATTR, aVar.j);
                    intent.putExtra("level", aVar.k);
                    intent.putExtra(RankingItem.KEY_FORCEUPDATE, aVar.l);
                    intent.putExtra("gamename", aVar.d);
                    intent.putExtra("gamelib", aVar.c);
                    intent.putExtra("urlpath", aVar.e);
                    intent.putExtra("gametype", aVar.f);
                    intent.putExtra("savePath", aVar.h);
                    intent.putExtra(ExcellianceAppInfo.KEY_PATCH, aVar.q);
                    intent.putExtra("omd5", aVar.r);
                    intent.putExtra("nmd5", aVar.s);
                    intent.putExtra("dmd5", aVar.t);
                    intent.putExtra("autodl", false);
                    intent.putExtra("flag", aVar.x | 4);
                    intent.putExtra("notifytitle", aVar.v);
                    intent.putExtra("notifymsg", aVar.w);
                    if (aVar.m != null && !aVar.m.toLowerCase().startsWith(HttpHost.DEFAULT_SCHEME_NAME)) {
                        intent.putExtra("iconurl", aVar.m);
                    }
                    this.E.startService(intent);
                }
            }
        }
        return false;
    }

    @Override
    public void stopDownloadingApp(String str) {
        com.excelliance.user.account.f.e.a("VersionManagerDoThis==>", "=====VersionManager.java4112/stopDownloadingApp: ");
        Intent intent = new Intent(this.E.getPackageName() + ".action.downloadcomp");
        intent.putExtra("canceldownloading", true);
        intent.putExtra("gameid", str);
        this.E.startService(intent);
    }

    @Override
    public boolean downloadAppIcon(String str) {
        NetworkInfo activeNetworkInfo = ((ConnectivityManager) this.E.getSystemService(FakeServiceHelper.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();
        if (!(activeNetworkInfo != null && activeNetworkInfo.isAvailable() && activeNetworkInfo.isConnected())) {
            return false;
        }
        String str2 = j() + "game_res/3rd/config/app_list.config";
        ArrayList<a> q2 = q(str2);
        if (q2 != null) {
            Log.d("VersionManager", "downloadAppIcon autoList.size = " + q2.size());
            for (a aVar : q2) {
                if (aVar.f2386b.equals(str)) {
                    String substring = str2.substring(0, str2.lastIndexOf("/"));
                    if (aVar.h == null || aVar.h.length() == 0) {
                        aVar.h = substring.substring(0, substring.lastIndexOf("/")) + "/jar/" + aVar.c + ".jar.dload";
                    }
                    String str3 = aVar.f == 0 ? aVar.h.substring(0, aVar.h.lastIndexOf("/")) + "/" + aVar.c + ".cfg" : aVar.h.substring(0, aVar.h.indexOf("jar/")) + "downloading/" + aVar.c + ".cfg";
                    if (!new File(str3).exists()) {
                        a(str3, aVar);
                    }
                    Intent intent = new Intent(this.E.getPackageName() + ".action.downloadcomp");
                    intent.putExtra("gameid", aVar.f2386b);
                    intent.putExtra(ClientCookie.VERSION_ATTR, aVar.j);
                    intent.putExtra("level", aVar.k);
                    intent.putExtra(RankingItem.KEY_FORCEUPDATE, aVar.l);
                    intent.putExtra("gamename", aVar.d);
                    intent.putExtra("gamelib", aVar.c);
                    intent.putExtra("urlpath", aVar.e);
                    intent.putExtra("gametype", aVar.f);
                    intent.putExtra("savePath", aVar.h);
                    intent.putExtra(ExcellianceAppInfo.KEY_PATCH, aVar.q);
                    intent.putExtra("omd5", aVar.r);
                    intent.putExtra("nmd5", aVar.s);
                    intent.putExtra("dmd5", aVar.t);
                    intent.putExtra("autodl", true);
                    intent.putExtra("flag", aVar.x | 4);
                    intent.putExtra("notifytitle", aVar.v);
                    intent.putExtra("notifymsg", aVar.w);
                    if (aVar.m != null && aVar.m.toLowerCase().startsWith(HttpHost.DEFAULT_SCHEME_NAME)) {
                        intent.putExtra("iconurl", aVar.m);
                        this.E.startService(intent);
                    }
                    Log.d("VersionManager", "downloadApp detail.icon=" + aVar.m);
                }
            }
        }
        return false;
    }

    @Override
    public void removeApp(String str) {
        a o2 = o(str);
        if (o2 != null) {
            a(o2);
            if (o2.m != null && new File(o2.m).exists()) {
                a(str, 3, (String) null);
            } else {
                a(str, 0, (String) null);
            }
        }
    }

    @Override
    public void setGameUrl(String str) {
        if (str == null || str.length() <= 0) {
            return;
        }
        x = str;
    }

    @Override
    public void setPlatformUrl(String str) {
        if (str == null || str.length() <= 0) {
            return;
        }
        y = str;
    }

    @Override
    public void useCustomizedDownloadNotify(boolean z2) {
        if (z2) {
            this.E.getSharedPreferences("platform_partner", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putInt("customNotify", 1).commit();
        } else {
            this.E.getSharedPreferences("platform_partner", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putInt("customNotify", 0).commit();
        }
    }

    private void a(a aVar) {
        String str;
        if (aVar == null) {
            return;
        }
        String str2 = Environment.getExternalStorageDirectory().toString() + "/." + i();
        String a2 = as.a(this.E);
        if (aVar.h.startsWith("/data/")) {
            str = a2 + "/game_res/3rd/";
        } else {
            str = str2 + "/game_res/3rd/";
        }
        File file = new File(str + "config/" + aVar.c + ".cfg");
        if (file.exists()) {
            file.delete();
        }
        File file2 = new File(aVar.h);
        if (file2.exists()) {
            file2.delete();
        }
        File file3 = new File(aVar.h + ".dload");
        if (file3.exists()) {
            file3.delete();
        }
        File file4 = new File(a2 + "/gameplugins/" + aVar.c);
        if (file4.exists()) {
            b(file4);
        }
    }

    private void a(String str, a aVar) {
        try {
            File file = new File(str);
            if (!file.exists()) {
                file.getParentFile().mkdirs();
                file.createNewFile();
            } else {
                file.delete();
                file.createNewFile();
            }
            String str2 = aVar.h;
            if (aVar.h == null || aVar.h.length() == 0 || "null".equals(aVar.h)) {
                String substring = str.substring(0, str.lastIndexOf("/"));
                String substring2 = substring.substring(0, substring.lastIndexOf("/"));
                if (aVar.e != null && aVar.e.length() > 0) {
                    str2 = substring2 + "/jar/" + aVar.e.substring(aVar.e.lastIndexOf("/") + 1) + ".dload";
                }
            }
            RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
            StringBuilder sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
            sb.append("<game>\n");
            sb.append("<ginfo id=\"" + aVar.f2386b + "\" ");
            sb.append("version=\"" + aVar.j + "\" ");
            sb.append("level=\"" + aVar.k + "\" ");
            sb.append("gfup=\"" + aVar.l + "\" ");
            sb.append("name=\"" + aVar.d + "\" ");
            sb.append("abbr=\"" + aVar.c + "\" ");
            sb.append("savepath=\"" + str2 + "\" ");
            sb.append("icon=\"" + aVar.m + "\" ");
            sb.append("gametype=\"" + aVar.f + "\" ");
            sb.append("cid=\"" + aVar.n + "\" ");
            sb.append("gnet=\"" + aVar.g + "\" ");
            sb.append("flag=\"" + aVar.x + "\" ");
            sb.append("size=\"" + aVar.i + "\" ");
            sb.append("dmd5=\"" + aVar.t + "\" ");
            sb.append("url=\"" + aVar.e + "\" ");
            sb.append("omd5=\"" + aVar.r + "\" ");
            sb.append("nmd5=\"" + aVar.s + "\" ");
            StringBuilder sb2 = new StringBuilder();
            sb2.append("patch=\"");
            sb2.append(aVar.q ? "1" : "0");
            sb2.append("\" ");
            sb.append(sb2.toString());
            StringBuilder sb3 = new StringBuilder();
            sb3.append("adl=\"");
            sb3.append(aVar.u ? "1" : "0");
            sb3.append("\" ");
            sb.append(sb3.toString());
            sb.append("ntftitle=\"" + aVar.v + "\" ");
            sb.append("ntfmsg=\"" + aVar.w + "\" ");
            sb.append(" />\n</game>\n");
            randomAccessFile.write(sb.toString().getBytes());
            randomAccessFile.close();
        } catch (Exception e2) {
            Log.e("VersionManager", "writeToFile Exception");
            e2.printStackTrace();
        }
    }

    public ExcellianceAppInfo h(String str) {
        return b(str, 0);
    }

    public ExcellianceAppInfo b(String str, int i2) {
        ExcellianceAppInfo excellianceAppInfo;
        ExcellianceAppInfo excellianceAppInfo2;
        ExcellianceAppInfo excellianceAppInfo3;
        ByteArrayInputStream byteArrayInputStream;
        String str2;
        XmlPullParser xmlPullParser;
        String str3;
        int length;
        ExcellianceAppInfo excellianceAppInfo4;
        String str4 = j() + "game_res/3rd/config/" + c(i2);
        File file = new File(str4);
        String str5 = null;
        if (!file.exists()) {
            return null;
        }
        String str6 = "";
        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;
                }
                str6 = str6 + readLine;
            }
            inputStreamReader.close();
        } catch (Exception e2) {
            Log.d("VersionManager", "e=" + e2);
        }
        this.E.getPackageManager();
        if (str6 != null) {
            try {
                if (!"".equals(str6.trim())) {
                    ByteArrayInputStream byteArrayInputStream2 = new ByteArrayInputStream(str6.getBytes());
                    XmlPullParser newPullParser = Xml.newPullParser();
                    try {
                        newPullParser.setInput(byteArrayInputStream2, "UTF-8");
                        int eventType = newPullParser.getEventType();
                        ExcellianceAppInfo excellianceAppInfo5 = null;
                        while (eventType != 1 && excellianceAppInfo5 == null) {
                            try {
                                if (eventType != 0 && eventType == 2) {
                                    try {
                                        if ("glist".equalsIgnoreCase(newPullParser.getName())) {
                                            String attributeValue = newPullParser.getAttributeValue(str5, "gid");
                                            newPullParser.getAttributeValue(str5, "gver");
                                            String attributeValue2 = newPullParser.getAttributeValue(str5, "gname");
                                            String attributeValue3 = newPullParser.getAttributeValue(str5, "glib");
                                            String attributeValue4 = newPullParser.getAttributeValue(str5, ExcellianceAppInfo.KEY_SAVEPATH);
                                            newPullParser.getAttributeValue(str5, ExcellianceAppInfo.KEY_GPATH);
                                            String attributeValue5 = newPullParser.getAttributeValue(str5, ExcellianceAppInfo.KEY_GTYPE);
                                            String attributeValue6 = newPullParser.getAttributeValue(str5, ExcellianceAppInfo.KEY_PATCH);
                                            String attributeValue7 = newPullParser.getAttributeValue(str5, ExcellianceAppInfo.KEY_GSIZE);
                                            newPullParser.getAttributeValue(str5, "omd5");
                                            newPullParser.getAttributeValue(str5, "dmd5");
                                            String attributeValue8 = newPullParser.getAttributeValue(str5, ExcellianceAppInfo.KEY_DSTATUS);
                                            String attributeValue9 = newPullParser.getAttributeValue(str5, "flag");
                                            String attributeValue10 = newPullParser.getAttributeValue(str5, "gtime");
                                            excellianceAppInfo3 = excellianceAppInfo5;
                                            try {
                                                String attributeValue11 = newPullParser.getAttributeValue(str5, "gsid");
                                                byteArrayInputStream = byteArrayInputStream2;
                                                String attributeValue12 = newPullParser.getAttributeValue(str5, "gfup");
                                                newPullParser.getAttributeValue(str5, "ntftitle");
                                                newPullParser.getAttributeValue(str5, "ntfmsg");
                                                if (attributeValue != null && str.equals(attributeValue)) {
                                                    if (attributeValue12 != null) {
                                                        attributeValue12.length();
                                                    }
                                                    if (attributeValue11 == null) {
                                                        attributeValue11 = attributeValue;
                                                    }
                                                    int parseInt = attributeValue9 != null ? Integer.parseInt(attributeValue9) : 259;
                                                    int i3 = (attributeValue8 == null || !(attributeValue8.equals(String.valueOf(1)) || attributeValue8.equals(String.valueOf(5)))) ? 0 : 1;
                                                    String substring = str4.substring(0, str4.lastIndexOf("/"));
                                                    StringBuilder sb = new StringBuilder();
                                                    sb.append(substring);
                                                    str2 = str4;
                                                    sb.append("/");
                                                    sb.append(attributeValue3);
                                                    sb.append(".cfg");
                                                    sb.toString();
                                                    if (attributeValue4 != null && attributeValue4.length() != 0) {
                                                        str3 = attributeValue4;
                                                        if (str3 != null || !new File(str3).exists()) {
                                                            if (!str3.contains("/ready/")) {
                                                                if (new File(str3.replace("/ready/", "/")).exists()) {
                                                                }
                                                                int i4 = i3 ^ 1;
                                                                if (attributeValue8 == null) {
                                                                    attributeValue8 = i3 != 0 ? "1" : "0";
                                                                }
                                                                if (i3 != 0 && Integer.parseInt(attributeValue8) != 5 && Integer.parseInt(attributeValue8) != 1) {
                                                                    attributeValue8 = "1";
                                                                }
                                                                String str7 = attributeValue8;
                                                                if ((attributeValue5 != null ? Integer.parseInt(attributeValue5) : 0) == 1) {
                                                                    xmlPullParser = newPullParser;
                                                                } else {
                                                                    String attributeValue13 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PPATH);
                                                                    String attributeValue14 = newPullParser.getAttributeValue(null, "gcid");
                                                                    if (attributeValue14 != null) {
                                                                        Integer.parseInt(attributeValue14);
                                                                    }
                                                                    String attributeValue15 = newPullParser.getAttributeValue(null, "gnet");
                                                                    if (attributeValue15 != null) {
                                                                        Integer.parseInt(attributeValue15);
                                                                    }
                                                                    if (attributeValue6 != null) {
                                                                        "1".equals(attributeValue6);
                                                                    }
                                                                    try {
                                                                        if ((Integer.parseInt(str7) == 2 || Integer.parseInt(str7) == 4 || Integer.parseInt(str7) == 6) && str3 != null) {
                                                                            StringBuilder sb2 = new StringBuilder();
                                                                            xmlPullParser = newPullParser;
                                                                            sb2.append(str3.substring(0, str3.lastIndexOf("/") + 1));
                                                                            sb2.append(attributeValue3);
                                                                            sb2.append(".jar");
                                                                            sb2.append(".dload");
                                                                            File file2 = new File(sb2.toString());
                                                                            if (file2.exists()) {
                                                                                length = (int) ((((float) file2.length()) / Integer.parseInt(attributeValue7)) * 100.0f);
                                                                                excellianceAppInfo4 = new ExcellianceAppInfo(this.E, attributeValue3, attributeValue2, null, attributeValue13, str3, String.valueOf(parseInt), attributeValue5, attributeValue, Long.parseLong(attributeValue11));
                                                                                excellianceAppInfo4.setPlayTime(Integer.parseInt(attributeValue10));
                                                                                excellianceAppInfo4.setDownloadStatus(Integer.parseInt(str7));
                                                                                if (length != -1) {
                                                                                    excellianceAppInfo4.setDownloadProgress(length);
                                                                                }
                                                                                excellianceAppInfo4.setUid(i2);
                                                                                excellianceAppInfo4.appType = i4;
                                                                                excellianceAppInfo5 = excellianceAppInfo4;
                                                                                eventType = xmlPullParser.next();
                                                                                byteArrayInputStream2 = byteArrayInputStream;
                                                                                str4 = str2;
                                                                                newPullParser = xmlPullParser;
                                                                                str5 = null;
                                                                            } else {
                                                                                Log.d("VersionManager", "parseAppDetails savePath DS_ONGOING not exist gameLib = " + attributeValue3);
                                                                            }
                                                                        } else {
                                                                            xmlPullParser = newPullParser;
                                                                        }
                                                                        excellianceAppInfo4.setPlayTime(Integer.parseInt(attributeValue10));
                                                                        excellianceAppInfo4.setDownloadStatus(Integer.parseInt(str7));
                                                                        if (length != -1) {
                                                                        }
                                                                        excellianceAppInfo4.setUid(i2);
                                                                        excellianceAppInfo4.appType = i4;
                                                                        excellianceAppInfo5 = excellianceAppInfo4;
                                                                        eventType = xmlPullParser.next();
                                                                        byteArrayInputStream2 = byteArrayInputStream;
                                                                        str4 = str2;
                                                                        newPullParser = xmlPullParser;
                                                                        str5 = null;
                                                                    } catch (XmlPullParserException e3) {
                                                                        e = e3;
                                                                        excellianceAppInfo2 = excellianceAppInfo4;
                                                                        e.printStackTrace();
                                                                        return excellianceAppInfo2;
                                                                    } catch (Exception e4) {
                                                                        e = e4;
                                                                        excellianceAppInfo = excellianceAppInfo4;
                                                                        e.printStackTrace();
                                                                        return excellianceAppInfo;
                                                                    }
                                                                    length = -1;
                                                                    excellianceAppInfo4 = new ExcellianceAppInfo(this.E, attributeValue3, attributeValue2, null, attributeValue13, str3, String.valueOf(parseInt), attributeValue5, attributeValue, Long.parseLong(attributeValue11));
                                                                }
                                                            } else {
                                                                if (new File(str3.replace("/jar/", "/ready/jar/")).exists()) {
                                                                }
                                                                int i42 = i3 ^ 1;
                                                                if (attributeValue8 == null) {
                                                                }
                                                                if (i3 != 0) {
                                                                    attributeValue8 = "1";
                                                                }
                                                                String str72 = attributeValue8;
                                                                if ((attributeValue5 != null ? Integer.parseInt(attributeValue5) : 0) == 1) {
                                                                }
                                                            }
                                                            excellianceAppInfo5 = excellianceAppInfo3;
                                                            eventType = xmlPullParser.next();
                                                            byteArrayInputStream2 = byteArrayInputStream;
                                                            str4 = str2;
                                                            newPullParser = xmlPullParser;
                                                            str5 = null;
                                                        }
                                                        i3 = 1;
                                                        int i422 = i3 ^ 1;
                                                        if (attributeValue8 == null) {
                                                        }
                                                        if (i3 != 0) {
                                                        }
                                                        String str722 = attributeValue8;
                                                        if ((attributeValue5 != null ? Integer.parseInt(attributeValue5) : 0) == 1) {
                                                        }
                                                    }
                                                    str3 = substring.substring(0, substring.lastIndexOf("/")) + "/jar/" + attributeValue3 + ".jar";
                                                    if (str3 != null) {
                                                    }
                                                    if (!str3.contains("/ready/")) {
                                                    }
                                                    excellianceAppInfo5 = excellianceAppInfo3;
                                                    eventType = xmlPullParser.next();
                                                    byteArrayInputStream2 = byteArrayInputStream;
                                                    str4 = str2;
                                                    newPullParser = xmlPullParser;
                                                    str5 = null;
                                                }
                                                str2 = str4;
                                                xmlPullParser = newPullParser;
                                                excellianceAppInfo5 = excellianceAppInfo3;
                                                eventType = xmlPullParser.next();
                                                byteArrayInputStream2 = byteArrayInputStream;
                                                str4 = str2;
                                                newPullParser = xmlPullParser;
                                                str5 = null;
                                            } catch (XmlPullParserException e5) {
                                                e = e5;
                                                excellianceAppInfo2 = excellianceAppInfo3;
                                                e.printStackTrace();
                                                return excellianceAppInfo2;
                                            } catch (Exception e6) {
                                                e = e6;
                                                excellianceAppInfo = excellianceAppInfo3;
                                                e.printStackTrace();
                                                return excellianceAppInfo;
                                            }
                                        }
                                    } catch (XmlPullParserException e7) {
                                        e = e7;
                                        excellianceAppInfo3 = excellianceAppInfo5;
                                        excellianceAppInfo2 = excellianceAppInfo3;
                                        e.printStackTrace();
                                        return excellianceAppInfo2;
                                    } catch (Exception e8) {
                                        e = e8;
                                        excellianceAppInfo3 = excellianceAppInfo5;
                                        excellianceAppInfo = excellianceAppInfo3;
                                        e.printStackTrace();
                                        return excellianceAppInfo;
                                    }
                                }
                                eventType = xmlPullParser.next();
                                byteArrayInputStream2 = byteArrayInputStream;
                                str4 = str2;
                                newPullParser = xmlPullParser;
                                str5 = null;
                            } catch (XmlPullParserException e9) {
                                e = e9;
                                excellianceAppInfo2 = excellianceAppInfo5;
                                e.printStackTrace();
                                return excellianceAppInfo2;
                            } catch (Exception e10) {
                                e = e10;
                                excellianceAppInfo = excellianceAppInfo5;
                                e.printStackTrace();
                                return excellianceAppInfo;
                            }
                            byteArrayInputStream = byteArrayInputStream2;
                            str2 = str4;
                            xmlPullParser = newPullParser;
                            excellianceAppInfo3 = excellianceAppInfo5;
                            excellianceAppInfo5 = excellianceAppInfo3;
                        }
                        excellianceAppInfo3 = excellianceAppInfo5;
                        byteArrayInputStream2.close();
                        return excellianceAppInfo3;
                    } catch (XmlPullParserException e11) {
                        e = e11;
                        excellianceAppInfo2 = null;
                    } catch (Exception e12) {
                        e = e12;
                        excellianceAppInfo = null;
                    }
                }
            } catch (Exception e13) {
                Log.d("VersionManager", "parseAppDetails e" + e13);
                e13.printStackTrace();
                return null;
            }
        }
        return null;
    }

    private a o(String str) {
        a aVar;
        a aVar2;
        String str2;
        ByteArrayInputStream byteArrayInputStream;
        String str3;
        File file;
        int i2;
        int length;
        a aVar3;
        String str4 = j() + "game_res/3rd/config/app_list.config";
        File file2 = new File(str4);
        String str5 = null;
        if (!file2.exists()) {
            return null;
        }
        String str6 = "";
        try {
            InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file2), "UTF-8");
            BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine == null) {
                    break;
                }
                str6 = str6 + readLine;
            }
            inputStreamReader.close();
        } catch (Exception e2) {
            Log.d("VersionManager", "e=" + e2);
        }
        String str7 = str6;
        this.E.getPackageManager();
        if (str7 != null) {
            try {
                if (!"".equals(str7.trim())) {
                    ByteArrayInputStream byteArrayInputStream2 = new ByteArrayInputStream(str7.getBytes());
                    XmlPullParser newPullParser = Xml.newPullParser();
                    try {
                        newPullParser.setInput(byteArrayInputStream2, "UTF-8");
                        int eventType = newPullParser.getEventType();
                        a aVar4 = null;
                        while (eventType != 1 && aVar4 == null) {
                            if (eventType != 0 && eventType == 2) {
                                try {
                                    if ("glist".equalsIgnoreCase(newPullParser.getName())) {
                                        String attributeValue = newPullParser.getAttributeValue(str5, "gid");
                                        String attributeValue2 = newPullParser.getAttributeValue(str5, "gver");
                                        String attributeValue3 = newPullParser.getAttributeValue(str5, "gname");
                                        String attributeValue4 = newPullParser.getAttributeValue(str5, "glib");
                                        String attributeValue5 = newPullParser.getAttributeValue(str5, ExcellianceAppInfo.KEY_SAVEPATH);
                                        String attributeValue6 = newPullParser.getAttributeValue(str5, ExcellianceAppInfo.KEY_GPATH);
                                        String attributeValue7 = newPullParser.getAttributeValue(str5, ExcellianceAppInfo.KEY_GTYPE);
                                        String attributeValue8 = newPullParser.getAttributeValue(str5, ExcellianceAppInfo.KEY_PATCH);
                                        String attributeValue9 = newPullParser.getAttributeValue(str5, ExcellianceAppInfo.KEY_GSIZE);
                                        String attributeValue10 = newPullParser.getAttributeValue(str5, "omd5");
                                        String attributeValue11 = newPullParser.getAttributeValue(str5, "dmd5");
                                        String attributeValue12 = newPullParser.getAttributeValue(str5, ExcellianceAppInfo.KEY_DSTATUS);
                                        String attributeValue13 = newPullParser.getAttributeValue(str5, "flag");
                                        String attributeValue14 = newPullParser.getAttributeValue(str5, "gtime");
                                        newPullParser.getAttributeValue(str5, "gsid");
                                        String attributeValue15 = newPullParser.getAttributeValue(str5, "gfup");
                                        byteArrayInputStream = byteArrayInputStream2;
                                        String attributeValue16 = newPullParser.getAttributeValue(str5, "ntftitle");
                                        String attributeValue17 = newPullParser.getAttributeValue(str5, "ntfmsg");
                                        if (attributeValue != null && str.equals(attributeValue)) {
                                            if (attributeValue15 != null) {
                                                if (attributeValue15.length() == 0) {
                                                }
                                                String str8 = attributeValue15;
                                                int parseInt = attributeValue13 == null ? Integer.parseInt(attributeValue13) : 259;
                                                int i3 = (attributeValue12 == null && (attributeValue12.equals(String.valueOf(1)) || attributeValue12.equals(String.valueOf(5)))) ? 1 : 0;
                                                String substring = str4.substring(0, str4.lastIndexOf("/"));
                                                String str9 = substring + "/" + attributeValue4 + ".cfg";
                                                if (attributeValue5 != null || attributeValue5.length() == 0) {
                                                    attributeValue5 = substring.substring(0, substring.lastIndexOf("/")) + "/jar/" + attributeValue4 + ".jar";
                                                }
                                                if (attributeValue5 != null || !new File(attributeValue5).exists()) {
                                                    if (!attributeValue5.contains("/ready/")) {
                                                        if (new File(attributeValue5.replace("/ready/", "/")).exists()) {
                                                        }
                                                        int i4 = i3 ^ 1;
                                                        if (attributeValue12 == null) {
                                                            attributeValue12 = i3 != 0 ? "1" : "0";
                                                        }
                                                        if (i3 != 0 && Integer.parseInt(attributeValue12) != 5 && Integer.parseInt(attributeValue12) != 1) {
                                                            attributeValue12 = "1";
                                                        }
                                                        str3 = attributeValue12;
                                                        int parseInt2 = attributeValue7 != null ? Integer.parseInt(attributeValue7) : 0;
                                                        String attributeValue18 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PPATH);
                                                        String attributeValue19 = newPullParser.getAttributeValue(null, "gcid");
                                                        int parseInt3 = attributeValue19 != null ? Integer.parseInt(attributeValue19) : 1;
                                                        String attributeValue20 = newPullParser.getAttributeValue(null, "gnet");
                                                        int parseInt4 = attributeValue20 != null ? Integer.parseInt(attributeValue20) : 1;
                                                        boolean z2 = attributeValue8 == null && "1".equals(attributeValue8);
                                                        try {
                                                            if ((Integer.parseInt(str3) != 2 || Integer.parseInt(str3) == 4 || Integer.parseInt(str3) == 6) && attributeValue5 != null) {
                                                                StringBuilder sb = new StringBuilder();
                                                                str2 = str4;
                                                                sb.append(attributeValue5.substring(0, attributeValue5.lastIndexOf("/") + 1));
                                                                sb.append(attributeValue4);
                                                                sb.append(".jar");
                                                                sb.append(".dload");
                                                                file = new File(sb.toString());
                                                                if (file.exists()) {
                                                                    i2 = i4;
                                                                    length = (int) ((((float) file.length()) / Integer.parseInt(attributeValue9)) * 100.0f);
                                                                    int i5 = i2;
                                                                    aVar3 = new a(attributeValue, attributeValue4, attributeValue3, attributeValue6, parseInt2, parseInt4, attributeValue5, str9, 0L, attributeValue2, "1", str8, attributeValue18, parseInt3, z2, attributeValue10, "", attributeValue11, false, parseInt, attributeValue16, attributeValue17);
                                                                    aVar3.c(Integer.parseInt(attributeValue14));
                                                                    aVar3.a(Integer.parseInt(str3));
                                                                    if (length != -1) {
                                                                        aVar3.b(length);
                                                                    }
                                                                    aVar3.f2385a = i5;
                                                                    aVar4 = aVar3;
                                                                } else {
                                                                    i2 = i4;
                                                                    Log.d("VersionManager", "parseAppDetails savePath DS_ONGOING not exist gameLib = " + attributeValue4);
                                                                }
                                                            } else {
                                                                str2 = str4;
                                                                i2 = i4;
                                                            }
                                                            aVar3.c(Integer.parseInt(attributeValue14));
                                                            aVar3.a(Integer.parseInt(str3));
                                                            if (length != -1) {
                                                            }
                                                            aVar3.f2385a = i5;
                                                            aVar4 = aVar3;
                                                        } catch (XmlPullParserException e3) {
                                                            e = e3;
                                                            aVar2 = aVar3;
                                                            e.printStackTrace();
                                                            return aVar2;
                                                        } catch (Exception e4) {
                                                            e = e4;
                                                            aVar = aVar3;
                                                            e.printStackTrace();
                                                            return aVar;
                                                        }
                                                        length = -1;
                                                        int i52 = i2;
                                                        aVar3 = new a(attributeValue, attributeValue4, attributeValue3, attributeValue6, parseInt2, parseInt4, attributeValue5, str9, 0L, attributeValue2, "1", str8, attributeValue18, parseInt3, z2, attributeValue10, "", attributeValue11, false, parseInt, attributeValue16, attributeValue17);
                                                    } else {
                                                        if (new File(attributeValue5.replace("/jar/", "/ready/jar/")).exists()) {
                                                        }
                                                        int i42 = i3 ^ 1;
                                                        if (attributeValue12 == null) {
                                                        }
                                                        if (i3 != 0) {
                                                            attributeValue12 = "1";
                                                        }
                                                        str3 = attributeValue12;
                                                        if (attributeValue7 != null) {
                                                        }
                                                        String attributeValue182 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PPATH);
                                                        String attributeValue192 = newPullParser.getAttributeValue(null, "gcid");
                                                        if (attributeValue192 != null) {
                                                        }
                                                        String attributeValue202 = newPullParser.getAttributeValue(null, "gnet");
                                                        if (attributeValue202 != null) {
                                                        }
                                                        if (attributeValue8 == null) {
                                                        }
                                                        if (Integer.parseInt(str3) != 2) {
                                                        }
                                                        StringBuilder sb2 = new StringBuilder();
                                                        str2 = str4;
                                                        sb2.append(attributeValue5.substring(0, attributeValue5.lastIndexOf("/") + 1));
                                                        sb2.append(attributeValue4);
                                                        sb2.append(".jar");
                                                        sb2.append(".dload");
                                                        file = new File(sb2.toString());
                                                        if (file.exists()) {
                                                        }
                                                    }
                                                    eventType = newPullParser.next();
                                                    byteArrayInputStream2 = byteArrayInputStream;
                                                    str4 = str2;
                                                    str5 = null;
                                                }
                                                i3 = 1;
                                                int i422 = i3 ^ 1;
                                                if (attributeValue12 == null) {
                                                }
                                                if (i3 != 0) {
                                                }
                                                str3 = attributeValue12;
                                                if (attributeValue7 != null) {
                                                }
                                                String attributeValue1822 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PPATH);
                                                String attributeValue1922 = newPullParser.getAttributeValue(null, "gcid");
                                                if (attributeValue1922 != null) {
                                                }
                                                String attributeValue2022 = newPullParser.getAttributeValue(null, "gnet");
                                                if (attributeValue2022 != null) {
                                                }
                                                if (attributeValue8 == null) {
                                                }
                                                if (Integer.parseInt(str3) != 2) {
                                                }
                                                StringBuilder sb22 = new StringBuilder();
                                                str2 = str4;
                                                sb22.append(attributeValue5.substring(0, attributeValue5.lastIndexOf("/") + 1));
                                                sb22.append(attributeValue4);
                                                sb22.append(".jar");
                                                sb22.append(".dload");
                                                file = new File(sb22.toString());
                                                if (file.exists()) {
                                                }
                                            }
                                            attributeValue15 = "0";
                                            String str82 = attributeValue15;
                                            if (attributeValue13 == null) {
                                            }
                                            if (attributeValue12 == null) {
                                            }
                                            String substring2 = str4.substring(0, str4.lastIndexOf("/"));
                                            String str92 = substring2 + "/" + attributeValue4 + ".cfg";
                                            if (attributeValue5 != null) {
                                            }
                                            attributeValue5 = substring2.substring(0, substring2.lastIndexOf("/")) + "/jar/" + attributeValue4 + ".jar";
                                            if (attributeValue5 != null) {
                                            }
                                            if (!attributeValue5.contains("/ready/")) {
                                            }
                                            eventType = newPullParser.next();
                                            byteArrayInputStream2 = byteArrayInputStream;
                                            str4 = str2;
                                            str5 = null;
                                        }
                                        str2 = str4;
                                        eventType = newPullParser.next();
                                        byteArrayInputStream2 = byteArrayInputStream;
                                        str4 = str2;
                                        str5 = null;
                                    }
                                } catch (XmlPullParserException e5) {
                                    e = e5;
                                    aVar2 = aVar4;
                                } catch (Exception e6) {
                                    e = e6;
                                    aVar = aVar4;
                                }
                            }
                            str2 = str4;
                            byteArrayInputStream = byteArrayInputStream2;
                            eventType = newPullParser.next();
                            byteArrayInputStream2 = byteArrayInputStream;
                            str4 = str2;
                            str5 = null;
                        }
                        byteArrayInputStream2.close();
                        return aVar4;
                    } catch (XmlPullParserException e7) {
                        e = e7;
                        aVar2 = null;
                    } catch (Exception e8) {
                        e = e8;
                        aVar = null;
                    }
                }
            } catch (Exception e9) {
                Log.d("VersionManager", "parseAppDetails e" + e9);
                e9.printStackTrace();
                return null;
            }
        }
        return null;
    }

    private ArrayList<a> p(String str) {
        ByteArrayInputStream byteArrayInputStream;
        String str2;
        boolean z2;
        String replace;
        ArrayList<a> arrayList = new ArrayList<>();
        ArrayList<a> arrayList2 = new ArrayList<>();
        File file = new File(str);
        if (file.exists()) {
            String str3 = "";
            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;
                    }
                    str3 = str3 + readLine;
                }
                inputStreamReader.close();
            } catch (Exception e2) {
                Log.d("VersionManager", "e=" + e2);
            }
            this.E.getPackageManager();
            if (str3 != null) {
                try {
                    if (!"".equals(str3.trim())) {
                        ByteArrayInputStream byteArrayInputStream2 = new ByteArrayInputStream(str3.getBytes());
                        XmlPullParser newPullParser = Xml.newPullParser();
                        try {
                            newPullParser.setInput(byteArrayInputStream2, "UTF-8");
                            int eventType = newPullParser.getEventType();
                            while (eventType != 1) {
                                if (eventType != 0 && eventType == 2 && "glist".equalsIgnoreCase(newPullParser.getName())) {
                                    String attributeValue = newPullParser.getAttributeValue(null, "gid");
                                    String attributeValue2 = newPullParser.getAttributeValue(null, "gver");
                                    String attributeValue3 = newPullParser.getAttributeValue(null, "gname");
                                    String attributeValue4 = newPullParser.getAttributeValue(null, "glib");
                                    String attributeValue5 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_SAVEPATH);
                                    String attributeValue6 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GPATH);
                                    String attributeValue7 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GTYPE);
                                    String attributeValue8 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PATCH);
                                    newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GSIZE);
                                    String attributeValue9 = newPullParser.getAttributeValue(null, "omd5");
                                    String attributeValue10 = newPullParser.getAttributeValue(null, "dmd5");
                                    String attributeValue11 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_DSTATUS);
                                    String attributeValue12 = newPullParser.getAttributeValue(null, "flag");
                                    String attributeValue13 = newPullParser.getAttributeValue(null, "gtime");
                                    newPullParser.getAttributeValue(null, "gsid");
                                    byteArrayInputStream = byteArrayInputStream2;
                                    String attributeValue14 = newPullParser.getAttributeValue(null, "gfup");
                                    ArrayList<a> arrayList3 = arrayList;
                                    try {
                                        String attributeValue15 = newPullParser.getAttributeValue(null, "ntftitle");
                                        String attributeValue16 = newPullParser.getAttributeValue(null, "ntfmsg");
                                        String attributeValue17 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PPATH);
                                        String attributeValue18 = newPullParser.getAttributeValue(null, "gcid");
                                        if (attributeValue14 != null) {
                                            if (attributeValue14.length() == 0) {
                                            }
                                            String str4 = attributeValue14;
                                            int parseInt = attributeValue12 == null ? Integer.parseInt(attributeValue12) : 259;
                                            String substring = str.substring(0, str.lastIndexOf("/"));
                                            String str5 = substring + "/" + attributeValue4 + ".cfg";
                                            if (attributeValue5 != null || attributeValue5.length() == 0) {
                                                attributeValue5 = substring.substring(0, substring.lastIndexOf("/")) + "/jar/" + attributeValue4 + ".jar";
                                            }
                                            if (attributeValue5 != null || new File(attributeValue5).exists()) {
                                                str2 = attributeValue5;
                                            } else if (attributeValue5.contains("/ready/")) {
                                                replace = attributeValue5.replace("/ready/", "/");
                                            } else {
                                                replace = attributeValue5.replace("/jar/", "/ready/jar/");
                                                if (!new File(replace).exists()) {
                                                    str2 = replace;
                                                    z2 = true;
                                                    if (z2) {
                                                        arrayList = arrayList3;
                                                    } else {
                                                        if (attributeValue11 != null && (attributeValue11.equals(String.valueOf(1)) || attributeValue11.equals(String.valueOf(5)))) {
                                                            if (attributeValue17 != null && !attributeValue17.startsWith(HttpHost.DEFAULT_SCHEME_NAME)) {
                                                                a(attributeValue, 3, (String) null);
                                                                attributeValue11 = "3";
                                                            }
                                                            a(attributeValue, 0, (String) null);
                                                            attributeValue11 = "1";
                                                        }
                                                        if (attributeValue11 != null) {
                                                            if (Integer.parseInt(attributeValue11) != 5 && Integer.parseInt(attributeValue11) != 1) {
                                                            }
                                                            String str6 = attributeValue11;
                                                            int parseInt2 = attributeValue7 == null ? Integer.parseInt(attributeValue7) : 0;
                                                            int parseInt3 = attributeValue18 == null ? Integer.parseInt(attributeValue18) : 1;
                                                            String attributeValue19 = newPullParser.getAttributeValue(null, "gnet");
                                                            int parseInt4 = attributeValue19 == null ? Integer.parseInt(attributeValue19) : 1;
                                                            boolean z3 = attributeValue8 == null && "1".equals(attributeValue8);
                                                            if (attributeValue17 != null && attributeValue17.toLowerCase().startsWith(HttpHost.DEFAULT_SCHEME_NAME)) {
                                                                String substring2 = str.substring(0, str.lastIndexOf("/"));
                                                                attributeValue17 = substring2.substring(0, substring2.lastIndexOf("/") + 1) + "icon/" + attributeValue4 + ".png";
                                                            }
                                                            if (attributeValue17 != null) {
                                                                new File(attributeValue17).exists();
                                                            }
                                                            a aVar = new a(attributeValue, attributeValue4, attributeValue3, attributeValue6, parseInt2, parseInt4, str2, str5, 0L, attributeValue2, "1", str4, attributeValue17, parseInt3, z3, attributeValue9, "", attributeValue10, false, parseInt, attributeValue15, attributeValue16);
                                                            aVar.c(Integer.parseInt(attributeValue13));
                                                            aVar.a(Integer.parseInt(str6));
                                                            arrayList = arrayList3;
                                                            arrayList.add(aVar);
                                                        }
                                                        attributeValue11 = "1";
                                                        String str62 = attributeValue11;
                                                        if (attributeValue7 == null) {
                                                        }
                                                        if (attributeValue18 == null) {
                                                        }
                                                        String attributeValue192 = newPullParser.getAttributeValue(null, "gnet");
                                                        if (attributeValue192 == null) {
                                                        }
                                                        if (attributeValue8 == null) {
                                                        }
                                                        if (attributeValue17 != null) {
                                                            String substring22 = str.substring(0, str.lastIndexOf("/"));
                                                            attributeValue17 = substring22.substring(0, substring22.lastIndexOf("/") + 1) + "icon/" + attributeValue4 + ".png";
                                                        }
                                                        if (attributeValue17 != null) {
                                                        }
                                                        a aVar2 = new a(attributeValue, attributeValue4, attributeValue3, attributeValue6, parseInt2, parseInt4, str2, str5, 0L, attributeValue2, "1", str4, attributeValue17, parseInt3, z3, attributeValue9, "", attributeValue10, false, parseInt, attributeValue15, attributeValue16);
                                                        aVar2.c(Integer.parseInt(attributeValue13));
                                                        aVar2.a(Integer.parseInt(str62));
                                                        arrayList = arrayList3;
                                                        arrayList.add(aVar2);
                                                    }
                                                }
                                                str2 = replace;
                                            }
                                            z2 = false;
                                            if (z2) {
                                            }
                                        }
                                        attributeValue14 = "0";
                                        String str42 = attributeValue14;
                                        if (attributeValue12 == null) {
                                        }
                                        String substring3 = str.substring(0, str.lastIndexOf("/"));
                                        String str52 = substring3 + "/" + attributeValue4 + ".cfg";
                                        if (attributeValue5 != null) {
                                        }
                                        attributeValue5 = substring3.substring(0, substring3.lastIndexOf("/")) + "/jar/" + attributeValue4 + ".jar";
                                        if (attributeValue5 != null) {
                                        }
                                        str2 = attributeValue5;
                                        z2 = false;
                                        if (z2) {
                                        }
                                    } catch (XmlPullParserException e3) {
                                        e = e3;
                                        arrayList = arrayList3;
                                        e.printStackTrace();
                                        Log.d("VersionManager", "parseDownloadedAppListConfig appList size = " + arrayList.size());
                                        return arrayList;
                                    } catch (Exception e4) {
                                        e = e4;
                                        arrayList = arrayList3;
                                        e.printStackTrace();
                                        Log.d("VersionManager", "parseDownloadedAppListConfig appList size = " + arrayList.size());
                                        return arrayList;
                                    }
                                } else {
                                    byteArrayInputStream = byteArrayInputStream2;
                                }
                                eventType = newPullParser.next();
                                byteArrayInputStream2 = byteArrayInputStream;
                            }
                            byteArrayInputStream2.close();
                        } catch (XmlPullParserException e5) {
                            e = e5;
                        } catch (Exception e6) {
                            e = e6;
                        }
                    }
                } catch (Exception e7) {
                    Log.d("VersionManager", "parseDownloadedAppListConfig e" + e7);
                    e7.printStackTrace();
                    return arrayList;
                }
            }
            return arrayList2;
        }
        Log.d("VersionManager", "parseDownloadedAppListConfig appList size = " + arrayList.size());
        return arrayList;
    }

    private ArrayList<a> q(String str) {
        ByteArrayInputStream byteArrayInputStream;
        boolean z2;
        String str2;
        ArrayList<a> arrayList = new ArrayList<>();
        ArrayList<a> arrayList2 = new ArrayList<>();
        File file = new File(str);
        if (file.exists()) {
            String str3 = "";
            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;
                    }
                    str3 = str3 + readLine;
                }
                inputStreamReader.close();
            } catch (Exception e2) {
                Log.d("VersionManager", "e=" + e2);
            }
            this.E.getPackageManager();
            if (str3 != null) {
                try {
                    if (!"".equals(str3.trim())) {
                        ByteArrayInputStream byteArrayInputStream2 = new ByteArrayInputStream(str3.getBytes());
                        XmlPullParser newPullParser = Xml.newPullParser();
                        try {
                            newPullParser.setInput(byteArrayInputStream2, "UTF-8");
                            int eventType = newPullParser.getEventType();
                            while (eventType != 1) {
                                if (eventType != 0 && eventType == 2 && "glist".equalsIgnoreCase(newPullParser.getName())) {
                                    String attributeValue = newPullParser.getAttributeValue(null, "gid");
                                    String attributeValue2 = newPullParser.getAttributeValue(null, "gver");
                                    String attributeValue3 = newPullParser.getAttributeValue(null, "gname");
                                    String attributeValue4 = newPullParser.getAttributeValue(null, "glib");
                                    String attributeValue5 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_SAVEPATH);
                                    String attributeValue6 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GPATH);
                                    String attributeValue7 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GTYPE);
                                    String attributeValue8 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PATCH);
                                    newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GSIZE);
                                    String attributeValue9 = newPullParser.getAttributeValue(null, "omd5");
                                    String attributeValue10 = newPullParser.getAttributeValue(null, "dmd5");
                                    String attributeValue11 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_DSTATUS);
                                    String attributeValue12 = newPullParser.getAttributeValue(null, "flag");
                                    byteArrayInputStream = byteArrayInputStream2;
                                    String attributeValue13 = newPullParser.getAttributeValue(null, "gtime");
                                    ArrayList<a> arrayList3 = arrayList;
                                    try {
                                        newPullParser.getAttributeValue(null, "gsid");
                                        String attributeValue14 = newPullParser.getAttributeValue(null, "gfup");
                                        String attributeValue15 = newPullParser.getAttributeValue(null, "ntftitle");
                                        String attributeValue16 = newPullParser.getAttributeValue(null, "ntfmsg");
                                        if (attributeValue14 != null) {
                                            if (attributeValue14.length() == 0) {
                                            }
                                            String str4 = attributeValue14;
                                            int parseInt = attributeValue12 == null ? Integer.parseInt(attributeValue12) : 259;
                                            if (attributeValue11 != null && (attributeValue11.equals(String.valueOf(1)) || attributeValue11.equals(String.valueOf(5)))) {
                                                z2 = true;
                                                String substring = str.substring(0, str.lastIndexOf("/"));
                                                String str5 = substring + "/" + attributeValue4 + ".cfg";
                                                if (attributeValue5 != null && attributeValue5.length() != 0) {
                                                    str2 = attributeValue5;
                                                    if (attributeValue5 == null && new File(attributeValue5).exists()) {
                                                        j b2 = b(str5);
                                                        if (b2 != null && b2.i.equals(attributeValue2)) {
                                                            z2 = true;
                                                        }
                                                        if (z2) {
                                                        }
                                                    } else if (attributeValue5.contains("/ready/")) {
                                                        if (new File(attributeValue5.replace("/jar/", "/ready/jar/")).exists()) {
                                                            z2 = true;
                                                        }
                                                        if (z2) {
                                                            if (attributeValue11 == null) {
                                                                attributeValue11 = "3";
                                                            }
                                                            String str6 = attributeValue11;
                                                            int parseInt2 = attributeValue7 != null ? Integer.parseInt(attributeValue7) : 0;
                                                            String attributeValue17 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PPATH);
                                                            String attributeValue18 = newPullParser.getAttributeValue(null, "gcid");
                                                            int parseInt3 = attributeValue18 != null ? Integer.parseInt(attributeValue18) : 1;
                                                            String attributeValue19 = newPullParser.getAttributeValue(null, "gnet");
                                                            int parseInt4 = attributeValue19 != null ? Integer.parseInt(attributeValue19) : 1;
                                                            boolean z3 = attributeValue8 != null && "1".equals(attributeValue8);
                                                            if (attributeValue17 != null) {
                                                                attributeValue17.toLowerCase().startsWith(HttpHost.DEFAULT_SCHEME_NAME);
                                                            }
                                                            a aVar = new a(attributeValue, attributeValue4, attributeValue3, attributeValue6, parseInt2, parseInt4, str2, str5, 0L, attributeValue2, "1", str4, attributeValue17, parseInt3, z3, attributeValue9, "", attributeValue10, false, parseInt, attributeValue15, attributeValue16);
                                                            aVar.c(Integer.parseInt(attributeValue13));
                                                            aVar.a(Integer.parseInt(str6));
                                                            arrayList = arrayList3;
                                                            arrayList.add(aVar);
                                                        } else {
                                                            arrayList = arrayList3;
                                                        }
                                                    }
                                                }
                                                attributeValue5 = substring.substring(0, substring.lastIndexOf("/")) + "/jar/" + attributeValue4 + ".jar";
                                                str2 = attributeValue5 + ".dload";
                                                if (attributeValue5 == null) {
                                                }
                                                if (attributeValue5.contains("/ready/")) {
                                                }
                                            }
                                            z2 = false;
                                            String substring2 = str.substring(0, str.lastIndexOf("/"));
                                            String str52 = substring2 + "/" + attributeValue4 + ".cfg";
                                            if (attributeValue5 != null) {
                                                str2 = attributeValue5;
                                                if (attributeValue5 == null) {
                                                }
                                                if (attributeValue5.contains("/ready/")) {
                                                }
                                            }
                                            attributeValue5 = substring2.substring(0, substring2.lastIndexOf("/")) + "/jar/" + attributeValue4 + ".jar";
                                            str2 = attributeValue5 + ".dload";
                                            if (attributeValue5 == null) {
                                            }
                                            if (attributeValue5.contains("/ready/")) {
                                            }
                                        }
                                        attributeValue14 = "0";
                                        String str42 = attributeValue14;
                                        if (attributeValue12 == null) {
                                        }
                                        if (attributeValue11 != null) {
                                            z2 = true;
                                            String substring22 = str.substring(0, str.lastIndexOf("/"));
                                            String str522 = substring22 + "/" + attributeValue4 + ".cfg";
                                            if (attributeValue5 != null) {
                                            }
                                            attributeValue5 = substring22.substring(0, substring22.lastIndexOf("/")) + "/jar/" + attributeValue4 + ".jar";
                                            str2 = attributeValue5 + ".dload";
                                            if (attributeValue5 == null) {
                                            }
                                            if (attributeValue5.contains("/ready/")) {
                                            }
                                        }
                                        z2 = false;
                                        String substring222 = str.substring(0, str.lastIndexOf("/"));
                                        String str5222 = substring222 + "/" + attributeValue4 + ".cfg";
                                        if (attributeValue5 != null) {
                                        }
                                        attributeValue5 = substring222.substring(0, substring222.lastIndexOf("/")) + "/jar/" + attributeValue4 + ".jar";
                                        str2 = attributeValue5 + ".dload";
                                        if (attributeValue5 == null) {
                                        }
                                        if (attributeValue5.contains("/ready/")) {
                                        }
                                    } catch (XmlPullParserException e3) {
                                        e = e3;
                                        arrayList = arrayList3;
                                        e.printStackTrace();
                                        Log.d("VersionManager", "parseDownloadableApps appList size = " + arrayList.size());
                                        return arrayList;
                                    } catch (Exception e4) {
                                        e = e4;
                                        arrayList = arrayList3;
                                        e.printStackTrace();
                                        Log.d("VersionManager", "parseDownloadableApps appList size = " + arrayList.size());
                                        return arrayList;
                                    }
                                } else {
                                    byteArrayInputStream = byteArrayInputStream2;
                                }
                                eventType = newPullParser.next();
                                byteArrayInputStream2 = byteArrayInputStream;
                            }
                            byteArrayInputStream2.close();
                        } catch (XmlPullParserException e5) {
                            e = e5;
                        } catch (Exception e6) {
                            e = e6;
                        }
                    }
                } catch (Exception e7) {
                    Log.d("VersionManager", "parseDownloadableApps e" + e7);
                    e7.printStackTrace();
                    return arrayList;
                }
            }
            return arrayList2;
        }
        Log.d("VersionManager", "parseDownloadableApps appList size = " + arrayList.size());
        return arrayList;
    }

    private List<a> e(int i2) {
        Log.d("VersionManager", "queryServerList entered");
        ArrayList arrayList = new ArrayList();
        Iterator<j> it = a(i2).iterator();
        while (it.hasNext()) {
            arrayList.add(c(it.next()));
        }
        return arrayList;
    }

    private void b(File file) {
        if (file.isFile()) {
            file.delete();
            return;
        }
        for (File file2 : file.listFiles()) {
            b(file2);
        }
        file.delete();
    }

    private a c(j jVar) {
        if (jVar == null) {
            return null;
        }
        return new a(jVar.f12504a, jVar.f12505b, jVar.c, jVar.d, jVar.e, jVar.f, jVar.g, jVar.n, jVar.h, jVar.i, jVar.j, jVar.k, jVar.l, jVar.m, jVar.p, jVar.q, jVar.r, jVar.s, jVar.t, jVar.w, jVar.u, jVar.v);
    }

    private Map<String, Object> b(a aVar) {
        HashMap hashMap = new HashMap();
        hashMap.put("type", Integer.valueOf(aVar.f2385a));
        hashMap.put("gameId", aVar.f2386b);
        hashMap.put("gameLib", aVar.c);
        hashMap.put("gameName", aVar.d);
        hashMap.put(SocialConstants.PARAM_URL, aVar.e);
        hashMap.put("gameType", Integer.valueOf(aVar.f));
        hashMap.put("nettype", Integer.valueOf(aVar.g));
        hashMap.put("savePath", aVar.h);
        hashMap.put(RankingItem.KEY_SIZE, Long.valueOf(aVar.i));
        hashMap.put(ClientCookie.VERSION_ATTR, aVar.j);
        hashMap.put("level", aVar.k);
        hashMap.put(RankingItem.KEY_FORCEUPDATE, aVar.l);
        hashMap.put(RankingItem.KEY_ICON, aVar.m);
        hashMap.put("cid", Integer.valueOf(aVar.n));
        hashMap.put("cfgPath", aVar.o);
        hashMap.put("downloadType", Integer.valueOf(aVar.p));
        hashMap.put(ExcellianceAppInfo.KEY_PATCH, Boolean.valueOf(aVar.q));
        hashMap.put("omd5", aVar.r);
        hashMap.put("nmd5", aVar.s);
        hashMap.put("dmd5", aVar.t);
        hashMap.put("autodl", Boolean.valueOf(aVar.u));
        hashMap.put("notifyTitle", aVar.v);
        hashMap.put("notifyMsg", aVar.w);
        hashMap.put("flag", Integer.valueOf(aVar.x));
        hashMap.put("downloadStatus", Integer.valueOf(aVar.y));
        hashMap.put("downloadProress", Integer.valueOf(aVar.z));
        hashMap.put("sortId", Integer.valueOf(aVar.A));
        hashMap.put("gameTime", Integer.valueOf(aVar.B));
        return hashMap;
    }

    public List<y> a(boolean z2) {
        return a(z2, 0);
    }

    public List<y> a(boolean z2, int i2) {
        return com.excelliance.kxqp.repository.a.a(this.E).d();
    }

    public List<y> m() {
        return b(false);
    }

    public List<y> b(boolean z2) {
        ArrayList arrayList = new ArrayList();
        String i2 = i(j() + "game_res/3rd/config/upgrade_list.config");
        return (i2 == null || i2.length() == 0) ? arrayList : a(z2, i2);
    }

    public List<y> a(boolean z2, String str) {
        ArrayList arrayList;
        XmlPullParserException xmlPullParserException;
        IOException iOException;
        ArrayList arrayList2;
        String attributeValue;
        XmlPullParser xmlPullParser;
        String str2;
        List<y> list;
        String str3;
        String str4;
        String str5;
        boolean i2;
        boolean z3;
        String str6;
        String str7;
        String str8;
        ArrayList arrayList3 = new ArrayList();
        String str9 = j() + "game_res/3rd/config/upgrade_list.config";
        String i3 = str == null ? i(str9) : str;
        if (i3 == null || i3.length() == 0) {
            return arrayList3;
        }
        List<y> a2 = a(false);
        if (i3 == null || "".equals(i3.trim())) {
            return arrayList3;
        }
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(i3.getBytes());
        XmlPullParser newPullParser = Xml.newPullParser();
        try {
            newPullParser.setInput(byteArrayInputStream, "UTF-8");
            int eventType = newPullParser.getEventType();
            while (eventType != 1) {
                switch (eventType) {
                    case 2:
                        if ("glist".equalsIgnoreCase(newPullParser.getName())) {
                            String attributeValue2 = newPullParser.getAttributeValue(null, "gid");
                            String attributeValue3 = newPullParser.getAttributeValue(null, "glib");
                            String attributeValue4 = newPullParser.getAttributeValue(null, "gname");
                            String attributeValue5 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GPATH);
                            if (attributeValue5 != null) {
                                attributeValue5 = attributeValue5.replaceAll("&amp;", com.alipay.sdk.sys.a.f472b);
                            }
                            String str10 = attributeValue5;
                            String attributeValue6 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GTYPE);
                            if (attributeValue6 == null || attributeValue6.length() == 0 || "0".equals(attributeValue6)) {
                                attributeValue6 = "1";
                            }
                            String str11 = attributeValue6;
                            try {
                                for (int i4 = 0; i4 < a2.size(); i4++) {
                                    y yVar = a2.get(i4);
                                    if (yVar.f12504a.equals(attributeValue2) || yVar.f12505b.equals(attributeValue3)) {
                                        str11 = String.valueOf(yVar.e);
                                        if (!"2".equals(str11) && !"4".equals(str11)) {
                                        }
                                        if (z2 || !"1".equals(str11)) {
                                            String attributeValue7 = newPullParser.getAttributeValue(null, "gnet");
                                            String attributeValue8 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GSIZE);
                                            String attributeValue9 = newPullParser.getAttributeValue(null, "gver");
                                            String attributeValue10 = newPullParser.getAttributeValue(null, "gvername");
                                            String attributeValue11 = newPullParser.getAttributeValue(null, "gcate");
                                            arrayList2 = arrayList3;
                                            String attributeValue12 = newPullParser.getAttributeValue(null, "glvl");
                                            String attributeValue13 = newPullParser.getAttributeValue(null, "gfup");
                                            String attributeValue14 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_SAVEPATH);
                                            String attributeValue15 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PPATH);
                                            String attributeValue16 = newPullParser.getAttributeValue(null, "gcid");
                                            String attributeValue17 = newPullParser.getAttributeValue(null, "omd5");
                                            String attributeValue18 = newPullParser.getAttributeValue(null, "nmd5");
                                            String attributeValue19 = newPullParser.getAttributeValue(null, "dmd5");
                                            String attributeValue20 = newPullParser.getAttributeValue(null, "notifytitle");
                                            String attributeValue21 = newPullParser.getAttributeValue(null, "notifymsg");
                                            String attributeValue22 = newPullParser.getAttributeValue(null, "flag");
                                            attributeValue = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_DSTATUS);
                                            if (attributeValue != null) {
                                                try {
                                                    break;
                                                } catch (IOException e2) {
                                                    iOException = e2;
                                                    arrayList = arrayList2;
                                                    iOException.printStackTrace();
                                                    return arrayList;
                                                } catch (XmlPullParserException e3) {
                                                    xmlPullParserException = e3;
                                                    arrayList = arrayList2;
                                                    xmlPullParserException.printStackTrace();
                                                    return arrayList;
                                                }
                                            }
                                            attributeValue = "0";
                                            String str12 = attributeValue;
                                            String attributeValue23 = newPullParser.getAttributeValue(null, "gsid");
                                            String attributeValue24 = newPullParser.getAttributeValue(null, "gtime");
                                            String attributeValue25 = newPullParser.getAttributeValue(null, "dtimes");
                                            String attributeValue26 = newPullParser.getAttributeValue(null, "tm");
                                            "zh".equals(GameJNI.d());
                                            if (attributeValue2 == null) {
                                                j jVar = v().get(attributeValue2);
                                                if (jVar != null) {
                                                    xmlPullParser = newPullParser;
                                                    StringBuilder sb = new StringBuilder();
                                                    str2 = attributeValue16;
                                                    sb.append("savePath=");
                                                    sb.append(attributeValue14);
                                                    sb.append(", partial.savePath=");
                                                    sb.append(jVar.g);
                                                    Log.d("VersionManager", sb.toString());
                                                } else {
                                                    xmlPullParser = newPullParser;
                                                    str2 = attributeValue16;
                                                }
                                                if (jVar != null && new File(jVar.g).exists()) {
                                                    if (jVar.s != null && jVar.s.length() > 0 && attributeValue19 != null && attributeValue19.length() > 0 && !jVar.s.equals(attributeValue19)) {
                                                        new File(jVar.n).delete();
                                                        new File(jVar.g).delete();
                                                    } else {
                                                        File file = new File(jVar.g);
                                                        str5 = attributeValue19;
                                                        long a3 = GameUtil.a(file.getParentFile());
                                                        str3 = attributeValue7;
                                                        long length = file.length();
                                                        if (Long.parseLong(attributeValue8) < a3 + length) {
                                                            str4 = attributeValue2;
                                                            StringBuilder sb2 = new StringBuilder();
                                                            list = a2;
                                                            sb2.append("left=");
                                                            sb2.append(a3);
                                                            sb2.append(", downloaded=");
                                                            sb2.append(length);
                                                            sb2.append(", size=");
                                                            sb2.append(attributeValue8);
                                                            Log.d("VersionManager", sb2.toString());
                                                            jVar.g.indexOf("game_res/");
                                                        } else {
                                                            list = a2;
                                                            str4 = attributeValue2;
                                                        }
                                                        if (attributeValue14 != null) {
                                                            try {
                                                                this.E.getPackageManager();
                                                                i2 = as.i(this.E, attributeValue3);
                                                            } catch (Exception unused) {
                                                            }
                                                            if (("2".equals(str11) || "4".equals(str11)) && !i2 && !new File(attributeValue14).exists()) {
                                                                a(attributeValue3, 1, 0, (String) null);
                                                                z3 = true;
                                                                if (attributeValue14 != null && attributeValue14.length() != 0) {
                                                                    if (!attributeValue14.endsWith(".dload")) {
                                                                        attributeValue14 = attributeValue14 + ".dload";
                                                                    }
                                                                    if (attributeValue14.indexOf("/" + ".jar".substring(1) + "/") < 0) {
                                                                        StringBuilder sb3 = new StringBuilder();
                                                                        sb3.append(attributeValue14.substring(0, attributeValue14.indexOf("/" + ".jar".substring(1) + "/")));
                                                                        sb3.append("/downloading/");
                                                                        sb3.append(attributeValue3);
                                                                        sb3.append(".cfg");
                                                                        str6 = sb3.toString();
                                                                    } else {
                                                                        str6 = str9.substring(0, str9.indexOf("/config/")) + "/downloading/" + attributeValue3 + ".cfg";
                                                                    }
                                                                    String str13 = attributeValue14;
                                                                    String str14 = str6;
                                                                    if (attributeValue15 == null) {
                                                                        int i5 = 0;
                                                                        while (i5 < list.size()) {
                                                                            a2 = list;
                                                                            y yVar2 = a2.get(i5);
                                                                            str7 = str4;
                                                                            if (yVar2.f12504a.equals(str7)) {
                                                                                str8 = yVar2.l;
                                                                                if (str8 != null && str8.length() != 0) {
                                                                                    str8.toLowerCase().startsWith(HttpHost.DEFAULT_SCHEME_NAME);
                                                                                }
                                                                                y yVar3 = new y(str7, attributeValue3, attributeValue4, str10, Integer.parseInt(str11), Integer.parseInt(str3), str13, str14, Long.parseLong(attributeValue8), attributeValue9, attributeValue12, attributeValue13, str8, Integer.parseInt(str2), false, attributeValue17, attributeValue18, str5, false, Integer.parseInt(attributeValue22), attributeValue20, attributeValue21);
                                                                                yVar3.y = Integer.parseInt(attributeValue23);
                                                                                yVar3.z = Integer.parseInt(attributeValue24);
                                                                                yVar3.X = attributeValue10;
                                                                                yVar3.Y = attributeValue11;
                                                                                yVar3.x = Integer.parseInt(str12);
                                                                                yVar3.Z = Integer.parseInt(attributeValue25);
                                                                                yVar3.A = attributeValue26;
                                                                                if (z3 && yVar3.m == 1) {
                                                                                    arrayList = arrayList2;
                                                                                    try {
                                                                                        arrayList.add(yVar3);
                                                                                    } catch (IOException e4) {
                                                                                        e = e4;
                                                                                        iOException = e;
                                                                                        iOException.printStackTrace();
                                                                                        return arrayList;
                                                                                    } catch (XmlPullParserException e5) {
                                                                                        e = e5;
                                                                                        xmlPullParserException = e;
                                                                                        xmlPullParserException.printStackTrace();
                                                                                        return arrayList;
                                                                                    }
                                                                                } else {
                                                                                    arrayList = arrayList2;
                                                                                }
                                                                            } else {
                                                                                i5++;
                                                                                list = a2;
                                                                                str4 = str7;
                                                                            }
                                                                        }
                                                                    }
                                                                    str7 = str4;
                                                                    a2 = list;
                                                                    str8 = attributeValue15;
                                                                    if (str8 != null) {
                                                                        str8.toLowerCase().startsWith(HttpHost.DEFAULT_SCHEME_NAME);
                                                                    }
                                                                    y yVar32 = new y(str7, attributeValue3, attributeValue4, str10, Integer.parseInt(str11), Integer.parseInt(str3), str13, str14, Long.parseLong(attributeValue8), attributeValue9, attributeValue12, attributeValue13, str8, Integer.parseInt(str2), false, attributeValue17, attributeValue18, str5, false, Integer.parseInt(attributeValue22), attributeValue20, attributeValue21);
                                                                    yVar32.y = Integer.parseInt(attributeValue23);
                                                                    yVar32.z = Integer.parseInt(attributeValue24);
                                                                    yVar32.X = attributeValue10;
                                                                    yVar32.Y = attributeValue11;
                                                                    yVar32.x = Integer.parseInt(str12);
                                                                    yVar32.Z = Integer.parseInt(attributeValue25);
                                                                    yVar32.A = attributeValue26;
                                                                    if (z3) {
                                                                    }
                                                                    arrayList = arrayList2;
                                                                }
                                                                String h2 = h();
                                                                str6 = h2 + "game_res/3rd/downloading/" + attributeValue3 + ".cfg";
                                                                attributeValue14 = h2 + "game_res/3rd/upgrade/jar/" + (attributeValue3 + ".jar.dload");
                                                                String str132 = attributeValue14;
                                                                String str142 = str6;
                                                                if (attributeValue15 == null) {
                                                                }
                                                                str7 = str4;
                                                                a2 = list;
                                                                str8 = attributeValue15;
                                                                if (str8 != null) {
                                                                }
                                                                y yVar322 = new y(str7, attributeValue3, attributeValue4, str10, Integer.parseInt(str11), Integer.parseInt(str3), str132, str142, Long.parseLong(attributeValue8), attributeValue9, attributeValue12, attributeValue13, str8, Integer.parseInt(str2), false, attributeValue17, attributeValue18, str5, false, Integer.parseInt(attributeValue22), attributeValue20, attributeValue21);
                                                                yVar322.y = Integer.parseInt(attributeValue23);
                                                                yVar322.z = Integer.parseInt(attributeValue24);
                                                                yVar322.X = attributeValue10;
                                                                yVar322.Y = attributeValue11;
                                                                yVar322.x = Integer.parseInt(str12);
                                                                yVar322.Z = Integer.parseInt(attributeValue25);
                                                                yVar322.A = attributeValue26;
                                                                if (z3) {
                                                                }
                                                                arrayList = arrayList2;
                                                            }
                                                        }
                                                        z3 = false;
                                                        if (attributeValue14 != null) {
                                                            if (!attributeValue14.endsWith(".dload")) {
                                                            }
                                                            if (attributeValue14.indexOf("/" + ".jar".substring(1) + "/") < 0) {
                                                            }
                                                            String str1322 = attributeValue14;
                                                            String str1422 = str6;
                                                            if (attributeValue15 == null) {
                                                            }
                                                            str7 = str4;
                                                            a2 = list;
                                                            str8 = attributeValue15;
                                                            if (str8 != null) {
                                                            }
                                                            y yVar3222 = new y(str7, attributeValue3, attributeValue4, str10, Integer.parseInt(str11), Integer.parseInt(str3), str1322, str1422, Long.parseLong(attributeValue8), attributeValue9, attributeValue12, attributeValue13, str8, Integer.parseInt(str2), false, attributeValue17, attributeValue18, str5, false, Integer.parseInt(attributeValue22), attributeValue20, attributeValue21);
                                                            yVar3222.y = Integer.parseInt(attributeValue23);
                                                            yVar3222.z = Integer.parseInt(attributeValue24);
                                                            yVar3222.X = attributeValue10;
                                                            yVar3222.Y = attributeValue11;
                                                            yVar3222.x = Integer.parseInt(str12);
                                                            yVar3222.Z = Integer.parseInt(attributeValue25);
                                                            yVar3222.A = attributeValue26;
                                                            if (z3) {
                                                            }
                                                            arrayList = arrayList2;
                                                        }
                                                        String h22 = h();
                                                        str6 = h22 + "game_res/3rd/downloading/" + attributeValue3 + ".cfg";
                                                        attributeValue14 = h22 + "game_res/3rd/upgrade/jar/" + (attributeValue3 + ".jar.dload");
                                                        String str13222 = attributeValue14;
                                                        String str14222 = str6;
                                                        if (attributeValue15 == null) {
                                                        }
                                                        str7 = str4;
                                                        a2 = list;
                                                        str8 = attributeValue15;
                                                        if (str8 != null) {
                                                        }
                                                        y yVar32222 = new y(str7, attributeValue3, attributeValue4, str10, Integer.parseInt(str11), Integer.parseInt(str3), str13222, str14222, Long.parseLong(attributeValue8), attributeValue9, attributeValue12, attributeValue13, str8, Integer.parseInt(str2), false, attributeValue17, attributeValue18, str5, false, Integer.parseInt(attributeValue22), attributeValue20, attributeValue21);
                                                        yVar32222.y = Integer.parseInt(attributeValue23);
                                                        yVar32222.z = Integer.parseInt(attributeValue24);
                                                        yVar32222.X = attributeValue10;
                                                        yVar32222.Y = attributeValue11;
                                                        yVar32222.x = Integer.parseInt(str12);
                                                        yVar32222.Z = Integer.parseInt(attributeValue25);
                                                        yVar32222.A = attributeValue26;
                                                        if (z3) {
                                                        }
                                                        arrayList = arrayList2;
                                                    }
                                                }
                                                list = a2;
                                                str3 = attributeValue7;
                                                str4 = attributeValue2;
                                                str5 = attributeValue19;
                                                if (attributeValue14 != null) {
                                                }
                                                z3 = false;
                                                if (attributeValue14 != null) {
                                                }
                                                String h222 = h();
                                                str6 = h222 + "game_res/3rd/downloading/" + attributeValue3 + ".cfg";
                                                attributeValue14 = h222 + "game_res/3rd/upgrade/jar/" + (attributeValue3 + ".jar.dload");
                                                String str132222 = attributeValue14;
                                                String str142222 = str6;
                                                if (attributeValue15 == null) {
                                                }
                                                str7 = str4;
                                                a2 = list;
                                                str8 = attributeValue15;
                                                if (str8 != null) {
                                                }
                                                y yVar322222 = new y(str7, attributeValue3, attributeValue4, str10, Integer.parseInt(str11), Integer.parseInt(str3), str132222, str142222, Long.parseLong(attributeValue8), attributeValue9, attributeValue12, attributeValue13, str8, Integer.parseInt(str2), false, attributeValue17, attributeValue18, str5, false, Integer.parseInt(attributeValue22), attributeValue20, attributeValue21);
                                                yVar322222.y = Integer.parseInt(attributeValue23);
                                                yVar322222.z = Integer.parseInt(attributeValue24);
                                                yVar322222.X = attributeValue10;
                                                yVar322222.Y = attributeValue11;
                                                yVar322222.x = Integer.parseInt(str12);
                                                yVar322222.Z = Integer.parseInt(attributeValue25);
                                                yVar322222.A = attributeValue26;
                                                if (z3) {
                                                }
                                                arrayList = arrayList2;
                                            } else {
                                                xmlPullParser = newPullParser;
                                                arrayList = arrayList2;
                                            }
                                            eventType = xmlPullParser.next();
                                            arrayList3 = arrayList;
                                            newPullParser = xmlPullParser;
                                        } else {
                                            xmlPullParser = newPullParser;
                                            arrayList = arrayList3;
                                            eventType = xmlPullParser.next();
                                            arrayList3 = arrayList;
                                            newPullParser = xmlPullParser;
                                        }
                                    }
                                }
                                String attributeValue122 = newPullParser.getAttributeValue(null, "glvl");
                                String attributeValue132 = newPullParser.getAttributeValue(null, "gfup");
                                String attributeValue142 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_SAVEPATH);
                                String attributeValue152 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_PPATH);
                                String attributeValue162 = newPullParser.getAttributeValue(null, "gcid");
                                String attributeValue172 = newPullParser.getAttributeValue(null, "omd5");
                                String attributeValue182 = newPullParser.getAttributeValue(null, "nmd5");
                                String attributeValue192 = newPullParser.getAttributeValue(null, "dmd5");
                                String attributeValue202 = newPullParser.getAttributeValue(null, "notifytitle");
                                String attributeValue212 = newPullParser.getAttributeValue(null, "notifymsg");
                                String attributeValue222 = newPullParser.getAttributeValue(null, "flag");
                                attributeValue = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_DSTATUS);
                                if (attributeValue != null) {
                                }
                                attributeValue = "0";
                                String str122 = attributeValue;
                                String attributeValue232 = newPullParser.getAttributeValue(null, "gsid");
                                String attributeValue242 = newPullParser.getAttributeValue(null, "gtime");
                                String attributeValue252 = newPullParser.getAttributeValue(null, "dtimes");
                                String attributeValue262 = newPullParser.getAttributeValue(null, "tm");
                                "zh".equals(GameJNI.d());
                                if (attributeValue2 == null) {
                                }
                                eventType = xmlPullParser.next();
                                arrayList3 = arrayList;
                                newPullParser = xmlPullParser;
                            } catch (IOException e6) {
                                e = e6;
                                arrayList = arrayList2;
                                iOException = e;
                                iOException.printStackTrace();
                                return arrayList;
                            } catch (XmlPullParserException e7) {
                                e = e7;
                                arrayList = arrayList2;
                                xmlPullParserException = e;
                                xmlPullParserException.printStackTrace();
                                return arrayList;
                            }
                            if (z2) {
                            }
                            String attributeValue72 = newPullParser.getAttributeValue(null, "gnet");
                            String attributeValue82 = newPullParser.getAttributeValue(null, ExcellianceAppInfo.KEY_GSIZE);
                            String attributeValue92 = newPullParser.getAttributeValue(null, "gver");
                            String attributeValue102 = newPullParser.getAttributeValue(null, "gvername");
                            String attributeValue112 = newPullParser.getAttributeValue(null, "gcate");
                            arrayList2 = arrayList3;
                        }
                        break;
                    case 0:
                    case 1:
                    case 3:
                    case 4:
                    default:
                        xmlPullParser = newPullParser;
                        arrayList = arrayList3;
                        eventType = xmlPullParser.next();
                        arrayList3 = arrayList;
                        newPullParser = xmlPullParser;
                }
            }
            return arrayList3;
        } catch (IOException e8) {
            e = e8;
            arrayList = arrayList3;
        } catch (XmlPullParserException e9) {
            e = e9;
            arrayList = arrayList3;
        }
    }

    public synchronized String i(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("VersionManager", "getUpgradeListFileContent: Exception = " + str2);
                e2.printStackTrace();
            }
        }
        if (str2.length() == 0) {
            str2 = null;
        }
        return str2;
    }

    public synchronized void a(String str, int i2, int i3, String str2) {
        String str3;
        String str4;
        String str5;
        int i4;
        String str6;
        String str7;
        int indexOf;
        int indexOf2;
        int indexOf3;
        int i5;
        int indexOf4;
        com.excelliance.user.account.f.e.a("VersionManager", "VersionManager.java/updateUpgradeAppListFile: ");
        String str8 = j() + "game_res/3rd/config/upgrade_list.config";
        String str9 = j() + "game_res/3rd/config/upgrade_list.config.tmp";
        String i6 = i(str8);
        Log.d("VersionManager", "update: action = " + i2 + ", pkgName = " + str + ", dstatus = " + i3);
        switch (i2) {
            case 0:
                if (i6 != null && i6.length() != 0) {
                    StringBuilder sb = new StringBuilder(i6);
                    int indexOf5 = sb.indexOf("</gamelist>");
                    if (indexOf5 >= 0) {
                        sb.insert(indexOf5, str2);
                        a(str8, sb.toString());
                    }
                    return;
                }
                a(str8, str2);
                return;
            case 1:
                if (i6 != null && i6.length() > 0) {
                    StringBuilder sb2 = new StringBuilder(i6);
                    int indexOf6 = sb2.indexOf("glib=\"" + str + "\"");
                    if (i3 == 5) {
                        while (indexOf6 >= 0) {
                            int indexOf7 = sb2.indexOf("dstatus=\"" + i3 + "\"", indexOf6);
                            int indexOf8 = sb2.indexOf(">", indexOf6);
                            if (indexOf7 < 0 || indexOf7 >= indexOf8) {
                                indexOf6 = sb2.indexOf("glib=\"" + str + "\"", indexOf8);
                            }
                        }
                    }
                    if (indexOf6 >= 0) {
                        int i7 = indexOf6 >= 25 ? indexOf6 - 25 : 0;
                        int i8 = -1;
                        while (true) {
                            if ((i8 < 0 || i8 > indexOf6) && i7 > 0) {
                                i8 = sb2.indexOf("<glist", i7);
                                i7 -= 25;
                            }
                        }
                        int indexOf9 = i8 >= 0 ? sb2.indexOf("/>", indexOf6) : -1;
                        if (i8 >= 0 && indexOf9 >= 0) {
                            sb2.delete(i8, indexOf9 + 2);
                            a(str8, sb2.toString());
                        }
                    }
                }
                return;
            case 2:
                if (i6 != null && i6.length() > 0) {
                    StringBuilder sb3 = new StringBuilder(i6);
                    int indexOf10 = sb3.indexOf("glib=\"" + str + "\"");
                    if (indexOf10 >= 0) {
                        ("glib=\"" + str + "\"").length();
                        if (i3 != 1) {
                            if (i3 != 3) {
                                if (i3 == 5) {
                                    String str10 = j() + "game_res/3rd/config/app_list.config";
                                    String c2 = c(str10);
                                    if (c2 != null && c2.length() > 0) {
                                        StringBuilder sb4 = new StringBuilder(c2);
                                        int indexOf11 = sb4.indexOf("glib=\"" + str + "\"");
                                        if (indexOf11 >= 0) {
                                            int i9 = indexOf11 >= 25 ? indexOf11 - 25 : 0;
                                            int i10 = -1;
                                            while (true) {
                                                if ((i10 < 0 || i10 > indexOf11) && i9 > 0) {
                                                    i10 = sb4.indexOf("<glist", i9);
                                                    i9 -= 25;
                                                }
                                            }
                                            int indexOf12 = i10 >= 0 ? sb4.indexOf("/>", indexOf11) : -1;
                                            if (i10 < 0 || indexOf12 < 0) {
                                                str3 = null;
                                                str4 = null;
                                                str5 = null;
                                            } else {
                                                int indexOf13 = sb4.indexOf("gtype=", i10);
                                                if (indexOf13 >= i10 && indexOf13 < indexOf12) {
                                                    int indexOf14 = sb4.indexOf("\"", indexOf13);
                                                    int i11 = indexOf14 + 1;
                                                    int indexOf15 = sb4.indexOf("\"", i11);
                                                    if (indexOf14 > i10 && indexOf15 > i10 && indexOf14 < indexOf12 && indexOf15 < indexOf12) {
                                                        str5 = sb4.substring(i11, indexOf15);
                                                        indexOf2 = sb4.indexOf("gcid=", i10);
                                                        if (indexOf2 >= i10 && indexOf2 < indexOf12) {
                                                            indexOf3 = sb4.indexOf("\"", indexOf2);
                                                            i5 = indexOf3 + 1;
                                                            indexOf4 = sb4.indexOf("\"", i5);
                                                            if (indexOf3 > i10 && indexOf4 > i10 && indexOf3 < indexOf12 && indexOf4 < indexOf12) {
                                                                str3 = sb4.substring(i5, indexOf4);
                                                                int i12 = indexOf12 + 2;
                                                                str4 = c(sb4.substring(i10, i12), ExcellianceAppInfo.KEY_SAVEPATH);
                                                                sb4.delete(i10, i12);
                                                            }
                                                        }
                                                        str3 = null;
                                                        int i122 = indexOf12 + 2;
                                                        str4 = c(sb4.substring(i10, i122), ExcellianceAppInfo.KEY_SAVEPATH);
                                                        sb4.delete(i10, i122);
                                                    }
                                                }
                                                str5 = null;
                                                indexOf2 = sb4.indexOf("gcid=", i10);
                                                if (indexOf2 >= i10) {
                                                    indexOf3 = sb4.indexOf("\"", indexOf2);
                                                    i5 = indexOf3 + 1;
                                                    indexOf4 = sb4.indexOf("\"", i5);
                                                    if (indexOf3 > i10) {
                                                        str3 = sb4.substring(i5, indexOf4);
                                                        int i1222 = indexOf12 + 2;
                                                        str4 = c(sb4.substring(i10, i1222), ExcellianceAppInfo.KEY_SAVEPATH);
                                                        sb4.delete(i10, i1222);
                                                    }
                                                }
                                                str3 = null;
                                                int i12222 = indexOf12 + 2;
                                                str4 = c(sb4.substring(i10, i12222), ExcellianceAppInfo.KEY_SAVEPATH);
                                                sb4.delete(i10, i12222);
                                            }
                                            if (str3 == null || !str3.equals(String.valueOf(0))) {
                                                int indexOf16 = sb3.indexOf("glib=", ("glib=\"" + str + "\"").length() + indexOf10);
                                                int indexOf17 = sb3.indexOf("dstatus=", indexOf10);
                                                String valueOf = String.valueOf(1);
                                                if (indexOf17 >= 0 && (indexOf17 < indexOf16 || indexOf16 == -1)) {
                                                    String substring = sb3.substring("dstatus=".length() + indexOf17 + 1, "dstatus=".length() + indexOf17 + 2);
                                                    if (str2 == null || i3 != 3 || Integer.parseInt(substring) == 0) {
                                                        sb3.delete("dstatus=".length() + indexOf17 + 1, "dstatus=".length() + indexOf17 + 2);
                                                        sb3.insert(indexOf17 + "dstatus=".length() + 1, valueOf);
                                                    }
                                                } else {
                                                    sb3.insert(sb3.indexOf("/>", indexOf10), " dstatus=\"" + valueOf + "\" ");
                                                }
                                                int i13 = indexOf10 >= 25 ? indexOf10 - 25 : 0;
                                                int i14 = -1;
                                                while (true) {
                                                    if ((i14 < 0 || i14 > indexOf10) && i13 > 0) {
                                                        i14 = sb3.indexOf("<glist", i13);
                                                        i13 -= 25;
                                                    }
                                                }
                                                if (i14 >= 0) {
                                                    i4 = sb3.indexOf("/>", indexOf10);
                                                    if (str5 != null && str5.length() > 0 && (indexOf = sb3.indexOf("gtype=", i14)) >= i14 && indexOf < i4) {
                                                        int indexOf18 = sb3.indexOf("\"", indexOf);
                                                        int i15 = indexOf18 + 1;
                                                        int indexOf19 = sb3.indexOf("\"", i15);
                                                        if (indexOf18 > i14 && indexOf19 > i14 && indexOf18 < i4 && indexOf19 < i4) {
                                                            sb3.delete(i15, indexOf19);
                                                            sb3.insert(i15, str5);
                                                            i4 = sb3.indexOf("/>", indexOf10);
                                                        }
                                                    }
                                                } else {
                                                    i4 = -1;
                                                }
                                                if (i14 < 0 || i4 < 0) {
                                                    str6 = null;
                                                    str7 = null;
                                                } else {
                                                    int i16 = i4 + 2;
                                                    String substring2 = sb3.substring(i14, i16);
                                                    StringBuilder sb5 = new StringBuilder(substring2);
                                                    int indexOf20 = sb5.indexOf(".dload", 0);
                                                    sb5.delete(indexOf20, sb5.indexOf("\"", indexOf20));
                                                    str7 = c(substring2, "gid");
                                                    str6 = c(substring2, "glib");
                                                    sb4.insert(i10, (CharSequence) sb5);
                                                    sb3.delete(i14, i16);
                                                }
                                                Log.i("VersionManager", "updateUpgradeAppListFile gameId:" + str7 + ", gLib:" + str6);
                                                if (!str4.contains(i())) {
                                                    Map<String, String> hashMap = new HashMap<>();
                                                    hashMap.put("gcid", "1");
                                                    a(str10, a(str7, str6, hashMap, sb4).toString());
                                                } else {
                                                    a(str8, sb4.toString());
                                                }
                                                a(str8, sb3.toString());
                                                return;
                                            }
                                        }
                                    }
                                }
                            } else if (str2 != null) {
                                if (BitmapFactory.decodeFile(str2) == null) {
                                    new File(str2).delete();
                                    return;
                                }
                                int indexOf21 = sb3.indexOf("ppath=", indexOf10);
                                if (indexOf21 >= 0) {
                                    int indexOf22 = sb3.indexOf("\"", indexOf21) + 1;
                                    sb3.delete(indexOf22, sb3.indexOf("\"", indexOf22));
                                    sb3.insert(indexOf22, str2);
                                }
                            }
                        } else if (str2 != null) {
                            int indexOf23 = sb3.indexOf(ExcellianceAppInfo.KEY_SAVEPATH, indexOf10);
                            if (indexOf23 >= 0) {
                                int indexOf24 = sb3.indexOf("glib=", indexOf10 + 4);
                                if (indexOf23 >= indexOf24 && indexOf24 != -1) {
                                    sb3.insert(sb3.indexOf("/>", indexOf10), " savepath=\"" + str2 + "\" ");
                                }
                                int indexOf25 = sb3.indexOf("\"", indexOf23) + 1;
                                sb3.delete(indexOf25, sb3.indexOf("\"", indexOf25));
                                sb3.insert(indexOf25, str2);
                            } else {
                                sb3.insert(sb3.indexOf("/>", indexOf10), " savepath=\"" + str2 + "\" ");
                            }
                        }
                        int indexOf26 = sb3.indexOf("glib=", ("glib=\"" + str + "\"").length() + indexOf10);
                        int indexOf27 = sb3.indexOf("dstatus=", indexOf10);
                        String valueOf2 = String.valueOf(i3);
                        if (indexOf27 >= 0 && (indexOf27 < indexOf26 || indexOf26 == -1)) {
                            String substring3 = sb3.substring("dstatus=".length() + indexOf27 + 1, "dstatus=".length() + indexOf27 + 2);
                            if (str2 == null || i3 != 3 || Integer.parseInt(substring3) == 0) {
                                sb3.delete("dstatus=".length() + indexOf27 + 1, "dstatus=".length() + indexOf27 + 2);
                                sb3.insert(indexOf27 + "dstatus=".length() + 1, valueOf2);
                            }
                        } else {
                            sb3.insert(sb3.indexOf("/>", indexOf10), " dstatus=\"" + valueOf2 + "\" ");
                        }
                        String sb6 = sb3.toString();
                        File file = new File(str9);
                        try {
                            if (!file.exists()) {
                                file.getParentFile().mkdirs();
                            } else {
                                file.delete();
                            }
                            file.createNewFile();
                            BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
                            bufferedWriter.write(sb6);
                            bufferedWriter.close();
                            new File(str9).renameTo(new File(str8));
                        } catch (Exception e2) {
                            e2.printStackTrace();
                        }
                    }
                }
                return;
            default:
                return;
        }
    }

    public String a(y yVar) {
        String str = yVar.l;
        if (str != null && str.length() != 0 && !str.toLowerCase().startsWith(HttpHost.DEFAULT_SCHEME_NAME) && !TextUtils.equals(str, "null")) {
            return str;
        }
        return h() + "game_res/3rd/icon/" + yVar.f12505b + ".png";
    }

    public String j(String str) {
        return h() + "game_res/3rd/icon/" + str + ".png";
    }

    public boolean a(Context context, String str) {
        return l;
    }

    public y a(ExcellianceAppInfo excellianceAppInfo, int i2, boolean z2) {
        return a(excellianceAppInfo, i2, z2, true);
    }

    public y a(ExcellianceAppInfo excellianceAppInfo, int i2, boolean z2, boolean z3) {
        y yVar;
        String path = excellianceAppInfo.getPath();
        try {
            PackageInfo a2 = as.a(this.E, path);
            if (a2 != null) {
                String appName = excellianceAppInfo.getAppName();
                String str = a2.packageName;
                String str2 = a2.versionName;
                int i3 = a2.versionCode;
                AppVersionBean appVersionBean = new AppVersionBean();
                appVersionBean.pkgName = excellianceAppInfo.getAppPackageName();
                appVersionBean.versionName = str2;
                appVersionBean.versionCode = i3;
                az.d("VersionManager", "addPkgToCfg appVersionBean: " + appVersionBean);
                com.excelliance.kxqp.gs.d.e.a().a(this.E, appVersionBean);
                int intValue = z3 ? 1 : Integer.valueOf(excellianceAppInfo.getGameType()).intValue();
                az.d("VersionManager", "addPkgToCfg gameType: " + intValue);
                StringBuilder sb = new StringBuilder();
                sb.append((appName + str).hashCode());
                sb.append("");
                y yVar2 = new y(sb.toString(), str2, "0", appName, str, intValue, 1, 0, 1);
                try {
                    yVar2.i = i3 + "";
                    yVar2.x = z3 ? 8 : excellianceAppInfo.getDownloadStatus();
                    yVar2.l = a(yVar2);
                    yVar2.s = "";
                    yVar2.q = "";
                    yVar2.r = "";
                    yVar2.o = 0;
                    yVar2.t = false;
                    yVar2.k = "0";
                    yVar2.h = 0L;
                    yVar2.g = path;
                    yVar2.m = 0;
                    yVar2.y = 0;
                    yVar2.p = false;
                    yVar2.u = "";
                    yVar2.v = "";
                    yVar2.f = 1;
                    yVar2.j = "1";
                    yVar2.A = null;
                    yVar2.G = i2;
                    yVar2.aa = excellianceAppInfo.downloadSource;
                    yVar2.H = excellianceAppInfo.getMainObb();
                    yVar2.I = excellianceAppInfo.getPatchObb();
                    yVar2.S = excellianceAppInfo.last_install_from_gp;
                    ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(this.E).b(str);
                    boolean z4 = b2 != null;
                    Log.d("VersionManager", String.format("VersionManager/addPkgToCfg:thread(%s) existsInAppList(%s)", Thread.currentThread().getName(), Boolean.valueOf(z4)));
                    if (z4) {
                        yVar2.P = b2.apkFrom;
                        yVar2.Q = b2.isWhite;
                        yVar2.O = b2.downloadButtonVisible;
                        if (TextUtils.isEmpty(b2.datafinder_game_id) && !TextUtils.isEmpty(excellianceAppInfo.datafinder_game_id)) {
                            yVar2.T = excellianceAppInfo.datafinder_game_id;
                        }
                        if (TextUtils.isEmpty(b2.appUpdateTime) && !TextUtils.isEmpty(excellianceAppInfo.appUpdateTime)) {
                            yVar2.U = excellianceAppInfo.appUpdateTime;
                        }
                        if (b2.serverVc == 0) {
                            yVar2.V = excellianceAppInfo.serverVc;
                        }
                        yVar2.W = excellianceAppInfo.maxShowTimes;
                    }
                    if (z4) {
                        a(i2, yVar2, str);
                    } else {
                        b(yVar2);
                        yVar2.T = excellianceAppInfo.datafinder_game_id;
                        yVar2.U = excellianceAppInfo.appUpdateTime;
                        yVar2.V = excellianceAppInfo.serverVc;
                    }
                    return yVar2;
                } catch (Exception e2) {
                    e = e2;
                    yVar = yVar2;
                }
            } else {
                yVar = null;
                try {
                    Log.d("VersionManager", String.format("VersionManager/addPkgToCfg:thread(%s) pkgInfo is null", Thread.currentThread().getName()));
                    return null;
                } catch (Exception e3) {
                    e = e3;
                }
            }
        } catch (Exception e4) {
            e = e4;
            yVar = null;
        }
        try {
            e.printStackTrace();
            return yVar;
        } catch (Exception e5) {
            e5.printStackTrace();
            return yVar;
        }
    }

    public y c(String str, int i2) {
        return b(str, i2, 8);
    }

    public y b(String str, int i2, int i3) {
        return b(str, i2, i3, 1);
    }

    public y a(String str, int i2, int i3, int i4, int i5) {
        String h2;
        Bitmap a2;
        y yVar = null;
        try {
            if (a(this.E, str)) {
                h2 = l(str);
            } else {
                h2 = GameUtil.getIntance().h(str);
            }
            PackageManager packageManager = this.E.getPackageManager();
            try {
                PackageInfo packageInfo = packageManager.getPackageInfo(str, 0);
                if (packageInfo == null) {
                    return null;
                }
                String charSequence = packageInfo.applicationInfo.loadLabel(packageManager).toString();
                String str2 = packageInfo.packageName;
                String str3 = packageInfo.versionName;
                int i6 = packageInfo.versionCode;
                AppVersionBean appVersionBean = new AppVersionBean();
                appVersionBean.pkgName = str;
                appVersionBean.versionName = str3;
                appVersionBean.versionCode = i6;
                az.d("VersionManager", "addLocalPkgToCfg appVersionBean: " + appVersionBean);
                com.excelliance.kxqp.gs.d.e.a().a(this.E, appVersionBean);
                Drawable loadIcon = packageInfo.applicationInfo.loadIcon(packageManager);
                StringBuilder sb = new StringBuilder();
                sb.append((charSequence + str2).hashCode());
                sb.append("");
                y yVar2 = new y(sb.toString(), str3, "0", charSequence, str2, 5, 1, 0, 1);
                try {
                    yVar2.i = i6 + "";
                    yVar2.ac = null;
                    yVar2.x = i3;
                    yVar2.l = a(yVar2);
                    yVar2.s = "";
                    yVar2.q = "";
                    yVar2.r = "";
                    yVar2.o = 0;
                    yVar2.t = false;
                    yVar2.k = "0";
                    yVar2.h = 0L;
                    yVar2.g = h2;
                    yVar2.m = 0;
                    yVar2.y = 0;
                    yVar2.p = false;
                    yVar2.u = "";
                    yVar2.v = "";
                    yVar2.f = 1;
                    yVar2.j = "1";
                    yVar2.A = null;
                    yVar2.G = i2;
                    yVar2.H = "";
                    yVar2.I = "";
                    yVar2.aa = "guideImport";
                    yVar2.K = i4;
                    yVar2.R = i5;
                    if (au.a().s(str2)) {
                        yVar2.N = 1;
                    }
                    ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(this.E).b(str2);
                    if (b2 != null) {
                        b2.setAppName(yVar2.c);
                        b2.setGameType(String.valueOf(5));
                        b2.setIconPath(yVar2.l);
                        b2.setPath(yVar2.g);
                        b2.setVersionCode(i6);
                        b2.setOnline(i4);
                        b2.setDownloadStatus(i3);
                        b2.setInstallFrom(i5);
                        b2.downloadSource = "guideImport";
                        com.excelliance.kxqp.repository.a.a(this.E).b(b2);
                        yVar2.P = b2.apkFrom;
                        yVar2.Q = b2.isWhite;
                        yVar2.O = b2.downloadButtonVisible;
                        yVar2.S = b2.last_install_from_gp;
                    } else {
                        if (loadIcon != null) {
                            if (loadIcon instanceof BitmapDrawable) {
                                a2 = ((BitmapDrawable) loadIcon).getBitmap();
                            } else {
                                a2 = com.excelliance.kxqp.gs.util.k.a(loadIcon);
                            }
                            try {
                                FileOutputStream fileOutputStream = new FileOutputStream(yVar2.l);
                                if (a2 != null) {
                                    a2.compress(Bitmap.CompressFormat.PNG, 100, fileOutputStream);
                                }
                                fileOutputStream.close();
                                if (a2 != null) {
                                    a2.recycle();
                                }
                            } catch (IOException e2) {
                                e2.printStackTrace();
                            }
                        }
                        b(yVar2);
                    }
                    return yVar2;
                } catch (Exception e3) {
                    e = e3;
                    yVar = yVar2;
                    e.printStackTrace();
                    return yVar;
                }
            } catch (Exception e4) {
                e = e4;
            }
        } catch (Exception e5) {
            e5.printStackTrace();
            return yVar;
        }
    }

    public y b(String str, int i2, int i3, int i4) {
        return a(str, i2, i3, i4, 0);
    }

    private void a(int i2, y yVar, String str) {
        Log.d("VersionManager", String.format("VersionManager/editAppListToFile:thread(%s) uid(%s) packageName(%s)", Thread.currentThread().getName(), Integer.valueOf(i2), str));
        com.excelliance.kxqp.repository.a.a(this.E).a(yVar);
    }

    public static ArrayList<ApplicationInfo> g(Context context) {
        ArrayList<ApplicationInfo> arrayList = new ArrayList<>();
        try {
            Bundle bundle = new Bundle();
            String packageName = context.getPackageName();
            Bundle call = context.getContentResolver().call(new Uri.Builder().scheme("content").authority(packageName + ":OuterDateProvider").build(), "method_read_applist", (String) null, bundle);
            return call != null ? call.getParcelableArrayList("applicationList") : arrayList;
        } catch (Exception e2) {
            e2.printStackTrace();
            return arrayList;
        }
    }

    public int a(String str, Context context, Boolean bool) {
        List<ApplicationInfo> g2;
        int i2 = -1;
        if (A) {
            return -1;
        }
        A = true;
        boolean z2 = str == null || str.length() == 0;
        List<ApplicationInfo> list = null;
        StringBuilder sb = new StringBuilder();
        if (z2) {
            try {
                context.getPackageManager();
                if (bool.booleanValue()) {
                    g2 = com.excelliance.kxqp.gs.l.f.a(context).a(context, true);
                } else {
                    g2 = g(context);
                }
                list = g2;
            } catch (Exception unused) {
            }
            if (list == null || list.size() == 0) {
                B = false;
                return -1;
            }
            int i3 = 0;
            for (int i4 = 0; list != null && i4 < list.size(); i4++) {
                ApplicationInfo applicationInfo = list.get(i4);
                if (applicationInfo != null) {
                    String h2 = GameUtil.getIntance().h(applicationInfo.packageName);
                    if ((applicationInfo.flags & 1) == 0 || (h2 != null && h2.startsWith("/data/app"))) {
                        int i5 = i3 + 1;
                        if (i3 != 0) {
                            sb.append(com.alipay.sdk.util.i.f491b);
                        }
                        sb.append(list.get(i4).packageName);
                        i3 = i5;
                    }
                }
            }
        } else {
            sb.append(str);
        }
        if (sb.length() == 0) {
            B = false;
            return -1;
        }
        GameUtil intance = GameUtil.getIntance();
        String o2 = GameUtil.o(context);
        StringBuilder sb2 = new StringBuilder((o2 == null || o2.length() <= 0) ? "http://mto.multiopen.cn/localinstall.php" : "http://folder." + o2 + "/localinstall.php");
        sb2.append("?sdkver=" + GameUtil.f(context));
        sb2.append("&compver=" + l());
        sb2.append("&mainver=" + intance.m());
        sb2.append("&vc=" + GameUtil.g(context));
        sb2.append("&vn=" + GameUtil.h(context));
        sb2.append("&chid=" + GameUtil.d(context));
        sb2.append("&subchid=" + GameUtil.e(context));
        sb2.append("&fv=1");
        sb2.append("&increase=");
        sb2.append(!z2 ? "0" : "1");
        String f2 = f();
        if (f2 != null) {
            sb2.append("&uid=" + f2);
        }
        sb2.append("&type=" + intance.u(context));
        sb2.append("&pkg=" + context.getPackageName());
        sb2.append("&api=" + Build.VERSION.SDK_INT);
        sb2.append("&release=" + Build.VERSION.RELEASE);
        sb2.append("&language=" + Locale.getDefault().getLanguage());
        sb2.append("&country=" + Locale.getDefault().getCountry());
        try {
            sb2.append("&abi=" + URLEncoder.encode(Build.CPU_ABI, "UTF-8").replaceAll("\\+", "%20"));
            sb2.append("&abi2=" + URLEncoder.encode(Build.CPU_ABI2, "UTF-8").replaceAll("\\+", "%20"));
            sb2.append("&abilist=" + URLEncoder.encode(a("ro.product.cpu.abilist"), "UTF-8").replaceAll("\\+", "%20"));
            sb2.append("&abilist32=" + URLEncoder.encode(a("ro.product.cpu.abilist32"), "UTF-8").replaceAll("\\+", "%20"));
            sb2.append("&abilist64=" + URLEncoder.encode(a("ro.product.cpu.abilist64"), "UTF-8").replaceAll("\\+", "%20"));
            sb2.append("&brand=" + URLEncoder.encode(Build.BRAND, "UTF-8").replaceAll("\\+", "%20"));
            sb2.append("&manufacturer=" + URLEncoder.encode(Build.MANUFACTURER, "UTF-8").replaceAll("\\+", "%20"));
            sb2.append("&model=" + URLEncoder.encode(Build.MODEL, "UTF-8").replaceAll("\\+", "%20"));
            sb2.append("&product=" + URLEncoder.encode(Build.PRODUCT, "UTF-8").replaceAll("\\+", "%20"));
        } catch (Exception unused2) {
        }
        sb2.append("&pl=" + sb.toString());
        try {
            if (!cd.a(bd.a(sb2.toString(), 24000, 12000))) {
                Log.d("VersionManager", "AppList OK");
                if (z2) {
                    context.getSharedPreferences("appsConfig", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putBoolean("listReported", true).commit();
                }
                i2 = 0;
            }
        } catch (Exception e2) {
            Log.d("VersionManager", "reportAppList e=" + e2);
            e2.printStackTrace();
        }
        A = false;
        return i2;
    }

    public void p() {
        String[] split;
        if (this.E == null) {
            return;
        }
        String string = this.E.getSharedPreferences("appsConfig", Build.VERSION.SDK_INT < 11 ? 0 : 4).getString("vt_pkg", null);
        if (string == null || (split = string.split(com.alipay.sdk.util.i.f491b)) == null) {
            return;
        }
        ArrayList<ExcellianceAppInfo> a2 = InitialData.a(this.E).a();
        com.excelliance.kxqp.wr.a a3 = com.excelliance.kxqp.wr.a.a();
        if (a2.size() > 0) {
            for (int i2 = 0; i2 < split.length; i2++) {
                if (split[i2].length() > 0) {
                    Iterator<ExcellianceAppInfo> it = a2.iterator();
                    while (it.hasNext()) {
                        ExcellianceAppInfo next = it.next();
                        if (next.getAppPackageName().contains(split[i2])) {
                            a3.a(0, next.getAppPackageName(), PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED, false);
                        }
                    }
                }
            }
        }
    }

    public boolean k(String str) {
        String[] split;
        if (this.E == null || str == null) {
            return false;
        }
        String string = this.E.getSharedPreferences("appsConfig", Build.VERSION.SDK_INT < 11 ? 0 : 4).getString("vt_pkg", null);
        if (string == null || (split = string.split(com.alipay.sdk.util.i.f491b)) == null) {
            return false;
        }
        for (int i2 = 0; i2 < split.length; i2++) {
            if (split[i2].length() > 0 && str.contains(split[i2])) {
                return true;
            }
        }
        return false;
    }

    public int q() {
        String attributeValue;
        new StringBuilder();
        GameUtil intance = GameUtil.getIntance();
        StringBuilder sb = new StringBuilder("http://sdk.ourplay.com.cn/shareaddr.php");
        sb.append("?sdkver=" + GameUtil.f(this.E));
        sb.append("&compver=" + l());
        sb.append("&mainver=" + intance.m());
        sb.append("&chid=" + GameUtil.d(this.E));
        sb.append("&subchid=" + GameUtil.e(this.E));
        sb.append("&type=" + intance.u(this.E));
        sb.append("&pkg=" + this.E.getPackageName());
        sb.append("&api=" + Build.VERSION.SDK_INT);
        sb.append("&release=" + Build.VERSION.RELEASE);
        sb.append("&language=" + Locale.getDefault().getLanguage());
        sb.append("&country=" + Locale.getDefault().getCountry());
        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) {
        }
        try {
            String a2 = bd.a(sb.toString(), 24000, 12000);
            if (TextUtils.isEmpty(a2)) {
                return -1;
            }
            if (a2 == null) {
                a2 = "";
            }
            ByteArrayInputStream byteArrayInputStream = (a2 == null || "".equals(a2.trim())) ? null : new ByteArrayInputStream(a2.getBytes());
            XmlPullParser newPullParser = Xml.newPullParser();
            newPullParser.setInput(byteArrayInputStream, "UTF-8");
            SharedPreferences sharedPreferences = this.E.getSharedPreferences("appsConfig", Build.VERSION.SDK_INT < 11 ? 0 : 4);
            for (int eventType = newPullParser.getEventType(); eventType != 1; eventType = newPullParser.next()) {
                if (eventType != 0 && eventType == 2) {
                    String name = newPullParser.getName();
                    if ("ai".equalsIgnoreCase(name)) {
                        String attributeValue2 = newPullParser.getAttributeValue(null, RankingItem.KEY_ADDR);
                        if (attributeValue2 != null) {
                            sharedPreferences.edit().putString(RankingItem.KEY_ADDR, attributeValue2).commit();
                        }
                        String attributeValue3 = newPullParser.getAttributeValue(null, "tel");
                        if (attributeValue3 != null) {
                            sharedPreferences.edit().putString("tel", attributeValue3).commit();
                        }
                        String attributeValue4 = newPullParser.getAttributeValue(null, "qg");
                        if (attributeValue4 != null) {
                            sharedPreferences.edit().putString("qg", attributeValue4).commit();
                        }
                        String attributeValue5 = newPullParser.getAttributeValue(null, "qgk");
                        if (attributeValue5 != null) {
                            sharedPreferences.edit().putString("qgk", attributeValue5).commit();
                        }
                    } else if ("bug".equals(name)) {
                        String attributeValue6 = newPullParser.getAttributeValue(null, "qg");
                        if (attributeValue6 != null) {
                            sharedPreferences.edit().putString("qq_group_num_bug", attributeValue6).commit();
                        }
                        String attributeValue7 = newPullParser.getAttributeValue(null, "qgk");
                        if (attributeValue7 != null) {
                            sharedPreferences.edit().putString("qq_group_key_bug", attributeValue7).commit();
                        }
                    } else if ("vip".equals(name)) {
                        String attributeValue8 = newPullParser.getAttributeValue(null, "qg");
                        if (attributeValue8 != null) {
                            sharedPreferences.edit().putString("qq_group_num_vip", attributeValue8).commit();
                        }
                        String attributeValue9 = newPullParser.getAttributeValue(null, "qgk");
                        if (attributeValue9 != null) {
                            sharedPreferences.edit().putString("qq_group_key_vip", attributeValue9).commit();
                        }
                    } else if ("app".equals(name) && (attributeValue = newPullParser.getAttributeValue(null, "package")) != null) {
                        String attributeValue10 = newPullParser.getAttributeValue(null, "qg");
                        if (attributeValue10 != null) {
                            sharedPreferences.edit().putString("qq_group_num_app_" + attributeValue, attributeValue10).commit();
                        }
                        String attributeValue11 = newPullParser.getAttributeValue(null, "qgk");
                        if (attributeValue11 != null) {
                            sharedPreferences.edit().putString("qq_group_key_app_" + attributeValue, attributeValue11).commit();
                        }
                    }
                }
            }
            byteArrayInputStream.close();
            return 0;
        } catch (Exception e2) {
            Log.d("VersionManager", "queryConfigAddr e=" + e2);
            e2.printStackTrace();
            return -1;
        }
    }

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

    public String s() {
        return d(0);
    }

    public String d(int i2) {
        return j() + "game_res/3rd/config/" + c(i2);
    }

    public String t() {
        return j() + "game_res/3rd/config/upgrade_list.config";
    }

    public String l(String str) {
        return h() + "game_res/3rd/jar/" + str + ".jar";
    }

    public void m(String str) {
        int indexOf;
        String str2 = j() + "game_res/3rd/config/cache_list.config";
        File file = new File(str2);
        StringBuilder sb = new StringBuilder();
        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;
                    } else {
                        sb.append(readLine);
                    }
                }
                inputStreamReader.close();
            } catch (Exception e2) {
                Log.d("VersionManager", "addCacheAppInfo: Exception");
                e2.printStackTrace();
            }
            int i2 = 0;
            if (sb.length() == 0) {
                sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?><listpack ver=\"1.0\">");
                sb.append(str);
                sb.append("</listpack>");
            } else {
                int indexOf2 = str.indexOf("<glist glib=\"");
                int indexOf3 = str.indexOf("gver=\"");
                if (indexOf2 >= 0 && indexOf3 > indexOf2) {
                    String substring = str.substring(indexOf2, indexOf3);
                    while (true) {
                        int indexOf4 = sb.indexOf(substring);
                        if (indexOf4 < 0 || (indexOf = sb.indexOf("/>", indexOf4) + "/>".length()) < 0 || indexOf <= indexOf4) {
                            break;
                        }
                        Log.v("VersionManager", sb.substring(indexOf4, indexOf));
                        sb.delete(indexOf4, indexOf);
                    }
                }
                if (sb.lastIndexOf("/>") >= 0) {
                    i2 = "/>".length() + sb.lastIndexOf("/>");
                } else {
                    int lastIndexOf = sb.lastIndexOf("</");
                    if (lastIndexOf >= 0) {
                        i2 = lastIndexOf;
                    }
                }
                sb.insert(i2, str);
            }
            File file2 = new File(str2 + ".tmp");
            try {
                if (!file2.exists()) {
                    file2.getParentFile().mkdirs();
                } else {
                    file2.delete();
                }
                file2.createNewFile();
                BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file2), "UTF-8"));
                bufferedWriter.write(sb.toString());
                bufferedWriter.close();
                new File(str2 + ".tmp").renameTo(new File(str2));
            } catch (Exception e3) {
                e3.printStackTrace();
            }
            com.excelliance.kxqp.swipe.b.d(this.E, str2);
        }
    }

    public void a(String str, String str2, Map<String, String> map, int i2) {
        a(str, str2, map, d(i2));
    }

    public synchronized StringBuilder a(String str, String str2, Map<String, String> map, String str3) {
        if (str == null || str2 == null || map == null || str3 == null) {
            Log.d("VersionManager", "editAppListFileDetail() null args return");
            return null;
        }
        if (!new File(str3).exists()) {
            Log.d("VersionManager", "editAppListFileDetail() xmlFile not exist return");
            return null;
        }
        String c2 = c(str3);
        int indexOf = c2.indexOf("<glist gid=\"" + str + "\"");
        if (indexOf < 0) {
            int indexOf2 = c2.indexOf("glib=\"" + str2 + "\"");
            if (indexOf2 < 0) {
                Log.d("VersionManager", "editAppListFileDetail() no such app in the list return");
                return null;
            }
            int indexOf3 = c2.indexOf("/>", indexOf2);
            int i2 = 0;
            while (i2 >= 0 && i2 < c2.length() && c2.indexOf("/>", i2) != indexOf3) {
                i2 = c2.indexOf("<glist", i2 + 1);
            }
            indexOf = i2;
        } else {
            c2.indexOf("/>", indexOf);
        }
        Set<String> keySet = map.keySet();
        StringBuilder sb = new StringBuilder(c2);
        for (String str4 : keySet) {
            int indexOf4 = sb.indexOf(str4 + "=", indexOf);
            if (indexOf4 < 0) {
                Log.d("VersionManager", "editAppListFileDetail() key" + str4 + "not exist return");
            }
            int indexOf5 = sb.indexOf("\"", indexOf4) + 1;
            sb.delete(indexOf5, sb.indexOf("\"", indexOf5));
            sb.insert(indexOf5, map.get(str4));
            if (str4 != null && ExcellianceAppInfo.KEY_DSTATUS.equals(str4)) {
                map.get(str4);
            }
        }
        a(str3, sb.toString());
        return sb;
    }

    public synchronized StringBuilder a(String str, String str2, Map<String, String> map, StringBuilder sb) {
        int indexOf;
        if (str == null || str2 == null || map == null || sb == null) {
            az.d("VersionManager", "editAppListDetail() null args return");
            return null;
        }
        String sb2 = sb.toString();
        int indexOf2 = sb2.indexOf("<glist gid=\"" + str + "\"");
        if (indexOf2 < 0) {
            int indexOf3 = sb2.indexOf("glib=\"" + str2 + "\"");
            if (indexOf3 < 0) {
                az.d("VersionManager", "editAppListDetail() no such app in the list return");
                return null;
            }
            indexOf = sb2.indexOf("/>", indexOf3);
            indexOf2 = 0;
            while (indexOf2 >= 0 && indexOf2 < sb2.length() && sb2.indexOf("/>", indexOf2) != indexOf) {
                indexOf2 = sb2.indexOf("<glist", indexOf2 + 1);
            }
        } else {
            indexOf = sb2.indexOf("/>", indexOf2);
        }
        Set<String> keySet = map.keySet();
        az.i("VersionManager", "editAppListDetail----indexHead: " + indexOf2 + " indexTail: " + indexOf + "--currList: " + sb2);
        StringBuilder sb3 = new StringBuilder(sb2);
        for (String str3 : keySet) {
            int indexOf4 = sb3.indexOf(str3 + "=", indexOf2);
            if (indexOf4 < 0) {
                int indexOf5 = sb3.indexOf("/>", sb3.indexOf("glib=\"" + str2 + "\""));
                if (indexOf5 < 0) {
                    Log.d("VersionManager", "edit not found key " + str3);
                } else {
                    String str4 = str3 + "=\"" + map.get(str3) + "\" ";
                    sb3.insert(indexOf5, str4);
                    az.d("VersionManager", "editAppListDetail() key " + str3 + " not exist return startIndex: " + indexOf5 + " str: " + str4);
                }
            } else {
                int indexOf6 = sb3.indexOf("\"", indexOf4);
                int i2 = indexOf6 + 1;
                int indexOf7 = sb3.indexOf("\"", i2);
                sb3.delete(i2, indexOf7);
                sb3.insert(i2, map.get(str3));
                az.d("VersionManager", "editAppListDetail: -----index: " + indexOf4 + " index2: " + indexOf6 + " index3: " + indexOf7 + " key:" + str3 + " value: " + map.get(str3));
            }
        }
        az.d("VersionManager", "editAppListDetail ---sb: " + sb3.substring(sb3.lastIndexOf(str)));
        return sb3;
    }

    public String c(String str, String str2) {
        int indexOf = str.indexOf("\"", str.indexOf(str2 + "=", 0)) + 1;
        return str.substring(indexOf, str.indexOf("\"", indexOf));
    }

    public synchronized void d(String str, String str2) {
        boolean z2;
        int lastIndexOf;
        if (str == null || str2 == null) {
            return;
        }
        String str3 = h() + "game_res/3rd/config/payinfo.config";
        String c2 = c(str3);
        if (c2 == null) {
            c2 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><listpack ver=\"1.0\"></listpack>";
            z2 = true;
        } else {
            z2 = false;
        }
        StringBuilder sb = new StringBuilder(c2);
        if (!z2) {
            if (sb.lastIndexOf("/>") >= 0) {
                lastIndexOf = sb.lastIndexOf("/>") + "/>".length();
            } else {
                lastIndexOf = sb.lastIndexOf("</");
            }
            Log.d("VersionManager", "addToPayListFile content = " + Base64.decode(c2, 0).toString());
        } else {
            lastIndexOf = sb.lastIndexOf("</listpack>");
        }
        StringBuilder sb2 = new StringBuilder();
        sb2.append("<glist gid=\"" + str + "\" ");
        sb2.append("orderno=\"" + str2 + "\" ");
        sb2.append("/>");
        sb.insert(lastIndexOf, (CharSequence) sb2);
        String str4 = new String(Base64.encode(sb.toString().getBytes(), 0));
        File file = new File(str3 + ".tmp");
        try {
            if (!file.exists()) {
                file.getParentFile().mkdirs();
            } else {
                file.delete();
            }
            file.createNewFile();
            BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
            bufferedWriter.write(str4);
            bufferedWriter.close();
            new File(str3 + ".tmp").renameTo(new File(str3));
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public List<q> u() {
        ArrayList arrayList = new ArrayList();
        if (this.K) {
            return arrayList;
        }
        this.K = true;
        GameUtil intance = GameUtil.getIntance();
        StringBuilder sb = new StringBuilder("https://sdk.ourplay.com.cn/functionswitch.php");
        sb.append("?sdkver=" + GameUtil.f(this.E));
        sb.append("&vc=" + GameUtil.g(this.E));
        sb.append("&vn=" + GameUtil.h(this.E));
        sb.append("&compver=" + l());
        sb.append("&mainver=" + intance.m());
        sb.append("&chid=" + GameUtil.d(this.E));
        sb.append("&subchid=" + GameUtil.e(this.E));
        String f2 = f();
        if (f2 != null) {
            sb.append("&uid=" + f2);
        }
        if (!TextUtils.isEmpty(null)) {
            sb.append("&aid=" + ((String) null));
        }
        String k2 = com.excelliance.kxqp.pay.ali.b.k(this.E);
        if (!TextUtils.isEmpty(k2)) {
            sb.append("&im=" + k2);
        }
        String a2 = bx.a().a(this.E);
        if (!TextUtils.isEmpty(a2)) {
            sb.append("&rid=" + a2);
        }
        sb.append("&type=2");
        sb.append("&payver=" + intance.e("pay"));
        StringBuilder sb2 = new StringBuilder();
        List<String> l2 = com.excelliance.kxqp.pay.ali.b.l(this.E);
        for (int i2 = 0; i2 < l2.size(); i2++) {
            sb2.append(l2.get(i2).trim());
            if (i2 < l2.size() - 1) {
                sb2.append(StatisticsManager.COMMA);
            }
        }
        Log.d("VersionManager", "imeis = " + sb2.toString().trim());
        sb.append("&imeis=" + sb2.toString().trim());
        String sb3 = sb.toString();
        Log.d("VersionManager", "url:" + sb3);
        try {
            String a3 = bd.a(sb3, 15000, 15000);
            Log.d("VersionManager", "result:_" + a3);
            if (!TextUtils.isEmpty(a3)) {
                JSONObject jSONObject = new JSONObject(a3);
                if (jSONObject.length() > 0) {
                    String optString = jSONObject.optString("alipay");
                    if (!TextUtils.isEmpty(optString)) {
                        JSONObject jSONObject2 = new JSONObject(optString);
                        int optInt = jSONObject2.optInt("status");
                        int optInt2 = jSONObject2.optInt("flag");
                        SharedPreferences.Editor edit = this.E.getSharedPreferences("alipay", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit();
                        edit.putInt("status", optInt).commit();
                        if (optInt > 0) {
                            Log.d("VersionManager", "status:" + optInt + "  flag:" + optInt2);
                            edit.putInt("server_flag", optInt2).commit();
                        }
                    }
                    String optString2 = jSONObject.optString("pay");
                    if (!TextUtils.isEmpty(optString2)) {
                        JSONObject jSONObject3 = new JSONObject(optString2);
                        String optString3 = jSONObject3.optString("payurl");
                        int optInt3 = jSONObject3.optInt("payver");
                        String optString4 = jSONObject3.optString("md5");
                        String optString5 = jSONObject3.optString("jarname");
                        int optInt4 = jSONObject3.optInt(RankingItem.KEY_SIZE);
                        int optInt5 = jSONObject3.optInt("status");
                        int optInt6 = jSONObject3.optInt("switch");
                        if (optInt5 > 0 && optInt6 != 0) {
                            Log.d("VersionManager", "status:" + optInt5 + "  swit:" + optInt6 + "  payUrl:" + optString3 + " jarname:" + optString5);
                            if (!TextUtils.isEmpty(optInt3 + "") && !TextUtils.isEmpty(optString5) && !TextUtils.isEmpty(optString3)) {
                                arrayList.add(new q(optString5, true, optString3, optInt3 + "", optInt4 + "", optString4));
                            }
                        }
                    }
                    String optString6 = jSONObject.optString("special");
                    if (!TextUtils.isEmpty(optString6)) {
                        JSONObject jSONObject4 = new JSONObject(optString6);
                        int optInt7 = jSONObject4.optInt("status");
                        Log.d("VersionManager", "special status = " + optInt7);
                        if (optInt7 == 1) {
                            int optInt8 = jSONObject4.optInt("flag");
                            Log.d("VersionManager", "special flag = " + optInt8);
                            if (optInt8 == 1) {
                                if (!com.excelliance.kxqp.pay.ali.b.p(this.E)) {
                                    String c2 = com.excelliance.kxqp.pay.ali.b.c(com.excelliance.kxqp.pay.ali.b.d(this.E).trim());
                                    com.excelliance.kxqp.pay.ali.b.b(this.E, c2);
                                    this.E.getSharedPreferences("special", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit().putString("cid", c2).apply();
                                } else {
                                    Log.d("VersionManager", "local is multied");
                                }
                            } else {
                                Log.d("VersionManager", "flag = " + optInt8);
                                com.excelliance.kxqp.pay.ali.b.m(this.E);
                            }
                        } else {
                            Log.d("VersionManager", "服务器异常status" + optInt7);
                        }
                    } else {
                        Log.d("VersionManager", "no special");
                    }
                } else {
                    Log.d("VersionManager", "jsonObject is null");
                }
            }
        } catch (Exception e2) {
            this.K = false;
            Log.d("VersionManager", "e=" + e2);
            e2.printStackTrace();
        }
        a(arrayList);
        this.K = false;
        return arrayList;
    }

    private void a(List<q> list) {
        if (list.size() == 0) {
            SharedPreferences sharedPreferences = this.E.getSharedPreferences(Constants.PARAM_PLATFORM, Build.VERSION.SDK_INT < 11 ? 0 : 4);
            int parseInt = Integer.parseInt(sharedPreferences.getString("update_info", "0"));
            if ((parseInt & 8) == 0 || GameUtil.getIntance().C(this.E)) {
                return;
            }
            GameUtil.getIntance().q(this.E);
            int s = GameUtil.getIntance().s();
            if (s != 0) {
                SharedPreferences.Editor edit = sharedPreferences.edit();
                edit.putString("update_info", String.valueOf(parseInt & (-9)));
                edit.commit();
                Process.killProcess(s);
            }
        }
    }

    private String a(Context context, boolean z2) {
        StringBuilder sb = new StringBuilder();
        String str = "0";
        try {
            sb.append("&imei=");
            sb.append("&aid=");
            boolean n2 = context != null ? bx.a().n(context) : false;
            sb.append("&uid=" + f());
            if (n2) {
                str = bx.a().a(context);
                if ((TextUtils.isEmpty(str) || TextUtils.equals(str, "0")) && n2) {
                    str = "-1";
                }
            }
            sb.append("&rid=" + str);
            GameUtil intance = GameUtil.getIntance();
            sb.append("&cqid=" + intance.H(context));
            sb.append("&uqid=" + intance.F(context));
            context.getSharedPreferences("hello", Build.VERSION.SDK_INT < 11 ? 0 : 4);
            sb.append("&abTest=" + com.excelliance.kxqp.gs.util.a.a(com.excelliance.kxqp.swipe.h.b(context), false));
        } catch (Exception e2) {
            Log.e("VersionManager", "getUserDevInfo: has exception = " + e2.getMessage());
        }
        return sb.toString();
    }

    public void a(PushBean pushBean) {
        Log.e("VersionManager", "reportPushInfo: bean = " + pushBean);
        if (com.excelliance.kxqp.info.a.h(this.E)) {
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put("sdkver", DualaidApkInfoUser.getOTAVersion(this.E));
                jSONObject.put("vc", DualaidApkInfoUser.getApkVersion(this.E));
                jSONObject.put(RankingItem.KEY_VER_NAME, DualaidApkInfoUser.getApkVersionName(this.E));
                jSONObject.put("compver", l());
                jSONObject.put("mainver", DualaidApkInfoUser.getCurrentMainVersion(this.E));
                jSONObject.put("chid", DualaidApkInfoUser.getApkMainCh(this.E));
                jSONObject.put("subchid", DualaidApkInfoUser.getApkSubCh(this.E));
                String f2 = f();
                if (f2 != null) {
                    jSONObject.put("uid", f2);
                }
                jSONObject.put("type", DualaidApkInfoUser.getPlatformType(this.E));
                String c2 = com.excelliance.kxqp.info.a.c(this.E);
                if (c2 == null) {
                    c2 = "";
                }
                jSONObject.put("imei", c2);
                String d2 = com.excelliance.kxqp.info.a.d(this.E);
                if (d2 == null) {
                    d2 = "";
                }
                jSONObject.put("imsi", d2);
                jSONObject.put("aid", com.excelliance.kxqp.info.a.e(this.E));
                jSONObject.put(WebActionRouter.KEY_PKG, this.E.getPackageName());
                jSONObject.put("api", Build.VERSION.SDK_INT);
                jSONObject.put("release", Build.VERSION.RELEASE);
                GameUtil intance = GameUtil.getIntance();
                intance.q(this.E);
                jSONObject.put(BiManager.UQID, intance.F(this.E));
                if (pushBean != null) {
                    jSONObject.put("pushId", pushBean.getPushId());
                    jSONObject.put("pushManufacturer", pushBean.getPushManufacturer());
                    jSONObject.put("pushVersion", pushBean.getPushVersion());
                }
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
            Log.d("VersionManager", "reportPushInfo: json = " + jSONObject.toString());
            final String a2 = com.excelliance.kxqp.util.b.a(jSONObject.toString());
            Log.d("VersionManager", "reportPushInfo: json = " + a2);
            Log.d("VersionManager", "reportPushInfo: url = https://svc.excean.com/opxspaceapi/push/pushid");
            tp.i(new Runnable() {
                @Override
                public void run() {
                    ac.a().a("https://svc.excean.com/opxspaceapi/push/pushid", a2, new ac.a() {
                        @Override
                        public void a(String str) {
                            try {
                                if (new JSONObject(str).optInt("flag") == 1) {
                                    Log.d("VersionManager", "reportPushInfo onSuccess");
                                    by.a(VersionManager.this.E, com.excelliance.kxqp.push.use.a.a.SP_PUSH_CONFIG).a(com.excelliance.kxqp.push.use.a.a.KEY_LAST_TIME_REPORT_PUSH_INFO, System.currentTimeMillis());
                                }
                            } catch (JSONException e3) {
                                e3.printStackTrace();
                            }
                        }

                        @Override
                        public void b(String str) {
                            Log.d("VersionManager", "reportPushInfo onFailed: " + str);
                        }
                    });
                }
            });
        }
    }

    public void h(Context context) {
        RequestData requestData;
        ResponseData<AppCacheClearResult> responseData;
        ResponseData<AppCacheClearResult> responseData2 = new ResponseData<>();
        try {
            requestData = (RequestData) new Gson().a(cn.i(context).toString(), new TypeToken<RequestData>() {
            }.getType());
        } catch (Exception e2) {
            e2.printStackTrace();
            Log.d("VersionManager", String.format("queryCacheConfigForSystemUpdate:thread(%s)", Thread.currentThread().getName()));
            requestData = null;
        }
        if (requestData == null) {
            requestData = new RequestData();
        }
        try {
            retrofit2.m<ResponseData<AppCacheClearResult>> a2 = ApiManager.getInstance().a(context, 15000L, 15000L, "https://api.ourplay.com.cn/").c(requestData).a();
            Log.e("VersionManager", "queryCacheConfigForSystemUpdate response:" + a2);
            if (a2.c()) {
                responseData = a2.d();
                if (responseData != null) {
                    try {
                        AppCacheClearResult appCacheClearResult = responseData.data;
                        if (appCacheClearResult != null) {
                            int clearFlag = appCacheClearResult.getClearFlag();
                            int c2 = by.a(context, "global_config").c("app_cache_config_value", 0);
                            az.d("VersionManager", "queryCacheConfigForSystemUpdate: newValue = " + clearFlag + ", oldValue = " + c2);
                            if (clearFlag != c2) {
                                by.a(context, "global_config").a("app_cache_config_value", clearFlag);
                                return;
                            }
                            return;
                        }
                        return;
                    } catch (Exception e3) {
                        e = e3;
                        e.printStackTrace();
                        Log.e("VersionManager", "queryCacheConfigForSystemUpdate:" + e.toString());
                        responseData.msg = e.toString();
                        return;
                    }
                }
                return;
            }
            responseData2.msg = a2.b();
        } catch (Exception e4) {
            e = e4;
            responseData = responseData2;
        }
    }

    public void i(Context context) {
        boolean h2 = com.excelliance.kxqp.info.a.h(context);
        Log.d("VersionManager", "pullAdConfigFromServer: " + context + ", networkConnected = " + h2);
        if (!h2) {
            return;
        }
        ResponseAdData responseAdData = new ResponseAdData();
        try {
            IAdModule iAdModule = (IAdModule) AppJoint.service(IAdModule.class);
            String supportAdPlat = iAdModule.getSupportAdPlat();
            String a2 = com.excelliance.kxqp.util.a.d.a(supportAdPlat);
            boolean n2 = bx.a().n(context);
            Log.d("VersionManager", "pullAdConfigFromServer: supportAdPlat = " + supportAdPlat + ", \nsupport_ad_plat = " + a2 + " \nisVip = " + n2);
            retrofit2.m<ResponseAdData> a3 = ApiManager.getInstance().a(context, 15000L, 15000L, "https://ad.ourplay.com.cn/").a(a2, 1, n2 ? 1 : 2).a();
            Log.e("VersionManager", "pullAdConfigFromServer response: " + a3);
            if (a3.c()) {
                Log.d("VersionManager", "pullAdConfigFromServer: " + a3.toString());
                ResponseAdData d2 = a3.d();
                responseAdData = responseAdData;
                if (d2 != null) {
                    try {
                        String str = d2.data;
                        Log.d("VersionManager", "pullAdConfigFromServer: resultData = " + str);
                        iAdModule.updateAdConfig(context, str);
                        responseAdData = str;
                    } catch (Exception e2) {
                        e = e2;
                        responseAdData = d2;
                        e.printStackTrace();
                        Log.e("VersionManager", "pullAdConfigFromServer:" + e.toString());
                        responseAdData.msg = e.toString();
                    }
                }
            } else {
                responseAdData.msg = a3.b();
                responseAdData = responseAdData;
            }
        } catch (Exception e3) {
            e = e3;
        }
    }

    public void j(Context context) {
        boolean h2 = com.excelliance.kxqp.info.a.h(context);
        Log.d("VersionManager", "pullNewAdConfigFromServer: " + context + ", networkConnected = " + h2);
        StatisticsBuilder.getInstance().builder().setDescription("广告相关-第一个交互").setPriKey1(148000).setPriKey2(8).setIntKey0().buildImmediate(context);
        if (!h2) {
            return;
        }
        StatisticsBuilder.getInstance().builder().setDescription("广告相关-开始拉取配置").setPriKey1(148000).setPriKey2(1).setIntKey0().buildImmediate(context);
        ResponseAdConfigData responseAdConfigData = new ResponseAdConfigData();
        try {
            IAdModule iAdModule = (IAdModule) AppJoint.service(IAdModule.class);
            String supportAdPlat = iAdModule.getSupportAdPlat();
            String a2 = com.excelliance.kxqp.util.a.d.a(supportAdPlat);
            boolean n2 = bx.a().n(context);
            Log.d("VersionManager", "pullNewAdConfigFromServer: supportAdPlat = " + supportAdPlat + ", \nsupport_ad_plat = " + a2 + " \nisVip = " + n2);
            retrofit2.b<ResponseAdConfigData> a3 = ApiManager.getInstance().a(context, 15000L, 15000L, "https://api.ourplay.com.cn/").a(a2, 1, n2 ? 1 : 2, 1, com.excelliance.kxqp.avds.a.a.c(context), String.valueOf(System.currentTimeMillis()));
            Log.d("VersionManager", "pullNewAdConfigFromServer: url = " + a3.e().a().toString());
            retrofit2.m<ResponseAdConfigData> a4 = a3.a();
            Log.e("VersionManager", "pullNewAdConfigFromServer response: " + a4);
            if (a4.c()) {
                Log.d("VersionManager", "pullNewAdConfigFromServer: " + a4.toString());
                ResponseAdConfigData d2 = a4.d();
                if (d2 != null) {
                    try {
                        ParallelStrategyBean parallelStrategyBean = d2.data;
                        az.d("VersionManager", "pullNewAdConfigFromServer: resultData = " + parallelStrategyBean);
                        iAdModule.updateNewAdConfig(context, new Gson().a(parallelStrategyBean));
                        StatisticsBuilder.getInstance().builder().setDescription("广告相关-拉取配置成功").setPriKey1(148000).setPriKey2(2).setIntKey0().buildImmediate(context);
                    } catch (Exception e2) {
                        e = e2;
                        responseAdConfigData = d2;
                        e.printStackTrace();
                        Log.e("VersionManager", "pullNewAdConfigFromServer:" + e.toString());
                        responseAdConfigData.msg = e.toString();
                    }
                }
            } else {
                responseAdConfigData.msg = a4.b();
            }
        } catch (Exception e3) {
            e = e3;
        }
    }

    public void k(Context context) {
        boolean h2 = com.excelliance.kxqp.info.a.h(context);
        Log.d("VersionManager", "pullAdConstantFromServer: " + context + ", networkConnected = " + h2);
        if (!h2) {
            return;
        }
        ResponseAdConstantData responseAdConstantData = new ResponseAdConstantData();
        try {
            ?? r1 = (IAdModule) AppJoint.service(IAdModule.class);
            retrofit2.b<ResponseAdConstantData> d2 = ApiManager.getInstance().a(context, 15000L, 15000L, "https://api.ourplay.com.cn/").d();
            Log.d("VersionManager", "pullAdConstantFromServer: url = " + d2.e().a().toString());
            retrofit2.m<ResponseAdConstantData> a2 = d2.a();
            Log.e("VersionManager", "pullAdConstantFromServer response: " + a2);
            if (a2.c()) {
                Log.d("VersionManager", "pullAdConstantFromServer: " + a2.toString());
                ResponseAdConstantData d3 = a2.d();
                try {
                    az.d("VersionManager", "pullAdConstantFromServer: result = " + d3);
                    responseAdConstantData = "VersionManager";
                    if (d3 != null) {
                        ?? a3 = new Gson().a(d3.data);
                        r1.updateConstantConfig(context, a3);
                        responseAdConstantData = a3;
                    }
                } catch (Exception e2) {
                    e = e2;
                    responseAdConstantData = d3;
                    e.printStackTrace();
                    Log.e("VersionManager", "pullAdConstantFromServer:" + e.toString());
                    responseAdConstantData.msg = e.toString();
                }
            } else {
                responseAdConstantData.msg = a2.b();
                responseAdConstantData = responseAdConstantData;
            }
        } catch (Exception e3) {
            e = e3;
        }
    }

    public void l(Context context) {
        boolean h2 = com.excelliance.kxqp.info.a.h(context);
        Log.d("VersionManager", "pullAdJarConfigFromServer: " + context + ", networkConnected = " + h2);
        if (!h2) {
            return;
        }
        StatisticsBuilder.getInstance().builder().setDescription("广告相关-拉取广告JAR配置").setPriKey1(148000).setPriKey2(3).setIntKey0().buildImmediate(context);
        ResponseAdJarData responseAdJarData = new ResponseAdJarData();
        try {
            String adJarVerJson = ((IAdModule) AppJoint.service(IAdModule.class)).getAdJarVerJson(context);
            String a2 = com.excelliance.kxqp.util.a.d.a(adJarVerJson);
            Log.d("VersionManager", "pullAdJarConfigFromServer: adJarVerJson = " + adJarVerJson + ", \nadJarVerJsonEncode = " + a2);
            retrofit2.b<ResponseAdJarData> a3 = ApiManager.getInstance().a(context, 15000L, 15000L, "https://ad.ourplay.com.cn/").a(a2, 802);
            StringBuilder sb = new StringBuilder();
            sb.append("pullAdJarConfigFromServer: url = ");
            sb.append(a3.e().a().toString());
            Log.d("VersionManager", sb.toString());
            retrofit2.m<ResponseAdJarData> a4 = a3.a();
            Log.e("VersionManager", "pullAdJarConfigFromServer response: " + a4);
            if (a4.c()) {
                Log.d("VersionManager", "pullAdJarConfigFromServer: " + a4.toString());
                ResponseAdJarData d2 = a4.d();
                responseAdJarData = responseAdJarData;
                if (d2 != null) {
                    try {
                        List<ResponseAdJarData.DataBean> data = d2.getData();
                        StringBuilder sb2 = new StringBuilder();
                        sb2.append("pullAdJarConfigFromServer: dataList = ");
                        sb2.append(data != null ? Integer.valueOf(data.size()) : null);
                        Log.d("VersionManager", sb2.toString());
                        responseAdJarData = data;
                        if (data != null) {
                            int size = data.size();
                            responseAdJarData = data;
                            if (size > 0) {
                                StatisticsBuilder.getInstance().builder().setDescription("广告相关-开始下载广告JAR").setPriKey1(148000).setPriKey2(4).setIntKey0().buildImmediate(context);
                                a(context, data);
                                responseAdJarData = data;
                            }
                        }
                    } catch (Exception e2) {
                        e = e2;
                        responseAdJarData = d2;
                        e.printStackTrace();
                        Log.e("VersionManager", "pullAdJarConfigFromServer:" + e.toString());
                        responseAdJarData.setMsg(e.toString());
                    }
                }
            } else {
                responseAdJarData.setMsg(a4.b());
                responseAdJarData = responseAdJarData;
            }
        } catch (Exception e3) {
            e = e3;
        }
    }

    private void a(Context context, List<ResponseAdJarData.DataBean> list) {
        IAdModule iAdModule = (IAdModule) AppJoint.service(IAdModule.class);
        ArrayList arrayList = new ArrayList();
        for (ResponseAdJarData.DataBean dataBean : list) {
            Log.d("VersionManager", "downloadAdJar 0 dataBean: " + dataBean);
            if (dataBean.getJarVer() > iAdModule.getAdJarVersion(context, dataBean.getJarName())) {
                Log.d("VersionManager", "downloadAdJar dataBean: " + dataBean);
                DownBean downBean = new DownBean();
                downBean.name = ResponseAdJarData.TYPE + dataBean.getJarName();
                downBean.md5 = dataBean.getSourceMd5();
                downBean.versionCode = dataBean.getJarVer();
                downBean.size = dataBean.getSourceSize();
                downBean.downloadUrl = dataBean.getSourceUrl();
                downBean.packageName = dataBean.getJarName();
                downBean.isZip = false;
                downBean.threadNum = 1;
                downBean.type = 8;
                String str = (iAdModule.getJarFilePath(context, dataBean.getJarName()) + File.separator + dataBean.getJarName() + ".jar") + ".tmp";
                File file = new File(str);
                if (file.exists()) {
                    file.delete();
                }
                downBean.filePath = str;
                downBean.startPos = new long[]{0};
                downBean.endPos = new long[]{dataBean.getSourceSize() - 1};
                arrayList.add(downBean);
            }
        }
        Log.d("VersionManager", "downloadAdJar: downBeanList size = " + arrayList.size());
        com.excelliance.kxqp.gs.multi.down.a.a(context).a(arrayList);
    }
}