百度手机卫士 v8.6.2版本的 MD5 值为:fa60cb367e40201705a2d9f9ce2cbfdf

以下内容为反编译后的 gun.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 gun {
    private static boolean b = false;
    private static final gsw c = new guv();
    private static gvd d;
    private Context a;

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

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

    public void a() {
        if (!d()) {
            if (!k()) {
                gum.a(this.a, System.currentTimeMillis());
                j();
            }
        } else if (!e(this.a) && hvy.c(this.a) && hvy.a(this.a) == 1 && hxj.g() && hwu.a() && !gum.m(this.a)) {
            hpw.a().b(new guo(this));
        }
        p(this.a);
    }

    public void i() {
        if (b) {
            hvq.b("SupermodeMgr", "downloadPermissionApkBg!");
        }
        ajn[] ajnVarArr = {new ajn()};
        ajnVarArr[0].a = "authority";
        ajnVarArr[0].c = this.a.getString(R.string.jadx_deobf_0x0000225a);
        ajnVarArr[0].b = "com.dianxinos.superuser";
        ajnVarArr[0].j = huq.l;
        ajnVarArr[0].g = "https://sjwssu.baidu.com/bd/sq/1011066p";
        ajnVarArr[0].m = "pak";
        ajp a = azo.a(this.a);
        String a2 = ajnVarArr[0].a();
        if (bai.a(this.a, ajnVarArr[0].a, ajnVarArr[0].b) == 6 && new File(a2).exists()) {
            a(a2);
        } else {
            azo.b(a, ajnVarArr[0], new gus(this, a2));
        }
    }

    public void a(String str) {
        if (b) {
            hvq.b("SupermodeMgr", "handlePermissionApkDownloadSuccess");
        }
        if (!gum.n(this.a)) {
            if (!gum.l(this.a)) {
                gum.f(this.a, true);
                Intent a = huk.a(this.a);
                a.putExtra("extra.from", 0);
                eco.a(a);
                hyx a2 = hyz.a(6, null, null, this.a.getString(R.string.jadx_deobf_0x00002aec), PendingIntent.getActivity(this.a, 0, a, 134217728), 56);
                a2.o = 0;
                a2.m = true;
                a2.n = this.a.getString(R.string.jadx_deobf_0x00002aeb);
                a2.s = true;
                ecl.a(this.a, new ect(a2));
                hzc.a(this.a);
                hzc.a("ehc", "ehc_p_s", (Number) 1);
                return;
            }
            return;
        }
        hpw.a().b(new gut(this, str));
    }

    private void j() {
        if (b) {
            hvq.b("SupermodeMgr", "notifyUser");
        }
        if (!gum.b(this.a) && c(this.a)) {
            gum.a(this.a, true);
            Intent intent = new Intent(this.a, (Class<?>) SupermodeActivity.class);
            intent.putExtra("extra.from", 0);
            intent.putExtra("extra.data", true);
            eco.a(intent);
            hyx a = hyz.a(6, null, null, this.a.getString(R.string.jadx_deobf_0x00001fe8), PendingIntent.getActivity(this.a, 0, intent, 134217728), 41);
            a.o = 0;
            a.m = true;
            a.n = this.a.getString(R.string.jadx_deobf_0x00001fe6);
            a.s = true;
            ecl.a(this.a, new ect(a));
            hzc.a(this.a);
            hzc.a("aty", "aty_nf", (Number) 1);
            hzc.a(this.a);
            hzc.a(5);
        }
    }

    private boolean k() {
        boolean z = System.currentTimeMillis() - gum.a(this.a) < AlarmUtil.DAY;
        if (b) {
            hvq.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) {
            hvq.b("SupermodeMgr", "cpu abi = " + a);
        }
        if (TextUtils.isEmpty(a)) {
            return false;
        }
        return a.startsWith("armeabi");
    }

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

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

    public static void d(Context context) {
        if (b) {
            hvq.b("SupermodeMgr", "startSdkRootBackbroundIfPossible");
        }
        if (!hvy.c(context) || System.currentTimeMillis() - gum.k(context) < 10800000) {
            if (b) {
                hvq.b("SupermodeMgr", "isNetworkAvaialble = false or < 3h, return!");
                return;
            }
            return;
        }
        Context applicationContext = context.getApplicationContext();
        if (c() && gum.d(applicationContext)) {
            boolean a = gve.a(gum.c(applicationContext));
            if (b) {
                hvq.b("SupermodeMgr", "startSdkRootBackbroundIfPossible isSupport = " + a);
            }
            if (a) {
                if (b) {
                    hvq.b("SupermodeMgr", "startSdkRootBackbroundIfPossible : run root()");
                }
                hzc.a(applicationContext);
                hzc.a("ehc", "ehc_sdk_bg_s", (Number) 1);
                gum.b(context, System.currentTimeMillis());
                hpw.a().b(new guu(applicationContext));
            }
        }
    }

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

    public static boolean f(Context context) {
        try {
            PackageManager a = hxq.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 = hxq.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, hzc hzcVar) {
        if (b) {
            hvq.b("SupermodeMgr", "reportRootStatus");
        }
        if (huc.a()) {
            hzc.a("root", "rooted_new", (Number) 1);
            if (hwu.a()) {
                hzc.a("root", "allowed_new", (Number) 1);
            }
            if (hvh.a().b()) {
                hzc.a("su_new", hwu.i(), (Number) 1);
            }
        }
    }

    public static void e() {
        if (b) {
            hvq.b("SupermodeMgr", "showRootRequestDialogIfPossible");
        }
        Context applicationContext = hti.a().getApplicationContext();
        if (!gum.s(applicationContext) && hwp.g(applicationContext, "com.kingroot.kinguser") && hvh.a().b()) {
            hpw.a().a(new gux(applicationContext));
        }
    }

    private static void p(Context context) {
        if (!hlw.p(context)) {
            if (b) {
                hvq.b("SupermodeMgr", "superservice CloudSwitch is off");
                return;
            }
            return;
        }
        if (gum.t(context)) {
            if (b) {
                hvq.b("SupermodeMgr", "superservice hasSuperserviceInstalledHistory");
                return;
            }
            return;
        }
        if (System.currentTimeMillis() - gum.v(context) < AlarmUtil.DAY) {
            if (b) {
                hvq.b("SupermodeMgr", "superservice install time off 1 DAY");
                return;
            }
            return;
        }
        if (gum.u(context) >= 5) {
            if (b) {
                hvq.b("SupermodeMgr", "superservice retry times out");
            }
        } else {
            if (q(context)) {
                gum.n(context, true);
                if (b) {
                    hvq.b("SupermodeMgr", "superservice isSuperserviceInstalled");
                    return;
                }
                return;
            }
            if (hvy.c(context) && hvy.a(context) == 1 && hwu.a()) {
                gum.a(context, gum.u(context) + 1);
                gum.c(context, System.currentTimeMillis());
                hpw.a().b(new gva(context));
            }
        }
    }

    private static boolean q(Context context) {
        try {
            PackageManager a = hxq.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) {
                    hvq.b("SupermodeMgr", "superservice executableFile installer exist");
                }
                a(file, context);
                return;
            }
            File file2 = new File(context.getFilesDir().getPath() + "/superservice/superservice.zip");
            if (b) {
                hvq.b("SupermodeMgr", "superservice filePath : " + file2.getAbsolutePath());
            }
            hzc.a(context);
            hzc.a("issctg", "iss_ds", (Number) 1);
            boolean[] zArr = {false};
            HttpUtils.a(context, "https://sjwssu.baidu.com/own/superservice", file2, new gvb(zArr), (hvk) null);
            if (zArr[0]) {
                boolean exists = file2.exists();
                if (b) {
                    hvq.b("SupermodeMgr", "superservice zipFile isExist : " + exists);
                }
                if (exists) {
                    hzc.a(context);
                    hzc.a("issctg", "iss_dc", (Number) 1);
                    boolean a = hyb.a(file2, file2.getParentFile());
                    if (b) {
                        hvq.b("SupermodeMgr", "superservice unzip isSuccess : " + a);
                    }
                    if (a) {
                        a(file, context);
                    } else {
                        hzc.a(context);
                        hzc.a("issctg", "iss_uf", (Number) 1);
                    }
                    file2.delete();
                }
            }
        } catch (Exception e) {
            if (b) {
                hvq.b("SupermodeMgr", "superservice Exception ");
                e.printStackTrace();
            }
        }
    }

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

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

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

    public static void k(Context context) {
        if (b) {
            hvq.b("SupermodeMgr", "notifySuperrootRec");
        }
        Intent intent = new Intent(context, (Class<?>) CommonIntentService.class);
        intent.setAction("com.dianxinos.optimizer.action.SUPERROOT_RECOMM");
        hyx a = hyz.a(6, null, null, context.getString(R.string.jadx_deobf_0x00002b02), PendingIntent.getService(context, 0, intent, 134217728), 77);
        a.o = 2;
        a.m = true;
        a.n = context.getString(R.string.jadx_deobf_0x00002b01);
        a.s = true;
        ecl.a(context, new ect(a));
        ave.a(context).b("aty", "au_srs", (Number) 1);
    }

    public static void l(Context context) {
        if (b) {
            hvq.b("SupermodeMgr", "recommendSuperroot");
        }
        ave.a(context).b("aty", "au_src", (Number) 1);
        ajn ajnVar = new ajn();
        ajnVar.a = "authority";
        ajnVar.c = context.getString(R.string.jadx_deobf_0x0000225a);
        ajnVar.b = "com.dianxinos.superuser";
        ajnVar.j = huq.l;
        ajnVar.g = "https://sjwssu.baidu.com/bd/sq/1011066p";
        ajnVar.m = "pak";
        ajp a = azo.a(context);
        String a2 = ajnVar.a();
        if (bai.a(context, ajnVar.a, ajnVar.b) == 6 && new File(a2).exists()) {
            if (b) {
                hvq.b("SupermodeMgr", "superroot apk exist!");
            }
            c(context, a2);
        } else {
            ave.a(context).b("aty", "au_srd", (Number) 1);
            azo.a(a, ajnVar, new gvc(context, a2));
        }
    }

    public static void c(Context context, String str) {
        if (b) {
            hvq.b("SupermodeMgr", "handleSuperrootSuc");
        }
        ave.a(context).b("aty", "au_srd_s", (Number) 1);
        d = new gvd(context);
        avj.a(context).a(d);
        htl.a(new gup(context), 10000L);
        hpw.a().b(new guq(context, str));
    }

    public static void m(Context context) {
        hpw.a().b(new gur(context));
    }
}