关于 http://developer.android.com/guide/publishing/licensing.html ,在“复制保护的替换”部分下,它说:
A limitation of the legacy Copy Protection mechanism on Android Market is that applications using it can be installed only on compatible devices that provide a secure internal storage environment. For example, a copy-protected application cannot be downloaded from Market to a device that provides root access, and the application cannot be installed to a device's SD card.
Android 的(同时已弃用)复制保护如何检查设备是否已获得 root 权限? Afaik 这是不可能的,同样根据 Dianne Hackborn(参见 How can you detect if the device is rooted in the app?)。所以这只能意味着,检查是由一些(公众未知的)混淆标准检查完成的,我想显然不仅仅是简单地检查“su”命令是否存在。 有人知道更多关于检查逻辑的信息吗?或者它的安全性如何?
最佳答案
这是我用的:
public static boolean isDeviceRooted () {
boolean ret = false;
String path = null;
Map<String,String> env = System.getenv();
if (env != null && (path = env.get("PATH")) != null) {
setDevicePath(path);
String [] dirs = path.split(":");
for (String dir : dirs){
String suPath = dir + "/" + "su";
File suFile = new File(suPath);
if (suFile != null && suFile.exists()) {
setSuLocation(suPath);
ret = true;
}
}
}
return ret;
}
理论上,它不会在所有情况下都有效,因为用户可以将“su”放在一个非标准位置,它不在 PATH 中,但实际上如果他这样做,其他需要知道位置的应用程序'su' 也不会找到它,因此 root 的目的将被打败。
关于android - Android 的复制保护如何检查设备是否已 Root ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7727021/