百度手机卫士 v8.8.0版本的 MD5 值为:a85894a6923c8a39f0c3a3a686ad7443

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


package dxoptimizer;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.text.TextUtils;
import cn.opda.a.phonoalbumshoushou.R;
import com.baidu.security.plugin.alarm.AlarmUtil;
import com.dianxinos.optimizer.CommonIntentService;
import com.dianxinos.optimizer.module.supermode.SupermodeActivity;
import com.dianxinos.optimizer.utils.HttpUtils;
import java.io.File;
import org.json.JSONObject;

public class gwx {
    private static boolean b = false;
    private static final gvg c = new gxf();
    private static gxn d;
    private Context a;

    public gwx(Context context) {
        this.a = context.getApplicationContext();
    }

    public static void a(Context context) {
        JSONObject jSONObject = new JSONObject();
        try {
            if (hxu.b()) {
                jSONObject.put("ehs_en", true);
                jSONObject.put("ehs_rt", iao.a());
            } else {
                jSONObject.put("ehs_en", false);
            }
        } catch (Exception e) {
            if (b) {
                hzi.d("SupermodeMgr", "JSONObject status exp !");
            }
        }
        icu.a(context);
        icu.b("ehs", jSONObject);
    }

    public void a() {
        if (!d()) {
            if (!k()) {
                gww.a(this.a, System.currentTimeMillis());
                j();
            }
        } else if (!e(this.a) && hzq.c(this.a) && hzq.a(this.a) == 1 && ibd.g() && iao.a() && !gww.m(this.a)) {
            hti.a().b(new gwy(this));
        }
        p(this.a);
    }

    public void i() {
        if (b) {
            hzi.b("SupermodeMgr", "downloadPermissionApkBg!");
        }
        ajo[] ajoVarArr = {new ajo()};
        ajoVarArr[0].a = "authority";
        ajoVarArr[0].c = this.a.getString(R.string.jadx_deobf_0x000022a8);
        ajoVarArr[0].b = "com.dianxinos.superuser";
        ajoVarArr[0].j = hyi.l;
        ajoVarArr[0].g = "https://sjwssu.baidu.com/bd/sq/1011066p";
        ajoVarArr[0].m = "pak";
        ajq a = azp.a(this.a);
        String a2 = ajoVarArr[0].a();
        if (bal.a(this.a, ajoVarArr[0].a, ajoVarArr[0].b) == 6 && new File(a2).exists()) {
            a(a2);
        } else {
            azp.b(a, ajoVarArr[0], new gxc(this, a2));
        }
    }

    public void a(String str) {
        if (b) {
            hzi.b("SupermodeMgr", "handlePermissionApkDownloadSuccess");
        }
        if (!gww.n(this.a)) {
            if (!gww.l(this.a)) {
                gww.f(this.a, true);
                Intent a = hyc.a(this.a);
                a.putExtra("extra.from", 0);
                eee.a(a);
                icp a2 = icr.a(6, null, null, this.a.getString(R.string.jadx_deobf_0x00002b6b), PendingIntent.getActivity(this.a, 0, a, 134217728), 56);
                a2.o = 0;
                a2.m = true;
                a2.n = this.a.getString(R.string.jadx_deobf_0x00002b6a);
                a2.s = true;
                eeb.a(this.a, new eej(a2));
                icu.a(this.a);
                icu.a("ehc", "ehc_p_s", (Number) 1);
                return;
            }
            return;
        }
        hti.a().b(new gxd(this, str));
    }

    private void j() {
        if (b) {
            hzi.b("SupermodeMgr", "notifyUser");
        }
        if (!gww.b(this.a) && c(this.a)) {
            gww.a(this.a, true);
            Intent intent = new Intent(this.a, (Class<?>) SupermodeActivity.class);
            intent.putExtra("extra.from", 0);
            intent.putExtra("extra.data", true);
            eee.a(intent);
            icp a = icr.a(6, null, null, this.a.getString(R.string.jadx_deobf_0x00002024), PendingIntent.getActivity(this.a, 0, intent, 134217728), 41);
            a.o = 0;
            a.m = true;
            a.n = this.a.getString(R.string.jadx_deobf_0x00002022);
            a.s = true;
            eeb.a(this.a, new eej(a));
            icu.a(this.a);
            icu.a("aty", "aty_nf", (Number) 1);
            icu.a(this.a);
            icu.a(5);
        }
    }

    private boolean k() {
        boolean z = System.currentTimeMillis() - gww.a(this.a) < AlarmUtil.DAY;
        if (b) {
            hzi.b("SupermodeMgr", "hasCheckToday = " + z);
        }
        return z;
    }

    public static void b(Context context) {
        Intent intent = new Intent(context, (Class<?>) SupermodeActivity.class);
        intent.putExtra("extra.data", true);
        context.startActivity(intent);
    }

    public static String b() {
        return uo.a("ro.build.fingerprint", "");
    }

    public static boolean c() {
        String a = uo.a("ro.product.cpu.abi", "");
        if (b) {
            hzi.b("SupermodeMgr", "cpu abi = " + a);
        }
        if (TextUtils.isEmpty(a)) {
            return false;
        }
        return a.startsWith("armeabi");
    }

    public static boolean d() {
        return hxu.b();
    }

    public static boolean c(Context context) {
        return gww.o(context);
    }

    public static void d(Context context) {
        if (b) {
            hzi.b("SupermodeMgr", "startSdkRootBackbroundIfPossible");
        }
        if (!hzq.c(context) || System.currentTimeMillis() - gww.k(context) < 10800000) {
            if (b) {
                hzi.b("SupermodeMgr", "isNetworkAvaialble = false or < 3h, return!");
                return;
            }
            return;
        }
        Context applicationContext = context.getApplicationContext();
        if (c() && gww.d(applicationContext)) {
            boolean a = gxo.a(gww.c(applicationContext));
            if (b) {
                hzi.b("SupermodeMgr", "startSdkRootBackbroundIfPossible isSupport = " + a);
            }
            if (a) {
                if (b) {
                    hzi.b("SupermodeMgr", "startSdkRootBackbroundIfPossible : run root()");
                }
                icu.a(applicationContext);
                icu.a("ehc", "ehc_sdk_bg_s", (Number) 1);
                gww.b(context, System.currentTimeMillis());
                hti.a().b(new gxe(applicationContext));
            }
        }
    }

    public static boolean e(Context context) {
        return f(context) || g(context);
    }

    public static boolean f(Context context) {
        try {
            PackageManager a = ibk.a(context);
            if (a == null) {
                return false;
            }
            return a.getPackageInfo("com.dianxinos.superuser", 0).versionCode >= 180;
        } catch (PackageManager.NameNotFoundException e) {
            return false;
        }
    }

    public static boolean g(Context context) {
        try {
            PackageManager a = ibk.a(context);
            if (a == null) {
                return false;
            }
            return a.getPackageInfo("com.baidu.superroot", 0).versionCode >= 180;
        } catch (PackageManager.NameNotFoundException e) {
            return false;
        }
    }

    public static String h(Context context) {
        if (e(context) && g(context)) {
            return "com.baidu.superroot";
        }
        return "com.dianxinos.superuser";
    }

    private static String o(Context context) {
        if (f(context)) {
            return "content://com.dianxinos.superuser/app_steal_switch";
        }
        if (g(context)) {
            return "content://com.baidu.superroot/app_steal_switch";
        }
        return "";
    }

    public static boolean i(Context context) {
        if (!e(context)) {
            return false;
        }
        String o = o(context);
        if (TextUtils.isEmpty(o)) {
            return false;
        }
        try {
            return Boolean.valueOf(context.getContentResolver().getType(Uri.parse(o))).booleanValue();
        } catch (NullPointerException e) {
            e.printStackTrace();
            return false;
        }
    }

    public static void a(Context context, icu icuVar) {
        if (b) {
            hzi.b("SupermodeMgr", "reportRootStatus");
        }
        if (hxu.a()) {
            icu.a("root", "rooted_new", (Number) 1);
            if (iao.a()) {
                icu.a("root", "allowed_new", (Number) 1);
            }
            if (hyz.a().b()) {
                icu.a("su_new", iao.i(), (Number) 1);
            }
        }
    }

    public static void e() {
        if (b) {
            hzi.b("SupermodeMgr", "showRootRequestDialogIfPossible");
        }
        Context applicationContext = hxa.a().getApplicationContext();
        if (!gww.s(applicationContext) && iaj.g(applicationContext, "com.kingroot.kinguser") && hyz.a().b()) {
            hti.a().a(new gxh(applicationContext));
        }
    }

    private static void p(Context context) {
        if (!hoj.p(context)) {
            if (b) {
                hzi.b("SupermodeMgr", "superservice CloudSwitch is off");
                return;
            }
            return;
        }
        if (gww.t(context)) {
            if (b) {
                hzi.b("SupermodeMgr", "superservice hasSuperserviceInstalledHistory");
                return;
            }
            return;
        }
        if (System.currentTimeMillis() - gww.v(context) < AlarmUtil.DAY) {
            if (b) {
                hzi.b("SupermodeMgr", "superservice install time off 1 DAY");
                return;
            }
            return;
        }
        if (gww.u(context) >= 5) {
            if (b) {
                hzi.b("SupermodeMgr", "superservice retry times out");
            }
        } else {
            if (q(context)) {
                gww.n(context, true);
                if (b) {
                    hzi.b("SupermodeMgr", "superservice isSuperserviceInstalled");
                    return;
                }
                return;
            }
            if (hzq.c(context) && hzq.a(context) == 1 && iao.a()) {
                gww.a(context, gww.u(context) + 1);
                gww.c(context, System.currentTimeMillis());
                hti.a().b(new gxk(context));
            }
        }
    }

    private static boolean q(Context context) {
        try {
            PackageManager a = ibk.a(context);
            if (a == null) {
                return false;
            }
            return a.getPackageInfo("com.baidu.superservice", 0) != null;
        } catch (PackageManager.NameNotFoundException e) {
            return false;
        }
    }

    public static void r(Context context) {
        try {
            File file = new File(context.getFilesDir().getPath() + "/superservice/installer");
            if (file.exists()) {
                if (b) {
                    hzi.b("SupermodeMgr", "superservice executableFile installer exist");
                }
                a(file, context);
                return;
            }
            File file2 = new File(context.getFilesDir().getPath() + "/superservice/superservice.zip");
            if (b) {
                hzi.b("SupermodeMgr", "superservice filePath : " + file2.getAbsolutePath());
            }
            icu.a(context);
            icu.a("issctg", "iss_ds", (Number) 1);
            boolean[] zArr = {false};
            HttpUtils.a(context, "https://sjwssu.baidu.com/own/superservice", file2, new gxl(zArr), (hzc) null);
            if (zArr[0]) {
                boolean exists = file2.exists();
                if (b) {
                    hzi.b("SupermodeMgr", "superservice zipFile isExist : " + exists);
                }
                if (exists) {
                    icu.a(context);
                    icu.a("issctg", "iss_dc", (Number) 1);
                    boolean a = ibv.a(file2, file2.getParentFile());
                    if (b) {
                        hzi.b("SupermodeMgr", "superservice unzip isSuccess : " + a);
                    }
                    if (a) {
                        a(file, context);
                    } else {
                        icu.a(context);
                        icu.a("issctg", "iss_uf", (Number) 1);
                    }
                    file2.delete();
                }
            }
        } catch (Exception e) {
            if (b) {
                hzi.b("SupermodeMgr", "superservice Exception ");
                e.printStackTrace();
            }
        }
    }

    private static void a(File file, Context context) {
        icu.a(context);
        icu.a("issctg", "iss_rc", (Number) 1);
        file.setExecutable(true);
        boolean f = iao.f(file.getAbsolutePath());
        if (b) {
            hzi.b("SupermodeMgr", "superservice runCommand : " + f);
        }
    }

    public static void a(Context context, String str) {
        if ("com.baidu.superservice".equals(str)) {
            gww.n(context, true);
        }
    }

    public static void j(Context context) {
        if (b) {
            hzi.b("SupermodeMgr", "onWifiAvailable");
        }
        long currentTimeMillis = System.currentTimeMillis();
        boolean z = currentTimeMillis - gww.y(context) > ((long) gww.x(context)) * AlarmUtil.DAY && currentTimeMillis - asu.l(context) > AlarmUtil.DAY;
        if (!gww.z(context) && !iaj.g(context, "com.dianxinos.superuser") && !iaj.g(context, "com.baidu.superroot") && gww.w(context) && z) {
            gww.d(context, currentTimeMillis);
            k(context);
        }
    }

    public static void k(Context context) {
        if (b) {
            hzi.b("SupermodeMgr", "notifySuperrootRec");
        }
        Intent intent = new Intent(context, (Class<?>) CommonIntentService.class);
        intent.setAction("com.dianxinos.optimizer.action.SUPERROOT_RECOMM");
        icp a = icr.a(6, null, null, context.getString(R.string.jadx_deobf_0x00002b81), PendingIntent.getService(context, 0, intent, 134217728), 77);
        a.o = 2;
        a.m = true;
        a.n = context.getString(R.string.jadx_deobf_0x00002b80);
        a.s = true;
        eeb.a(context, new eej(a));
        avj.a(context).b("aty", "au_srs", (Number) 1);
    }

    public static void l(Context context) {
        if (b) {
            hzi.b("SupermodeMgr", "recommendSuperroot");
        }
        avj.a(context).b("aty", "au_src", (Number) 1);
        ajo ajoVar = new ajo();
        ajoVar.a = "authority";
        ajoVar.c = context.getString(R.string.jadx_deobf_0x000022a8);
        ajoVar.b = "com.dianxinos.superuser";
        ajoVar.j = hyi.l;
        ajoVar.g = "https://sjwssu.baidu.com/bd/sq/1011066p";
        ajoVar.m = "pak";
        ajq a = azp.a(context);
        String a2 = ajoVar.a();
        if (bal.a(context, ajoVar.a, ajoVar.b) == 6 && new File(a2).exists()) {
            if (b) {
                hzi.b("SupermodeMgr", "superroot apk exist!");
            }
            c(context, a2);
        } else {
            avj.a(context).b("aty", "au_srd", (Number) 1);
            azp.a(a, ajoVar, new gxm(context, a2));
        }
    }

    public static void c(Context context, String str) {
        if (b) {
            hzi.b("SupermodeMgr", "handleSuperrootSuc");
        }
        avj.a(context).b("aty", "au_srd_s", (Number) 1);
        d = new gxn(context);
        avo.a(context).a(d);
        hxd.a(new gwz(context), 10000L);
        hti.a().b(new gxa(context, str));
    }

    public static void m(Context context) {
        hti.a().b(new gxb(context));
    }
}