Access Permission Control
Introduction
This sample shows how @ohos.abilityAccessCtrl works to implement app permission control. The display effect is as follows:

Concepts
Application access control: provides application permission management, including authentication, authorization, and authorization revocation.
Required Permissions
-
ohos.permission.GET_SENSITIVE_PERMISSIONS
-
ohos.permission.REVOKE_SENSITIVE_PERMISSIONS
-
ohos.permission.GRANT_SENSITIVE_PERMISSIONS
-
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
-
ohos.permission.GET_BUNDLE_INFO
-
ohos.permission.MICROPHONE
Usage
-
Open the app. A dialog box is displayed, asking you whether to grant the permission. Touch Cancel.
-
The permission check screen is displayed. Touch the Check Permission button. A message is displayed, indicating that the permission is not granted.
-
Close the app and open it again. A dialog box is displayed, asking you whether to grant the permission. Touch OK.
-
The permission check screen is displayed. Touch the Check Permission button. A message is displayed, indicating that the permission has been granted.
-
Close the app and open it again. No dialog box is displayed. Touch the Check Permission button. A message is displayed, indicating that the permission has been granted.
Constraints
-
This sample can only be run on standard-system devices.
-
Before building a project, you need to run Make Module 'entry'.
-
This sample requires DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100) to compile and run.
-
The ohos.permission.GET_SENSITIVE_PERMISSIONS, ohos.permission.REVOKE_SENSITIVE_PERMISSIONS, and ohos.permission.GRANT_SENSITIVE_PERMISSIONS permissions used in this sample are of the system_core level. You need to configure signatures for these permissions. For details about the application permission level (APL), see Permission List.