Android Crash on Android 8.0 Oreo: SecurityException: Permission Denial: null asks to run as user 450 but is calling from user 0

前端 未结 3 1777
眼角桃花
眼角桃花 2020-12-10 18:03

I upgrade my phone to Android Oreo. When I\'m running my app on this device. My app crashes. While it\'s running well on Android 7 and lower devices.

This is the log

3条回答
  •  隐瞒了意图╮
    2020-12-10 18:21

    To summarize from this answer, and looking at the sources of UserHandle.java we see the meaning of the framework user id's.

    # | @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
    

    Then to understand what android:protectionLevel="signature" means, you'll have to read the page about permission-element. Which is summarized in the table:

    So what you need to do in your AndroidManifest.xml depend a lot on what API's you need to support, as higher > 23 API's also require a android:permissionGroup= definition, for non-normal ("dangerous") permissions...

    To be able to hold INTERACT_ACROSS_USERS, your app has to be signed by the firmware's signing key or it has to be installed on the system partition.

    To be able to hold INTERACT_ACROSS_USERS_FULL, your app has to be signed by the firmware's signing key.

    Therefore finally add this in your manifest file:

    
    

    Hope it helps...

提交回复
热议问题