1# Application Permission Management Overview
2
3## Introduction
4
5Application permissions are used to control the access to system resources (such as the Contacts) and system capabilities (such as the camera and microphone) to protect system data (including personal data) and functions.
6
7Application permissions are used to protect:
8
9- Data, including personal data (such as photos, Contacts, Calendar, and location) and device data (such as device ID, camera data, and microphone data).
10
11- Functionalities, including device functionalities (such as accessing the camera or microphone, making a call, and connecting to the Internet) and application functionalities (such as displaying a floating window and creating a shortcut).
12
13## Basic Principles for Using Permissions
14
15Determine the permissions required by your application based on the use cases of your application. Comply with the following principles when applying for permissions during application development:
16
17- All the permissions required by your application (including third-party libraries referenced by your application) must be declared one by one in the application's configuration file. For details, see [Declaring Permissions](declare-permissions.md).
18
19- Request only the least required permissions for your application. Do not apply for unnecessary or obsolete permissions. Excess permission for an application may adversely affect user experience. When users have concern about the application security, they are reluctant to install or use the application.
20
21- When requesting a sensitive permission, also specify the reason why this permission is required. Sensitive permissions are permissions closely related to user privacy, including those related to the location, camera, microphone, Calendar, fitness, body sensors, media, files, images and videos. For details, see [Requesting User Authorization](request-user-authorization.md).
22
23- Sensitive permissions must be dynamically requested before the related service feature is provided.
24
25- If a user refuses to grant a permission, other service features irrelevant to this permission can be used normally.
26
27## Authorization Mode
28
29Permissions can be classified into system_grant permissions and user_grant permissions based on the authorization mode.
30
31### system_grant (System Authorization)
32
33A system_grant permission is authorized by the system. The application with this type of permission cannot access user or device sensitive information, and the operations allowed have controllable impact on the system or other applications.
34
35For an application with a system_grant permission, the system automatically grants the permission to the application during the installation process.
36
37### user_grant (User Authorization)
38
39A user_grant permission must be authorized by the user. An application with this type of permission may access user or device sensitive information, and the operations allowed may have a critical impact on the system or other applications.
40
41This type of permissions must be declared in the application installation package and authorized by the user in a dialog box during the running of the application. The application has the permission only after user authorization.
42
43For example, the permissions related to the microphone and camera in the [Open user_grant Permissions](permissions-for-all-user.md) are user_grant permissions. The list of user_grant permissions must be presented on the application details page in the application market.
44
45## Permission Groups and Permissions
46
47A permission group consists of user_grant permissions that are logically related.
48
49 It helps minimize the number of dialogs that are presented to the user when an application requests closely related permissions. A permission in a permission group is called a sub-permission of the group.
50
51The relationship between a permission group and its permissions is not fixed. For details about the permission groups supported by the system, see [Application Permission Groups](app-permission-group-list.md).
52
53## Basic Concepts in the Permission Mechanism
54
55- TokenID
56
57  Token identity (token ID or **TokenID**) uniquely identifies an application in the system. The AccessTokenManager (ATM) service manages the application Access Token (AT) information based on the token ID. The AT information includes the application ID, sub-user ID, application twin index, application Ability Privilege Level (APL), and permission grant status. When resources are required, the system uses the token ID as the unique identifier to obtain the application's permission grant status and performs authentication based on the information to control the resource access behavior of the application.
58
59  In addition, the system supports the multi-user feature and the App Twin feature. Different users and the twin applications of the same application have their own AT information with different token IDs.
60
61- APL
62
63  Both the applications and permissions are assigned with different APLs to prevent abuse of permissions.
64
65  The APL defines the application's priority for requesting permissions. Applications of different APLs can request permissions of different APLs.
66
67- Application APL
68
69  Application APLs are classified into three levels in ascending order of seniority.
70
71  | APL| Description|
72  | -------- | -------- |
73  | normal | Default APL of an application.|
74  | system_basic | Application that provides basic system services.|
75  | system_core | Application that provides OS core abilities. <br>Only the APL of a system application or Mobile Device Management (MDM) application can be system_core.|
76
77- Permission APL
78
79  Permissions are granted to applications based on the application APL. The permission APLs are also classified into three levels in ascending order of seniority.
80
81  | APL| Description| Available To|
82  | -------- | -------- | -------- |
83  | normal | Allows an application to access common system resources beyond the default rules, such as configuring Wi-Fi and invoking the camera to take photos.<br>Access to these resources (including data and functions) imposes low risks on user privacy and other applications.| Applications with the normal or higher APL.|
84  | system_basic | Allows an application to access resources related to basic OS services (basic functions provided or preset by the system), such as system settings and identity authentication.<br>Access to these resources imposes low risks to user privacy and other applications.| <!--RP1-->Applications with the system_basic or system_core APL.<!--RP1End--> |
85  | system_core | Allows an application to access OS core resources, which are critical to underlying core services. If these resources are corrupted, the OS cannot run properly.| - Applications with the system_core APL.<br>- System applications only.|
86
87- ACL
88
89  Permission APLs and application APLs are in one-to-one correspondence. In principle, an application with a lower APL cannot request a permission with a higher APL. However, you can use the Access Control List (ACL) to enable an application to have permissions beyond its APL.
90
91  All the system permissions are defined with the **Enable via ACL** field. If the value is true, the application can be granted to an application with a lower APL via the ACL. For the definition of a permission, see <!--RP2-->[Permissions for System Applications](permissions-for-system-apps.md)<!--RP2End-->.
92
93  For example, to implement a special feature, application A with the normal APL requires permission P, whose APL is system_basic. If **Enable via ACL** is true for permission P, application A can request permission P via the ACL.
94