百度手机卫士 v8.4.5版本的 MD5 值为:c65ef854a40bb6200c4d8c4603c58403

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

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

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

    public void a() {
        if (!d()) {
            if (!k()) {
                gpw.a(this.a, System.currentTimeMillis());
                j();
            }
        } else if (!e(this.a) && hqo.c(this.a) && hqo.a(this.a) == 1 && hrz.g() && hrk.a() && !gpw.m(this.a)) {
            hkn.a().b(new gpy(this));
        }
        p(this.a);
    }

    public void i() {
        if (b) {
            hqg.b("SupermodeMgr", "downloadPermissionApkBg!");
        }
        aky[] akyVarArr = {new aky()};
        akyVarArr[0].a = "authority";
        akyVarArr[0].c = this.a.getString(R.string.jadx_deobf_0x0000216f);
        akyVarArr[0].b = "com.dianxinos.superuser";
        akyVarArr[0].j = hpg.l;
        akyVarArr[0].g = "https://sjwssu.baidu.com/bd/sq/1011066p";
        akyVarArr[0].m = "pak";
        ala a = bbb.a(this.a);
        String a2 = akyVarArr[0].a();
        if (bbv.a(this.a, akyVarArr[0].a, akyVarArr[0].b) == 6 && new File(a2).exists()) {
            a(a2);
        } else {
            bbb.b(a, akyVarArr[0], new gqc(this, a2));
        }
    }

    public void a(String str) {
        if (b) {
            hqg.b("SupermodeMgr", "handlePermissionApkDownloadSuccess");
        }
        if (!gpw.n(this.a)) {
            if (!gpw.l(this.a)) {
                gpw.f(this.a, true);
                Intent a = hpa.a(this.a);
                a.putExtra("extra.from", 0);
                dzk.a(a);
                htn a2 = htp.a(6, null, null, this.a.getString(R.string.jadx_deobf_0x00002983), PendingIntent.getActivity(this.a, 0, a, 134217728), 56);
                a2.o = 0;
                a2.m = true;
                a2.n = this.a.getString(R.string.jadx_deobf_0x00002982);
                a2.s = true;
                dzh.a(this.a, new dzp(a2));
                hts.a(this.a);
                hts.a("ehc", "ehc_p_s", (Number) 1);
                return;
            }
            return;
        }
        hkn.a().b(new gqd(this, str));
    }

    private void j() {
        if (b) {
            hqg.b("SupermodeMgr", "notifyUser");
        }
        if (!gpw.b(this.a) && c(this.a)) {
            gpw.a(this.a, true);
            Intent intent = new Intent(this.a, (Class<?>) SupermodeActivity.class);
            intent.putExtra("extra.from", 0);
            intent.putExtra("extra.data", true);
            dzk.a(intent);
            htn a = htp.a(6, null, null, this.a.getString(R.string.jadx_deobf_0x00001eed), PendingIntent.getActivity(this.a, 0, intent, 134217728), 41);
            a.o = 0;
            a.m = true;
            a.n = this.a.getString(R.string.jadx_deobf_0x00001eeb);
            a.s = true;
            dzh.a(this.a, new dzp(a));
            hts.a(this.a);
            hts.a("aty", "aty_nf", (Number) 1);
            hts.a(this.a);
            hts.a(5);
        }
    }

    private boolean k() {
        boolean z = System.currentTimeMillis() - gpw.a(this.a) < AlarmUtil.DAY;
        if (b) {
            hqg.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 un.a("ro.build.fingerprint", "");
    }

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

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

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

    public static void d(Context context) {
        if (b) {
            hqg.b("SupermodeMgr", "startSdkRootBackbroundIfPossible");
        }
        if (!hqo.c(context) || System.currentTimeMillis() - gpw.k(context) < 10800000) {
            if (b) {
                hqg.b("SupermodeMgr", "isNetworkAvaialble = false or < 3h, return!");
                return;
            }
            return;
        }
        Context applicationContext = context.getApplicationContext();
        if (c() && gpw.d(applicationContext)) {
            boolean a = gqo.a(gpw.c(applicationContext));
            if (b) {
                hqg.b("SupermodeMgr", "startSdkRootBackbroundIfPossible isSupport = " + a);
            }
            if (a) {
                if (b) {
                    hqg.b("SupermodeMgr", "startSdkRootBackbroundIfPossible : run root()");
                }
                hts.a(applicationContext);
                hts.a("ehc", "ehc_sdk_bg_s", (Number) 1);
                gpw.b(context, System.currentTimeMillis());
                hkn.a().b(new gqe(applicationContext));
            }
        }
    }

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

    public static boolean f(Context context) {
        try {
            PackageManager a = hsg.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 = hsg.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, hts htsVar) {
        if (b) {
            hqg.b("SupermodeMgr", "reportRootStatus");
        }
        if (hos.a()) {
            hts.a("root", "rooted_new", (Number) 1);
            if (hrk.a()) {
                hts.a("root", "allowed_new", (Number) 1);
            }
            if (hpx.a().b()) {
                hts.a("su_new", hrk.i(), (Number) 1);
            }
        }
    }

    public static void e() {
        if (b) {
            hqg.b("SupermodeMgr", "showRootRequestDialogIfPossible");
        }
        Context applicationContext = hny.a().getApplicationContext();
        if (!gpw.s(applicationContext) && hrf.g(applicationContext, "com.kingroot.kinguser") && hpx.a().b()) {
            hkn.a().a(new gqh(applicationContext));
        }
    }

    private static void p(Context context) {
        if (!hhc.p(context)) {
            if (b) {
                hqg.b("SupermodeMgr", "superservice CloudSwitch is off");
                return;
            }
            return;
        }
        if (gpw.t(context)) {
            if (b) {
                hqg.b("SupermodeMgr", "superservice hasSuperserviceInstalledHistory");
                return;
            }
            return;
        }
        if (System.currentTimeMillis() - gpw.v(context) < AlarmUtil.DAY) {
            if (b) {
                hqg.b("SupermodeMgr", "superservice install time off 1 DAY");
                return;
            }
            return;
        }
        if (gpw.u(context) >= 5) {
            if (b) {
                hqg.b("SupermodeMgr", "superservice retry times out");
            }
        } else {
            if (q(context)) {
                gpw.n(context, true);
                if (b) {
                    hqg.b("SupermodeMgr", "superservice isSuperserviceInstalled");
                    return;
                }
                return;
            }
            if (hqo.c(context) && hqo.a(context) == 1 && hrk.a()) {
                gpw.a(context, gpw.u(context) + 1);
                gpw.c(context, System.currentTimeMillis());
                hkn.a().b(new gqk(context));
            }
        }
    }

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

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

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

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

    public static void k(Context context) {
        if (b) {
            hqg.b("SupermodeMgr", "notifySuperrootRec");
        }
        Intent intent = new Intent(context, (Class<?>) CommonIntentService.class);
        intent.setAction("com.dianxinos.optimizer.action.SUPERROOT_RECOMM");
        htn a = htp.a(6, null, null, context.getString(R.string.jadx_deobf_0x00002999), PendingIntent.getService(context, 0, intent, 134217728), 77);
        a.o = 2;
        a.m = true;
        a.n = context.getString(R.string.jadx_deobf_0x00002998);
        a.s = true;
        dzh.a(context, new dzp(a));
        awr.a(context).b("aty", "au_srs", (Number) 1);
    }

    public static void l(Context context) {
        if (b) {
            hqg.b("SupermodeMgr", "recommendSuperroot");
        }
        awr.a(context).b("aty", "au_src", (Number) 1);
        aky akyVar = new aky();
        akyVar.a = "authority";
        akyVar.c = context.getString(R.string.jadx_deobf_0x0000216f);
        akyVar.b = "com.dianxinos.superuser";
        akyVar.j = hpg.l;
        akyVar.g = "https://sjwssu.baidu.com/bd/sq/1011066p";
        akyVar.m = "pak";
        ala a = bbb.a(context);
        String a2 = akyVar.a();
        if (bbv.a(context, akyVar.a, akyVar.b) == 6 && new File(a2).exists()) {
            if (b) {
                hqg.b("SupermodeMgr", "superroot apk exist!");
            }
            c(context, a2);
        } else {
            awr.a(context).b("aty", "au_srd", (Number) 1);
            bbb.a(a, akyVar, new gqm(context, a2));
        }
    }

    public static void c(Context context, String str) {
        if (b) {
            hqg.b("SupermodeMgr", "handleSuperrootSuc");
        }
        awr.a(context).b("aty", "au_srd_s", (Number) 1);
        d = new gqn(context);
        aww.a(context).a(d);
        hob.a(new gpz(context), 10000L);
        hkn.a().b(new gqa(context, str));
    }

    public static void m(Context context) {
        hkn.a().b(new gqb(context));
    }
}