off*_*set 33 permissions android
我在android中有一个大型应用程序.
应用程序不时崩溃,错误不明确.我不确切知道何时以及为何会发生这种情况.
java.lang.SecurityException: Permission Denial: get/set setting for user asks
to run as user -2 but is calling from user 0; this requires
android.permission.INTERACT_ACROSS_USERS_FULL
Run Code Online (Sandbox Code Playgroud)
有帮助吗?
Int*_*iya 13
java.lang.SecurityException:Permission Denial:用户的get/set设置要求以用户-2运行,但是从用户0调用; 这需要android.permission.INTERACT_ACROSS_USERS_FULL
android:protectionLevel="signature"在清单中添加此内容.
有关详细信息,请查看 Permission-Element
喜欢:
<permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" android:protectionLevel="signature"/>
Run Code Online (Sandbox Code Playgroud)
not*_*bit 11
总结一下这个答案,并查看UserHandle.java的来源,我们看到了框架用户id的含义.
# | @UserIdInt | Value | Status | Description |
# | --------------------- | ------ | ---------- | ------------|
# | USER_OWNER | 0 | deprecated | "owner" user of the device
# | USER_SYSTEM | 0 | ok | "system" user of the device
# | USER_ALL | -1 | ok | ALL users on the device
| USER_CURRENT | -2 | ok | the currently active user
# | USER_CURRENT_OR_SELF | -3 | ok | id from which we would like to send to the current user
# | USER_NULL | -10000 | ok | An undefined user id
Run Code Online (Sandbox Code Playgroud)
然后要了解具体android:protectionLevel="signature"含义,您必须阅读有关permission-element的页面.表中总结了哪些内容:
因此,您需要做的事情AndroidManifest.xml很大程度上依赖于您需要支持的API,因为更高> 23的API也需要android:permissionGroup= 定义,非正常("危险")权限......
也很高兴知道(通过@CommonsWare)
为了能够保持INTERACT_ACROSS_USERS,您的应用程序已被签署通过固件的签名密钥或者它必须在系统分区上安装.
为了能够容纳INTERACT_ACROSS_USERS_FULL,您的应用必须通过固件的签名密钥进行签名.
| 归档时间: |
|
| 查看次数: |
45517 次 |
| 最近记录: |