Android 运行环境(模拟器)检测记录

	public boolean readSysProperty(Context context) {
        int i;
        int i2;
        if (context == null) {
            throw new IllegalArgumentException("context must not be null");
        }
        String property = getProperty("gsm.version.baseband");
        if (property == null || property.contains("1.0.0.0")) {
            SystemLog.i(TAG, "baseBandVersion = " + property);
            i = 1;
        } else {
            i = 0;
        }
        String property2 = getProperty("ro.build.flavor");
        if (property2 == null || property2.contains("vbox") || property2.contains("sdk_gphone")) {
            SystemLog.i(TAG, "buildFlavor = " + property2);
            i++;
        }
        String property3 = getProperty("ro.product.board");
        if (property3 == null || (property3.contains(WXEnvironment.OS) || property3.contains("goldfish"))) {
            SystemLog.i(TAG, "productBoard = " + property3);
            i++;
        }
        String property4 = getProperty("ro.board.platform");
        if (property4 == null || property4.contains(WXEnvironment.OS)) {
            SystemLog.i(TAG, "boardPlatform = " + property4);
            i++;
        }
        String property5 = getProperty("ro.hardware");
        SystemLog.i(TAG, "hardWare = " + property5);
        if (property5 == null) {
            i++;
        } else if (property5.toLowerCase().contains("ttvm")) {
            i += 10;
        } else if (property5.toLowerCase().contains("nox")) {
            i += 10;
        }
        if (!context.getPackageManager().hasSystemFeature("android.hardware.camera.flash")) {
            SystemLog.i(TAG, "isSupportCameraFlash = false");
            i2 = i + 1;
        } else {
            i2 = i;
        }
        int size = ((SensorManager) context.getSystemService("sensor")).getSensorList(-1).size();
        if (size <= 7) {
            SystemLog.i(TAG, "sensorSize = " + size);
            i2++;
        }
        String str = "userAppNum";
        int userAppNum = getUserAppNum(CommandUtil.getSingleInstance().exec("pm list package -3"));
        SystemLog.i(TAG, "userAppSize = " + userAppNum);
        if (userAppNum <= 5) {
            i2++;
        }
        String exec = CommandUtil.getSingleInstance().exec("cat /proc/self/cgroup");
        if (exec == null) {
            SystemLog.i(TAG, "filter = " + exec);
            i2++;
        }
        if (i2 > 4) {
            return true;
        }
        return false;
    }

    private int getUserAppNum(String str) {
        if (TextUtils.isEmpty(str)) {
            return 0;
        }
        return str.split("package:").length;
    }

    private String getProperty(String str) {
        String property = CommandUtil.getSingleInstance().getProperty(str);
        if (TextUtils.isEmpty(property)) {
            return null;
        }
        return property;
    }

    public boolean checkXposed() {
        Exception exc = new Exception("checkXposed");
        for (StackTraceElement className : exc.getStackTrace()) {
            if ("de.robv.android.xposed.XposedBridge".equals(className.getClassName())) {
                SystemLog.i("checkXposed", "true");
                SystemLog.upload(exc);
                return true;
            }
        }
        SystemLog.i("checkXposed", "false");
        return false;
    }
  public String getProperty(String str) {
        String str2;
        try {
            Object invoke = Class.forName("android.os.SystemProperties").getMethod("get", new Class[]{String.class}).invoke(null, new Object[]{str});
            if (invoke != null) {
                str2 = (String) invoke;
            } else {
                str2 = null;
            }
            return str2;
        } catch (Exception e) {
            return null;
        }
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值