aosp版本为android-8.1.0_r18 手机型号nexus5x 工程版系统 我的应用是系统签名 图片
Shell中没有问题
# adb shell
# getenforce selinux status is disabled
Permissive
# su system
$ su
没有任何错误。
su的权限描述。
-rwsrwsrwx 1 root shell 11080 2021-06-07 17:14 /system/xbin/su
我修改了su.cpp文件。
if (current_uid != AID_ROOT && current_uid != AID_SHELL && current_uid != AID_SYSTEM) error(1, 0, "not allowed");
应用程序代码
process = Runtime.getRuntime().exec("su");
BufferedReader resultReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
BufferedReader errorReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
result = new StringBuffer();
error = new StringBuffer();
DataOutputStream os = new DataOutputStream(process.getOutputStream());
process.waitFor();
String line;
while ((line = resultReader.readLine()) != null) {
line += "\n";
result.append(line);
Log.d("AC", line);
}
resultReader.close();
while ((line = errorReader.readLine()) != null) {
line += "\n";
error.append(line);
Log.e("AC", "exec err:" + line);
}
我得到了su:setgid失败:操作不允许的错误。
getenforce
宽容模式 - balalals