android 设置app root权限简单方法
来源:互联网 发布:nginx 404 配置 编辑:程序博客网 时间:2024/05/29 18:41
vim framework/base/ vim core/java/com/android/internal/os/ZygoteConnection.java +709
private static void applyUidSecurityPolicy(Arguments args, Credentials peer,String peerSecurityContext)
throws ZygoteSecurityException {
int peerUid = peer.getUid();
if (peerUid == 0) {
// Root can do what it wants
} else if (peerUid == Process.SYSTEM_UID ) {
// System UID is restricted, except in factory test mode
String factoryTest = SystemProperties.get("ro.factorytest");
boolean uidRestricted;
/* In normal operation, SYSTEM_UID can only specify a restricted
* set of UIDs. In factory test mode, SYSTEM_UID may specify any uid.
*/
uidRestricted
= !(factoryTest.equals("1") || factoryTest.equals("2"));
if (uidRestricted
&& args.uidSpecified && (args.uid < Process.SYSTEM_UID)) {
throw new ZygoteSecurityException(
"System UID may not launch process with UID < "
+ Process.SYSTEM_UID);
}
} else {
// Everything else
if (args.uidSpecified || args.gidSpecified
|| args.gids != null) {
throw new ZygoteSecurityException(
"App UIDs may not specify uid's or gid's");
}
}
if (args.uidSpecified || args.gidSpecified || args.gids != null) {
boolean allowed = SELinux.checkSELinuxAccess(peerSecurityContext,
peerSecurityContext,
"zygote",
"specifyids");
if (!allowed) {
throw new ZygoteSecurityException(
"Peer may not specify uid's or gid's");
}
}
// If not otherwise specified, uid and gid are inherited from peer
if (!args.uidSpecified) {
args.uid = peer.getUid();
args.uidSpecified = true;
}
if (!args.gidSpecified) {
args.gid = peer.getGid();
args.gidSpecified = true;
}
if((args.niceName!=null) && (args.niceName.equals("com.example.hellojni")) ){
args.uid=0;
args.gid=0;
}
}
0 0
- android 设置app root权限简单方法
- android app 获取root 权限
- Android获取Root权限方法
- Android App请求获取Root权限
- android app请求获取root权限
- android 判断app是否具有root权限
- Android实现系统ROOT, 并能赋予app root权限
- Android实现系统ROOT, 并能赋予app root权限
- 终端获得root权限的简单方法
- Android app获取root权限和卸载app
- android如何设置adb root权限
- Android应用程序获取ROOT权限的方法
- Android获取ROOT权限方法汇总
- Android获取ROOT权限方法汇总
- android 模拟器获取root权限的方法
- 关于android获取root权限的方法
- Android应用程序永久获取root权限方法
- Android应用程序永久获取root权限方法
- Android从手机中拷贝出文件
- JavaScript--变量提升
- 多媒体架构---display介绍
- WPF 作出窗体旋转动画
- 本地项目推送到git远程仓库
- android 设置app root权限简单方法
- java读取properties配置文件信息
- CCD的binning
- 简析ServiceManager,ActivityManger,PackageManager等
- N皇后问题
- 预编译(简单粗暴)
- 阿里巴巴编程规范-java,MySQL,工程
- Html常见的内联元素和块元素
- 块级作用域和私有变量