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

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


package com.excelliance.kxqp.gs.service;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.annotation.TargetApi;
import android.app.AlarmManager;
import android.app.Application;
import android.app.IntentService;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Process;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import androidx.core.app.NotificationCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.alipay.sdk.util.i;
import com.alipay.sdk.util.l;
import com.android.admodule.bean.AdPlatBeanResult;
import com.android.spush.util.WebActionRouter;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.PlatSdk;
import com.excelliance.kxqp.SmtServService;
import com.excelliance.kxqp.VersionManager;
import com.excelliance.kxqp.background_resident.c;
import com.excelliance.kxqp.bean.CheckAppDownloadStateResult;
import com.excelliance.kxqp.bitmap.bean.RankingItem;
import com.excelliance.kxqp.bitmap.bean.ResponseData;
import com.excelliance.kxqp.bitmap.ui.imp.h;
import com.excelliance.kxqp.gs.bean.AddGameBean;
import com.excelliance.kxqp.gs.bean.AppDownLoadInfoBean;
import com.excelliance.kxqp.gs.bean.CityBean;
import com.excelliance.kxqp.gs.bean.CooperationAPPContent;
import com.excelliance.kxqp.gs.bean.InitialGameBean;
import com.excelliance.kxqp.gs.bean.InstallResultcallBack;
import com.excelliance.kxqp.gs.bean.ObbNativeInfo;
import com.excelliance.kxqp.gs.bean.ProxyConfigHelper;
import com.excelliance.kxqp.gs.bean.ResponseResult;
import com.excelliance.kxqp.gs.bean.VersionBean;
import com.excelliance.kxqp.gs.g.ac;
import com.excelliance.kxqp.gs.m.a.d;
import com.excelliance.kxqp.gs.multi.down.DownService;
import com.excelliance.kxqp.gs.multi.down.model.DownBean;
import com.excelliance.kxqp.gs.multi.down.model.PatchDownBean;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.ui.add.AddGamesActivity;
import com.excelliance.kxqp.gs.ui.gaccount.GGAccBean;
import com.excelliance.kxqp.gs.ui.share.core.ui.BaseAssistActivity;
import com.excelliance.kxqp.gs.util.ai;
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.at;
import com.excelliance.kxqp.gs.util.au;
import com.excelliance.kxqp.gs.util.aw;
import com.excelliance.kxqp.gs.util.ay;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.ba;
import com.excelliance.kxqp.gs.util.bc;
import com.excelliance.kxqp.gs.util.bd;
import com.excelliance.kxqp.gs.util.bf;
import com.excelliance.kxqp.gs.util.bg;
import com.excelliance.kxqp.gs.util.bn;
import com.excelliance.kxqp.gs.util.bp;
import com.excelliance.kxqp.gs.util.bq;
import com.excelliance.kxqp.gs.util.bs;
import com.excelliance.kxqp.gs.util.bt;
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.cb;
import com.excelliance.kxqp.gs.util.cc;
import com.excelliance.kxqp.gs.util.cd;
import com.excelliance.kxqp.gs.util.ck;
import com.excelliance.kxqp.gs.util.cn;
import com.excelliance.kxqp.gs.util.q;
import com.excelliance.kxqp.gs.util.s;
import com.excelliance.kxqp.gs.vip.f;
import com.excelliance.kxqp.n;
import com.excelliance.kxqp.platforms.ExcellianceAppInfo;
import com.excelliance.kxqp.repository.a;
import com.excelliance.kxqp.sdk.StatisticsBase;
import com.excelliance.kxqp.sdk.StatisticsGS;
import com.excelliance.kxqp.ui.InitialData;
import com.excelliance.kxqp.util.ab;
import com.excelliance.kxqp.util.d.b;
import com.excelliance.kxqp.util.master.e;
import com.excelliance.kxqp.util.o;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.tencent.connect.common.Constants;
import com.tencent.open.SocialConstants;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Random;
import java.util.regex.Pattern;
import kotlinx.coroutines.DebugKt;
import org.apache.http.cookie.ClientCookie;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class CustomIntentService extends IntentService {

    public static boolean f8152a;
    private static boolean c;
    private static long d;

    final Handler f8153b;

    @Deprecated
    public void a(Context context, boolean z) {
    }

    public CustomIntentService() {
        super("CustomIntentService");
        this.f8153b = new Handler() {
            @Override
            public void handleMessage(Message message) {
                super.handleMessage(message);
                if (message.what != 2) {
                    return;
                }
                Process.killProcess(Process.myPid());
            }
        };
    }

    public CustomIntentService(String str) {
        super(str);
        this.f8153b = new Handler() {
            @Override
            public void handleMessage(Message message) {
                super.handleMessage(message);
                if (message.what != 2) {
                    return;
                }
                Process.killProcess(Process.myPid());
            }
        };
    }

    @Override
    protected void onHandleIntent(final Intent intent) {
        if (intent == null) {
            Log.e("CustomIntentService", "Fatal Exception onHandleIntent intent is null");
            return;
        }
        aq.a(getApplicationContext());
        String action = intent.getAction();
        final Context applicationContext = getApplicationContext();
        if (TextUtils.isEmpty(action) || applicationContext == null) {
            return;
        }
        az.d("CustomIntentService", "onHandleIntent action: " + action);
        String packageName = applicationContext.getPackageName();
        if (TextUtils.equals(action, packageName + ".check.have.apk.and.obb")) {
            az.e("CustomIntentService", "it must be migrate to GameTypeHelper");
        } else {
            if (TextUtils.equals(action, packageName + ".refresh.game.type")) {
                az.e("CustomIntentService", "it must be migrate to GameTypeHelper");
            } else {
                if (TextUtils.equals(action, packageName + ".initial.init")) {
                    tp.f(new Runnable() {
                        @Override
                        public void run() {
                            CustomIntentService.this.o(applicationContext, intent);
                        }
                    });
                } else {
                    if (TextUtils.equals(action, packageName + ".initial.game.type")) {
                        tp.f(new Runnable() {
                            @Override
                            public void run() {
                                CustomIntentService.this.a(applicationContext, intent.getBooleanExtra("force", false));
                            }
                        });
                    } else {
                        if (TextUtils.equals(action, packageName + ".refresh.proxy.config")) {
                            b(intent, applicationContext);
                        } else {
                            if (TextUtils.equals(action, packageName + ".pre.get.share.info")) {
                                c(applicationContext, intent.getStringExtra("shareLibName"));
                            } else {
                                if (!TextUtils.equals(action, packageName + ".switch.proxy.regin")) {
                                    if (TextUtils.equals(action, packageName + ".download.check.check.obb")) {
                                        tp.f(new Runnable() {
                                            @Override
                                            public void run() {
                                                CustomIntentService.this.m(applicationContext, intent);
                                            }
                                        });
                                    } else {
                                        if (TextUtils.equals(action, packageName + ".download.check.check.split")) {
                                            az.d("CustomIntentService", "CHECK_SPLIT_FILE: ");
                                            n(applicationContext, intent);
                                        } else {
                                            if (TextUtils.equals(action, packageName + ".refresh.obb.download.state")) {
                                                k(applicationContext, intent);
                                            } else {
                                                if (TextUtils.equals(action, packageName + ".refresh.split.download.state")) {
                                                    l(applicationContext, intent);
                                                } else {
                                                    if (TextUtils.equals(action, packageName + ".delete.cache.native.app.info")) {
                                                        a(intent, applicationContext);
                                                    } else {
                                                        if (TextUtils.equals(action, packageName + ".report.downloadermanager.state")) {
                                                            j(applicationContext, intent);
                                                        } else {
                                                            if (TextUtils.equals(action, packageName + ".migrate.apk")) {
                                                                i(applicationContext, intent);
                                                            } else {
                                                                if (TextUtils.equals(action, packageName + ".install.migrate.apk")) {
                                                                    tp.f(new Runnable() {
                                                                        @Override
                                                                        public void run() {
                                                                            CustomIntentService.this.d(applicationContext);
                                                                        }
                                                                    });
                                                                } else {
                                                                    if (TextUtils.equals(action, packageName + ".report.google.play.install.game.info")) {
                                                                        tp.f(new Runnable() {
                                                                            @Override
                                                                            public void run() {
                                                                                CustomIntentService.this.h(applicationContext, intent);
                                                                            }
                                                                        });
                                                                    } else {
                                                                        if (TextUtils.equals(action, packageName + ".google.account.add.success")) {
                                                                            a(applicationContext, 0);
                                                                        } else {
                                                                            if (TextUtils.equals(action, packageName + ".check.game.icon.dismiss")) {
                                                                                p(applicationContext, intent);
                                                                            } else {
                                                                                if (TextUtils.equals(action, packageName + ".get.oauth.id")) {
                                                                                    if (intent.getIntExtra("judge", 1) == 6) {
                                                                                        a(intent);
                                                                                    } else {
                                                                                        g(applicationContext, intent);
                                                                                    }
                                                                                } else {
                                                                                    if (TextUtils.equals(action, packageName + ".report.error.log")) {
                                                                                        f(applicationContext, intent);
                                                                                    } else {
                                                                                        if (TextUtils.equals(action, packageName + ".mock.progress")) {
                                                                                            Bundle bundleExtra = intent.getBundleExtra("bundle");
                                                                                            if (bundleExtra != null) {
                                                                                                String string = bundleExtra.getString(WebActionRouter.KEY_PKG);
                                                                                                long j = bundleExtra.getLong(ExcellianceAppInfo.KEY_CURRNETPOS) + 2;
                                                                                                ExcellianceAppInfo a2 = InitialData.a(applicationContext).a(-1, 0, string);
                                                                                                if (a2 != null && a2.getDownloadStatus() == 11) {
                                                                                                    if (j >= 100) {
                                                                                                        j = 100;
                                                                                                    }
                                                                                                    Log.d("CustomIntentService", "onHandleIntent: " + j + "\t" + bundleExtra.getString("a"));
                                                                                                    int i = bundleExtra.getInt("index");
                                                                                                    int i2 = bundleExtra.getInt("type");
                                                                                                    Bundle bundle = new Bundle();
                                                                                                    bundle.putInt("index", i);
                                                                                                    bundle.putLong(RankingItem.KEY_SIZE, 100L);
                                                                                                    bundle.putString(WebActionRouter.KEY_PKG, string);
                                                                                                    bundle.putInt("type", i2);
                                                                                                    bundle.putLong(ExcellianceAppInfo.KEY_CURRNETPOS, j);
                                                                                                    Intent intent2 = new Intent(applicationContext.getPackageName() + ".download.notify.progress");
                                                                                                    intent2.putExtra("bundle", bundle);
                                                                                                    applicationContext.sendBroadcast(intent2);
                                                                                                    bundle.putString("a", getClass().getSimpleName());
                                                                                                    if (j < 100) {
                                                                                                        Intent intent3 = new Intent(applicationContext.getPackageName() + ".mock.progress");
                                                                                                        intent3.setComponent(new ComponentName(applicationContext.getPackageName(), "com.excelliance.kxqp.gs.service.CustomIntentService"));
                                                                                                        intent3.putExtra("bundle", bundle);
                                                                                                        PendingIntent service = PendingIntent.getService(applicationContext, 0, intent3, 134217728);
                                                                                                        AlarmManager alarmManager = (AlarmManager) applicationContext.getSystemService(NotificationCompat.CATEGORY_ALARM);
                                                                                                        alarmManager.cancel(service);
                                                                                                        alarmManager.set(1, System.currentTimeMillis() + j < 80 ? 1000L : 2000L, service);
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        } else {
                                                                                            if (TextUtils.equals(action, packageName + ".start.register.proxy")) {
                                                                                                e(applicationContext, intent);
                                                                                            } else {
                                                                                                if (TextUtils.equals(action, packageName + ".add.google.account")) {
                                                                                                    a(applicationContext);
                                                                                                } else {
                                                                                                    if (TextUtils.equals(action, packageName + ".check.google.card.count")) {
                                                                                                        a();
                                                                                                    } else {
                                                                                                        if (TextUtils.equals(action, packageName + ".query.account.decode.price")) {
                                                                                                            q(applicationContext, intent);
                                                                                                        } else {
                                                                                                            if (TextUtils.equals(action, packageName + "REPORT_INNER_GOOGLE_ACCOUNT_LOGIN")) {
                                                                                                                r(applicationContext, intent);
                                                                                                            } else {
                                                                                                                if (TextUtils.equals(action, packageName + ".query.if.jump.to.gp")) {
                                                                                                                    d(applicationContext, intent);
                                                                                                                } else if (TextUtils.equals(action, "com.excean.gspace.jump.to.google.game.detail")) {
                                                                                                                    c(applicationContext, intent);
                                                                                                                } else {
                                                                                                                    if (TextUtils.equals(action, packageName + ".show.sms.permission.dialog")) {
                                                                                                                        String stringExtra = intent.getStringExtra(WebActionRouter.KEY_PKG);
                                                                                                                        boolean booleanExtra = intent.getBooleanExtra("isGranted", true);
                                                                                                                        Log.d("CustomIntentService", "onHandleIntent:aaa " + stringExtra);
                                                                                                                        if (TextUtils.equals(stringExtra, applicationContext.getPackageName()) || TextUtils.equals(stringExtra, e.b(applicationContext))) {
                                                                                                                            c.a(applicationContext, booleanExtra, stringExtra);
                                                                                                                        }
                                                                                                                    } else if (TextUtils.equals(action, "com.excean.gspace.export.split.apk.and.install.action")) {
                                                                                                                        b(applicationContext, intent);
                                                                                                                    } else {
                                                                                                                        if (TextUtils.equals(action, packageName + ".repair.app.crack.file.not.exist")) {
                                                                                                                            az.d("CustomIntentService", "onHandleIntent REPAIR_APP_CRACK_FILE_NOT_EXIST pkg:" + packageName);
                                                                                                                            a(applicationContext, intent);
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                            }
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        try {
            String A = GameUtil.getIntance().A(applicationContext);
            Context applicationContext2 = getApplicationContext();
            String name = applicationContext2.getClass().getName();
            String name2 = applicationContext2.getClass().getSuperclass().getName();
            String a3 = a(A, "uenm_sdfdma_zeqpclox");
            String a4 = a(name, "uenm_sdfdma_zeqpclox");
            String a5 = a(name2, "uenm_sdfdma_zeqpclox");
            if (TextUtils.equals(a4, "b2NhIml0b2lgYGVtYm9pImd0fXwiR1RdXE18fGBlb214ZWNi\n") && TextUtils.equals(a5, "bWJofmNlaCJtfHwiTXx8YGVvbXhlY2I=\n") && (TextUtils.equals(a3, "Pzw0Pjw/ODk/PDQ+PD4+aG08PD88Pjw9PD48Pjw4PzQ6NDQ/OzU/PDxoPDo8NT5tNDo4NDQ6ajs8\naDw9PD08bjw5PDw/PDk+Pz08bj88PDU8Ojw/OTk8ODw6PT88Pjg/OGk/PTxuPzw8NTw6PD85OTw4\nPDQ9Pzw+OT84ND89PG4=\n") || TextUtils.equals(a3, "Pzw0Pjw9bT8/PDQ+PD08b208PD88Pjw9PD48Pjw4OT07bTs9bTk/PDxoPDo8NT5tNDo4NDQ6ajs8\naDw9PD08OTw5PDw/PD05Pz09Pz88PT08Ojw/OTk8ODw/PT88bTo7Oj06aDo+Om86OTs+Ozo6NTs8\nPzw+PD07PGg/PT8/Pzw=\n"))) {
                return;
            }
            int nextInt = new Random().nextInt(200) + 50;
            if (this.f8153b != null) {
                this.f8153b.removeMessages(2);
                this.f8153b.sendEmptyMessageDelayed(2, nextInt);
            }
        } catch (Exception unused) {
        }
    }

    public void a(final Context context, Intent intent) {
        final String stringExtra = intent.getStringExtra(WebActionRouter.KEY_PKG);
        if (cd.a(stringExtra)) {
            return;
        }
        tp.f(new Runnable() {
            @Override
            public void run() {
                boolean z;
                int i;
                az.d("CustomIntentService", "CustomIntentService/repairCrackFileNotExistApp enter");
                ExcellianceAppInfo b2 = a.a(context).b(stringExtra);
                if (b2 != null) {
                    az.d("CustomIntentService", "CustomIntentService/repairCrackFileNotExistApp appInfo:" + b2);
                    String a2 = bn.a(context, b2);
                    az.d("CustomIntentService", "CustomIntentService/repairCrackFileNotExistApp path:" + a2);
                    File file = new File(a2);
                    if (file.exists()) {
                        z = false;
                        i = 0;
                        for (File file2 : file.listFiles()) {
                            String name = file2.getName();
                            if (name.endsWith(".apk")) {
                                i++;
                            }
                            if (name.endsWith("base.apk")) {
                                z = true;
                            }
                        }
                    } else {
                        z = false;
                        i = 0;
                    }
                    if (!z || i < 1) {
                        return;
                    }
                    az.d("CustomIntentService", "CustomIntentService/repairCrackFileNotExistApp 1 path:" + a2);
                    VersionManager.a(context, b2);
                    VersionManager.a(context, b2, 1);
                    Intent intent2 = new Intent();
                    intent2.setAction(context.getPackageName() + ".download.notify.state");
                    Bundle bundle = new Bundle();
                    bundle.putInt("index", -1);
                    bundle.putInt("state", 1);
                    bundle.putInt("errorCount", 0);
                    bundle.putString(WebActionRouter.KEY_PKG, b2.getAppPackageName());
                    intent2.putExtra("bundle", bundle);
                    LocalBroadcastManager.getInstance(context).sendBroadcast(intent2);
                    Intent intent3 = new Intent("com.excelliance.kxqp.action.installDownApps");
                    intent3.setComponent(new ComponentName(context.getPackageName(), "com.excelliance.kxqp.SmtServService"));
                    Bundle bundle2 = new Bundle();
                    bundle2.putString(WebActionRouter.KEY_PKG, b2.getAppPackageName());
                    if (i == 1) {
                        az.d("CustomIntentService", "CustomIntentService/repairCrackFileNotExistApp 2 path:" + a2);
                        bundle2.putString("apkPath", a2 + File.separator + "base.apk");
                    } else {
                        az.d("CustomIntentService", "CustomIntentService/repairCrackFileNotExistApp 3 path:" + a2);
                        bundle2.putString("apkPath", a2);
                    }
                    try {
                        bundle2.putInt("installType", Integer.parseInt(b2.getGameType()));
                        bundle2.putInt("sourceType", 0);
                        intent3.putExtra("bundle", bundle2);
                        try {
                            context.startService(intent3);
                        } catch (Exception e) {
                            e.printStackTrace();
                            az.e("CustomIntentService", "CustomIntentService/repairCrackFileNotExistApp run server:" + e.toString());
                        }
                    } catch (NumberFormatException e2) {
                        e2.printStackTrace();
                        az.e("CustomIntentService", "CustomIntentService/repairCrackFileNotExistApp NumberFormatException :" + e2.toString());
                    }
                }
            }
        });
    }

    private void b(Context context, Intent intent) {
        az.d("CustomIntentService", "sendInstallSplitApk enter:");
        int intExtra = intent.getIntExtra("android.content.pm.extra.STATUS", -999);
        String stringExtra = intent.getStringExtra("android.content.pm.extra.PACKAGE_NAME");
        az.d("CustomIntentService", "sendInstallSplitApk status:" + intExtra + " pkg:" + stringExtra);
        switch (intExtra) {
            case -1:
                az.d("CustomIntentService", "sendInstallSplitApk Requesting user confirmation for installation");
                Intent intent2 = (Intent) intent.getParcelableExtra("android.intent.extra.INTENT");
                if (context != null) {
                    Intent intent3 = new Intent();
                    intent3.setAction(context.getPackageName() + "SPLIT_REQUEST_RECEIVER_CALLBACK");
                    Bundle bundle = new Bundle();
                    bundle.putString(WebActionRouter.KEY_PKG, stringExtra);
                    bundle.putParcelable("comfirIntent", intent2);
                    bundle.putInt("status", intExtra);
                    intent3.putExtra("bundle", bundle);
                    LocalBroadcastManager.getInstance(context).sendBroadcast(intent3);
                    return;
                }
                return;
            case 0:
                f a2 = f.a();
                if (stringExtra != null && a2.a(stringExtra)) {
                    String b2 = a2.b(stringExtra);
                    a2.c(stringExtra);
                    az.d("CustomIntentService", "sendInstallSplitApk Installation succeed size:" + a2.d());
                    if (!cd.a(b2)) {
                        Log.d("CustomIntentService", "sendInstallSplitApk Installation succeed appName:" + b2);
                        Intent intent4 = new Intent();
                        intent4.setAction(context.getPackageName() + "SPLIT_REQUEST_RECEIVER_CALLBACK");
                        Bundle bundle2 = new Bundle();
                        bundle2.putString(WebActionRouter.KEY_PKG, stringExtra);
                        bundle2.putString("appName", b2);
                        bundle2.putInt("status", intExtra);
                        intent4.putExtra("bundle", bundle2);
                        LocalBroadcastManager.getInstance(context).sendBroadcast(intent4);
                        com.excelliance.kxqp.gs.util.e.c(stringExtra);
                        n.a().a("event_split_apk_importing").postValue(stringExtra);
                    }
                }
                az.d("CustomIntentService", "sendInstallSplitApk Installation succeed");
                return;
            default:
                f a3 = f.a();
                if (stringExtra != null && a3.a(stringExtra)) {
                    String b3 = a3.b(stringExtra);
                    a3.c(stringExtra);
                    by.a(context, "sp_total_info").a("sp_key_close_miui_notice", true);
                    az.d("CustomIntentService", "sendInstallSplitApk Installation failure size:" + a3.d());
                    if (!cd.a(b3)) {
                        Log.d("CustomIntentService", "sendInstallSplitApk Installation failure appName:" + b3);
                        Intent intent5 = new Intent();
                        intent5.setAction(context.getPackageName() + "SPLIT_REQUEST_RECEIVER_CALLBACK");
                        Bundle bundle3 = new Bundle();
                        bundle3.putString(WebActionRouter.KEY_PKG, stringExtra);
                        bundle3.putString("appName", b3);
                        bundle3.putInt("status", intExtra);
                        intent5.putExtra("bundle", bundle3);
                        LocalBroadcastManager.getInstance(context).sendBroadcast(intent5);
                        com.excelliance.kxqp.gs.util.e.c(stringExtra);
                        n.a().a("event_split_apk_importing").postValue(stringExtra);
                    }
                }
                az.d("CustomIntentService", "sendInstallSplitApk Installation failed");
                return;
        }
    }

    private void a(Intent intent) {
        String stringExtra = intent.getStringExtra("account");
        if (TextUtils.isEmpty(stringExtra)) {
            return;
        }
        bz.a().h(getApplicationContext(), stringExtra);
    }

    private void c(Context context, Intent intent) {
        try {
            String stringExtra = intent.getStringExtra("pkgName");
            String stringExtra2 = intent.getStringExtra("reginId");
            Log.d("CustomIntentService", "jumpToGoogleGameDetail: pkgName " + stringExtra + " reginId: " + stringExtra2);
            String z = as.z(context);
            h hVar = new h(null, context);
            if (TextUtils.isEmpty(stringExtra2)) {
                stringExtra2 = z;
            }
            hVar.startGooglePlay(context, stringExtra, stringExtra2);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void d(Context context, Intent intent) {
        String str;
        Exception e;
        Intent intent2;
        String str2 = "";
        Bundle bundleExtra = intent.getBundleExtra("data");
        String string = bundleExtra.getString(WebActionRouter.KEY_PKG);
        Log.d("CustomIntentService", "queryIfNeedJumpToGp data: " + bundleExtra + " pkg: " + string);
        try {
            try {
                ExcellianceAppInfo b2 = as.b(string, context);
                JSONArray jSONArray = new JSONArray();
                try {
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put(WebActionRouter.KEY_PKG, string);
                    jSONObject.put(RankingItem.KEY_VER, b2 == null ? 0 : b2.getVersionCode());
                    int cpu = e.d(context, string, b2 == null ? 0 : b2.getUid()).getCpu();
                    if (cpu == -1) {
                        cpu = 0;
                    }
                    jSONObject.put("cpu", cpu);
                    jSONArray.put(jSONObject);
                } catch (Exception e2) {
                    e2.printStackTrace();
                }
                str = as.a(context, string, jSONArray, false, new AppDownLoadInfoBean(), false);
            } catch (Exception e3) {
                str = "";
                e = e3;
            }
        } catch (Throwable th) {
            th = th;
            Intent intent3 = new Intent("com.excean.android.vending.handle.tourist.download");
            intent3.putExtra(l.c, str2);
            intent3.putExtra("data", bundleExtra);
            intent3.putExtra(WebActionRouter.KEY_PKG, string);
            context.sendBroadcast(intent3);
            throw th;
        }
        try {
            try {
                az.d("CustomIntentService", "queryIfNeedJumpToGp 1: " + str);
                intent2 = new Intent("com.excean.android.vending.handle.tourist.download");
            } catch (Exception e4) {
                e = e4;
                e.printStackTrace();
                intent2 = new Intent("com.excean.android.vending.handle.tourist.download");
                intent2.putExtra(l.c, str);
                intent2.putExtra("data", bundleExtra);
                intent2.putExtra(WebActionRouter.KEY_PKG, string);
                context.sendBroadcast(intent2);
            }
            intent2.putExtra(l.c, str);
            intent2.putExtra("data", bundleExtra);
            intent2.putExtra(WebActionRouter.KEY_PKG, string);
            context.sendBroadcast(intent2);
        } catch (Throwable th2) {
            String str3 = str;
            th = th2;
            str2 = str3;
            Intent intent32 = new Intent("com.excean.android.vending.handle.tourist.download");
            intent32.putExtra(l.c, str2);
            intent32.putExtra("data", bundleExtra);
            intent32.putExtra(WebActionRouter.KEY_PKG, string);
            context.sendBroadcast(intent32);
            throw th;
        }
    }

    private void e(final Context context, final Intent intent) {
        Log.d("CustomIntentService", "switchRegisterProxy1");
        tp.d(new Runnable() {
            @Override
            public void run() {
                if (context == null || intent == null) {
                    return;
                }
                CustomIntentService.this.o(context);
                if (!GameUtil.b()) {
                    PlatSdk.getInstance().initVM((Application) context.getApplicationContext());
                }
                int intExtra = intent.getIntExtra("connect", 1);
                Log.d("CustomIntentService", "switchRegisterProxy2: " + intExtra);
                if (intExtra == 1) {
                    String b2 = by.a(context, "sp_config").b("reg_proxy_config", "");
                    if (TextUtils.isEmpty(b2)) {
                        return;
                    }
                    ProxyConfigHelper.getInstance(context).refreshRegisterConfig(context, com.excelliance.kxqp.gs.util.c.a(b2, "keics_e21p3kds8s"), true);
                    GameUtil.c(true);
                    Log.d("CustomIntentService", "switchRegisterProxy3 ready ");
                    return;
                }
                if (intExtra == 2) {
                    bt a2 = bt.a();
                    int a3 = a2.a(context, "11082");
                    az.d("CustomIntentService", "switchRegisterProxy4 " + a3);
                    if (a3 != -1) {
                        a2.a(a3);
                    }
                    if (GameUtil.b()) {
                        try {
                            com.excelliance.kxqp.wr.a.a().a(0, "com.exce.wv");
                        } catch (Exception e) {
                            e.printStackTrace();
                            Log.e("CustomIntentService", "CustomIntentService/switchRegisterProxy run:" + e.toString());
                        }
                    }
                    GameUtil.c(false);
                    return;
                }
                if (intExtra != 3) {
                    if (intExtra == 4) {
                        String stringExtra = intent.getStringExtra("rip");
                        int intExtra2 = intent.getIntExtra(ClientCookie.PORT_ATTR, 0);
                        az.d("CustomIntentService", "switchRegisterProxy ip: " + stringExtra + " port: " + intExtra2);
                        if (intExtra2 <= 0 || TextUtils.isEmpty(stringExtra)) {
                            return;
                        }
                        ProxyConfigHelper.subTryCount(stringExtra, intExtra2);
                        String a4 = as.a(context, stringExtra, intExtra2);
                        az.d("CustomIntentService", "getRegProxyConfig: " + a4);
                        if (TextUtils.isEmpty(a4)) {
                            return;
                        }
                        by.a(context, "sp_config").a("reg_proxy_config", com.excelliance.kxqp.gs.util.c.a(a4));
                        return;
                    }
                    return;
                }
                GameUtil.c(false);
                String b3 = by.a(context, "sp_config").b("reg_proxy_config", "");
                Log.d("CustomIntentService", "switchRegisterProxy string: " + b3);
                if (TextUtils.isEmpty(b3)) {
                    return;
                }
                String a5 = com.excelliance.kxqp.gs.util.c.a(b3, "keics_e21p3kds8s");
                Log.d("CustomIntentService", "switchRegisterProxy config: " + a5);
                ProxyConfigHelper.getInstance(context).refreshRegisterConfig(context, a5, true);
                GameUtil.c(true);
                Log.d("CustomIntentService", "switchRegisterProxy3 ready ");
                ExcellianceAppInfo b4 = as.b("com.exce.wv", context);
                if (b4 != null) {
                    StatisticsGS.getInstance().uploadUserAction(context, StatisticsBase.UA_GOOGLE_ACCOUNT_REGISTER, 5, 1);
                    PlatSdk platSdk = PlatSdk.getInstance();
                    platSdk.a(context, b4.getPath(), b4.getAppPackageName(), b4.getUid(), platSdk.a(1, context));
                }
            }
        });
    }

    private void f(Context context, Intent intent) {
        try {
            ba.a(context).d(context);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void c(Context context) {
        String a2 = as.a(context, (String) null, 0);
        az.d("CustomIntentService", "getRegProxyConfig: " + a2);
        if (TextUtils.isEmpty(a2)) {
            return;
        }
        by.a(context, "sp_config").a("reg_proxy_config", com.excelliance.kxqp.gs.util.c.a(a2));
    }

    private void g(Context context, Intent intent) {
        int intExtra = intent.getIntExtra("judge", 1);
        String stringExtra = intent.getStringExtra("idAuth");
        String stringExtra2 = intent.getStringExtra("account");
        String stringExtra3 = intent.getStringExtra("rip");
        String stringExtra4 = intent.getStringExtra("rport");
        HashMap hashMap = new HashMap();
        hashMap.put("id", TextUtils.isEmpty(stringExtra) ? "" : stringExtra.trim());
        hashMap.put("account", TextUtils.isEmpty(stringExtra2) ? "" : stringExtra2.trim());
        if (!TextUtils.isEmpty(stringExtra3) && !TextUtils.isEmpty(stringExtra4)) {
            hashMap.put("rip", stringExtra3);
            hashMap.put("rport", stringExtra4);
        }
        az.d("CustomIntentService", "getOauthId judge: " + intExtra + " idAuth: " + stringExtra + " account: " + stringExtra2 + " oauthId: " + as.a(context, intExtra, (HashMap<String, String>) hashMap));
        if (intExtra != 3 || TextUtils.isEmpty(stringExtra) || TextUtils.isEmpty(stringExtra2)) {
            return;
        }
        StatisticsGS.getInstance().uploadUserAction(context, StatisticsBase.UA_GOOGLE_ACCOUNT_OPERATION, 1, stringExtra2);
        bz.a().k(getApplicationContext());
    }

    private String a(String str, String str2) {
        try {
            byte[] bytes = str2.getBytes("utf-8");
            byte[] bytes2 = str.getBytes("utf-8");
            for (byte b2 : bytes) {
                for (int i = 0; i < bytes2.length; i++) {
                    bytes2[i] = (byte) (bytes2[i] ^ b2);
                }
            }
            return Base64.encodeToString(bytes2, 0);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    private void a(final Context context, final int i) {
        tp.b(new Runnable() {
            @Override
            public void run() {
                boolean z;
                by a2 = by.a(context, "sp_total_info");
                if (a2.b(".hide.register.google.account", false).booleanValue()) {
                    az.d("CustomIntentService", "signAccountSuccess: " + a2.c(".user.back.count", 0));
                    return;
                }
                if (i == 1) {
                    if (!GameUtil.b()) {
                        PlatSdk.getInstance().initVM((Application) context.getApplicationContext());
                    }
                    List<com.excelliance.kxqp.gs.ui.account.c> list = null;
                    int i2 = 3;
                    while (i2 > 0) {
                        list = as.f();
                        if (list != null && list.size() > 0) {
                            break;
                        }
                        i2--;
                        try {
                            Thread.sleep(1000L);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                    az.d("CustomIntentService", "startAppGame allAccounts: " + list);
                    if (list == null || list.size() <= 0) {
                        z = false;
                        if (z) {
                            return;
                        }
                        a2.a(".hide.register.google.account", true);
                        cb.a(false, 1, context);
                        if (a2.b("login.success.account", false).booleanValue()) {
                            cb.a(true, 2, context);
                        }
                        Intent intent = new Intent();
                        intent.setAction(context.getPackageName() + VersionManager.q);
                        context.sendBroadcast(intent);
                        return;
                    }
                }
                z = true;
                if (z) {
                }
            }
        });
    }

    public void h(Context context, Intent intent) {
        try {
            JSONObject jSONObject = new JSONObject();
            String stringExtra = intent.getStringExtra("apkPath");
            String stringExtra2 = intent.getStringExtra("libName");
            int intExtra = intent.getIntExtra(AdPlatBeanResult.FIRST, 2);
            az.d("CustomIntentService", "reportGPGameInfo apkPath: " + stringExtra + " libName: " + stringExtra2);
            if (!TextUtils.isEmpty(stringExtra) && !TextUtils.isEmpty(stringExtra2)) {
                VersionBean g = as.g(context, stringExtra);
                az.d("CustomIntentService", "reportGPGameInfo versionBean: " + g);
                try {
                    jSONObject.put("apkver", g.getVersioncode());
                    jSONObject.put("pkgname", stringExtra2);
                    jSONObject.put(AdPlatBeanResult.FIRST, intExtra);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                String c2 = bn.c(context, stringExtra2);
                String str = c2 + "/main." + g.getVersioncode() + "." + stringExtra2 + ResponseData.KEY_OBB_SUFFIX;
                String str2 = c2 + "/patch." + g.getVersioncode() + "." + stringExtra2 + ResponseData.KEY_OBB_SUFFIX;
                File file = new File(str);
                if (!file.exists() || !file.isFile()) {
                    File a2 = an.a(file.getParentFile(), Pattern.compile("^main.[0-9]*." + stringExtra2 + ResponseData.KEY_OBB_SUFFIX));
                    if (a2 != null) {
                        str = a2.getAbsolutePath();
                        az.d("CustomIntentService", "reportGPGameInfo main: " + str);
                    }
                }
                File file2 = new File(str);
                az.d("CustomIntentService", "reportGPGameInfo exists: " + file2.exists());
                if (!TextUtils.isEmpty(str) && file2.exists()) {
                    String a3 = an.a(str);
                    JSONObject jSONObject2 = new JSONObject();
                    try {
                        jSONObject2.put("md5", a3);
                        jSONObject2.put(RankingItem.KEY_SIZE, file2.length());
                        String substring = file2.getName().substring("main.".length(), r4.lastIndexOf(stringExtra2) - 1);
                        Log.d("CustomIntentService", "reportGPGameInfo: " + substring);
                        jSONObject2.put(RankingItem.KEY_VER, substring);
                        jSONObject2.put("time", file2.lastModified() / 1000);
                        jSONObject.put("main", jSONObject2);
                    } catch (JSONException e2) {
                        e2.printStackTrace();
                    }
                }
                File file3 = new File(str2);
                if (!file3.exists() || !file3.isFile()) {
                    File a4 = an.a(file3.getParentFile(), Pattern.compile("^patch.[0-9]*." + stringExtra2 + ResponseData.KEY_OBB_SUFFIX));
                    if (a4 != null) {
                        str2 = a4.getAbsolutePath();
                    }
                }
                File file4 = new File(str2);
                if (!TextUtils.isEmpty(str2) && file4.exists()) {
                    String a5 = an.a(str2);
                    JSONObject jSONObject3 = new JSONObject();
                    try {
                        jSONObject3.put("md5", a5);
                        jSONObject3.put(RankingItem.KEY_SIZE, file4.length());
                        String substring2 = file4.getName().substring("patch.".length(), r13.lastIndexOf(stringExtra2) - 1);
                        Log.d("CustomIntentService", "reportGPGameInfo: " + substring2);
                        jSONObject3.put(RankingItem.KEY_VER, substring2);
                        jSONObject3.put("time", file4.lastModified() / 1000);
                        jSONObject.put(ExcellianceAppInfo.KEY_PATCH, jSONObject3);
                    } catch (JSONException e3) {
                        e3.printStackTrace();
                    }
                }
                if (b.c && !cd.a(stringExtra)) {
                    File file5 = new File(stringExtra);
                    if (file5.exists() && file5.isDirectory()) {
                        File[] listFiles = file5.listFiles();
                        try {
                            JSONArray jSONArray = new JSONArray();
                            int length = listFiles.length;
                            for (File file6 : listFiles) {
                                if (file6.exists() && file6.isFile() && !file6.isHidden()) {
                                    String name = file6.getName();
                                    int lastIndexOf = name.lastIndexOf("config.");
                                    int lastIndexOf2 = name.lastIndexOf(".apk");
                                    if (lastIndexOf >= 0 && lastIndexOf2 > 0 && lastIndexOf2 > lastIndexOf) {
                                        jSONArray.put(name.substring(lastIndexOf, lastIndexOf2));
                                    } else if (!name.toLowerCase().endsWith(".flock") && !name.toLowerCase().endsWith(".dex")) {
                                        jSONArray.put(name);
                                    }
                                }
                            }
                            jSONObject.put("multi", jSONArray);
                        } catch (JSONException e4) {
                            e4.printStackTrace();
                        }
                    }
                }
                String jSONObject4 = jSONObject.toString();
                as.f(context, jSONObject4);
                az.d("CustomIntentService", "reportGPGameInfo: " + jSONObject4);
            }
        } catch (Exception e5) {
            e5.printStackTrace();
        }
    }

    public void d(Context context) {
        Bundle a2 = an.a();
        az.d("CustomIntentService", "migrateGame migratePkgInfo: " + a2 + " waitForEnvironment: " + f8152a);
        if (a2 == null) {
            return;
        }
        if (!com.excelliance.kxqp.gs.ui.home.b.a(context).b()) {
            f8152a = true;
            return;
        }
        String string = a2.getString(WebActionRouter.KEY_PKG);
        az.d("CustomIntentService", "migrateGame pkg: " + string);
        if (TextUtils.isEmpty(string)) {
            f8152a = false;
            return;
        }
        ExcellianceAppInfo b2 = as.b(string, context);
        az.d("CustomIntentService", "migrateGame info: " + b2);
        if (b2 != null) {
            a(string);
            f8152a = false;
            return;
        }
        int i = a2.getInt("cpu");
        String packageName = getPackageName();
        az.d("CustomIntentService", "migrateGame cpu: " + i + " pkg: " + string + " packageName: " + packageName);
        if ((i == 0 && !packageName.endsWith(".b64")) || (i == 1 && packageName.endsWith(".b64"))) {
            f8152a = false;
            return;
        }
        if (i > 2 || i < 0) {
            f8152a = false;
            return;
        }
        String b3 = bn.b(string);
        if (TextUtils.isEmpty(b3) || !new File(b3).exists()) {
            f8152a = false;
            return;
        }
        Intent intent = new Intent(context.getPackageName() + ".add.game.migrate");
        intent.putExtra("show", true);
        context.sendBroadcast(intent);
        String k = bn.k(context, string);
        an.a(b3, k);
        an.b(k);
        Bundle bundle = new Bundle();
        bundle.putString(WebActionRouter.KEY_PKG, string);
        bundle.putString("apkPath", k);
        bundle.putInt("installType", 1);
        bundle.putInt("sourceType", 101);
        Intent intent2 = new Intent("com.excelliance.kxqp.action.installDownApps");
        intent2.setComponent(new ComponentName(context.getPackageName(), "com.excelliance.kxqp.SmtServService"));
        intent2.putExtra("bundle", bundle);
        try {
            context.startService(intent2);
        } catch (Exception unused) {
        }
        VersionBean g = as.g(context, k);
        Intent intent3 = new Intent();
        intent3.putExtra(ClientCookie.VERSION_ATTR, g.getVersioncode());
        intent3.putExtra("libName", string);
        intent3.setAction(context.getPackageName() + ".download.check.check.obb");
        intent3.setComponent(new ComponentName(context.getPackageName(), "com.excelliance.kxqp.gs.service.CustomIntentService"));
        try {
            context.startService(intent3);
        } catch (Exception unused2) {
        }
        a(string);
    }

    private void a(String str) {
        String a2 = bn.a();
        String b2 = bn.b(str);
        an.c(a2);
        an.c(b2);
    }

    private void i(Context context, Intent intent) {
        Log.d("CustomIntentService", "migrateApk start ");
        String stringExtra = intent.getStringExtra(WebActionRouter.KEY_PKG);
        String stringExtra2 = intent.getStringExtra(ClientCookie.PATH_ATTR);
        int intExtra = intent.getIntExtra("cpu", 0);
        if (TextUtils.isEmpty(stringExtra) || TextUtils.isEmpty(stringExtra2) || TextUtils.isEmpty(stringExtra2) || !new File(stringExtra2).exists()) {
            return;
        }
        String b2 = bn.b(stringExtra);
        an.a(stringExtra2, b2);
        an.b(b2);
        an.a(stringExtra, intExtra);
        Log.d("CustomIntentService", "migrateApk end ");
    }

    private void j(Context context, Intent intent) {
        String stringExtra = intent.getStringExtra("devices");
        String stringExtra2 = intent.getStringExtra(SocialConstants.PARAM_URL);
        az.d("CustomIntentService", "reportDownloaderManagerState: " + stringExtra + "\n url: " + stringExtra2);
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put(SocialConstants.PARAM_URL, stringExtra2);
            jSONObject.put("devices", stringExtra);
            jSONObject.put("client", 1);
            if (!bf.e(context) || cd.a(as.e(context, jSONObject.toString()))) {
                return;
            }
            by.a(context, "sp_total_info").a(".downloader.manager.info", stringExtra);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    private void a(Intent intent, Context context) {
        String stringExtra = intent.getStringExtra(WebActionRouter.KEY_PKG);
        if (TextUtils.isEmpty(stringExtra)) {
            return;
        }
        String[] split = stringExtra.split(i.f491b);
        List<AddGameBean> a2 = at.a(context);
        ListIterator<AddGameBean> listIterator = a2.listIterator();
        String str = null;
        while (listIterator.hasNext()) {
            AddGameBean next = listIterator.next();
            for (String str2 : split) {
                if (TextUtils.equals(next.packageName, str2)) {
                    if (TextUtils.isEmpty(str)) {
                        str = str2;
                    }
                    at.a(next.iconPath);
                    listIterator.remove();
                }
            }
        }
        at.a(context, a2);
    }

    private void k(final Context context, Intent intent) {
        boolean z;
        Bundle bundleExtra = intent.getBundleExtra("obbDownState");
        final String string = bundleExtra.getString("libName");
        String string2 = bundleExtra.getString("main");
        String string3 = bundleExtra.getString(ExcellianceAppInfo.KEY_PATCH);
        bundleExtra.getLong(ClientCookie.VERSION_ATTR);
        long j = bundleExtra.getLong("obbVer");
        int i = bundleExtra.getInt("appId");
        final ExcellianceAppInfo b2 = as.b(string, context);
        if (b2 == null) {
            return;
        }
        az.d("CustomIntentService", "refreshObbDownloadState libName: " + string + " patch: " + string3 + " main: " + string2 + " appId:" + i);
        JSONObject jSONObject = new JSONObject();
        if (!TextUtils.isEmpty(string2)) {
            b2.setMainObb("");
            b2.mainObbVer = (int) j;
            try {
                jSONObject.put(ExcellianceAppInfo.KEY_MAINOBB, b2.getMainObb());
                jSONObject.put(ExcellianceAppInfo.KEY_MAINOBBVER, b2.mainObbVer);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        } else if (!TextUtils.isEmpty(string3)) {
            b2.setPatchObb("");
            b2.patchObbVer = (int) j;
            try {
                jSONObject.put(ExcellianceAppInfo.KEY_PATCHOBB, b2.getPatchObb());
                jSONObject.put(ExcellianceAppInfo.KEY_PATCHOBBVER, b2.patchObbVer);
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
        } else {
            z = false;
            if (!b2.loseObb()) {
                b2.setDownloadStatus(1);
                b2.setDownloadProgress(0);
                try {
                    jSONObject.put(ExcellianceAppInfo.KEY_DPRORESS, b2.getDownloadProgress());
                    jSONObject.put(ExcellianceAppInfo.KEY_DSTATUS, b2.getDownloadStatus());
                } catch (JSONException e3) {
                    e3.printStackTrace();
                }
                if (com.excelliance.kxqp.gs.util.b.S(context) && z && i != 0) {
                    az.d("CustomIntentService", "refreshObbDownloadState report update info libName: " + string + " patch: " + string3 + " main: " + string2 + " appId:" + i);
                    SmtServService.a(b2.getPath(), b2.getAppPackageName(), context, true);
                }
                try {
                    if (!ab.a()) {
                        az.i("CustomIntentService", "refreshObbDownloadState pkg = " + string + " flag:8796094070784");
                        com.excelliance.kxqp.wr.a.a().a(0, string, 8796094070784L, false);
                    }
                } catch (Exception e4) {
                    e4.printStackTrace();
                }
            }
            if (TextUtils.equals(b2.getGameType(), Constants.VIA_SHARE_TYPE_PUBLISHVIDEO)) {
                GameUtil intance = GameUtil.getIntance();
                intance.q(context);
                b2.setGameType(TextUtils.equals(intance.h(string), b2.getPath()) ? "5" : "1");
                try {
                    jSONObject.put(ExcellianceAppInfo.KEY_GTYPE, b2.getGameType());
                } catch (JSONException e5) {
                    e5.printStackTrace();
                }
            }
            final CheckAppDownloadStateResult a2 = a(b2);
            a.a(context).a().runInTransaction(new Runnable() {
                @Override
                public void run() {
                    ExcellianceAppInfo b3 = a.a(context).b(string);
                    b3.setMainObb(b2.getMainObb());
                    b3.mainObbVer = b2.mainObbVer;
                    b3.setPatchObb(b2.getPatchObb());
                    b3.patchObbVer = b2.mainObbVer;
                    b3.setDownloadStatus(b2.getDownloadStatus());
                    b3.setDownloadProgress(b2.getDownloadProgress());
                    b3.setGameType(b2.getGameType());
                    b3.lastDownloadTime = a2.lastDownloadTime;
                    if (a2.downloadOver) {
                        b3.lastPauseTime = 0L;
                    }
                    if (a2.downloadOver) {
                        b3.downloadSubStatus = 0;
                    }
                    Log.d("CustomIntentService", String.format("CustomIntentService/refreshObbDownloadState run:thread(%s) mainObbVer(%s)", Thread.currentThread().getName(), Integer.valueOf(b3.mainObbVer)));
                    a.a(context).b(b3);
                }
            });
            if (!b2.loseObb()) {
                a(context, b2.getAppPackageName());
            }
            az.d("CustomIntentService", "refreshObbDownloadState add onn info 0:  loseObb:" + b2.loseObb() + " appId:" + i);
            if (com.excelliance.kxqp.gs.util.b.S(context) && !b2.loseObb() && i != 0) {
                Log.e("CustomIntentService", "refreshObbDownloadState: add onn info" + b2);
                com.excelliance.kxqp.bitmap.a.a.a(context, b2.appId);
            }
            if (!b2.haveApkInstalled()) {
                com.excelliance.kxqp.manager.c.a(context).a(context, b2, "obb");
                return;
            }
            Log.e("CustomIntentService", "refreshObbDownloadState: " + b2);
            return;
        }
        z = true;
        if (!b2.loseObb()) {
        }
        if (TextUtils.equals(b2.getGameType(), Constants.VIA_SHARE_TYPE_PUBLISHVIDEO)) {
        }
        final CheckAppDownloadStateResult a22 = a(b2);
        a.a(context).a().runInTransaction(new Runnable() {
            @Override
            public void run() {
                ExcellianceAppInfo b3 = a.a(context).b(string);
                b3.setMainObb(b2.getMainObb());
                b3.mainObbVer = b2.mainObbVer;
                b3.setPatchObb(b2.getPatchObb());
                b3.patchObbVer = b2.mainObbVer;
                b3.setDownloadStatus(b2.getDownloadStatus());
                b3.setDownloadProgress(b2.getDownloadProgress());
                b3.setGameType(b2.getGameType());
                b3.lastDownloadTime = a22.lastDownloadTime;
                if (a22.downloadOver) {
                    b3.lastPauseTime = 0L;
                }
                if (a22.downloadOver) {
                    b3.downloadSubStatus = 0;
                }
                Log.d("CustomIntentService", String.format("CustomIntentService/refreshObbDownloadState run:thread(%s) mainObbVer(%s)", Thread.currentThread().getName(), Integer.valueOf(b3.mainObbVer)));
                a.a(context).b(b3);
            }
        });
        if (!b2.loseObb()) {
        }
        az.d("CustomIntentService", "refreshObbDownloadState add onn info 0:  loseObb:" + b2.loseObb() + " appId:" + i);
        if (com.excelliance.kxqp.gs.util.b.S(context)) {
            Log.e("CustomIntentService", "refreshObbDownloadState: add onn info" + b2);
            com.excelliance.kxqp.bitmap.a.a.a(context, b2.appId);
        }
        if (!b2.haveApkInstalled()) {
        }
    }

    private void a(final Context context, String str) {
        Log.d("CustomIntentService", String.format("AntPluginInstallOut:thread(%s) pkg(%s) ", Thread.currentThread().getName(), str));
        boolean t = au.a().t(str);
        az.d("CustomIntentService", "AntPluginInstallOut isFgoType:" + t + " pkg:" + str);
        if (t) {
            final ExcellianceAppInfo b2 = a.a(context).b(str);
            az.d("CustomIntentService", "AntPluginInstallOut appInfo:" + b2);
            if (b2 == null || !TextUtils.equals(b2.getGameType(), "1") || !b2.isInstalled() || b2.market_install_local == 1) {
                return;
            }
            if (!bn.d(b2.path) || f.g()) {
                try {
                    PackageInfo packageInfo = context.getPackageManager().getPackageInfo(b2.getAppPackageName(), 0);
                    if (packageInfo != null) {
                        int i = packageInfo.versionCode;
                        az.d("CustomIntentService", "AntPluginInstallOut versionCodeNative:" + i + " versionCode:" + b2.getVersionCode());
                        if (i > b2.getVersionCode()) {
                            return;
                        }
                    } else {
                        az.d("CustomIntentService", "AntPluginInstallOut enter packageInfo == null");
                    }
                } catch (PackageManager.NameNotFoundException e) {
                    e.printStackTrace();
                    az.d("CustomIntentService", "AntPluginInstallOut fail");
                }
                if (com.excelliance.kxqp.manager.b.a().a(b2.getAppPackageName())) {
                    com.excelliance.kxqp.gs.util.e.a(context, b2.getPath(), b2.getAppPackageName(), b2.getAppName(), new InstallResultcallBack() {
                        @Override
                        public void onResult(boolean z) {
                            if (z) {
                                au.a().a(context, b2.getAppPackageName(), b2.getPath(), false);
                            }
                        }
                    });
                }
            }
        }
    }

    private void l(Context context, Intent intent) {
        Bundle bundleExtra = intent.getBundleExtra("splitDownState");
        com.excelliance.kxqp.util.d.c.a(context, new com.excelliance.kxqp.util.d.a.b(bundleExtra.getInt("appId"), bundleExtra.getString("libName"), bundleExtra.getString("filePath"), bundleExtra.getString("split_name"), bundleExtra.getLong(ClientCookie.VERSION_ATTR), bundleExtra.getInt("downloadState")));
    }

    public void m(final Context context, Intent intent) {
        int i;
        DownBean a2;
        DownBean a3;
        long longExtra = intent.getLongExtra(ClientCookie.VERSION_ATTR, 0L);
        final String stringExtra = intent.getStringExtra("libName");
        boolean booleanExtra = intent.getBooleanExtra("ignoreFile", false);
        boolean booleanExtra2 = intent.getBooleanExtra("updateSource", false);
        boolean booleanExtra3 = intent.getBooleanExtra("downloadForUpdate", false);
        int intExtra = intent.getIntExtra("appId", 0);
        DownService.a(context, stringExtra);
        a.a(context.getApplicationContext()).a().runInTransaction(new Runnable() {
            @Override
            public void run() {
                ExcellianceAppInfo b2 = a.a(context.getApplicationContext()).b(stringExtra);
                if (b2 != null) {
                    b2.downloadStatus = 13;
                    a.a(context.getApplicationContext()).b(b2);
                }
            }
        });
        if (com.excelliance.kxqp.gs.util.b.S(context) && intExtra != 0) {
            az.d("CustomIntentService", "yalp checkObbDownLoad: ");
            ArrayList arrayList = new ArrayList();
            JSONObject c2 = ck.c(context, stringExtra, longExtra);
            com.excelliance.kxqp.gs.m.a.f b2 = com.excelliance.kxqp.gs.m.d.a.a().b(context, "appId", String.valueOf(intExtra));
            int optInt = c2.optInt("main");
            int optInt2 = c2.optInt(ExcellianceAppInfo.KEY_PATCH);
            if (b2 != null && !b2.c() && b2.p.i >= optInt && (a3 = com.excelliance.kxqp.gs.m.b.a.a(b2, true, context)) != null) {
                arrayList.add(a3);
            }
            if (b2 != null && !b2.d() && b2.q.i >= optInt2 && (a2 = com.excelliance.kxqp.gs.m.b.a.a(b2, false, context)) != null) {
                arrayList.add(a2);
            }
            for (DownBean downBean : arrayList) {
                String query = com.excelliance.kxqp.gs.multi.a.a.a(context).query(downBean.name);
                if (!cd.a(query)) {
                    ay.a(query, downBean);
                }
                az.d("CustomIntentService", "yalp downloadObb downBean: " + downBean);
            }
            if (arrayList.size() > 0 && !booleanExtra) {
                ListIterator<DownBean> listIterator = arrayList.listIterator();
                while (listIterator.hasNext()) {
                    DownBean next = listIterator.next();
                    File file = new File(next.filePath);
                    if (file.exists() && file.length() == next.size && d.a(next)) {
                        Log.d("OBB_FUCK", "yalp obb exist already downBean:" + next);
                        listIterator.remove();
                    }
                }
            }
            HashMap hashMap = new HashMap();
            for (int i2 = 0; i2 < arrayList.size(); i2++) {
                hashMap.put("obb" + i2, arrayList.get(i2));
            }
            if (arrayList.size() <= 0) {
                a(context, stringExtra, false, (List<DownBean>) arrayList, booleanExtra2, booleanExtra3);
                if (com.excelliance.kxqp.gs.util.b.S(context) && intExtra != 0) {
                    Log.e("CustomIntentService", "checkObbDownLoad: add onn pkg:" + stringExtra);
                    com.excelliance.kxqp.bitmap.a.a.a(context, intExtra);
                }
            } else {
                a(context, stringExtra, true, (List<DownBean>) arrayList, booleanExtra2, booleanExtra3);
            }
            a(context, hashMap, booleanExtra2, stringExtra);
        } else {
            ObbNativeInfo b3 = as.b(context, stringExtra, longExtra);
            String a4 = as.a(context, stringExtra, longExtra, b3.mJSONObject_obbinfo);
            az.d("CustomIntentService", "checkObbDownLoad: " + a4);
            ArrayList arrayList2 = new ArrayList();
            if (!TextUtils.isEmpty(a4)) {
                boolean a5 = ay.a(context, a4, arrayList2);
                az.d("CustomIntentService", "downloadObb size: " + arrayList2.size());
                for (DownBean downBean2 : arrayList2) {
                    com.excelliance.kxqp.gs.multi.a.a a6 = com.excelliance.kxqp.gs.multi.a.a.a(context);
                    String query2 = a6.query(downBean2.name);
                    if (!cd.a(query2)) {
                        ay.a(query2, downBean2);
                    }
                    PatchDownBean patchDownBean = downBean2.patchDownBean;
                    if (patchDownBean != null) {
                        String query3 = a6.query(patchDownBean.name);
                        if (!cd.a(query3)) {
                            ay.a(query3, patchDownBean);
                        }
                    }
                    az.d("CustomIntentService", "downloadObb downBean: " + downBean2);
                }
                if (a5 && !booleanExtra) {
                    ListIterator<DownBean> listIterator2 = arrayList2.listIterator();
                    while (listIterator2.hasNext()) {
                        DownBean next2 = listIterator2.next();
                        String str = next2.filePath;
                        File file2 = new File(str);
                        if (a(b3, next2, listIterator2)) {
                            az.d("CustomIntentService", "checkObbDownLoad exist same md5 and other versionCode downBean: " + next2);
                            as.c(context.getApplicationContext(), next2.packageName, longExtra);
                        } else if (file2.exists()) {
                            if (TextUtils.equals(an.a(str), next2.md5)) {
                                Log.d("OBB_FUCK", "obb exist already");
                                listIterator2.remove();
                            }
                        } else if (next2.patchDownBean != null) {
                            if (new File(next2.patchDownBean.filePath + "").exists() && TextUtils.isEmpty(e.a(context, stringExtra, next2.patchDownBean.filePath))) {
                                e.a(context, new File(next2.patchDownBean.filePath), stringExtra, 0, an.a(next2.patchDownBean.filePath), null);
                            }
                        }
                    }
                }
            }
            HashMap hashMap2 = new HashMap();
            if (arrayList2.size() > 0) {
                int size = arrayList2.size();
                for (int i3 = 0; i3 < arrayList2.size(); i3++) {
                    hashMap2.put("obb" + i3, arrayList2.get(i3));
                }
                i = size;
            } else {
                i = 0;
            }
            if (i <= 0) {
                a(context, stringExtra, false, (List<DownBean>) arrayList2, booleanExtra2, booleanExtra3);
                a(context, stringExtra);
            } else {
                a(context, stringExtra, true, (List<DownBean>) arrayList2, booleanExtra2, booleanExtra3);
            }
            a(context, hashMap2, booleanExtra2, stringExtra);
        }
        DownService.b(context, stringExtra);
    }

    private void a(Context context, Map<String, DownBean> map, boolean z, String str) {
        Log.d("CustomIntentService", String.format("CustomIntentService/downloadObb:thread(%s) ", Thread.currentThread().getName()));
        try {
            ArrayList arrayList = new ArrayList();
            for (int i = 0; i < map.size(); i++) {
                DownBean downBean = map.get("obb" + i);
                if (downBean != null) {
                    arrayList.add(downBean);
                }
            }
            Log.e("CustomIntentService", "Obb size:" + arrayList.size());
            if (arrayList.size() > 0) {
                if (z) {
                    b(context, str);
                }
                com.excelliance.kxqp.gs.multi.down.a.a(context).a(arrayList);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void b(final Context context, final String str) {
        a.a(context).a().runInTransaction(new Runnable() {
            @Override
            public void run() {
                ExcellianceAppInfo b2 = a.a(context).b(str);
                if (b2 != null) {
                    b2.lastDownloadTime = System.currentTimeMillis();
                    az.d("CustomIntentService", "updateDownloadAppTime appInfo: " + b2);
                    a.a(context).b(b2);
                }
            }
        });
        tp.f(new Runnable() {
            @Override
            public void run() {
                ExcellianceAppInfo b2 = a.a(context).b(str);
                if (b2 != null) {
                    com.excelliance.kxqp.gs.g.c.a().a(b2);
                }
            }
        });
    }

    private boolean a(ObbNativeInfo obbNativeInfo, DownBean downBean, ListIterator<DownBean> listIterator) {
        if (obbNativeInfo.mJSONObject_obbinfo != null && downBean.name.startsWith("main")) {
            String str = obbNativeInfo.main_md5;
            String str2 = obbNativeInfo.main_file;
            int i = obbNativeInfo.main_ver;
            if (!cd.a(str2) && !cd.a(str) && downBean.md5.equals(str) && i != downBean.versionCode) {
                File file = new File(str2);
                if (file.exists()) {
                    az.d("CustomIntentService", "checkNativeOtherObbMd5IsSame main filepath:" + str2 + " main new filepath:" + downBean.filePath + " main_ver:" + i + " new main_ver:" + downBean.versionCode);
                    file.renameTo(new File(downBean.filePath));
                    listIterator.remove();
                    return true;
                }
            }
        } else if (obbNativeInfo.mJSONObject_obbinfo != null && downBean.name.startsWith(ExcellianceAppInfo.KEY_PATCH)) {
            String str3 = obbNativeInfo.patch_md5;
            String str4 = obbNativeInfo.patch_file;
            int i2 = obbNativeInfo.patch_ver;
            if (!cd.a(str4) && !cd.a(str3) && downBean.md5.equals(str3) && i2 != downBean.versionCode) {
                File file2 = new File(str4);
                if (file2.exists()) {
                    az.d("CustomIntentService", "checkNativeOtherObbMd5IsSame patch filepath:" + str4 + " patch new filepath:" + downBean.filePath + " patch_ver:" + i2 + " new patch_ver:" + downBean.versionCode);
                    file2.renameTo(new File(downBean.filePath));
                    listIterator.remove();
                    return true;
                }
            }
        }
        return false;
    }

    private void n(Context context, Intent intent) {
        com.excelliance.kxqp.util.d.a.a(context, new com.excelliance.kxqp.util.d.a.a(intent.getLongExtra(ClientCookie.VERSION_ATTR, 0L), intent.getStringExtra("libName"), intent.getBooleanExtra("ignoreFile", false), intent.getIntExtra("appId", 0), intent.getStringExtra("filePath")));
    }

    private void a(Context context, String str, boolean z, List<DownBean> list, boolean z2, boolean z3) {
        ExcellianceAppInfo b2 = as.b(str, context);
        if (b2 == null) {
            Log.e("CustomIntentService", "refreshByObb: appInfo is null ");
            return;
        }
        if (!z) {
            a(context, 100, list, b2, z2, z3);
            if (b2.haveApkInstalled()) {
                com.excelliance.kxqp.manager.c.a(context).a(context, b2, "obb");
                return;
            }
            Intent intent = new Intent();
            intent.setAction(context.getPackageName() + ".download.notify.state");
            Bundle bundle = new Bundle();
            bundle.putInt("index", -1);
            bundle.putInt("state", 1);
            bundle.putInt("errorCount", 0);
            bundle.putString(WebActionRouter.KEY_PKG, str);
            intent.putExtra("bundle", bundle);
            LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
            az.d("CustomIntentService", "bundle " + bundle);
            return;
        }
        a(context, 0, list, b2, z2, z3);
        Intent intent2 = new Intent();
        intent2.setAction(context.getPackageName() + VersionManager.q);
        context.sendBroadcast(intent2);
    }

    private void a(final Context context, final int i, List<DownBean> list, final ExcellianceAppInfo excellianceAppInfo, boolean z, boolean z2) {
        VersionManager.getInstance().a(context);
        if (excellianceAppInfo != null) {
            excellianceAppInfo.setDownloadProgress(i);
            if (list.size() > 0) {
                a(excellianceAppInfo, list);
                excellianceAppInfo.setDownloadStatus(2);
            } else {
                excellianceAppInfo.setDownloadStatus(1);
                if (excellianceAppInfo.downloadSubStatus == 2) {
                    excellianceAppInfo.downloadSubStatus = 0;
                }
            }
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put(ExcellianceAppInfo.KEY_MAINOBB, excellianceAppInfo.getMainObb());
                jSONObject.put(ExcellianceAppInfo.KEY_PATCHOBB, excellianceAppInfo.getPatchObb());
                jSONObject.put(ExcellianceAppInfo.KEY_DPRORESS, i);
                jSONObject.put(ExcellianceAppInfo.KEY_DSTATUS, excellianceAppInfo.getDownloadStatus());
            } catch (JSONException e) {
                e.printStackTrace();
            }
            final String mainObb = excellianceAppInfo.getMainObb();
            final String patchObb = excellianceAppInfo.getPatchObb();
            final int downloadStatus = excellianceAppInfo.getDownloadStatus();
            final int i2 = excellianceAppInfo.downloadSubStatus;
            final CheckAppDownloadStateResult a2 = a(excellianceAppInfo, z, z2);
            a.a(context).a().runInTransaction(new Runnable() {
                @Override
                public void run() {
                    ExcellianceAppInfo b2 = a.a(context).b(excellianceAppInfo.appPackageName);
                    b2.mainObb = mainObb;
                    b2.patchObb = patchObb;
                    b2.downloadProress = i;
                    b2.downloadStatus = downloadStatus;
                    b2.downloadSubStatus = i2;
                    b2.lastDownloadTime = a2.lastDownloadTime;
                    if (a2.downloadOver) {
                        b2.lastPauseTime = 0L;
                    }
                    if (a2.downloadOver) {
                        excellianceAppInfo.downloadSubStatus = 0;
                    }
                    Log.d("CustomIntentService", String.format("DownManager/onObbChanged runInTransaction run:thread(%s) mainObb(%s) progress(%s) state(%s)", Thread.currentThread().getName(), b2.mainObb, Integer.valueOf(b2.downloadProress), Integer.valueOf(b2.downloadStatus)));
                    a.a(context).b(b2);
                }
            });
            az.d("CustomIntentService", "refreshExcellianceAppInfo appInfo: " + excellianceAppInfo + "\t" + InitialData.a(context).a(-1, 0, excellianceAppInfo.getAppPackageName()));
        }
    }

    private CheckAppDownloadStateResult a(ExcellianceAppInfo excellianceAppInfo, boolean z, boolean z2) {
        az.d("CustomIntentService", "getLastDownloadTime appInfo: " + excellianceAppInfo + " updateObb:" + z + " downloadForUpdate:" + z2);
        CheckAppDownloadStateResult checkAppDownloadStateResult = new CheckAppDownloadStateResult();
        long j = excellianceAppInfo.lastDownloadTime;
        boolean z3 = false;
        if (z && (!TextUtils.isEmpty(excellianceAppInfo.getMainObb()) || !TextUtils.isEmpty(excellianceAppInfo.getPatch()))) {
            j = System.currentTimeMillis();
        } else if (TextUtils.isEmpty(excellianceAppInfo.getMainObb()) && TextUtils.isEmpty(excellianceAppInfo.getPatch())) {
            if (j > 0) {
                com.excelliance.kxqp.gs.g.c.a().a(excellianceAppInfo, true, (String) null, z2, j);
            }
            j = 0;
            z3 = true;
        }
        checkAppDownloadStateResult.lastDownloadTime = j;
        checkAppDownloadStateResult.downloadOver = z3;
        az.d("CustomIntentService", "getLastDownloadTime appInfo: " + excellianceAppInfo + " updateObb:" + z + " downloadForUpdate:" + z2 + " checkAppDownloadStateResult:" + checkAppDownloadStateResult);
        return checkAppDownloadStateResult;
    }

    private CheckAppDownloadStateResult a(ExcellianceAppInfo excellianceAppInfo) {
        boolean z;
        az.d("CustomIntentService", "getLastDownloadSatte appInfo: " + excellianceAppInfo);
        CheckAppDownloadStateResult checkAppDownloadStateResult = new CheckAppDownloadStateResult();
        long j = excellianceAppInfo.lastDownloadTime;
        if (TextUtils.isEmpty(excellianceAppInfo.getMainObb()) && TextUtils.isEmpty(excellianceAppInfo.getPatch())) {
            z = true;
            if (j > 0) {
                com.excelliance.kxqp.gs.g.c.a().a(excellianceAppInfo, true, (String) null, false, j);
            }
            j = 0;
        } else {
            z = false;
        }
        checkAppDownloadStateResult.lastDownloadTime = j;
        checkAppDownloadStateResult.downloadOver = z;
        az.d("CustomIntentService", "getLastDownloadSatte appInfo: " + excellianceAppInfo + " checkAppDownloadStateResult:" + checkAppDownloadStateResult);
        return checkAppDownloadStateResult;
    }

    private void a(ExcellianceAppInfo excellianceAppInfo, List<DownBean> list) {
        for (DownBean downBean : list) {
            String str = downBean.name;
            long j = downBean.versionCode;
            if (str.contains("main." + j)) {
                excellianceAppInfo.setMainObb(str);
            } else {
                if (str.contains("patch." + j)) {
                    excellianceAppInfo.setPatchObb(str);
                }
            }
        }
    }

    private void c(final Context context, final String str) {
        tp.d(new Runnable() {
            @Override
            public void run() {
                String a2 = as.a(str, context);
                az.d("CustomIntentService", "preGetShareInfo: " + a2);
                if (TextUtils.isEmpty(a2) || ay.e(a2).beanIsNull()) {
                    return;
                }
                by.a(context, "sp_share_info").a(str, true);
            }
        });
    }

    public void o(Context context, Intent intent) {
        as.l(context.getApplicationContext());
        b(context.getApplicationContext());
        g(context, intent);
        l(context);
        m(context);
        k(context);
        g(context);
        n(context);
        Log.d("CustomIntentService", "initialInit start3 " + System.currentTimeMillis());
        a(context, 1);
        j(context);
        p(context);
        i(context);
        q(context);
        a();
        r(context);
        s(context);
        h(context);
        f(context);
        e(context);
        com.excelliance.kxqp.gs.ui.update.b.d(context).c(context);
        as.m(context.getApplicationContext());
    }

    private void e(final Context context) {
        if (com.excelliance.kxqp.gs.util.b.aD(context)) {
            new com.excelliance.kxqp.gs.discover.bbs.c(context).a(cn.i(context).toString(), "https://api.ourplay.com.cn//goneload/leadsort", new com.excelliance.kxqp.gs.discover.a.c<Object>() {
                @Override
                public com.excelliance.kxqp.gs.discover.model.ResponseData<Object> a(String str) {
                    by.a(context, "global_config").a("sp_key_import_local_sort_list", str);
                    return null;
                }
            });
        }
    }

    private void f(Context context) {
        String a2 = bd.a(bc.g, cn.i(context).toString());
        Log.d("CustomIntentService", "fetchPluginConfig/response: " + a2);
        if (TextUtils.isEmpty(a2)) {
            return;
        }
        by.a(context, "global_config").a("sp_key_plugin_page_features", a2);
    }

    private void g(Context context) {
        List<ExcellianceAppInfo> n = as.n(context);
        if (s.a(n)) {
            return;
        }
        ListIterator<ExcellianceAppInfo> listIterator = n.listIterator();
        StringBuilder sb = new StringBuilder();
        while (listIterator.hasNext()) {
            ExcellianceAppInfo next = listIterator.next();
            if (TextUtils.equals(next.getGameType(), String.valueOf(5)) && next.getDownloadStatus() != 8) {
                sb.append(next.getAppPackageName());
                sb.append(i.f491b);
            }
        }
        int lastIndexOf = sb.lastIndexOf(i.f491b);
        if (lastIndexOf != -1) {
            sb.deleteCharAt(lastIndexOf);
        }
        AddGamesActivity.a(context, sb.toString(), false, 6, null);
    }

    private void h(Context context) {
        JSONObject jSONObject;
        String optString;
        String optString2;
        String optString3;
        String optString4;
        String optString5;
        JSONObject i = cn.i(context);
        String b2 = by.a(context, "sharePackageInfo").b("sharedJsonInfo", "");
        az.d("VipUtil", "reportSharePkgData read apk jsonInfo:" + b2);
        if (cd.a(b2)) {
            return;
        }
        String a2 = cn.a(b2);
        az.d("CustomIntentService", "reportSharePkgData decrypt:" + a2);
        try {
            jSONObject = new JSONObject(a2);
            optString = jSONObject.optString("from_aid");
            optString2 = jSONObject.optString("from_chid");
            optString3 = jSONObject.optString("from_subchid");
            optString4 = jSONObject.optString("from_rid");
            optString5 = jSONObject.optString(RankingItem.KEY_VER);
        } catch (Exception e) {
            az.d("CustomIntentService", "ex:" + e.getMessage());
            e.printStackTrace();
        }
        if (jSONObject.has(BaseAssistActivity.KEY_TYPE)) {
            int optInt = jSONObject.optInt(BaseAssistActivity.KEY_TYPE);
            az.d("VipUtil", "newyear_aid:" + optString);
            i.put("from_aid", optString);
            i.put("from_chid", optString2);
            i.put("from_subchid", optString3);
            i.put("from_rid", optString4);
            i.put("from_ver", optString5);
            i.put(BaseAssistActivity.KEY_TYPE, optInt);
            com.excelliance.kxqp.gs.discover.model.ResponseData a3 = new com.excelliance.kxqp.gs.discover.bbs.c(context).a(i.toString(), "https://api.ourplay.com.cn/sharedown", new com.excelliance.kxqp.gs.discover.a.c<Object>() {
                @Override
                public com.excelliance.kxqp.gs.discover.model.ResponseData<Object> a(String str) {
                    return (com.excelliance.kxqp.gs.discover.model.ResponseData) new Gson().a(str, new TypeToken<com.excelliance.kxqp.gs.discover.model.ResponseData<Object>>() {
                    }.getType());
                }
            });
            if (a3 != null) {
                if (a3.code == 1 || a3.code == 3) {
                    cn.c(context, 3);
                }
            }
        }
    }

    private void a() {
        String a2 = as.a(getApplicationContext(), 3, (Map<String, String>) null);
        Log.d("CustomIntentService", "initData googleCard: " + a2);
        if (TextUtils.isEmpty(a2)) {
            return;
        }
        try {
            boolean optBoolean = new JSONObject(a2).optBoolean("show");
            by.a(getApplicationContext(), "global_config").a("sp_key_google_card_total_count", optBoolean ? 1 : 0);
            if (optBoolean) {
                return;
            }
            com.excelliance.kxqp.gs.ui.novice.c.a(getApplicationContext()).a(new Runnable() {
                @Override
                public void run() {
                    Context applicationContext = CustomIntentService.this.getApplicationContext();
                    cc.a(applicationContext, "GOOGLE_CARD", false);
                    Intent intent = new Intent();
                    intent.setAction(applicationContext.getPackageName() + ".ACTION.REFRESH.FUNCTION.SWITCH");
                    CustomIntentService.this.getApplicationContext().sendBroadcast(intent);
                }
            });
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    private void i(Context context) {
        long j;
        JSONObject i = cn.i(context);
        try {
            i.put(ClientCookie.DOMAIN_ATTR, "cdn.excean.com");
        } catch (JSONException e) {
            e.printStackTrace();
        }
        az.d("initDownloadLimitCfg", "request:" + i.toString());
        az.d("initDownloadLimitCfg", "encrypt request:" + cn.b(i.toString()));
        String a2 = bd.a("https://sdk.ourplay.com.cn/downloadcfg.php", i.toString());
        az.d("initDownloadLimitCfg", "response:" + a2);
        String a3 = cn.a(a2);
        az.d("initDownloadLimitCfg", "decrypt response:" + a3);
        long a4 = by.a(context, "global_config").a(com.excelliance.kxqp.gs.multi.down.b.f7518b, Long.valueOf(PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED));
        try {
            try {
                j = new JSONObject(a3).getLong("bw");
            } catch (Exception e2) {
                e = e2;
            }
        } catch (Throwable th) {
            th = th;
        }
        try {
            by.a(context, "global_config").a(com.excelliance.kxqp.gs.multi.down.b.f7518b, j);
            com.excelliance.kxqp.gs.multi.down.b.a(context, j);
        } catch (Exception e3) {
            e = e3;
            a4 = j;
            az.d("initDownloadLimitCfg", "ex:" + e.getMessage());
            e.printStackTrace();
            com.excelliance.kxqp.gs.multi.down.b.a(context, a4);
        } catch (Throwable th2) {
            th = th2;
            a4 = j;
            com.excelliance.kxqp.gs.multi.down.b.a(context, a4);
            throw th;
        }
    }

    private void j(Context context) {
        try {
            AlarmManager alarmManager = (AlarmManager) context.getSystemService(NotificationCompat.CATEGORY_ALARM);
            Intent intent = new Intent();
            intent.setClass(context, SmtServService.class);
            intent.setAction(getPackageName() + ".upload.target.game.lib");
            alarmManager.set(1, System.currentTimeMillis() + 60000, PendingIntent.getService(context, 10001001, intent, 1073741824));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void p(Context context, Intent intent) {
        Log.d("CustomIntentService", "checkGameIcon2: ");
        String stringExtra = intent.getStringExtra("checkdata");
        int i = 0;
        if (!TextUtils.isEmpty(stringExtra)) {
            try {
                JSONArray jSONArray = new JSONArray(stringExtra);
                int length = jSONArray.length();
                int i2 = 0;
                while (i < length) {
                    try {
                        JSONObject optJSONObject = jSONArray.optJSONObject(i);
                        String optString = optJSONObject.optString(RankingItem.KEY_ICON);
                        if (!TextUtils.isEmpty(optString) && !new File(optString).exists()) {
                            String optString2 = optJSONObject.optString("apk");
                            if (TextUtils.isEmpty(optString2)) {
                                continue;
                            } else {
                                o.a(context, optString2, optString);
                                try {
                                    az.d("CustomIntentService", "checkGameIcon: " + optString2);
                                    i2 = 1;
                                } catch (JSONException e) {
                                    e = e;
                                    i = 1;
                                    e.printStackTrace();
                                    if (i == 0) {
                                    }
                                }
                            }
                        }
                        i++;
                    } catch (JSONException e2) {
                        e = e2;
                        i = i2;
                    }
                }
                i = i2;
            } catch (JSONException e3) {
                e = e3;
            }
        }
        if (i == 0) {
            Intent intent2 = new Intent();
            intent2.setAction(context.getPackageName() + VersionManager.q);
            context.sendBroadcast(intent2);
        }
    }

    private void b(Intent intent, final Context context) {
        long currentTimeMillis;
        Runnable runnable;
        int refreshConfig;
        int H;
        final Intent intent2 = new Intent(context.getPackageName() + ".refresh.proxy.net");
        boolean booleanExtra = intent.getBooleanExtra(DebugKt.DEBUG_PROPERTY_VALUE_AUTO, false);
        boolean booleanExtra2 = intent.getBooleanExtra("key_switch_last_really_area", false);
        intent2.putExtra(DebugKt.DEBUG_PROPERTY_VALUE_AUTO, booleanExtra);
        if (!aq.v() && (((H = as.H(context)) == 1 && !aq.a().t() && !bx.a().n(context)) || (H == 0 && !aq.a().u() && !bx.a().n(context)))) {
            intent2.putExtra("state", -2);
            c(context);
            context.sendBroadcast(intent2);
            return;
        }
        if (as.y(context)) {
            by.a(context, "sp_total_info").a("sp_disconnectioin");
        }
        long currentTimeMillis2 = System.currentTimeMillis();
        String b2 = by.a(context, "sp_city_config").b("sp_city_config", "");
        try {
            try {
                if (TextUtils.isEmpty(b2)) {
                    b2 = as.b(context);
                }
                if (TextUtils.isEmpty(b2)) {
                    intent2.putExtra("state", 0);
                } else {
                    by.a(context, "sp_city_config").a("sp_city_config", b2);
                    List<CityBean> a2 = ay.a(b2, !aq.v());
                    if (a2.size() > 0) {
                        int[] iArr = new int[a2.size()];
                        String[] strArr = new String[a2.size()];
                        for (int i = 0; i < a2.size(); i++) {
                            iArr[i] = 1;
                            strArr[i] = a2.get(i).getId();
                        }
                        String a3 = as.a(iArr, strArr, context);
                        if (!TextUtils.isEmpty(a3)) {
                            if (booleanExtra2) {
                                com.excelliance.kxqp.gs.g.c.a().b(context, booleanExtra ? "否" : "是");
                                refreshConfig = ProxyConfigHelper.refreshConfigNetChange(context, a3, true);
                            } else {
                                com.excelliance.kxqp.gs.g.c.a().b(context, booleanExtra ? "否" : "是");
                                refreshConfig = ProxyConfigHelper.refreshConfig(context, a3, false);
                            }
                            az.d("CustomIntentService", "refreshProxyConfig: " + refreshConfig);
                            if (refreshConfig == 0) {
                                String a4 = com.excelliance.kxqp.gs.util.c.a(by.a(context, "sp_config").b("sp_config", a3), "keics_e21p3kds8s");
                                az.d("CustomIntentService", "decryptFromBase64: " + a4);
                                com.excelliance.kxqp.gs.g.c.a().b(context, "是");
                                refreshConfig = ProxyConfigHelper.refreshConfig(context, a4, false);
                                if (refreshConfig == 0) {
                                    String A = as.A(context);
                                    if (!TextUtils.isEmpty(A)) {
                                        com.excelliance.kxqp.gs.g.c.a().b(context, "是");
                                        refreshConfig = ProxyConfigHelper.switchProxy(context, A, false);
                                        as.a(context, as.m(context, A));
                                    }
                                }
                            } else {
                                by.a(context, "sp_config").a("sp_config", com.excelliance.kxqp.gs.util.c.a(a3));
                            }
                            intent2.putExtra("state", refreshConfig);
                        } else {
                            intent2.putExtra("state", 0);
                        }
                    } else {
                        intent2.putExtra("state", 0);
                    }
                }
                c(context);
                currentTimeMillis = System.currentTimeMillis();
            } catch (Exception e) {
                e.printStackTrace();
                currentTimeMillis = System.currentTimeMillis();
                if (currentTimeMillis - currentTimeMillis2 < 1000) {
                    runnable = new Runnable() {
                        @Override
                        public void run() {
                            context.sendBroadcast(intent2);
                        }
                    };
                }
            }
            if (currentTimeMillis - currentTimeMillis2 < 1000) {
                runnable = new Runnable() {
                    @Override
                    public void run() {
                        context.sendBroadcast(intent2);
                    }
                };
                tp.a(runnable, (currentTimeMillis2 + 1000) - currentTimeMillis);
                return;
            }
            context.sendBroadcast(intent2);
        } catch (Throwable th) {
            long currentTimeMillis3 = System.currentTimeMillis();
            if (currentTimeMillis3 - currentTimeMillis2 < 1000) {
                tp.a(new Runnable() {
                    @Override
                    public void run() {
                        context.sendBroadcast(intent2);
                    }
                }, (currentTimeMillis2 + 1000) - currentTimeMillis3);
            } else {
                context.sendBroadcast(intent2);
            }
            throw th;
        }
    }

    private void k(Context context) {
        String str;
        by a2 = by.a(context, "sp_total_info");
        boolean booleanValue = a2.b("sp_initial_game", false).booleanValue();
        az.d("CustomIntentService", "[initialGame:" + booleanValue);
        if (booleanValue) {
            return;
        }
        try {
            try {
                String a3 = com.excelliance.kxqp.gs.util.f.a(new File(com.excelliance.kxqp.gs.ui.make_money.f.a(context)));
                Log.d("CustomIntentService", "initialGame: " + a3);
                if (TextUtils.isEmpty(a3)) {
                    if (by.a(context, "switcher").b("switcher", "false").contains("true") && !TextUtils.isEmpty("")) {
                        str = "";
                    }
                    return;
                }
                String a4 = bp.a(a3, "fuck_snsslmm_bslznw", "utf-8");
                String optString = new JSONObject(a4).optString("sharelib");
                Log.d("CustomIntentService", "initialGame decrypt: " + a4 + " | sharelib: " + optString);
                str = optString;
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (cd.a(str)) {
                return;
            }
            String c2 = as.c(context, str);
            if (!TextUtils.isEmpty(c2)) {
                InitialGameBean f = ay.f(c2);
                az.d("CustomIntentService", "---- bean: " + f);
                if (!f.isNull()) {
                    Intent intent = new Intent();
                    String j = bn.j(context);
                    String str2 = f.getMd5() + ".png";
                    ai.a(f.getPic(), j, str2);
                    intent.setAction(context.getPackageName() + ".download.app.from.shared.pkg");
                    intent.putExtra(WebActionRouter.KEY_PKG, f.getLib());
                    intent.putExtra("image", j + str2);
                    intent.putExtra("name", f.getAppTitle());
                    context.sendBroadcast(intent);
                }
            }
        } finally {
            a2.a("sp_initial_game", true);
        }
    }

    private void l(final Context context) {
        tp.f(new Runnable() {
            @Override
            public void run() {
                try {
                    by a2 = by.a(context, "sp_total_info");
                    long a3 = a2.a("sp_pull_extra_gameinfo_time_out", (Long) 0L);
                    if (a3 == 0 || System.currentTimeMillis() - a3 > 7200000) {
                        String d2 = as.d(context);
                        try {
                            if (!TextUtils.isEmpty(d2)) {
                                az.d("CustomIntentService", "initExtra");
                                List<String> b2 = ay.b(d2);
                                if (b2.size() > 0) {
                                    com.excelliance.kxqp.gs.c.b a4 = com.excelliance.kxqp.gs.c.b.a(context);
                                    a4.c();
                                    a4.a(b2);
                                }
                                a2.a("sp_pull_extra_gameinfo_time_out", System.currentTimeMillis());
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        try {
                            List<String> b3 = ay.b(context, d2);
                            if (b3.size() > 0) {
                                by a5 = by.a(context, "SP_UNPRESTART_GAME_LIST");
                                a5.d();
                                Iterator<String> it = b3.iterator();
                                while (it.hasNext()) {
                                    a5.a(it.next(), false);
                                }
                            }
                        } catch (Exception e2) {
                            e2.printStackTrace();
                        }
                        try {
                            List<String> c2 = ay.c(context, d2);
                            if (c2.size() > 0) {
                                by a6 = by.a(context, "SP_ALLOW_INNER_INSTALL");
                                a6.d();
                                Iterator<String> it2 = c2.iterator();
                                while (it2.hasNext()) {
                                    a6.a(it2.next(), true);
                                }
                            }
                        } catch (Exception e3) {
                            e3.printStackTrace();
                        }
                        String d3 = ay.d(d2, context);
                        if (TextUtils.isEmpty(d3)) {
                            return;
                        }
                        by.a(context, "sp_gp_down_address").a("sp_gp_down_address", com.excelliance.kxqp.gs.util.c.a(d3));
                    }
                } catch (Exception e4) {
                    e4.getMessage();
                }
            }
        });
    }

    private void m(Context context) {
        if (by.a(context, "sp_app_cooperation_info").d()) {
            az.d("CustomIntentService", "enter  initAPPCooperationExtra");
            String jSONObject = cn.i(context).toString();
            az.d("CustomIntentService", "request: " + jSONObject);
            az.d("CustomIntentService", "encry request: " + cn.b(jSONObject));
            String a2 = bd.a("https://api.ourplay.com.cn/rank/partner", jSONObject);
            if (!cd.a(a2)) {
                String a3 = cn.a(a2);
                az.d("CustomIntentService", "response: " + a3);
                try {
                    JSONObject jSONObject2 = new JSONObject(a3);
                    int optInt = jSONObject2.optInt("code");
                    if (optInt != 0) {
                        az.d("CustomIntentService", "code" + optInt + "msg: " + jSONObject2.optString("msg"));
                        return;
                    }
                    JSONArray optJSONArray = jSONObject2.optJSONArray("data");
                    if (optJSONArray != null) {
                        List<CooperationAPPContent> a4 = ay.a(optJSONArray);
                        if (a4 != null && a4.size() > 0) {
                            by a5 = by.a(context, "sp_app_cooperation_info");
                            HashMap hashMap = new HashMap();
                            for (int i = 0; i < a4.size(); i++) {
                                if (!cd.a(a4.get(i).getContent())) {
                                    hashMap.put(a4.get(i).getPkg_name(), a4.get(i).getContent());
                                }
                            }
                            az.d("CustomIntentService", "put data");
                            a5.a(hashMap);
                            return;
                        }
                        az.d("CustomIntentService", "resultList is null ");
                        return;
                    }
                    az.d("CustomIntentService", "data is null ");
                    return;
                } catch (Exception e) {
                    e.printStackTrace();
                    return;
                }
            }
            az.d("CustomIntentService", "response data empty");
            return;
        }
        az.d("CustomIntentService", "clear extra app cooperation fail!");
    }

    private void n(Context context) {
        by a2 = by.a(context, "sp_filtered");
        if (a2.b("sp_filtered", false).booleanValue()) {
            return;
        }
        String packageName = context.getPackageName();
        PackageManager packageManager = context.getPackageManager();
        List<ApplicationInfo> arrayList = new ArrayList<>();
        if (bq.h(context)) {
            arrayList = com.excelliance.kxqp.gs.l.f.a(context).a(context, true);
        }
        Collections.sort(arrayList, new ApplicationInfo.DisplayNameComparator(packageManager));
        HashMap<String, Integer> d2 = VersionManager.d(context);
        ArrayList arrayList2 = new ArrayList();
        for (ApplicationInfo applicationInfo : arrayList) {
            if ((applicationInfo.flags & 1) <= 0 && as.i(context, applicationInfo.packageName)) {
                String str = applicationInfo.packageName;
                if (!packageName.contains(str) && !str.contains(packageName)) {
                    GameUtil intance = GameUtil.getIntance();
                    boolean a3 = at.a(context, str);
                    boolean d3 = bs.d(str);
                    if (!a3 && !d3) {
                        AddGameBean a4 = at.a(applicationInfo, context);
                        a4.dependGS = intance.a(str, context);
                        Integer num = d2.get(str);
                        a4.order = num != null ? num.intValue() : 10000;
                        at.a(packageManager, applicationInfo, a4.iconPath);
                        arrayList2.add(a4);
                    }
                }
            }
        }
        if (arrayList2.size() > 0) {
            as.a(arrayList2);
            az.d("CustomIntentService", "preScanNativeGames: " + arrayList2.size());
            au.a().a(context.getApplicationContext(), arrayList2);
            at.a(context, arrayList2);
        }
        a2.a("sp_filtered", true);
    }

    public void a(Context context) {
        aw.b(context);
        o(context);
        Log.d("CustomIntentService", "addGoogleAccount");
        Intent intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS");
        intent.putExtra("allowableAccountTypes", new String[]{"com.google"});
        Intent intent2 = new Intent();
        intent2.setClassName(context.getPackageName(), "com.excelliance.kxqp.platform.ChooseTypeAndAccountActivity");
        intent2.setFlags(268435456);
        intent2.putExtra("extra.target.userid", 0);
        intent2.putExtra("extra.target.intent", intent);
        context.startActivity(intent2);
        com.excelliance.kxqp.gs.g.c.a().a((String) null, (String) null, (String) null, "调用登录google帐号api", (String) null);
    }

    public void o(Context context) {
        try {
            String str = bn.g(context) + "gameplugins/com.exce.wv/app_webview";
            boolean exists = new File(str).exists();
            Log.d("CustomIntentService", "addGoogleAccount exists: " + exists);
            if (exists) {
                an.c(str);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void p(final Context context) {
        tp.f(new Runnable() {
            @Override
            public void run() {
                String g = as.g(context);
                boolean z = false;
                if (!TextUtils.isEmpty(g)) {
                    try {
                        z = new JSONObject(g).optBoolean("show");
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                Log.d("CustomIntentService", "run allowShow: " + z);
                by.a(context, "sp_total_info").a("SP_GOOGLE_ACCOUNT_ENTRANCE", z);
                String packageName = context.getPackageName();
                try {
                    Intent intent = new Intent();
                    intent.setAction(packageName + VersionManager.q);
                    context.sendBroadcast(intent);
                } catch (Exception e2) {
                    e2.printStackTrace();
                }
                try {
                    Intent intent2 = new Intent();
                    intent2.setAction(packageName + ".refresh.google.acc.sell.ui");
                    intent2.putExtra("allowShow", z);
                    context.sendBroadcast(intent2);
                } catch (Exception e3) {
                    e3.printStackTrace();
                }
            }
        });
    }

    private void q(final Context context) {
        final by a2 = by.a(context, "SP_UNPRESTART_GAME_LIST");
        if (a2.e()) {
            tp.f(new Runnable() {
                @Override
                public void run() {
                    Closeable closeable;
                    InputStream inputStream;
                    BufferedReader bufferedReader;
                    IOException e;
                    Exception e2;
                    try {
                        try {
                            try {
                                inputStream = context.getAssets().open("type1");
                            } catch (IOException e3) {
                                e = e3;
                            }
                        } catch (IOException e4) {
                            bufferedReader = null;
                            e = e4;
                            inputStream = null;
                        } catch (Throwable th) {
                            closeable = null;
                            th = th;
                            inputStream = null;
                        }
                    } catch (Throwable th2) {
                        th = th2;
                    }
                    try {
                        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
                        while (true) {
                            try {
                                String readLine = bufferedReader.readLine();
                                if (readLine == null) {
                                    break;
                                }
                                Log.d("CustomIntentService", "run line: " + readLine);
                                if (!TextUtils.isEmpty(readLine)) {
                                    a2.a(readLine.trim(), false);
                                }
                            } catch (Exception e5) {
                                e2 = e5;
                                e2.printStackTrace();
                                q.a(inputStream);
                                q.a(bufferedReader);
                            }
                        }
                    } catch (IOException e6) {
                        bufferedReader = null;
                        e = e6;
                        e.printStackTrace();
                        q.a(inputStream);
                        q.a(bufferedReader);
                    } catch (Exception e7) {
                        bufferedReader = null;
                        e2 = e7;
                    } catch (Throwable th3) {
                        closeable = null;
                        th = th3;
                        q.a(inputStream);
                        q.a(closeable);
                        throw th;
                    }
                    q.a(inputStream);
                    q.a(bufferedReader);
                }
            });
        }
    }

    @TargetApi(5)
    private void r(Context context) {
        AccountManager accountManager;
        Account[] accounts;
        try {
            by a2 = by.a(context, "sp_total_info");
            long a3 = a2.a("SP_REPOST_NATIVE_GOOGLE_ACCOUNT_stamp", (Long) 0L);
            if ((a3 != 0 && System.currentTimeMillis() - a3 <= 86400000) || (accountManager = (AccountManager) context.getSystemService("account")) == null || (accounts = accountManager.getAccounts()) == null) {
                return;
            }
            ArrayList arrayList = new ArrayList();
            for (Account account : accounts) {
                String str = account.name;
                if (TextUtils.equals("com.google", account.type)) {
                    arrayList.add(str);
                }
            }
            az.d("CustomIntentService", "reportUsrAccount list: " + arrayList);
            if (arrayList.size() > 0) {
                as.a(context, 7, arrayList);
                a2.a("SP_REPOST_NATIVE_GOOGLE_ACCOUNT_stamp", System.currentTimeMillis());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void q(Context context, Intent intent) {
        ResponseResult<com.excelliance.kxqp.gs.ui.conncode.b> a2;
        try {
            Intent intent2 = new Intent("com.exce.wvRECEVIE_GOOGLE_ACCOUNT_DECODE_MONEY");
            try {
                GGAccBean a3 = as.a(context, (Map<String, String>) null);
                if (a3 != null) {
                    if (a3.getMoney() > 0.0d) {
                        by.a(context, "sp_total_info").a("GOOGLE_ACCOUNT_VALUE", String.valueOf(a3.getMoney()));
                    }
                    az.d("CustomIntentService", "ggAccBean run: " + a3);
                    intent2.putExtra("account_price", String.valueOf(a3.getMoney()));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            try {
                String a4 = as.a(1, context);
                if (!TextUtils.isEmpty(a4)) {
                    String a5 = cn.a(a4);
                    az.d("CustomIntentService", "decrypt decrpty:" + a5);
                    if (!TextUtils.isEmpty(a5) && (a2 = com.excelliance.kxqp.gs.ui.conncode.b.a(a5)) != null && a2.data != null) {
                        intent2.putExtra("decode_price", String.valueOf(a2.data.c()));
                    }
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
            context.sendBroadcast(intent2);
        } catch (Exception e3) {
            e3.printStackTrace();
        }
    }

    private void r(Context context, Intent intent) {
        try {
            ArrayList arrayList = new ArrayList();
            List<com.excelliance.kxqp.gs.ui.account.c> f = as.f();
            int size = f.size();
            for (int i = 0; i < size; i++) {
                Account account = f.get(i).f8499b;
                if (account != null && TextUtils.equals("com.google", account.type)) {
                    arrayList.add(account.name);
                }
            }
            az.d("CustomIntentService", "reportInnerGoogleAccountLogin list: " + arrayList);
            if (arrayList.size() > 0) {
                as.a(context, 6, arrayList);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void s(final Context context) {
        if (by.a(context, "sp_total_info").b("SP_HAVE_REPORT_SHARE_BOOSTER", false).booleanValue() || !bf.e(context)) {
            return;
        }
        tp.f(new Runnable() {
            @Override
            public void run() {
                String a2 = bg.a("accaid", context);
                String a3 = bg.a("rid", context);
                az.d("CustomIntentService", "reportShareBooster accaid: " + a2 + " | fromrid: " + a3);
                if (!TextUtils.isEmpty(a2)) {
                    new com.excelliance.kxqp.gs.ui.accreceive.b(context).a(a2, a3);
                }
                by.a(context, "sp_total_info").a("SP_HAVE_REPORT_SHARE_BOOSTER", true);
            }
        });
    }

    public void b(Context context) {
        az.d("CustomIntentService", "uploadYuedong inital");
        ac.a().b(context.getApplicationContext());
    }

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