为什么 /system/app 中的程序无法获得超级用户访问权限?
我们正在创建一个需要超级用户权限的 Android 应用程序。 SuperUser.apk 和 su 已安装。然而,在 /data/app 和 /system/app 中安装我们的应用程序似乎是有区别的。如果我们安装在 /data/app 中,一切似乎都工作正常。如果我们安装在/system/app,SuperUser.apk不会弹出授予权限。
是否有某些类型的程序必须安装在一个位置而不是另一个位置?
TIA
We are creating an Android application which requires super user privileges. The SuperUser.apk and su are installed. However there seems to be a difference between installing our application in /data/app vs. /system/app. If we install in /data/app, everything seems to work fine. If we install in /system/app, SuperUser.apk does not popup to grant privileges.
Are there certain types of programs that must be installed in one location vs. another?
TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
/system/app 文件夹中的 APK 文件已经具有系统级权限,因此它们不需要超级用户,我认为这就是它不会弹出的原因。
您应该确认您的应用程序已经拥有您所请求的权限。例如, AlarmManager.setTime 需要签名OrSystem权限 android.permission.SET_TIME ,如果没有它会抛出异常。您还可以使用 PackageManager.checkPermission。
如果这不起作用,请检查 APK 文件的属性。如果它们与系统文件夹中的其他 APK 不匹配,Android 可能会忽略它们。你可以这样修复它:
APK files in the /system/app folder already have system-level permissions so they don't require SuperUser, which I assume is why it doesn't pop up.
You should confirm that your application already has the permission you have requested. For instance, AlarmManager.setTime requires the signatureOrSystem permission android.permission.SET_TIME and will throw an exception if it doesn't have it. You can also check explicitly with PackageManager.checkPermission.
If this doesn't work, check the attributes of the APK file. If they don't match the other APKs in the system folder Android may ignore them. You can fix it like this: