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

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


package com.excelliance.kxqp;

import android.app.Activity;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.android.spush.util.WebActionRouter;
import com.bytedance.sdk.open.aweme.common.constants.ParamKeyConstants;
import com.excean.bytedancebi.bean.BiEventDialogShow;
import com.excean.bytedancebi.bean.BiSendContentEvent;
import com.excean.ggspace.main.R;
import com.excean.view.dialog.ContainerDialog;
import com.excelliance.kxqp.bean.AntiAddictionInfo;
import com.excelliance.kxqp.bean.AppExtraBean;
import com.excelliance.kxqp.bean.LanguagePackageInfo;
import com.excelliance.kxqp.bitmap.bean.RankingItem;
import com.excelliance.kxqp.bitmap.ui.imp.RankingListFragment;
import com.excelliance.kxqp.gs.appstore.model.ResponseData;
import com.excelliance.kxqp.gs.base.b;
import com.excelliance.kxqp.gs.bean.CheckObbVersionUpdateResult;
import com.excelliance.kxqp.gs.bean.CityBean;
import com.excelliance.kxqp.gs.bean.DownloadAreaBean;
import com.excelliance.kxqp.gs.bean.InstallResultcallBack;
import com.excelliance.kxqp.gs.bean.LoginAreaBean;
import com.excelliance.kxqp.gs.bean.ProxyConfigHelper;
import com.excelliance.kxqp.gs.bean.ReginBean;
import com.excelliance.kxqp.gs.dialog.UpdateProgressDialog;
import com.excelliance.kxqp.gs.dialog.ag;
import com.excelliance.kxqp.gs.dialog.ah;
import com.excelliance.kxqp.gs.dialog.at;
import com.excelliance.kxqp.gs.dialog.av;
import com.excelliance.kxqp.gs.dialog.o;
import com.excelliance.kxqp.gs.game.GameAttributesHelper;
import com.excelliance.kxqp.gs.game.GameType;
import com.excelliance.kxqp.gs.gamelanguage.LanguageChangeViewModel;
import com.excelliance.kxqp.gs.gamelanguage.ResponseRemoteAppLanguageInfo;
import com.excelliance.kxqp.gs.k.a.a;
import com.excelliance.kxqp.gs.k.b.b;
import com.excelliance.kxqp.gs.launch.LaunchViewModel;
import com.excelliance.kxqp.gs.launch.a.h;
import com.excelliance.kxqp.gs.main.InitObserver;
import com.excelliance.kxqp.gs.main.MainActivity;
import com.excelliance.kxqp.gs.main.PLTObserver;
import com.excelliance.kxqp.gs.multi.down.model.DownBean;
import com.excelliance.kxqp.gs.receiver.ApkDownloadCompleteReceiver;
import com.excelliance.kxqp.gs.service.ProxyDelayService;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.ui.home.MainFragment;
import com.excelliance.kxqp.gs.util.Upl;
import com.excelliance.kxqp.gs.util.ad;
import com.excelliance.kxqp.gs.util.an;
import com.excelliance.kxqp.gs.util.aq;
import com.excelliance.kxqp.gs.util.as;
import com.excelliance.kxqp.gs.util.au;
import com.excelliance.kxqp.gs.util.ay;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.bf;
import com.excelliance.kxqp.gs.util.bn;
import com.excelliance.kxqp.gs.util.bs;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.gs.util.bz;
import com.excelliance.kxqp.gs.util.cd;
import com.excelliance.kxqp.gs.util.cf;
import com.excelliance.kxqp.gs.util.cg;
import com.excelliance.kxqp.gs.vip.VipIncomeUploadUtil;
import com.excelliance.kxqp.pay.PayManager;
import com.excelliance.kxqp.platforms.ExcellianceAppInfo;
import com.excelliance.kxqp.platforms.gameservice.PlatService;
import com.excelliance.kxqp.sdk.StatisticsBase;
import com.excelliance.kxqp.sdk.StatisticsGS;
import com.excelliance.kxqp.ui.InitialData;
import com.excelliance.kxqp.ui.RippleView;
import com.excelliance.kxqp.ui.detail.category.CategoryListActivity;
import com.excelliance.kxqp.util.ac;
import com.excelliance.kxqp.util.ai;
import com.excelliance.kxqp.util.aj;
import com.excelliance.kxqp.wr.pm;
import com.tencent.connect.common.Constants;
import java.io.File;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlinx.coroutines.DebugKt;
import org.apache.http.cookie.ClientCookie;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class ShortCutActivity extends FragmentActivity {
    private static Map<String, JSONObject> D;

    public static PlatService.ExcelliancePlatHelper f2244a;
    private static Context e;
    private static String g;
    private static String h;
    private static int i;
    private ApkDownloadCompleteReceiver A;
    FrameLayout d;
    private Context f;
    private com.excelliance.kxqp.util.master.d j;
    private ShortCutViewModel k;
    private LanguageChangeViewModel l;
    private LaunchViewModel m;
    private RippleView p;
    private com.excelliance.kxqp.gs.dialog.o q;
    private ImageView r;
    private ExcellianceAppInfo t;
    private SharedPreferences u;
    private a z;

    public final boolean f2245b = true;
    private boolean n = false;
    private boolean o = false;
    public ServiceConnection c = new ServiceConnection() {
        @Override
        public void onServiceDisconnected(ComponentName componentName) {
            ShortCutActivity.f2244a = null;
        }

        @Override
        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
            ShortCutActivity.f2244a = (PlatService.ExcelliancePlatHelper) iBinder;
        }
    };
    private boolean s = false;
    private long v = 0;
    private boolean w = false;
    private Handler x = new Handler(Looper.getMainLooper()) {
        @Override
        public void handleMessage(Message message) {
            Log.d("ShortCutActivity", "handleMessage  msg = " + message.what);
            int i2 = message.what;
            if (i2 == 5) {
                ShortCutActivity.this.finish();
                return;
            }
            if (i2 == 19) {
                Log.d("ShortCutActivity", "msg MSG_THIRD_PARTY_PAY_PLAT");
                PayManager.a((HashMap<String, Object>) message.obj);
                return;
            }
            switch (i2) {
                case 1:
                    Log.d("ShortCutActivity", "msg MSG_REINSTALL_FOR_NEW");
                    String str = (String) message.obj;
                    if (str != null) {
                        ShortCutActivity.this.c(str);
                        return;
                    }
                    return;
                case 2:
                    Log.d("ShortCutActivity", "msg MSG_START_APP");
                    if (ShortCutActivity.this.t != null) {
                        ShortCutActivity.this.s();
                        ShortCutActivity.this.a(ShortCutActivity.this.t, 0);
                        return;
                    }
                    return;
                default:
                    switch (i2) {
                        case 7:
                            break;
                        case 8:
                            ah.a(ShortCutActivity.e).a(ShortCutActivity.this.d);
                            ag.a(ShortCutActivity.e).a(ShortCutActivity.this.d);
                            return;
                        case 9:
                            Bundle data = message.getData();
                            String str2 = (String) data.get("serverVersionCode");
                            Log.d("ShortCutActivity", "serverVersionCode = " + str2);
                            String str3 = (String) data.get("showDialog");
                            by a2 = by.a(ShortCutActivity.e, "download_sp");
                            if (!com.excelliance.kxqp.gs.util.n.a(str2)) {
                                com.excelliance.kxqp.gs.util.g a3 = com.excelliance.kxqp.gs.util.g.a(ShortCutActivity.e);
                                Boolean a4 = a3.a(a3.a(), Integer.parseInt(str2));
                                a2.a("isNewVersion", a4.booleanValue());
                                String b2 = a2.b("isCheckVn", "");
                                String string = data.getString("verName");
                                boolean equals = !TextUtils.isEmpty(string) ? TextUtils.equals(b2, string) : true;
                                if (a4.booleanValue()) {
                                    Message obtainMessage = ShortCutActivity.this.x.obtainMessage(10);
                                    Log.d("ShortCutActivity", "showDialog = " + str3 + " verName: " + string);
                                    if (TextUtils.equals(str3, "2")) {
                                        if (!equals) {
                                            data.putInt(CategoryListActivity.TAG_NAME, 0);
                                            obtainMessage.obj = data;
                                            ShortCutActivity.this.a(obtainMessage);
                                        }
                                    } else if (TextUtils.equals(str3, "3")) {
                                        data.putInt(CategoryListActivity.TAG_NAME, 1);
                                        obtainMessage.obj = data;
                                        ShortCutActivity.this.a(obtainMessage);
                                    }
                                    Intent intent = new Intent();
                                    intent.setAction("HaveNewVersion");
                                    intent.putExtra("msg", "msg");
                                    intent.putExtra("showDialog", str3);
                                    intent.putExtra(ParamKeyConstants.WebViewConstants.QUERY_FROM, "main");
                                    ShortCutActivity.e.sendBroadcast(intent);
                                }
                                ShortCutActivity.e.sendBroadcast(new Intent(ShortCutActivity.e.getPackageName() + "refresh_updatedata"));
                                return;
                            }
                            a2.a("isNewVersion");
                            return;
                        case 10:
                            try {
                                File file = new File(as.a(ShortCutActivity.e) + "/tmpSyncFile");
                                if (file.exists()) {
                                    file.delete();
                                }
                            } catch (Exception e2) {
                                e2.printStackTrace();
                            }
                            ExcellianceAppInfo excellianceAppInfo = (ExcellianceAppInfo) message.obj;
                            if (excellianceAppInfo != null) {
                                boolean b3 = GameUtil.b(excellianceAppInfo.getPath());
                                int i3 = message.arg2;
                                if (i3 <= 0) {
                                    ShortCutActivity.this.a(excellianceAppInfo, b3);
                                    break;
                                } else {
                                    ShortCutActivity.this.a(excellianceAppInfo, b3, i3);
                                    break;
                                }
                            }
                            break;
                        case 11:
                            if (message.arg2 <= 0) {
                                ShortCutActivity.this.a((ExcellianceAppInfo) message.obj, message.arg1);
                                return;
                            } else {
                                ShortCutActivity.this.a((ExcellianceAppInfo) message.obj, message.arg1, message.arg2);
                                return;
                            }
                        case 12:
                            Context context = ShortCutActivity.e;
                            az.d("ShortCutActivity", "handleMessage MSG_GP_CONNECTION_REGIN");
                            int i4 = message.arg1;
                            String str4 = "";
                            String str5 = (String) message.obj;
                            if (i4 == -3) {
                                com.excelliance.kxqp.gs.util.w.e(context, "no_boost_regin");
                                str4 = com.excelliance.kxqp.gs.util.w.e(context, "net_unusable");
                            } else if (i4 == 1) {
                                com.excelliance.kxqp.gs.util.w.e(ShortCutActivity.e, "boost_regin");
                                int u = as.u(ShortCutActivity.e);
                                String c = u >= 0 ? as.c(context, u) : null;
                                str4 = (TextUtils.isEmpty(c) || TextUtils.equals(c, str5)) ? String.format(ShortCutActivity.e.getString(R.string.boost_success), str5) : String.format(ShortCutActivity.e.getString(R.string.optimal_special_proxy_content_toast), c, str5);
                            } else if (i4 == -2) {
                                str5 = com.excelliance.kxqp.gs.util.w.e(context, "noconnection");
                                com.excelliance.kxqp.gs.util.w.e(context, "no_boost_regin");
                                str4 = com.excelliance.kxqp.gs.util.w.e(context, "noconnection_success");
                            } else if (i4 == 0) {
                                com.excelliance.kxqp.gs.util.w.e(context, "no_boost_regin");
                                str4 = com.excelliance.kxqp.gs.util.w.e(context, "boost_failure2");
                            } else if (i4 == -1) {
                                com.excelliance.kxqp.gs.util.w.e(context, "no_boost_regin");
                                str4 = com.excelliance.kxqp.gs.util.w.e(context, "no_need_connect");
                            }
                            if (!TextUtils.isEmpty(str5) && str5.equals(com.excelliance.kxqp.gs.util.w.e(context, "noconnection"))) {
                                com.excelliance.kxqp.gs.util.w.e(context, "no_boost_regin");
                            }
                            if ((message.arg2 & 1) == 1) {
                                Toast.makeText(context, str4, 1).show();
                                return;
                            }
                            return;
                        case 13:
                            ShortCutActivity.this.i();
                            return;
                        case 14:
                            cg.a(ShortCutActivity.e, "环境异常,请稍后重试");
                            ShortCutActivity.this.x.sendMessage(ShortCutActivity.this.x.obtainMessage(8));
                            ShortCutActivity.this.finish();
                            return;
                        default:
                            return;
                    }
                    Object obj = message.obj;
                    az.i("ShortCutActivity", "handleMessage: " + obj);
                    if (obj != null) {
                        int i5 = message.arg1;
                        ExcellianceAppInfo excellianceAppInfo2 = (ExcellianceAppInfo) obj;
                        String appPackageName = excellianceAppInfo2.getAppPackageName();
                        az.o("Open", "[" + excellianceAppInfo2.getAppName() + "/" + appPackageName + "]");
                        au.a().c(appPackageName, ShortCutActivity.e);
                        ShortCutActivity.this.a(excellianceAppInfo2, i5);
                        return;
                    }
                    return;
            }
        }
    };
    private boolean y = false;
    private final Observer<AntiAddictionInfo> B = new AnonymousClass34();
    private Observer<LanguagePackageInfo> C = new Observer<LanguagePackageInfo>() {
        @Override
        public void onChanged(LanguagePackageInfo languagePackageInfo) {
            az.d("ShortCutActivity", String.format("mLanguagePackageInfoObserver/onChanged:thread(%s)", Thread.currentThread().getName()));
            if (languagePackageInfo != null) {
                az.i("ShortCutActivity", "mLanguagePackageInfoObserver/languagePackageInfo: " + languagePackageInfo);
                switch (languagePackageInfo.downloadStatus) {
                    case 0:
                    case 1:
                        if (ShortCutActivity.this.n) {
                            ShortCutActivity.this.n = false;
                            az.i("ShortCutActivity", "mLanguagePackageInfoObserver/alreadyAutoSet: " + by.a(ShortCutActivity.e, "sp_total_info").b("sp_key_pkg_language_has_auto_set_" + ShortCutActivity.this.t.getAppPackageName(), false).booleanValue());
                            if (languagePackageInfo.languageType == 1 && languagePackageInfo.downloadStatus == 1 && languagePackageInfo.languageVersion > 0) {
                                ShortCutActivity.this.a(ShortCutActivity.this.t, 1, 0, false);
                                return;
                            }
                            return;
                        }
                        return;
                    default:
                        return;
                }
            }
        }
    };
    private boolean E = false;

    public void s() {
    }

    public void a(final ExcellianceAppInfo excellianceAppInfo, final int i2) {
        av.a(getContext(), new av.a() {
            @Override
            public void a(boolean z) {
                if (z) {
                    return;
                }
                ShortCutActivity.this.a(excellianceAppInfo, i2, 0);
            }
        });
    }

    public void a(ExcellianceAppInfo excellianceAppInfo, int i2, int i3) {
        a(excellianceAppInfo, i2, i3, true);
    }

    public void a(ExcellianceAppInfo excellianceAppInfo, int i2, int i3, boolean z) {
        az.d("ShortCutActivity", "startAppGame whenSpeedStartAppActionGpOrPG: pkg:" + excellianceAppInfo.getAppPackageName() + ", checkLanguage = " + z + ", animtion = " + i2 + ", accountAffinity = " + i3);
        if (z) {
            AppExtraBean d = com.excelliance.kxqp.repository.a.a(e).d(excellianceAppInfo.getAppPackageName());
            int supportChangeLanguage = d != null ? d.getSupportChangeLanguage() : 0;
            if (supportChangeLanguage > 0) {
                tp.f(new AnonymousClass33(excellianceAppInfo, supportChangeLanguage, d, i2, i3));
                return;
            }
        }
        as.y(e, excellianceAppInfo.getAppPackageName());
        a(excellianceAppInfo);
        if (TextUtils.equals(excellianceAppInfo.getAppPackageName(), "com.studiowildcard.wardrumstudios.ark")) {
            List<com.excelliance.kxqp.gs.ui.account.c> f = as.f();
            az.d("ShortCutActivity", "startAppGame allAccounts1: " + f);
            if (f != null) {
                Iterator<com.excelliance.kxqp.gs.ui.account.c> it = f.iterator();
                while (it.hasNext()) {
                    az.d("ShortCutActivity", "startAppGame allAccounts2: " + it.next());
                }
            }
            if (f == null || f.size() <= 0) {
                Message message = new Message();
                message.what = 1;
                a(message);
                return;
            }
        }
        if (e == null) {
            return;
        }
        if (i2 == 1) {
            b(excellianceAppInfo.getAppPackageName());
        }
        a(excellianceAppInfo, true, i3);
    }

    public class AnonymousClass33 implements Runnable {

        final ExcellianceAppInfo f2289a;

        final int f2290b;
        final AppExtraBean c;
        final int d;
        final int e;

        AnonymousClass33(ExcellianceAppInfo excellianceAppInfo, int i, AppExtraBean appExtraBean, int i2, int i3) {
            this.f2289a = excellianceAppInfo;
            this.f2290b = i;
            this.c = appExtraBean;
            this.d = i2;
            this.e = i3;
        }

        @Override
        public void run() {
            ResponseData<ResponseRemoteAppLanguageInfo> a2;
            LanguagePackageInfo q;
            boolean booleanValue = by.a(ShortCutActivity.e, "sp_total_info").b("sp_key_pkg_language_has_auto_set_" + this.f2289a.getAppPackageName(), false).booleanValue();
            HashMap<String, String> n = pm.c().n(0, this.f2289a.getAppPackageName());
            boolean z = n != null && n.size() > 0;
            boolean z2 = this.f2290b == 2 && !booleanValue;
            if (!z && (q = com.excelliance.kxqp.repository.a.a(ShortCutActivity.e).q(this.f2289a.getAppPackageName())) != null && q.languageType == 1) {
                z = true;
            }
            if ((z2 || z) && (a2 = com.excelliance.kxqp.gs.gamelanguage.h.a(ShortCutActivity.e.getApplicationContext()).a(false, this.f2289a.getAppPackageName(), !z2)) != null && a2.data != null && a2.code == 1) {
                if (by.a(ShortCutActivity.e, "sp_total_info").b("sp_key_pkg_language_cancel_auto_set_" + this.f2289a.getAppPackageName(), false).booleanValue()) {
                    by.a(ShortCutActivity.e, "sp_total_info").a("sp_key_pkg_language_cancel_auto_set_" + this.f2289a.getAppPackageName());
                }
                ResponseRemoteAppLanguageInfo responseRemoteAppLanguageInfo = a2.data;
                if (responseRemoteAppLanguageInfo != null && responseRemoteAppLanguageInfo.size > 0 && responseRemoteAppLanguageInfo.versionCode > 0) {
                    ShortCutActivity.this.n = true;
                    com.excelliance.kxqp.gs.gamelanguage.k.a(ShortCutActivity.e.getApplicationContext()).a(a2.data);
                    io.reactivex.i.b(new h.b.a().a(ShortCutActivity.this.m).a(this.f2289a).a(this.c).a()).c(new io.reactivex.d.g<h.b>() {
                        @Override
                        public boolean a(h.b bVar) throws Exception {
                            return true;
                        }
                    }).a(new com.excelliance.kxqp.gs.launch.function.v()).a(new io.reactivex.d.d<h.b>() {
                        @Override
                        public void accept(h.b bVar) throws Exception {
                            az.i("ShortCutActivity", "startAppGame/onNext() called with: thread = 【" + Thread.currentThread() + "】, request = 【" + bVar + "】");
                            ShortCutActivity.this.n = false;
                            tp.i(new Runnable() {
                                @Override
                                public void run() {
                                    ShortCutActivity.this.a(AnonymousClass33.this.f2289a, AnonymousClass33.this.d, AnonymousClass33.this.e, false);
                                }
                            });
                        }
                    }, new io.reactivex.d.d<Throwable>() {
                        @Override
                        public void accept(Throwable th) throws Exception {
                            az.i("ShortCutActivity", "startAppGame/onError() called with: thread = 【" + Thread.currentThread() + "】, t = 【" + th + "】");
                            ShortCutActivity.this.n = false;
                            tp.i(new Runnable() {
                                @Override
                                public void run() {
                                    ShortCutActivity.this.a(AnonymousClass33.this.f2289a, AnonymousClass33.this.d, AnonymousClass33.this.e, false);
                                }
                            });
                        }
                    });
                }
            }
            if (ShortCutActivity.this.n) {
                return;
            }
            tp.i(new Runnable() {
                @Override
                public void run() {
                    ShortCutActivity.this.a(AnonymousClass33.this.f2289a, AnonymousClass33.this.d, AnonymousClass33.this.e, false);
                }
            });
        }
    }

    public static Context getContext() {
        return e;
    }

    @Override
    public void onCreate(Bundle bundle) {
        az.d("ShortCutActivityLT", "onCreate()");
        super.onCreate(bundle);
        e = this;
        h = getIntent().getStringExtra("gamelib");
        this.t = com.excelliance.kxqp.repository.a.a(e).b(h);
        if (this.t == null) {
            finish();
            return;
        }
        this.l = (LanguageChangeViewModel) ViewModelProviders.of(this).get(LanguageChangeViewModel.class);
        this.l.a(e.getApplicationContext(), com.excelliance.kxqp.gs.gamelanguage.h.a(e.getApplicationContext()), com.excelliance.kxqp.repository.a.a(e.getApplicationContext()));
        this.l.a(this.t.getAppPackageName()).observe(this, this.C);
        this.m = (LaunchViewModel) ViewModelProviders.of(this).get(LaunchViewModel.class);
        this.m.a(this);
        boolean booleanValue = by.a(e, "sp_config").b("sp_key_anti_addiction_system_switch", false).booleanValue();
        if (this.t.isLy == 1 || !booleanValue) {
            g();
            return;
        }
        GameType gameType = au.b().get(this.t.getAppPackageName());
        if (gameType != null && gameType.getExt() != null && (gameType.getExt().intValue() & 1048576) == 1048576) {
            g();
            return;
        }
        this.o = true;
        this.k = (ShortCutViewModel) ViewModelProviders.of(this).get(ShortCutViewModel.class);
        this.k.a(this.t.appPackageName, e);
        this.k.a().observe(this, this.B);
    }

    class AnonymousClass34 implements Observer<AntiAddictionInfo> {
        AnonymousClass34() {
        }

        @Override
        public void onChanged(AntiAddictionInfo antiAddictionInfo) {
            final SharedPreferences sharedPreferences = ShortCutActivity.e.getSharedPreferences("USERINFO", 0);
            final bx a2 = bx.a();
            Log.d("ShortCutActivity", "onChanged: antiAddictionInfo::" + antiAddictionInfo);
            if (!(ShortCutActivity.e instanceof Activity) || ((Activity) ShortCutActivity.e).isFinishing()) {
                return;
            }
            if (antiAddictionInfo.result == 3) {
                if (antiAddictionInfo.isVerified) {
                    com.excelliance.kxqp.gs.launch.function.x.a(ShortCutActivity.e, ShortCutActivity.this.t.appPackageName);
                }
                ShortCutActivity.this.g();
                ShortCutActivity.this.l();
                return;
            }
            if ((antiAddictionInfo.result == 0 || antiAddictionInfo.result == 2) && !antiAddictionInfo.isVerified) {
                ShortCutActivity.this.a(ShortCutActivity.e, new ai.b() {
                    @Override
                    public void run() {
                    }

                    @Override
                    public void a(String str, String str2) {
                        if (ShortCutActivity.this.k != null) {
                            ShortCutActivity.this.k.a(ShortCutActivity.this, str, str2, new Runnable() {
                                @Override
                                public void run() {
                                    ai.a().c();
                                    by.a(ShortCutActivity.e, "sp_config").a("sp_key_start_game_but_not_accelerate", false);
                                    com.excelliance.kxqp.gs.launch.function.x.a(ShortCutActivity.e, ShortCutActivity.this.t.appPackageName);
                                    String string = ShortCutActivity.e.getString(R.string.real_name_verify_success);
                                    cg.a(ShortCutActivity.e, string);
                                    BiSendContentEvent biSendContentEvent = new BiSendContentEvent();
                                    biSendContentEvent.current_page = "快捷方式";
                                    biSendContentEvent.content_type = "实名认证";
                                    com.excelliance.kxqp.gs.g.c.a().a(biSendContentEvent);
                                    BiEventDialogShow biEventDialogShow = new BiEventDialogShow();
                                    biEventDialogShow.current_page = "快捷方式";
                                    biEventDialogShow.dialog_type = "toast";
                                    biEventDialogShow.toast_name = string;
                                    com.excelliance.kxqp.gs.g.c.a().a(biEventDialogShow);
                                    ShortCutActivity.this.g();
                                    ShortCutActivity.this.l();
                                    a2.a(sharedPreferences, "USER_REAL_NAME_VERIFY", 1);
                                    ai.a();
                                    ai.b(ShortCutActivity.e);
                                }
                            });
                        }
                    }
                });
                return;
            }
            if (antiAddictionInfo.result == 1 && !antiAddictionInfo.isVerified) {
                ShortCutActivity.this.a(ShortCutActivity.e, new Runnable() {
                    @Override
                    public void run() {
                        by.a(ShortCutActivity.e, "sp_config").a("sp_key_start_game_but_not_accelerate", true);
                        com.excelliance.kxqp.gs.launch.function.x.b(ShortCutActivity.e, ShortCutActivity.this.t.appPackageName);
                        ShortCutActivity.this.g();
                        ShortCutActivity.this.l();
                    }
                }, new ai.b() {
                    @Override
                    public void run() {
                    }

                    @Override
                    public void a(String str, String str2) {
                        if (ShortCutActivity.this.k != null) {
                            ShortCutActivity.this.k.a(ShortCutActivity.this, str, str2, new Runnable() {
                                @Override
                                public void run() {
                                    ai.a().c();
                                    by.a(ShortCutActivity.e, "sp_config").a("sp_key_start_game_but_not_accelerate", false);
                                    String string = ShortCutActivity.e.getString(R.string.real_name_verify_success);
                                    cg.a(ShortCutActivity.e, string);
                                    BiSendContentEvent biSendContentEvent = new BiSendContentEvent();
                                    biSendContentEvent.current_page = "快捷方式";
                                    biSendContentEvent.content_type = "实名认证";
                                    com.excelliance.kxqp.gs.g.c.a().a(biSendContentEvent);
                                    BiEventDialogShow biEventDialogShow = new BiEventDialogShow();
                                    biEventDialogShow.current_page = "快捷方式";
                                    biEventDialogShow.dialog_type = "toast";
                                    biEventDialogShow.toast_name = string;
                                    com.excelliance.kxqp.gs.g.c.a().a(biEventDialogShow);
                                    com.excelliance.kxqp.gs.launch.function.x.a(ShortCutActivity.e, ShortCutActivity.this.t.appPackageName);
                                    ShortCutActivity.this.g();
                                    ShortCutActivity.this.l();
                                    a2.a(sharedPreferences, "USER_REAL_NAME_VERIFY", 1);
                                }
                            });
                        }
                    }
                });
                return;
            }
            if (antiAddictionInfo.isVerified) {
                com.excelliance.kxqp.gs.launch.function.x.a(ShortCutActivity.e, ShortCutActivity.this.t.appPackageName);
            }
            ShortCutActivity.this.g();
            ShortCutActivity.this.l();
        }
    }

    public void g() {
        this.f = getApplicationContext();
        this.y = false;
        aq.a(e);
        new PLTObserver(this).initPLT();
        com.excelliance.kxqp.manager.d.a(this).a();
        getLifecycle().addObserver(new InitObserver(this));
        ProxyDelayService.c(e);
        tp.f(new Runnable() {
            @Override
            public void run() {
                com.excelliance.kxqp.bitmap.a.a.a(ShortCutActivity.e, false);
            }
        });
        if (this.j == null) {
            this.j = new com.excelliance.kxqp.util.master.d(e);
        }
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("com.excean.gspace.run_app_resume");
        intentFilter.addAction(Constants.VIA_REPORT_TYPE_SET_AVATAR);
        intentFilter.addAction(e.getPackageName() + RankingListFragment.OPERATE_TOURIST_GAME);
        this.z = new a();
        registerReceiver(this.z, intentFilter);
        int identifier = getResources().getIdentifier("activty_start_app", "layout", getPackageName());
        if (identifier > 0) {
            setContentView(identifier);
        }
        this.d = (FrameLayout) findViewById(com.excelliance.kxqp.gs.util.w.d(this, "fram_layout"));
        this.r = (ImageView) findViewById(getResources().getIdentifier("circle_img", "id", getPackageName()));
        this.p = new RippleView(this);
        GameUtil.getIntance().q(this);
        if (GameUtil.getIntance().r() <= 0) {
            Log.d("ShortCutActivity", "onCreate: not exists rpid");
        }
        g = getIntent().getStringExtra("gameid");
        i = getIntent().getIntExtra("user", 0);
        GameUtil.getIntance().a(this);
        az.d("ShortCutActivity", "mAppInfo:" + this.t);
        this.u = getSharedPreferences("USERINFO", Build.VERSION.SDK_INT < 11 ? 0 : 4);
        boolean c = aj.a().c(this);
        boolean z = this.u.getBoolean("OFFLINE_NOTICE", false);
        Log.d("ShortCutActivity", "是否请求");
        if (c && !z && this.t != null && this.t.getUid() != 0) {
            Log.d("ShortCutActivity", "请求");
            k();
        }
        StatisticsGS.getInstance().uploadUserAction(e, StatisticsBase.UA_LAUNCH_XSPACE, 2, 1);
    }

    public void h() {
        Bundle a2 = by.a(e, "sp_new_version_info").a();
        String str = (String) a2.get("serverVersionCode");
        Log.d("ShortCutActivity", "serverVersionCode = " + str);
        String str2 = (String) a2.get("showDialog");
        by a3 = by.a(e, "download_sp");
        if (bs.c() && bs.p(e)) {
            str = "";
        }
        if (!com.excelliance.kxqp.gs.util.n.a(str)) {
            boolean z = a2.getShort("b64", (short) 0) == 1;
            com.excelliance.kxqp.gs.util.g a4 = com.excelliance.kxqp.gs.util.g.a(e);
            int a5 = a4.a(z);
            Boolean a6 = a4.a(a5, Integer.parseInt(str));
            a3.a("isNewVersion", a6.booleanValue());
            StringBuilder sb = new StringBuilder();
            sb.append("isCheckVn");
            sb.append(z ? "_b64" : "");
            String b2 = a3.b(sb.toString(), "");
            String string = a2.getString("verName");
            boolean equals = !TextUtils.isEmpty(string) ? TextUtils.equals(b2, string) : true;
            int a7 = com.excelliance.kxqp.util.master.d.a(e, z ? com.excelliance.kxqp.util.master.e.b(e) : e.getPackageName(), a5);
            Boolean valueOf = Boolean.valueOf(z ? false : a4.a(a7, Integer.parseInt(str)).booleanValue());
            if (a6.booleanValue()) {
                final Message obtainMessage = this.x.obtainMessage(10);
                Log.d("ShortCutActivity", "showDialog = " + str2 + " verName: " + string);
                if (TextUtils.equals(str2, "2")) {
                    if (!equals) {
                        if (!a6.booleanValue() && valueOf.booleanValue()) {
                            a2.putInt("_lastVer", a7);
                            a2.putInt("serverVersionCode_lastVer", Integer.parseInt(str));
                        }
                        a2.putInt(CategoryListActivity.TAG_NAME, 0);
                        obtainMessage.obj = a2;
                        tp.i(new Runnable() {
                            @Override
                            public void run() {
                                if (ShortCutActivity.this.isDestroyed()) {
                                    return;
                                }
                                ShortCutActivity.this.a(obtainMessage);
                            }
                        });
                    }
                } else if (TextUtils.equals(str2, "3")) {
                    if (!a6.booleanValue() && valueOf.booleanValue()) {
                        a2.putInt("_lastVer", a7);
                        a2.putInt("serverVersionCode_lastVer", Integer.parseInt(str));
                    }
                    a2.putInt(CategoryListActivity.TAG_NAME, 1);
                    obtainMessage.obj = a2;
                    tp.i(new Runnable() {
                        @Override
                        public void run() {
                            ShortCutActivity.this.a(obtainMessage);
                        }
                    });
                }
                Intent intent = new Intent();
                intent.setAction("HaveNewVersion");
                intent.putExtra("msg", "msg");
                intent.putExtra("showDialog", str2);
                intent.putExtra(ParamKeyConstants.WebViewConstants.QUERY_FROM, "main");
                e.sendBroadcast(intent);
            }
            e.sendBroadcast(new Intent(e.getPackageName() + "refresh_updatedata"));
            return;
        }
        a3.a("isNewVersion");
    }

    public boolean a(String str, CheckObbVersionUpdateResult checkObbVersionUpdateResult) {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        String b2 = by.a(e, "request_update_data").b("request_obb_update_data", "");
        if (!TextUtils.isEmpty(b2)) {
            try {
                az.d("ShortCutActivity", "requestUpdateDataObb: " + b2);
                JSONArray a2 = ay.a(b2, e);
                az.d("ShortCutActivity", "requestUpdateDataObb: " + a2);
                if (a2 != null) {
                    for (int i2 = 0; i2 < a2.length(); i2++) {
                        JSONObject optJSONObject = a2.optJSONObject(i2);
                        az.d("ShortCutActivity", "requestUpdateDataObb: " + optJSONObject);
                        if (optJSONObject != null) {
                            linkedHashMap.put(optJSONObject.optString(WebActionRouter.KEY_PKG), optJSONObject);
                        }
                    }
                }
                if (!linkedHashMap.containsKey(str)) {
                    CheckObbVersionUpdateResult.setNormalType(checkObbVersionUpdateResult);
                    return false;
                }
                D = linkedHashMap;
                JSONObject updateNoPropData = com.excelliance.kxqp.bitmap.bean.ResponseData.getUpdateNoPropData(e);
                JSONObject optJSONObject2 = updateNoPropData != null ? updateNoPropData.optJSONObject(str + com.excelliance.kxqp.bitmap.bean.ResponseData.KEY_OBB_SUFFIX) : null;
                JSONObject jSONObject = (JSONObject) linkedHashMap.get(str);
                JSONObject optJSONObject3 = jSONObject.optJSONObject("main");
                JSONObject optJSONObject4 = jSONObject.optJSONObject(ExcellianceAppInfo.KEY_PATCH);
                int optInt = jSONObject.optInt(RankingItem.KEY_VER);
                int optInt2 = jSONObject.optInt("appId");
                az.d("ShortCutActivity", "downloadObb main: " + optJSONObject3 + " patch: " + optJSONObject4 + " versionCode: " + optInt);
                ExcellianceAppInfo a3 = InitialData.a(e).a(-1, 0, str);
                if ((a3 != null && a3.getVersionCode() != optInt) || (optJSONObject2 != null && optJSONObject2.optInt(RankingItem.KEY_VER) == optInt)) {
                    CheckObbVersionUpdateResult.setNormalType(checkObbVersionUpdateResult);
                    return false;
                }
                if (!com.excelliance.kxqp.gs.util.b.S(e) || optInt2 == 0) {
                    if (optJSONObject3 != null) {
                        DownBean b3 = ay.b(optJSONObject3, e, str, "main.", optInt);
                        File file = new File(b3.filePath);
                        az.d("ShortCutActivity", b3 + "\t" + file.exists());
                        if (file.exists()) {
                            String a4 = an.a(b3.filePath);
                            Log.d("ShortCutActivity", "isUpdateObb: " + a4 + "\t" + b3.md5);
                            if (!TextUtils.isEmpty(a4) && !TextUtils.equals(a4, b3.md5)) {
                                CheckObbVersionUpdateResult.setUpdateType(checkObbVersionUpdateResult);
                                return true;
                            }
                        } else {
                            CheckObbVersionUpdateResult.setHiatusType(checkObbVersionUpdateResult);
                            return true;
                        }
                    }
                    if (optJSONObject4 != null) {
                        DownBean b4 = ay.b(optJSONObject4, e, str, "patch.", optInt);
                        if (new File(b4.filePath).exists()) {
                            String a5 = an.a(b4.filePath);
                            if (!TextUtils.isEmpty(a5) && !TextUtils.equals(a5, b4.md5)) {
                                CheckObbVersionUpdateResult.setUpdateType(checkObbVersionUpdateResult);
                                return true;
                            }
                        } else {
                            CheckObbVersionUpdateResult.setHiatusType(checkObbVersionUpdateResult);
                            return true;
                        }
                    }
                } else {
                    az.d("ShortCutActivity", "isUpdateObb yalp main: " + optJSONObject3 + " patch: " + optJSONObject4 + " versionCode: " + optInt);
                    com.excelliance.kxqp.gs.m.a.f b5 = com.excelliance.kxqp.gs.m.d.a.a().b(e, "appId", String.valueOf(optInt2));
                    if (b5 != null) {
                        if (optJSONObject3 == null || b5.c()) {
                            az.d("ShortCutActivity", "isUpdateObb mainobb is null content: " + jSONObject.toString());
                        } else {
                            com.excelliance.kxqp.gs.m.a.c cVar = b5.p;
                            if (new File(cVar.g).exists() && cVar.e != null) {
                                String b6 = com.excelliance.kxqp.util.master.e.b(e, str, cVar.g);
                                if (TextUtils.isEmpty(b6)) {
                                    b6 = an.a(e, cVar.g, str, Arrays.toString(cVar.e));
                                }
                                if (!TextUtils.isEmpty(b6) && !TextUtils.equals(b6, Arrays.toString(cVar.e))) {
                                    Log.e("ShortCutActivity", "isUpdateObb: main" + optInt + "\t" + Arrays.toString(cVar.e));
                                    CheckObbVersionUpdateResult.setUpdateType(checkObbVersionUpdateResult);
                                    return true;
                                }
                            } else {
                                Log.e("ShortCutActivity", "isUpdateObb: main" + optInt);
                                CheckObbVersionUpdateResult.setHiatusType(checkObbVersionUpdateResult);
                                return true;
                            }
                        }
                        if (optJSONObject4 != null) {
                            com.excelliance.kxqp.gs.m.a.c cVar2 = b5.q;
                            if (new File(cVar2.g).exists() && cVar2.e != null) {
                                String b7 = com.excelliance.kxqp.util.master.e.b(e, str, cVar2.g);
                                if (TextUtils.isEmpty(b7)) {
                                    b7 = an.a(e, cVar2.g, str, Arrays.toString(cVar2.e));
                                }
                                if (!TextUtils.isEmpty(b7) && !TextUtils.equals(b7, Arrays.toString(cVar2.e))) {
                                    Log.e("ShortCutActivity", "isUpdateObb: patch" + optInt + "\t" + Arrays.toString(cVar2.e));
                                    CheckObbVersionUpdateResult.setUpdateType(checkObbVersionUpdateResult);
                                    return true;
                                }
                            } else {
                                Log.e("ShortCutActivity", "isUpdateObb: patch" + optInt);
                                CheckObbVersionUpdateResult.setHiatusType(checkObbVersionUpdateResult);
                                return true;
                            }
                        } else {
                            az.d("ShortCutActivity", "isUpdateObb patchobb is null content: " + jSONObject.toString());
                        }
                    } else {
                        az.d("ShortCutActivity", "isUpdateObb yapp is null content: " + jSONObject.toString());
                    }
                }
                CheckObbVersionUpdateResult.setNormalType(checkObbVersionUpdateResult);
                return false;
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
        CheckObbVersionUpdateResult.setNormalType(checkObbVersionUpdateResult);
        return false;
    }

    public class AnonymousClass2 implements Runnable {
        AnonymousClass2() {
        }

        @Override
        public void run() {
            if (com.excelliance.kxqp.gs.launch.function.e.a(ShortCutActivity.e, ShortCutActivity.this.t.getAppPackageName())) {
                Log.d("ShortCutActivity", String.format("ShortCutActivity/startAppAsync run:thread(%s) need fix", Thread.currentThread().getName()));
                tp.i(new Runnable() {
                    @Override
                    public void run() {
                        new ContainerDialog.a().a(ShortCutActivity.e.getString(R.string.tips)).b(ShortCutActivity.e.getString(R.string.this_app_need_fix_before_use)).d(ShortCutActivity.e.getString(R.string.cancel)).e(ShortCutActivity.e.getString(R.string.go_to_fix)).a(new ContainerDialog.b() {
                            @Override
                            public void a(DialogFragment dialogFragment) {
                                dialogFragment.dismiss();
                                ShortCutActivity.this.finish();
                            }
                        }).b(new ContainerDialog.b() {
                            @Override
                            public void a(DialogFragment dialogFragment) {
                                ShortCutActivity.e.startActivity(ShortCutActivity.e.getPackageManager().getLaunchIntentForPackage(ShortCutActivity.e.getPackageName()));
                                dialogFragment.dismiss();
                                ShortCutActivity.this.finish();
                            }
                        }).a().show(ShortCutActivity.this.getSupportFragmentManager(), "FixGameDialog");
                    }
                });
            } else {
                ShortCutActivity.this.a();
            }
        }
    }

    public void i() {
        tp.b(new AnonymousClass2());
    }

    public void a() {
        boolean z;
        boolean z2;
        boolean z3 = true;
        if (MainFragment.q() != null && as.d(e, false)) {
            if (this.t != null) {
                String path = this.t.getPath();
                String appPackageName = this.t.getAppPackageName();
                if (!TextUtils.isEmpty(path)) {
                    boolean b2 = GameAttributesHelper.b(e, appPackageName, path, true);
                    Log.d("ShortCutActivity", "onItemClick libName: " + appPackageName + " isDependOnGms: " + b2);
                    z = b2 ^ true;
                    File file = new File(path);
                    if (com.excelliance.kxqp.gs.util.b.U(e) && (bn.d(path) || (!cd.a(path) && file.isDirectory()))) {
                        az.d("ShortCutActivity", "split path: " + path);
                        if (file.exists()) {
                        }
                        z2 = true;
                    } else {
                        if (file.exists()) {
                            if (file.isFile()) {
                            }
                        }
                        z2 = true;
                    }
                    Log.d("ShortCutActivity", "onItemClick: " + z2);
                }
            }
            z = false;
            if (!z) {
                cf.a(e, e.getString(R.string.prepare_environment), 0);
                StatisticsGS.getInstance().uploadUserAction(e, 39);
                finish();
                return;
            }
        }
        if (TextUtils.equals(this.t.getGameType(), "1") || TextUtils.equals(this.t.getGameType(), "5")) {
            Bundle bundle = new Bundle();
            bundle.putString(WebActionRouter.KEY_PKG, this.t.getAppPackageName());
            bundle.putString(ClientCookie.PATH_ATTR, this.t.getPath());
            AppExtraBean d = com.excelliance.kxqp.util.master.e.d(e, this.t.getAppPackageName(), this.t.getUid());
            az.d("ShortCutActivity", String.format("ShortCutActivity/startApp:thread(%s) appExtraInfo(%s)", Thread.currentThread().getName(), d));
            int i2 = -1;
            if (d.getDepend64() == 1) {
                bundle.putInt("cpu", 2);
                i2 = 2;
            }
            if (d.getCpu() == 2) {
                bundle.putInt("cpu", d.getCpu());
                i2 = 2;
            }
            if (com.excelliance.kxqp.gs.ui.home.b.a(e).a(e, i2, this.t.getPath(), this.t.getAppPackageName())) {
                new ContainerDialog.a().a(e.getString(R.string.tips)).b(e.getString(R.string.this_app_need_download_assistant_before_use)).d(e.getString(R.string.cancel)).e(e.getString(R.string.task_to_be_start)).a(new ContainerDialog.b() {
                    @Override
                    public void a(DialogFragment dialogFragment) {
                        dialogFragment.dismiss();
                    }
                }).b(new ContainerDialog.b() {
                    @Override
                    public void a(DialogFragment dialogFragment) {
                        ShortCutActivity.e.startActivity(ShortCutActivity.e.getPackageManager().getLaunchIntentForPackage(ShortCutActivity.e.getPackageName()));
                        dialogFragment.dismiss();
                        ShortCutActivity.this.finish();
                    }
                }).a().show(getSupportFragmentManager(), "NeedDownloadDialog");
                return;
            }
            File file2 = new File(this.t.getPath());
            if (com.excelliance.kxqp.gs.util.b.U(e) && (bn.d(this.t.getPath()) || (!cd.a(this.t.getPath()) && file2.isDirectory()))) {
                az.d("ShortCutActivity", "split 1 path: " + this.t.getPath());
                if (file2.exists()) {
                }
                if (!TextUtils.equals(this.t.getGameType(), "1")) {
                }
                if (!z3) {
                    finish();
                    return;
                }
            } else {
                if (file2.exists()) {
                    if (file2.isFile()) {
                    }
                }
                if (!TextUtils.equals(this.t.getGameType(), "1") && z3) {
                    com.excelliance.kxqp.bitmap.ui.b.b.a(e, this.t.getAppPackageName(), as.z(e), false);
                    finish();
                    return;
                } else if (!z3 && com.excelliance.kxqp.util.master.e.a(this.t.getPath()) && this.j != null && this.j.b()) {
                    finish();
                    return;
                }
            }
        }
        if (TextUtils.equals("7", this.t.getGameType()) || this.t.loseObb()) {
            int downloadStatus = this.t.getDownloadStatus();
            Log.e("ShortCutActivity", "downloadStatus: " + downloadStatus);
            if (downloadStatus == 4) {
                cf.a(e, e.getString(R.string.update_now), 0);
                finish();
                return;
            } else {
                cf.a(e, e.getString(R.string.installing_now), 0);
                finish();
                return;
            }
        }
        au a2 = au.a();
        final int c = a2.c(this.t.getAppPackageName());
        Log.d("ShortCutActivity", "startApp: type = " + c);
        if (a2.a(c)) {
            StatisticsGS.getInstance().uploadUserAction(e, 16, this.t.getAppPackageName());
            tp.i(new Runnable() {
                @Override
                public void run() {
                    ShortCutActivity.this.a(c);
                }
            });
            return;
        }
        if (com.excelliance.kxqp.bitmap.bean.ResponseData.getStartDownloadPkg(e).contains(this.t.getAppPackageName())) {
            Log.d("ShortCutActivity", "rankStatisticsGS onItemClick: UA_OPEN_APP " + this.t.getAppPackageName());
            StatisticsGS.getInstance().uploadUserAction(e, 93, this.t.getAppPackageName());
        }
        boolean isAppCompliant = this.t.isAppCompliant();
        final CheckObbVersionUpdateResult checkObbVersionUpdateResult = new CheckObbVersionUpdateResult();
        if (isAppCompliant && com.excelliance.kxqp.bitmap.a.a.b(e, this.t.getAppPackageName()).update) {
            tp.i(new Runnable() {
                @Override
                public void run() {
                    ShortCutActivity.this.j();
                }
            });
        } else if (isAppCompliant && a(this.t.getAppPackageName(), checkObbVersionUpdateResult)) {
            tp.i(new Runnable() {
                @Override
                public void run() {
                    ShortCutActivity.this.a(checkObbVersionUpdateResult);
                }
            });
        } else {
            tp.i(new Runnable() {
                @Override
                public void run() {
                    ShortCutActivity.this.a(ShortCutActivity.this.t, 1);
                }
            });
        }
    }

    public void j() {
        final boolean z;
        boolean z2;
        JSONObject jSONObject;
        final com.excelliance.kxqp.gs.dialog.as asVar = new com.excelliance.kxqp.gs.dialog.as(e, com.excelliance.kxqp.gs.util.w.o(e, "theme_dialog_no_title2"));
        if (com.excelliance.kxqp.bitmap.a.f2685a == null || (jSONObject = com.excelliance.kxqp.bitmap.a.f2685a.get(this.t.getAppPackageName())) == null) {
            z = false;
            z2 = false;
        } else {
            z2 = com.excelliance.kxqp.bitmap.a.a.b(jSONObject.optInt(RankingItem.KEY_FORCEUPDATE));
            z = com.excelliance.kxqp.bitmap.a.a.a(jSONObject.optInt(RankingItem.KEY_FORCEUPDATE));
        }
        String string = z2 ? com.excelliance.kxqp.swipe.a.a.getString(e, "forceClearDataUpdate") : String.format(com.excelliance.kxqp.swipe.a.a.getString(e, "update_apk_content"), this.t.getAppName());
        if (z) {
            asVar.j();
        }
        if (z2) {
            asVar.d(com.excelliance.kxqp.swipe.a.a.getString(e, "exit_dialog_no"));
            asVar.c(com.excelliance.kxqp.swipe.a.a.getString(e, "reInstall"));
        }
        asVar.a(string);
        asVar.a(new b.a() {
            @Override
            public void a() {
                JSONObject jSONObject2;
                if (ShortCutActivity.this.t.getDownloadStatus() == 0 || ShortCutActivity.this.t.getDownloadStatus() == 8 || ShortCutActivity.this.t.getDownloadStatus() == 1) {
                    if (com.excelliance.kxqp.bitmap.a.f2685a != null && (jSONObject2 = com.excelliance.kxqp.bitmap.a.f2685a.get(ShortCutActivity.this.t.getAppPackageName())) != null) {
                        if (com.excelliance.kxqp.bitmap.a.a.b(jSONObject2.optInt(RankingItem.KEY_FORCEUPDATE))) {
                            PlatSdk.getInstance().c(ShortCutActivity.e, ShortCutActivity.this.t.getAppPackageName(), ShortCutActivity.this.t.getUid());
                        }
                        ExcellianceAppInfo pareseInfo = RankingItem.pareseInfo(ShortCutActivity.e, jSONObject2, InitialData.a(ShortCutActivity.e).a(), true);
                        if (pareseInfo != null && pareseInfo.getOnline() == 3) {
                            ShortCutActivity.this.t.areas = pareseInfo.areas;
                            com.excelliance.kxqp.bitmap.ui.b.b.a(ShortCutActivity.e, ShortCutActivity.this.t, as.o(ShortCutActivity.e));
                            return;
                        }
                    }
                    an.c(bn.k(ShortCutActivity.e, ShortCutActivity.this.t.getAppPackageName()));
                    ShortCutActivity.this.t.setGameType("7");
                    ShortCutActivity.this.t.setDownloadProgress(0);
                    ShortCutActivity.this.t.setDownloadStatus(2);
                    tp.f(new Runnable() {
                        @Override
                        public void run() {
                            VersionManager.a(ShortCutActivity.e, ShortCutActivity.this.t);
                            ShortCutActivity.e.sendBroadcast(new Intent(ShortCutActivity.e.getPackageName() + VersionManager.q));
                        }
                    });
                }
                Intent intent = new Intent();
                intent.setComponent(new ComponentName(ShortCutActivity.e, "com.excelliance.kxqp.ui.HelloActivity"));
                Bundle bundle = new Bundle();
                bundle.putInt("action_jump", -1);
                bundle.putString(DebugKt.DEBUG_PROPERTY_VALUE_AUTO, "main");
                intent.putExtra("notifi_action", bundle);
                ShortCutActivity.e.startActivity(intent);
                ShortCutActivity.this.x.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        ShortCutActivity.this.finish();
                    }
                }, 1000L);
            }

            @Override
            public void b() {
                ShortCutActivity.this.b(ShortCutActivity.this.t.getAppPackageName());
                if (asVar.i()) {
                    JSONObject jSONObject2 = new JSONObject();
                    try {
                        jSONObject2.put(RankingItem.KEY_VER, com.excelliance.kxqp.bitmap.a.a.f());
                        com.excelliance.kxqp.bitmap.bean.ResponseData.saveUpdateNoPropData(ShortCutActivity.e, com.excelliance.kxqp.bitmap.bean.ResponseData.getUpdateNoPropData(ShortCutActivity.e).put(ShortCutActivity.this.t.getAppPackageName(), jSONObject2));
                    } catch (JSONException e2) {
                        e2.printStackTrace();
                    }
                }
                if (!z) {
                    ShortCutActivity.this.a(ShortCutActivity.this.t, 1);
                } else {
                    ShortCutActivity.this.finish();
                }
            }
        });
        asVar.setOnKeyListener(new DialogInterface.OnKeyListener() {
            @Override
            public boolean onKey(DialogInterface dialogInterface, int i2, KeyEvent keyEvent) {
                if (i2 != 4 || keyEvent.getAction() != 0) {
                    return false;
                }
                dialogInterface.dismiss();
                ShortCutActivity.this.finish();
                return true;
            }
        });
        if (asVar.isShowing()) {
            return;
        }
        asVar.show();
        asVar.k();
    }

    public void a(CheckObbVersionUpdateResult checkObbVersionUpdateResult) {
        final com.excelliance.kxqp.gs.dialog.as asVar = new com.excelliance.kxqp.gs.dialog.as(e, com.excelliance.kxqp.gs.util.w.o(e, "theme_dialog_no_title2"));
        if (checkObbVersionUpdateResult.result == 2) {
            asVar.j();
            asVar.b(com.excelliance.kxqp.swipe.a.a.getString(e, "update_dialog_title_hiatus"));
            asVar.c(com.excelliance.kxqp.swipe.a.a.getString(e, "download_immediately"));
            String string = com.excelliance.kxqp.swipe.a.a.getString(e, "update_obb_content");
            Object[] objArr = new Object[6];
            objArr[0] = com.excelliance.kxqp.bitmap.a.a.b(e);
            objArr[1] = (!GameUtil.isNetworkConnected(e) || GameJNI.b()) ? "" : com.excelliance.kxqp.swipe.a.a.getString(e, "flow_network_state");
            objArr[2] = this.t.getAppName();
            objArr[3] = com.excelliance.kxqp.swipe.a.a.getString(e, "update_dialog_str_four_hiatus");
            objArr[4] = com.excelliance.kxqp.swipe.a.a.getString(e, "update_dialog_str_five_hiatus");
            objArr[5] = com.excelliance.kxqp.swipe.a.a.getString(e, "update_dialog_str_six_hiatus");
            asVar.a(String.format(string, objArr));
        } else {
            String string2 = com.excelliance.kxqp.swipe.a.a.getString(e, "update_obb_content");
            Object[] objArr2 = new Object[6];
            objArr2[0] = com.excelliance.kxqp.bitmap.a.a.b(e);
            objArr2[1] = (!GameUtil.isNetworkConnected(e) || GameJNI.b()) ? "" : com.excelliance.kxqp.swipe.a.a.getString(e, "flow_network_state");
            objArr2[2] = this.t.getAppName();
            objArr2[3] = com.excelliance.kxqp.swipe.a.a.getString(e, "update_dialog_str_four_update");
            objArr2[4] = com.excelliance.kxqp.swipe.a.a.getString(e, "update_dialog_str_five_update");
            objArr2[5] = com.excelliance.kxqp.swipe.a.a.getString(e, "update_dialog_str_six_update");
            asVar.a(String.format(string2, objArr2));
        }
        if (!com.excelliance.kxqp.bitmap.a.a.f2688a.contains(this.t.getAppPackageName())) {
            asVar.j();
        }
        asVar.a(new b.a() {
            @Override
            public void a() {
                Intent intent = new Intent();
                if (ShortCutActivity.this.t.getVersionCode() == 0) {
                    try {
                        PackageInfo packageInfo = ShortCutActivity.e.getPackageManager().getPackageInfo(ShortCutActivity.this.t.getAppPackageName(), 0);
                        if (packageInfo != null) {
                            ShortCutActivity.this.t.setVersionCode(packageInfo.versionCode);
                        }
                    } catch (Exception e2) {
                        Log.e("ShortCutActivity", "positiveClick: " + e2);
                    }
                }
                az.d("ShortCutActivity", "positiveClick: " + ShortCutActivity.this.t.getVersionCode());
                if (com.excelliance.kxqp.gs.util.b.S(ShortCutActivity.e)) {
                    com.excelliance.kxqp.gs.m.e.c.a(ShortCutActivity.this.t, intent, ShortCutActivity.e, ShortCutActivity.D);
                }
                intent.putExtra(ClientCookie.VERSION_ATTR, Long.valueOf(ShortCutActivity.this.t.getVersionCode()));
                intent.putExtra("libName", ShortCutActivity.this.t.getAppPackageName());
                intent.putExtra("updateSource", true);
                intent.putExtra("downloadForUpdate", ShortCutActivity.this.t.downloadForUpdate);
                intent.setAction(ShortCutActivity.e.getPackageName() + ".download.check.check.obb");
                intent.setComponent(new ComponentName(ShortCutActivity.e.getPackageName(), "com.excelliance.kxqp.gs.service.CustomIntentService"));
                ShortCutActivity.e.startService(intent);
                if (asVar.i()) {
                    JSONObject jSONObject = new JSONObject();
                    try {
                        jSONObject.put(RankingItem.KEY_VER, ShortCutActivity.this.t.getVersionCode());
                        com.excelliance.kxqp.bitmap.bean.ResponseData.saveUpdateNoPropData(ShortCutActivity.e, com.excelliance.kxqp.bitmap.bean.ResponseData.getUpdateNoPropData(ShortCutActivity.e).put(ShortCutActivity.this.t.getAppPackageName() + com.excelliance.kxqp.bitmap.bean.ResponseData.KEY_OBB_SUFFIX, jSONObject));
                    } catch (JSONException e3) {
                        e3.printStackTrace();
                    }
                }
            }

            @Override
            public void b() {
                if (asVar.i()) {
                    JSONObject jSONObject = new JSONObject();
                    try {
                        jSONObject.put(RankingItem.KEY_VER, ShortCutActivity.this.t.getVersionCode());
                        com.excelliance.kxqp.bitmap.bean.ResponseData.saveUpdateNoPropData(ShortCutActivity.e, com.excelliance.kxqp.bitmap.bean.ResponseData.getUpdateNoPropData(ShortCutActivity.e).put(ShortCutActivity.this.t.getAppPackageName() + com.excelliance.kxqp.bitmap.bean.ResponseData.KEY_OBB_SUFFIX, jSONObject));
                    } catch (JSONException e2) {
                        e2.printStackTrace();
                    }
                }
            }
        });
        if (asVar.isShowing()) {
            return;
        }
        asVar.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialogInterface) {
                ShortCutActivity.this.finish();
            }
        });
        asVar.show();
        asVar.k();
    }

    private void k() {
        Log.d("ShortCutActivity", "start server");
        String a2 = com.excelliance.kxqp.util.as.a().a(this.u, e);
        if (TextUtils.isEmpty(a2)) {
            Log.d("ShortCutActivity", "获取参数异常");
        } else {
            ac.a().a("http://folder.appota.cn/difflogin.php", com.excelliance.kxqp.util.b.a(a2), new ac.a() {
                @Override
                public void a(String str) {
                    try {
                        JSONObject jSONObject = new JSONObject(str);
                        int optInt = jSONObject.optInt("flag");
                        Log.d("ShortCutActivity", "flag = " + optInt);
                        int optInt2 = jSONObject.optInt("vip");
                        Log.d("ShortCutActivity", "v_p_" + optInt2);
                        int i2 = 0;
                        if (optInt == 2) {
                            if (ShortCutActivity.this.u == null) {
                                ShortCutActivity shortCutActivity = ShortCutActivity.this;
                                ShortCutActivity shortCutActivity2 = ShortCutActivity.this;
                                if (Build.VERSION.SDK_INT >= 11) {
                                    i2 = 4;
                                }
                                shortCutActivity.u = shortCutActivity2.getSharedPreferences("USERINFO", i2);
                            }
                            Log.d("ShortCutActivity", "已下线,记录sp");
                            ShortCutActivity.this.u.edit().putBoolean("OFFLINE_NOTICE", true).apply();
                            return;
                        }
                        if (optInt == 0) {
                            Log.d("ShortCutActivity", "缺少必要的参数没有上传");
                            return;
                        }
                        if (optInt == 1) {
                            com.excelliance.kxqp.gs.g.aa.a(ShortCutActivity.e).a(optInt2);
                            Log.d("ShortCutActivity", "无其他设备登录该账号");
                        } else if (optInt == 3) {
                            com.excelliance.kxqp.gs.g.aa.a(ShortCutActivity.e).a(0);
                            Log.d("ShortCutActivity", "未查到该账号登录的信息");
                        }
                    } catch (JSONException e2) {
                        e2.printStackTrace();
                        Log.d("ShortCutActivity", "json exception");
                    }
                }

                @Override
                public void b(String str) {
                    Log.d("ShortCutActivity", "onFailed info = " + str);
                }
            });
        }
    }

    @Override
    public void onNewIntent(Intent intent) {
        Log.d("ShortCutActivityLT", "onNewIntent: ");
        super.onNewIntent(intent);
        g = intent.getStringExtra("gameid");
        h = intent.getStringExtra("gamelib");
        i = intent.getIntExtra("user", 0);
        VersionManager.getInstance().a(e);
        ArrayList<ExcellianceAppInfo> a2 = InitialData.a(e).a();
        if (a2 != null) {
            Iterator<ExcellianceAppInfo> it = a2.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                ExcellianceAppInfo next = it.next();
                if (next.getAppPackageName().equals(h)) {
                    this.t = next;
                    break;
                }
            }
        }
        StatisticsGS.getInstance().uploadUserAction(e, StatisticsBase.UA_LAUNCH_XSPACE, 2, 1);
    }

    @Override
    public void onResume() {
        Log.d("ShortCutActivity", "onResume: ");
        super.onResume();
        if (this.o) {
            return;
        }
        l();
    }

    public void l() {
        if (!p()) {
            a(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialogInterface) {
                    ShortCutActivity.this.l();
                }
            });
        } else if (o()) {
            if (m()) {
                tp.f(new Runnable() {
                    @Override
                    public void run() {
                        ShortCutActivity.this.h();
                    }
                });
            } else {
                n();
            }
        }
    }

    private boolean m() {
        Bundle a2 = by.a(e, "sp_new_version_info").a();
        final boolean z = a2.getShort("b64", (short) 0) == 1;
        tp.f(new Runnable() {
            @Override
            public void run() {
                ShortCutActivity.this.a(z);
            }
        });
        String str = (String) a2.get("serverVersionCode");
        Log.d("ShortCutActivity", "serverVersionCode = " + str);
        String str2 = (String) a2.get("showDialog");
        by a3 = by.a(this.f, "download_sp");
        if (bs.c() && bs.p(e)) {
            str = "";
        }
        if (!com.excelliance.kxqp.gs.util.n.a(str)) {
            com.excelliance.kxqp.gs.util.g a4 = com.excelliance.kxqp.gs.util.g.a(this.f);
            int a5 = a4.a(z);
            Boolean a6 = a4.a(a5, Integer.parseInt(str));
            a3.a("isNewVersion", a6.booleanValue());
            Boolean.valueOf(z ? false : a4.a(com.excelliance.kxqp.util.master.d.a(this.f, z ? com.excelliance.kxqp.util.master.e.b(this.f) : this.f.getPackageName(), a5), Integer.parseInt(str)).booleanValue());
            if (a6.booleanValue()) {
                StringBuilder sb = new StringBuilder();
                sb.append("isCheckVn");
                sb.append(z ? "_b64" : "");
                String b2 = a3.b(sb.toString(), "");
                String string = a2.getString("verName");
                boolean equals = !TextUtils.isEmpty(string) ? TextUtils.equals(b2, string) : true;
                if (TextUtils.equals(str2, "2")) {
                    return !equals;
                }
                if (TextUtils.equals(str2, "3")) {
                    return true;
                }
            }
        }
        return false;
    }

    public void a(boolean z) {
        Upl reStore;
        InputStream inputStream;
        if (bf.e(this.f)) {
            String str = com.excelliance.kxqp.gs.util.g.a(this.f).a(com.excelliance.kxqp.gs.util.g.f12014a, z) + "&appArray=" + com.excelliance.kxqp.gs.ui.home.c.a(e);
            az.d("ShortCutActivity", "path = " + str);
            InputStream inputStream2 = null;
            try {
                try {
                    HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
                    httpURLConnection.setConnectTimeout(5000);
                    httpURLConnection.setReadTimeout(5000);
                    httpURLConnection.setRequestMethod("GET");
                    inputStream = httpURLConnection.getInputStream();
                } catch (Exception e2) {
                    e = e2;
                    reStore = null;
                }
                try {
                    try {
                        reStore = com.excelliance.kxqp.gs.util.h.a().a(inputStream);
                    } catch (Exception e3) {
                        e = e3;
                        reStore = null;
                    }
                    try {
                        reStore.save(this.f, z);
                        com.excelliance.kxqp.gs.util.q.a(inputStream);
                    } catch (Exception e4) {
                        e = e4;
                        inputStream2 = inputStream;
                        e.printStackTrace();
                        com.excelliance.kxqp.gs.util.q.a(inputStream2);
                        if (reStore != null) {
                        }
                    }
                } catch (Throwable th) {
                    th = th;
                    inputStream2 = inputStream;
                    com.excelliance.kxqp.gs.util.q.a(inputStream2);
                    throw th;
                }
            } catch (Throwable th2) {
                th = th2;
            }
        } else {
            reStore = Upl.reStore(this.f, z);
        }
        if (reStore != null) {
            return;
        }
        try {
            String vc = reStore.getVc();
            String url = reStore.getUrl();
            String md5 = reStore.getMd5();
            by a2 = by.a(this.f, "download_sp");
            a2.a("MD5", md5);
            String vn = reStore.getVn();
            String showDialog = reStore.getShowDialog();
            az.d("ShortCutActivity", "upl: " + reStore);
            String size = reStore.getSize();
            String type = reStore.getType();
            String b2 = cd.b(reStore.getContent(), "#");
            by.a(e, z ? "sp_new_version_info_assistant" : "sp_new_version_info").a("has_saved_before", true).a(vn, vc, url, showDialog, b2, size, type, md5, z);
            Log.d("ShortCutActivity", "run: hytest content = " + b2);
            a2.a("mVerName", vn);
            a2.a("mVerCose", vc);
        } catch (Exception e5) {
            e5.printStackTrace();
        }
    }

    public void n() {
        GameUtil.getIntance().a(this);
        VersionManager.getInstance().a(e);
        String str = h;
        com.excean.a.b.a("ShortCutActivity", String.format("ShortCutActivity/continueResumeLogic:thread(%s) mGameLib(%s) mAppInfo(%s) mUser(%s)", Thread.currentThread().getName(), h, this.t, Integer.valueOf(i)));
        if (this.t != null) {
            if (!bx.a().n(e)) {
                String e2 = com.excelliance.kxqp.gs.util.w.e(e, "me_login_tips_cancle");
                String e3 = com.excelliance.kxqp.gs.util.w.e(e, "me_vip_expire_tips");
                String e4 = com.excelliance.kxqp.gs.util.w.e(e, "me_login_tips_sure_pay");
                at.b bVar = new at.b(e);
                bVar.a(e3);
                bVar.c(e4);
                bVar.b(e2);
                bVar.a(false);
                bVar.a(new at.a() {
                    @Override
                    public void a(View view, Dialog dialog) {
                        if (dialog != null && dialog.isShowing()) {
                            dialog.dismiss();
                        }
                        Intent intent = new Intent(ShortCutActivity.e, (Class<?>) MainActivity.class);
                        intent.putExtra("shortcut", "openLaunch");
                        ShortCutActivity.this.startActivity(intent);
                        ShortCutActivity.this.finish();
                    }
                });
                bVar.b(new at.a() {
                    @Override
                    public void a(View view, Dialog dialog) {
                        VipIncomeUploadUtil.a(ShortCutActivity.e, VipIncomeUploadUtil.a.CLICK_DESKTOP_ICON_VIP_DIALOG);
                        if (dialog != null && dialog.isShowing()) {
                            dialog.dismiss();
                        }
                        ShortCutActivity.this.finish();
                        Intent intent = new Intent(ShortCutActivity.e, (Class<?>) MainActivity.class);
                        intent.putExtra("shortcut", "openVip");
                        ShortCutActivity.this.startActivity(intent);
                    }
                });
                at a2 = bVar.a();
                VipIncomeUploadUtil.a(e, VipIncomeUploadUtil.a.CLICK_DESKTOP_ICON);
                a2.show();
                return;
            }
            String path = this.t.getPath();
            if (path != null) {
                String h2 = GameUtil.getIntance().h(str);
                if (new File(path).exists() && (h2 == null || !new File(h2).exists() || path.equals(h2))) {
                    h2 = path;
                }
                az.d("ShortCutActivity", "savePath:" + h2 + " PlatSdk.PLATFORM_NEW_VM: true");
                if (h2 != null && new File(h2).exists()) {
                    i();
                    return;
                }
                try {
                    int identifier = getResources().getIdentifier("already_removed", "string", getPackageName());
                    if (identifier != 0) {
                        Toast.makeText(this, getResources().getString(identifier), 0).show();
                    }
                } catch (Exception unused) {
                }
                finish();
                return;
            }
            return;
        }
        try {
            int identifier2 = getResources().getIdentifier("already_removed", "string", getPackageName());
            if (identifier2 != 0) {
                Toast.makeText(this, getResources().getString(identifier2), 0).show();
            }
        } catch (Exception unused2) {
        }
        finish();
    }

    private boolean o() {
        if (as.J(e)) {
            return true;
        }
        View b2 = com.excelliance.kxqp.gs.util.w.b(e, "dialog_available");
        TextView textView = (TextView) findViewById(com.excelliance.kxqp.gs.util.w.d(this, "positive"));
        if (com.excelliance.kxqp.gs.newappstore.b.c.a(e)) {
            textView.setTextColor(com.excelliance.kxqp.gs.newappstore.b.c.f7694a);
        }
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                com.excelliance.kxqp.manager.a.a().b();
            }
        });
        WindowManager windowManager = (WindowManager) getSystemService("window");
        WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
        layoutParams.type = 2;
        layoutParams.flags = 2;
        layoutParams.width = -2;
        layoutParams.height = ad.a(e, 233.0f);
        layoutParams.format = 1;
        layoutParams.gravity = 17;
        layoutParams.dimAmount = 0.6f;
        windowManager.addView(b2, layoutParams);
        return false;
    }

    private boolean p() {
        try {
            Method declaredMethod = Class.forName("com.excelliance.kxqp.helper.InitHelper").getDeclaredMethod("getPrivacyAgreed", Context.class);
            declaredMethod.setAccessible(true);
            return ((Boolean) declaredMethod.invoke(null, this)).booleanValue();
        } catch (Exception e2) {
            Log.e("ShortCutActivity", "error when check privacy:");
            e2.printStackTrace();
            return true;
        }
    }

    private void a(DialogInterface.OnDismissListener onDismissListener) {
        try {
            if (isFinishing()) {
                return;
            }
            Class<?> cls = Class.forName("com.excelliance.kxqp.ui.PermissionPromptUtil");
            Method declaredMethod = cls.getDeclaredMethod("getInstance", new Class[0]);
            declaredMethod.setAccessible(true);
            Object invoke = declaredMethod.invoke(null, new Object[0]);
            Method declaredMethod2 = cls.getDeclaredMethod("show", Context.class);
            declaredMethod2.setAccessible(true);
            declaredMethod2.invoke(invoke, this);
            cls.getDeclaredMethod("setDismissListener", DialogInterface.OnDismissListener.class).invoke(invoke, onDismissListener);
        } catch (Exception e2) {
            Log.e("ShortCutActivity", "class:com.excelliance.kxqp.ui.PermissionPromptUtil has been modified");
            e2.printStackTrace();
            cg.a(e, e.getResources().getString(R.string.userinfo_error));
        }
    }

    public void a(int i2) {
        boolean v = au.a().v(this.t.getAppPackageName(), e);
        az.d("showLegalAlertDialog allow", v + "");
        if (v) {
            Message obtainMessage = this.x.obtainMessage(7);
            obtainMessage.obj = this.t;
            obtainMessage.arg1 = 1;
            this.x.sendMessage(obtainMessage);
            return;
        }
        if (this.q == null) {
            this.q = new com.excelliance.kxqp.gs.dialog.o(e, com.excelliance.kxqp.gs.util.w.o(e, "theme_dialog_no_title2"), this.t, i2);
            this.q.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialogInterface) {
                    ShortCutActivity.this.finish();
                }
            });
            this.q.a(new AnonymousClass22());
        }
        if (this.q.isShowing()) {
            return;
        }
        this.q.a(this.t, i2);
        this.q.show();
    }

    public class AnonymousClass22 implements o.a {
        AnonymousClass22() {
        }

        @Override
        public void a(final int i, final ExcellianceAppInfo excellianceAppInfo) {
            tp.f(new Runnable() {
                @Override
                public void run() {
                    boolean z = false;
                    if (i == 5 || (i & 16) == 16) {
                        final String path = excellianceAppInfo.getPath();
                        final String appPackageName = excellianceAppInfo.getAppPackageName();
                        az.d("ShortCutActivity", "install to native: " + path + " appPackageName: " + appPackageName);
                        if (com.excelliance.kxqp.gs.vip.f.a(excellianceAppInfo.getAppName(), path, appPackageName, ShortCutActivity.e)) {
                            az.d("ShortCutActivity", "2 need split apk install");
                            com.excelliance.kxqp.gs.util.e.a(ShortCutActivity.e, path, appPackageName, excellianceAppInfo.getAppName(), new InstallResultcallBack() {
                                @Override
                                public void onResult(boolean z2) {
                                    if (!z2) {
                                        Toast.makeText(ShortCutActivity.e, com.excelliance.kxqp.gs.util.w.e(ShortCutActivity.e, "file_not_found"), 0).show();
                                    } else {
                                        au.a().a(ShortCutActivity.e, appPackageName, path, false);
                                    }
                                    ShortCutActivity.this.finish();
                                }
                            });
                            z = true;
                        }
                    } else if (i != 4) {
                        Message obtainMessage = ShortCutActivity.this.x.obtainMessage(7);
                        obtainMessage.obj = ShortCutActivity.this.q.a();
                        obtainMessage.arg1 = 1;
                        ShortCutActivity.this.x.sendMessage(obtainMessage);
                    }
                    if (z) {
                        return;
                    }
                    ShortCutActivity.this.finish();
                }
            });
        }
    }

    public void a(ExcellianceAppInfo excellianceAppInfo, boolean z) {
        a(excellianceAppInfo, z, -1);
    }

    public void a(final ExcellianceAppInfo excellianceAppInfo, final boolean z, final int i2) {
        av.a(this, new av.a() {
            @Override
            public void a(boolean z2) {
                if (z2) {
                    return;
                }
                PlatSdk platSdk = PlatSdk.getInstance();
                Context applicationContext = ShortCutActivity.e.getApplicationContext();
                az.d("ShortCutActivity", "[" + excellianceAppInfo.getPath() + "]");
                if (platSdk.e(applicationContext, excellianceAppInfo.getPath())) {
                    if (z) {
                        new File(as.a(ShortCutActivity.e) + "/tmpSyncFile");
                        boolean b2 = GameUtil.b(excellianceAppInfo.getPath());
                        if (!GameUtil.b() || b2) {
                            ShortCutActivity.this.x.removeMessages(10);
                            Message obtainMessage = ShortCutActivity.this.x.obtainMessage(10);
                            obtainMessage.obj = excellianceAppInfo;
                            obtainMessage.arg2 = i2;
                            ShortCutActivity.this.x.sendMessageDelayed(obtainMessage, 2500L);
                            return;
                        }
                        as.D(ShortCutActivity.e);
                        StatisticsGS.getInstance().uploadUserAction(ShortCutActivity.e, 16, excellianceAppInfo.getAppPackageName());
                        bz.a().g(ShortCutActivity.e, excellianceAppInfo.getAppPackageName());
                        if ("com.android.vending".equals(excellianceAppInfo.getAppPackageName())) {
                            by a2 = by.a(ShortCutActivity.e, "sp_google_pre_start");
                            if (a2.a("gp_first_start_time", (Long) 0L) == 0) {
                                a2.a("gp_first_start_time", System.currentTimeMillis());
                            }
                        }
                        Bundle a3 = bs.t(excellianceAppInfo.getAppPackageName()) ? platSdk.a(i2, ShortCutActivity.e) : null;
                        Log.d("ShortCutActivity", "onCreate extras:startGame: " + a3);
                        by.a(ShortCutActivity.e, "sp_app_launch_time").a(excellianceAppInfo.getAppPackageName(), System.currentTimeMillis());
                        platSdk.a(ShortCutActivity.e, excellianceAppInfo.getPath(), excellianceAppInfo.getAppPackageName(), excellianceAppInfo.getUid(), a3);
                        com.excelliance.kxqp.gs.g.c.a().a(ShortCutActivity.e, (String) null, 2, excellianceAppInfo);
                        com.excelliance.kxqp.gs.g.c.a().a(ShortCutActivity.e, (String) null, 3, excellianceAppInfo);
                        return;
                    }
                    as.D(ShortCutActivity.e);
                    StatisticsGS.getInstance().uploadUserAction(ShortCutActivity.e, 16, excellianceAppInfo.getAppPackageName());
                    bz.a().g(ShortCutActivity.e, excellianceAppInfo.getAppPackageName());
                    if ("com.android.vending".equals(excellianceAppInfo.getAppPackageName())) {
                        by a4 = by.a(ShortCutActivity.e, "sp_google_pre_start");
                        if (a4.a("gp_first_start_time", (Long) 0L) == 0) {
                            a4.a("gp_first_start_time", System.currentTimeMillis());
                        }
                    }
                    Bundle a5 = bs.t(excellianceAppInfo.getAppPackageName()) ? platSdk.a(i2, ShortCutActivity.e) : null;
                    Log.d("ShortCutActivity", "onCreate extras:startGame: " + a5);
                    by.a(ShortCutActivity.e, "sp_app_launch_time").a(excellianceAppInfo.getAppPackageName(), System.currentTimeMillis());
                    platSdk.a(ShortCutActivity.e, excellianceAppInfo.getPath(), excellianceAppInfo.getAppPackageName(), excellianceAppInfo.getUid(), a5);
                    com.excelliance.kxqp.gs.g.c.a().a(ShortCutActivity.e, (String) null, 2, excellianceAppInfo);
                    com.excelliance.kxqp.gs.g.c.a().a(ShortCutActivity.e, (String) null, 3, excellianceAppInfo);
                }
            }
        });
    }

    private void a(final ExcellianceAppInfo excellianceAppInfo) {
        au a2 = au.a();
        int c = a2.c(excellianceAppInfo.getAppPackageName());
        if (b(excellianceAppInfo)) {
            return;
        }
        if (Boolean.valueOf(as.w(e)).booleanValue() && !a2.a(c)) {
            tp.f(new Runnable() {
                @Override
                public void run() {
                    ShortCutActivity.this.a(excellianceAppInfo.getAppPackageName());
                }
            });
        } else {
            if (a2.a(c)) {
                return;
            }
            q();
        }
    }

    private boolean b(final ExcellianceAppInfo excellianceAppInfo) {
        final AppExtraBean d = com.excelliance.kxqp.repository.a.a(e).d(excellianceAppInfo.getAppPackageName());
        if (!com.excelliance.kxqp.gs.launch.function.ad.b(e, d != null ? ay.i(d.getProxyArea()) : null)) {
            return false;
        }
        tp.f(new Runnable() {
            @Override
            public void run() {
                a.c a2;
                b.C0251b a3 = new b.C0251b.a().a(ShortCutActivity.e.getApplicationContext()).a(d).a(excellianceAppInfo).a(ShortCutActivity.e).a();
                ArrayList arrayList = new ArrayList();
                arrayList.add(new com.excelliance.kxqp.gs.k.b.e());
                b.c a4 = new com.excelliance.kxqp.gs.k.b.c(arrayList, 0, a3).a(a3);
                az.d("ShortCutActivity", "selectOptimalProxyBeforeStart:response = " + a4);
                if (a4 == null || a4.b() != 1 || (a2 = a4.a()) == null || a2.b() == null) {
                    return;
                }
                ReginBean b2 = a2.b();
                String v = as.v(ShortCutActivity.e);
                List<CityBean> a5 = ay.a(by.a(ShortCutActivity.e, "sp_city_config").b("sp_city_config", ""), !aq.v());
                if (b2 != null && !com.excelliance.kxqp.gs.util.s.a(a5)) {
                    Iterator<CityBean> it = a5.iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            break;
                        }
                        CityBean next = it.next();
                        if (TextUtils.equals(next.getId(), b2.id)) {
                            v = next.getName();
                            break;
                        }
                    }
                }
                Message obtainMessage = ShortCutActivity.this.x.obtainMessage(12);
                obtainMessage.obj = v;
                obtainMessage.arg1 = a2.c();
                boolean n = au.a().n(excellianceAppInfo.getAppPackageName(), ShortCutActivity.e);
                if (ProxyDelayService.f8210a.contains(excellianceAppInfo.getAppPackageName())) {
                    obtainMessage.arg1 = 1;
                    obtainMessage.arg2 = 2;
                } else if (!n) {
                    obtainMessage.arg2 = 1;
                }
                if (!bf.e(ShortCutActivity.e)) {
                    obtainMessage.arg1 = -3;
                    obtainMessage.arg2 = 1;
                }
                ShortCutActivity.this.x.sendMessage(obtainMessage);
                as.i();
            }
        });
        return true;
    }

    public void a(String str) {
        LoginAreaBean loginAreaBean;
        DownloadAreaBean downloadAreaBean;
        az.d("ShortCutActivity", "switchOptimalProxy:" + str);
        AppExtraBean d = com.excelliance.kxqp.repository.a.a(e).d(str);
        if (d != null) {
            LoginAreaBean g2 = ay.g(d.getDArea());
            downloadAreaBean = ay.h(d.getXArea());
            loginAreaBean = g2;
        } else {
            loginAreaBean = null;
            downloadAreaBean = null;
        }
        com.excelliance.kxqp.gs.g.c.a().b(e, "是");
        a.c switchOptimalProxy = ProxyConfigHelper.getInstance(e).switchOptimalProxy(str, true, loginAreaBean, downloadAreaBean, false);
        ReginBean b2 = switchOptimalProxy.b();
        List<CityBean> a2 = ay.a(by.a(e, "sp_city_config").b("sp_city_config", ""), !aq.v());
        String v = as.v(e);
        if (b2 != null && !com.excelliance.kxqp.gs.util.s.a(a2)) {
            Iterator<CityBean> it = a2.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                CityBean next = it.next();
                if (TextUtils.equals(next.getId(), b2.id)) {
                    v = next.getName();
                    break;
                }
            }
        }
        az.d("ShortCutActivity", "reginBean:" + b2);
        Message obtainMessage = this.x.obtainMessage(12);
        obtainMessage.obj = v;
        obtainMessage.arg1 = switchOptimalProxy.c();
        az.d("ShortCutActivity", "switchOptimalProxy:state" + switchOptimalProxy.c());
        boolean n = au.a().n(str, e);
        if (ProxyDelayService.f8210a.contains(str)) {
            obtainMessage.arg1 = 1;
            obtainMessage.arg2 = 2;
        } else if (!n) {
            obtainMessage.arg2 = 1;
        }
        if (!bf.e(e)) {
            obtainMessage.arg1 = -3;
            obtainMessage.arg2 = 1;
        }
        if (!au.a().b(e, str)) {
            obtainMessage.arg1 = 2;
            as.i();
            return;
        }
        ExcellianceAppInfo b3 = com.excelliance.kxqp.repository.a.a(e).b(str);
        if (b3 != null) {
            az.d("ShortCutActivity", String.format("MainFragment/switchOptimalProxy:thread(%s)  pkg = %s,apkFrom = %d", Thread.currentThread(), str, Integer.valueOf(b3.apkFrom)));
            if (b3.apkFrom != 2) {
                this.x.sendMessage(obtainMessage);
            }
        } else if (b3.apkFrom != 2) {
            this.x.sendMessage(obtainMessage);
        }
        as.i();
    }

    private void q() {
        Boolean b2 = by.a(e, "sp_total_info").b("sp_disconnectioin", false);
        if (by.a(e, ".sp.common.disposable.flag.info").b("sp_common_disposable_key_specific_switch_proxy", false).booleanValue() && !b2.booleanValue() && !as.w(e)) {
            r();
        } else {
            if (b2.booleanValue() || as.w(e)) {
                return;
            }
            r();
        }
    }

    private void r() {
        List<CityBean> a2;
        String b2 = by.a(e, "sp_city_config").b("sp_city_config", "");
        if (aq.v()) {
            a2 = ay.c(b2);
        } else {
            a2 = ay.a(e, ay.a(b2, true));
        }
        final int t = as.t(e);
        if (a2 == null || a2.size() <= t) {
            return;
        }
        final CityBean cityBean = a2.get(t);
        tp.d(new Runnable() {
            @Override
            public void run() {
                ShortCutActivity.this.a(t, cityBean, true);
            }
        });
    }

    public void a(int i2, CityBean cityBean, boolean z) {
        if (cityBean == null || cd.a(cityBean.getId())) {
            return;
        }
        String id = cityBean.getId();
        by.a(e, "sp_total_info").a("sp_disconnectioin", false);
        as.a(e, i2);
        String name = cityBean.getName();
        if (as.w(e)) {
            name = com.excelliance.kxqp.gs.util.w.e(e, "optimal_node");
        }
        com.excelliance.kxqp.gs.g.c.a().b(e, "是");
        int switchProxy = ProxyConfigHelper.switchProxy(e, id, true, this.t != null ? this.t.getAppPackageName() : null);
        Message obtainMessage = this.x.obtainMessage(12);
        obtainMessage.obj = name;
        obtainMessage.arg1 = switchProxy;
        obtainMessage.arg2 = 1;
        this.x.sendMessage(obtainMessage);
        as.i();
    }

    public void b(String str) {
        AppExtraBean d;
        if (com.excelliance.kxqp.gs.util.b.aZ(e) && !ag.a() && (d = com.excelliance.kxqp.repository.a.a(e).d(str)) != null && !com.excelliance.kxqp.gs.util.s.a(d.getTextFeatureList())) {
            ag.a(e).a(str, this.d, d);
            return;
        }
        if (ah.b()) {
            return;
        }
        Log.d("ShortCutActivity", "startGameAnimation: " + str);
        ah.a(e).a(str, this.d);
    }

    @Override
    public void onPause() {
        super.onPause();
    }

    @Override
    public void onStart() {
        super.onStart();
    }

    @Override
    public void onStop() {
        super.onStop();
        StatisticsGS.getInstance().uploadUserAction(e, StatisticsBase.UA_EXIT_XSPACE);
    }

    @Override
    public void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        this.y = true;
    }

    @Override
    public void onDestroy() {
        Log.v("ShortCutActivity", "hytest ondestroy");
        if (this.E && this.A != null) {
            e.unregisterReceiver(this.A);
            this.E = false;
            LocalBroadcastManager.getInstance(e).unregisterReceiver(this.A);
        }
        if (this.j != null) {
            this.j.g();
        }
        if (this.z != null) {
            unregisterReceiver(this.z);
        }
        super.onDestroy();
        if (this.k != null) {
            this.k.a().removeObserver(this.B);
        }
        if (this.l != null) {
            this.l.a(this.t.getAppPackageName()).removeObserver(this.C);
        }
    }

    @Override
    public void onBackPressed() {
        if (isFinishing()) {
            return;
        }
        if (Build.VERSION.SDK_INT == 24) {
            moveTaskToBack(true);
            this.x.removeMessages(5);
            this.x.sendEmptyMessageDelayed(5, 100L);
        }
        super.onBackPressed();
    }

    public Handler b() {
        return this.x;
    }

    public void c(final String str) {
        if (this.w) {
            return;
        }
        this.w = true;
        new Thread() {
            @Override
            public void run() {
                PlatSdk.getInstance().a(ShortCutActivity.e, str, false, ShortCutActivity.i);
                ShortCutActivity.this.w = false;
                ShortCutActivity.this.x.removeMessages(2);
                ShortCutActivity.this.x.sendEmptyMessage(2);
            }
        }.start();
    }

    public class a extends BroadcastReceiver {
        private a() {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (TextUtils.equals(action, "com.excean.gspace.run_app_resume") || TextUtils.equals(action, Constants.VIA_REPORT_TYPE_SET_AVATAR)) {
                ShortCutActivity.this.x.sendMessage(ShortCutActivity.this.x.obtainMessage(8));
                ShortCutActivity.this.finish();
                return;
            }
            if (TextUtils.equals(action, context.getPackageName() + RankingListFragment.OPERATE_TOURIST_GAME) && ShortCutActivity.this.n) {
                ShortCutActivity.this.n = false;
                if (ShortCutActivity.this.t != null) {
                    if (by.a(ShortCutActivity.e, "sp_total_info").b("sp_key_pkg_language_cancel_auto_set_" + ShortCutActivity.this.t.getAppPackageName(), false).booleanValue()) {
                        by.a(ShortCutActivity.e, "sp_total_info").a("sp_key_pkg_language_cancel_auto_set_" + ShortCutActivity.this.t.getAppPackageName());
                    }
                    ShortCutActivity.this.a(ShortCutActivity.this.t, 1, 0, false);
                }
            }
        }
    }

    protected void a(String str, boolean z) {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.intent.action.DOWNLOAD_COMPLETE");
        this.A = new ApkDownloadCompleteReceiver(z ? com.excelliance.kxqp.gs.ui.home.b.a(this).e() : getPackageName());
        if (!this.E) {
            this.E = true;
            e.registerReceiver(this.A, intentFilter);
            LocalBroadcastManager.getInstance(e).registerReceiver(this.A, new IntentFilter(getContext().getPackageName() + ".download.notify.state"));
        }
        if (com.excelliance.kxqp.gs.util.n.a(str) || str == null) {
            return;
        }
        com.excelliance.kxqp.gs.util.e.a(e, str, z);
        String e2 = z ? com.excelliance.kxqp.gs.ui.home.b.a(this).e() : getPackageName();
        if (this.y) {
            return;
        }
        UpdateProgressDialog.b(e2).a(new UpdateProgressDialog.a() {
            @Override
            public void a(boolean z2) {
                if (z2) {
                    ShortCutActivity.this.finish();
                } else {
                    ShortCutActivity.this.c();
                }
            }
        }).a();
    }

    public void a(Message message) {
        int i2 = message.what;
        String str = null;
        String str2 = i2 == 7 ? "dialog_with_image" : i2 == 10 ? "dialog_update" : null;
        final boolean a2 = com.excelliance.kxqp.gs.util.e.a(message, i2);
        final com.excelliance.kxqp.gs.dialog.g gVar = new com.excelliance.kxqp.gs.dialog.g(e, com.excelliance.kxqp.gs.util.w.o(e, "theme_dialog_no_title2"), str2);
        gVar.setOnKeyListener(new DialogInterface.OnKeyListener() {
            @Override
            public boolean onKey(DialogInterface dialogInterface, int i3, KeyEvent keyEvent) {
                if (i3 != 4) {
                    return false;
                }
                ShortCutActivity.this.finish();
                return true;
            }
        });
        gVar.a(new b.InterfaceC0157b() {
            @Override
            public void a(int i3, Message message2, int i4) {
                if (i3 == 10) {
                    Bundle bundle = (Bundle) message2.obj;
                    String string = bundle.getString("apkUrl");
                    boolean z = bundle.getShort("b64") == 1;
                    if (com.excelliance.kxqp.gs.util.e.a(ShortCutActivity.e)) {
                        ShortCutActivity.this.c();
                    }
                    ShortCutActivity.this.a(string, z);
                    bz.a().a(ShortCutActivity.e, 80000, "点击更新OurPlay");
                }
                gVar.dismiss();
            }

            @Override
            public void b(int i3, Message message2, int i4) {
                if (i3 != 10 || message2 == null) {
                    return;
                }
                Object obj = message2.obj;
                if (obj != null && (obj instanceof Bundle)) {
                    Bundle bundle = (Bundle) obj;
                    boolean z = bundle.getBoolean("checkBox");
                    Log.d("ShortCutActivity", "negativeClick: " + z);
                    by a3 = by.a(ShortCutActivity.e, "download_sp");
                    if (z) {
                        a3.a("isCheckVn", bundle.getString("verName"));
                    } else {
                        a3.a("isCheckVn");
                    }
                }
                ShortCutActivity.this.n();
            }
        });
        gVar.setOnShowListener(new DialogInterface.OnShowListener() {
            @Override
            public void onShow(DialogInterface dialogInterface) {
                if (a2) {
                    bz.a().a(ShortCutActivity.e, 79000, "弹出更新OurPlay弹框");
                }
            }
        });
        if (gVar.isShowing()) {
            return;
        }
        String str3 = "";
        String str4 = "";
        if (i2 == 10) {
            gVar.d(true);
            str4 = com.excelliance.kxqp.gs.util.w.e(e, "update_apk_now");
            str = com.excelliance.kxqp.gs.util.w.e(e, "update_apk_nocare");
            str3 = ((Bundle) message.obj).getString("content");
        }
        gVar.show();
        gVar.c(i2);
        gVar.a(message);
        gVar.a(str3);
        gVar.a(true, str4, str);
        if (i2 == 10) {
            Bundle bundle = (Bundle) message.obj;
            gVar.f(true);
            int i3 = bundle.getInt(CategoryListActivity.TAG_NAME);
            Log.d("ShortCutActivity", "showUpdateDialog: " + i3);
            gVar.g(i3 == 0);
            gVar.c(i3 != 0);
            gVar.h(i3 == 0);
            gVar.i(i3 == 0);
            gVar.a(bundle);
        }
    }

    public final void c() {
        Intent intent = new Intent("android.intent.action.MAIN");
        intent.addCategory("android.intent.category.HOME");
        startActivity(intent);
    }

    public void a(Context context, ai.b bVar) {
        if (context instanceof Activity) {
            ai.a().a((Activity) context, bVar, false, "快捷方式");
        }
    }

    public void a(Context context, Runnable runnable, ai.b bVar) {
        if (context instanceof Activity) {
            Activity activity = (Activity) context;
            if (activity.isFinishing()) {
                return;
            }
            ai.a().a(activity, runnable, bVar, "快捷方式");
        }
    }
}