简体   繁体   中英

Questions about Android Permissions

I was looking at the classes related to permissions on Android and I have a couple of questions.

In BasePermission class, I see three fields defined: TYPE_NORMAL, TYPE_BUILTIN and TYPE_DYNAMIC. What do these represent? I'm guessing TYPE_DYNAMIC is for when addPermission() API method is used dynamically by the app to create a permission, but I'm not at all sure about the other two. Does Android keep track of how permissions were created (ie, defined by the system, a system app or a third-party app)? It seems that PermissionInfo class keeps track of some flags, but I couldn't find any flag that directly corresponded to how the permission was created.

Thanks so much in advance!

Faraz is right but i have some additions. I was exploring the android source code and i found some information.

  1. You can only add, update or remove TYPE_DYNAMIC permissions.

  2. TYPE_DYNAMIC permissions are defined by application developers.

  3. TYPE_BUILTIN permissions can only be acquired by system apps.

EDIT: TYPE_DYNAMIC permission example How to use custom permissions in Android?

It seems that the TYPE_BUILTIN is for Linux kernel permissions, TYPE_DYNAMIC is for any dynamically created permission (via the use of addPermission*() API methods) and TYPE_NORMAL is for any other statically created permission (both system and third-party).

This link explains where in the system code these permissions are defined.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM