4

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 (i.e., 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!

DallaRosa
  • 5,737
  • 2
  • 35
  • 53
Alice Van Der Land
  • 547
  • 1
  • 8
  • 18

2 Answers2

1

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?

Community
  • 1
  • 1
cokceken
  • 2,068
  • 11
  • 22
  • What's the source of this information? I don't think it's correct. I was printing the values for the permissions and Internet permission also seems to be TYPE_BUILTIN. – Alice Van Der Land Dec 05 '16 at 18:48
0

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.

Community
  • 1
  • 1
Alice Van Der Land
  • 547
  • 1
  • 8
  • 18