为什么 /system/app 中的程序无法获得超级用户访问权限?

发布于 2024-12-19 21:34:01 字数 230 浏览 5 评论 0原文

我们正在创建一个需要超级用户权限的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

呆° 2024-12-26 21:34:01

/system/app 文件夹中的 APK 文件已经具有系统级权限,因此它们不需要超级用户,我认为这就是它不会弹出的原因。

您应该确认您的应用程序已经拥有您所请求的权限。例如, AlarmManager.setTime 需要签名OrSystem权限 android.permission.SET_TIME ,如果没有它会抛出异常。您还可以使用 PackageManager.checkPermission

如果这不起作用,请检查 APK 文件的属性。如果它们与系统文件夹中的其他 APK 不匹配,Android 可能会忽略它们。你可以这样修复它:

chmod 644 <filename>

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:

chmod 644 <filename>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文