| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundle-ApplicationInfo.md). |
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
| permissionName | Permissions | Yes | Permission to check.|
| permissionName | Permissions | Yes | Permission to check. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
**Return value**
**Return value**
...
@@ -71,7 +71,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -71,7 +71,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
lettokenID=0;// You can use getApplicationInfo to obtain the access token ID.
lettokenID=0;// Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
| tokenID | number | Yes | Token ID of the application. |
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
| permissionName | Permissions | Yes | Name of the permission to verify.|
| permissionName | Permissions | Yes | Permission to verify. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
**Return value**
**Return value**
...
@@ -116,7 +116,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -116,7 +116,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
```js
```js
letatManager=abilityAccessCtrl.createAtManager();
letatManager=abilityAccessCtrl.createAtManager();
lettokenID=0;
lettokenID=0;// Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundle-ApplicationInfo.md). |
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
| permissionName | Permissions | Yes | Name of the permission to grant.|
| permissionName | Permissions | Yes | Permission to grant. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
| permissionFlag | number | Yes | Permission flag. The value **1** means that the permission request dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. |
| permissionFlag | number | Yes | Permission flag. The value **1** means that the permission request dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. |
**Return value**
**Return value**
...
@@ -165,7 +165,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -165,7 +165,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
lettokenID=0;// You can use getApplicationInfo to obtain the access token ID.
lettokenID=0;// Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundle-ApplicationInfo.md).|
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md).|
| permissionName | Permissions | Yes | Name of the permission to grant.|
| permissionName | Permissions | Yes | Permission to grant. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
| permissionFlag | number | Yes | Permission flag. The value **1** means that the permission request dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. |
| permissionFlag | number | Yes | Permission flag. The value **1** means that the permission request dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. |
| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the permission is granted successfully, **err** is **undefine**. Otherwise, **err** is an error object.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the permission is granted successfully, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
**Error codes**
...
@@ -208,7 +208,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -208,7 +208,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| 12100001 | The parameter is invalid. The tokenID is 0 |
| 12100001 | The parameter is invalid. The tokenID is 0 |
| 12100002 | TokenId does not exist. |
| 12100002 | TokenId does not exist. |
| 12100003 | Permission does not exist. |
| 12100003 | Permission does not exist. |
| 12100006 | The specified application does not support the permissions granted or ungranted as specified. |
| 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
| 12100007 | Service is abnormal. |
**Example**
**Example**
...
@@ -216,7 +217,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -216,7 +217,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
lettokenID=0;// You can use getApplicationInfo to obtain the access token ID.
lettokenID=0;// Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundle-ApplicationInfo.md). |
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
| permissionName | Permissions | Yes | Name of the permission to revoke.|
| permissionName | Permissions | Yes | Permission to revoke. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
| permissionFlag | number | Yes | Permission flag. The value **1** means that the permission request dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. |
| permissionFlag | number | Yes | Permission flag. The value **1** means that the permission request dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. |
**Return value**
**Return value**
...
@@ -275,7 +276,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -275,7 +276,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
lettokenID=0;// You can use getApplicationInfo to obtain the access token ID.
lettokenID=0;// Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundle-ApplicationInfo.md). |
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
| permissionName | Permissions | Yes | Name of the permission to revoke.|
| permissionName | Permissions | Yes | Permission to revoke. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
| permissionFlag | number | Yes | Permission flag. The value **1** means that the permission request dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. |
| permissionFlag | number | Yes | Permission flag. The value **1** means that the permission request dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. |
| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the permission is revoked successfully, **err** is **undefine**. Otherwise, **err** is an error object.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the permission is revoked successfully, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
**Error codes**
...
@@ -318,7 +319,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -318,7 +319,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| 12100001 | The parameter is invalid. The tokenID is 0 |
| 12100001 | The parameter is invalid. The tokenID is 0 |
| 12100002 | TokenId does not exist. |
| 12100002 | TokenId does not exist. |
| 12100003 | Permission does not exist. |
| 12100003 | Permission does not exist. |
| 12100006 | The specified application does not support the permissions granted or ungranted as specified. |
| 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
| 12100007 | Service is abnormal. |
**Example**
**Example**
...
@@ -326,7 +328,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -326,7 +328,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
lettokenID=0;// You can use getApplicationInfo to obtain the access token ID.
lettokenID=0;// Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundle-ApplicationInfo.md). |
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
| permissionName | Permissions | Yes | Name of the permission to query.|
| permissionName | Permissions | Yes | Target permission. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
**Return value**
**Return value**
...
@@ -375,7 +377,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -375,7 +377,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| 12100001 | The parameter is invalid. The tokenID is 0 |
| 12100001 | The parameter is invalid. The tokenID is 0 |
| 12100002 | The specified tokenID does not exist. |
| 12100002 | The specified tokenID does not exist. |
| 12100003 | The specified permission does not exist. |
| 12100003 | The specified permission does not exist. |
| 12100006 | The operation is not allowd. Either the application is a sandbox or the tokenID is from a remote device. |
| 12100006 | The operation is not allowed. Either the application is a sandbox or the tokenID is from a remote device. |
| 12100007 | Service is abnormal. |
| 12100007 | Service is abnormal. |
**Example**
**Example**
...
@@ -384,7 +386,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
...
@@ -384,7 +386,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
lettokenID=0;// You can use getApplicationInfo to obtain the access token ID.
lettokenID=0;// Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundle-ApplicationInfo.md). |
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
| permissionName | Permissions | Yes | Name of the permission to verify. Only valid permission names are supported.|
| permissionName | Permissions | Yes | Permission to verify. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
**Return value**
**Return value**
...
@@ -550,18 +552,107 @@ Verifies whether an application has the specified permission. This API uses a pr
...
@@ -550,18 +552,107 @@ Verifies whether an application has the specified permission. This API uses a pr
lettokenID=0;// You can use getApplicationInfo to obtain the access token ID.
lettokenID=0;// Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
| context | Context | Yes| Ability context of the application that requests the permission.|
| permissions | Array<Permissions> | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
| callback | AsyncCallback<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Yes| Callback invoked to return the result.|
**Error codes**
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
| context | Context | Yes| Ability context of the application that requests the permission.|
| permissions | Array<Permissions> | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
lettokenID=0;// You can use getApplicationInfo to obtain the access token ID.
lettokenID=0;// Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
| change | [PermissionStateChangeType](#permissionstatechangetype9) | Yes | No | Operation that triggers the permission grant state change. |
| change | [PermissionStateChangeType](#permissionstatechangetype9) | Yes | No | Operation that triggers the permission grant state change. |
| tokenID | number | Yes | No | Token ID of the application whose permission grant state changes are subscribed.|
| tokenID | number | Yes | No | Token ID of the application whose permission grant state changes are subscribed.|
| permissionName | Permissions | Yes | No | Name of the permission whose grant state is changed.|
| permissionName | Permissions | Yes | No | permission whose grant state is changed. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
The **privacyManager** module provides APIs for privacy management, such as management of permission usage records.
The **privacyManager** module provides APIs for privacy management, such as management of permission usage records.
...
@@ -42,11 +42,14 @@ The permission usage record includes the application identity (token ID) of the
...
@@ -42,11 +42,14 @@ The permission usage record includes the application identity (token ID) of the
**Error codes**
**Error codes**
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | Parameter invalid. |
| 12100001 | The parameter is invalid. The tokenID is 0 |
| 12100002 | TokenId does not exist. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | Permission does not exist. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
**Example**
**Example**
...
@@ -89,11 +92,14 @@ The permission usage record includes the application identity (token ID) of the
...
@@ -89,11 +92,14 @@ The permission usage record includes the application identity (token ID) of the
**Error codes**
**Error codes**
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | Parameter invalid. |
| 12100001 | The parameter is invalid. The tokenID is 0 |
| 12100002 | TokenId does not exist. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | Permission does not exist. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
**Example**
**Example**
...
@@ -139,11 +145,14 @@ Obtains historical permission usage records. This API uses a promise to return t
...
@@ -139,11 +145,14 @@ Obtains historical permission usage records. This API uses a promise to return t
**Error codes**
**Error codes**
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | Parameter invalid. |
| 12100001 | The parameter is invalid. the value of flag in request is invalid. |
| 12100002 | TokenId does not exist. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | Permission does not exist. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
**Example**
**Example**
...
@@ -191,11 +200,14 @@ Obtains historical permission usage records. This API uses an asynchronous callb
...
@@ -191,11 +200,14 @@ Obtains historical permission usage records. This API uses an asynchronous callb
**Error codes**
**Error codes**
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | Parameter invalid. |
| 12100001 | The parameter is invalid. the value of flag in request is invalid. |
| 12100002 | TokenId does not exist. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | Permission does not exist. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
**Example**
**Example**
...
@@ -251,12 +263,15 @@ Starts to use a permission and flushes the permission usage record. This API is
...
@@ -251,12 +263,15 @@ Starts to use a permission and flushes the permission usage record. This API is
**Error codes**
**Error codes**
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | Parameter invalid. |
| 12100001 | The parameter is invalid. The tokenID is 0 |
| 12100002 | TokenId does not exist. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | Permission does not exist. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100004 | The interface is not used together. |
| 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
**Example**
**Example**
...
@@ -296,12 +311,15 @@ Starts to use a permission and flushes the permission usage record. This API is
...
@@ -296,12 +311,15 @@ Starts to use a permission and flushes the permission usage record. This API is
**Error codes**
**Error codes**
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | Parameter invalid. |
| 12100001 | The parameter is invalid. The tokenID is 0 |
| 12100002 | TokenId does not exist. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | Permission does not exist. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100004 | The interface is not used together. |
| 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. |
Stops using a permission. This API is called by a system application and uses a promise to return the result. **startUsingPermission** and **stopUsingPermission** are used in pairs. This API uses a promise to return the result.
Stops using a permission. This API is called by a system application and uses a promise to return the result. **startUsingPermission** and **stopUsingPermission** are used in pairs. This API uses a promise to return the result.
...
@@ -348,12 +366,15 @@ Stops using a permission. This API is called by a system application and uses a
...
@@ -348,12 +366,15 @@ Stops using a permission. This API is called by a system application and uses a
**Error codes**
**Error codes**
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | Parameter invalid. |
| 12100001 | The parameter is invalid. The tokenID is 0 |
| 12100002 | TokenId does not exist. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | Permission does not exist. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100004 | The interface is not used together. |
| 12100004 | The interface is not used with |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
**Example**
**Example**
...
@@ -393,12 +414,15 @@ Stops using a permission. This API is called by a system application and uses a
...
@@ -393,12 +414,15 @@ Stops using a permission. This API is called by a system application and uses a
**Error codes**
**Error codes**
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | Parameter invalid. |
| 12100001 | The parameter is invalid. The tokenID is 0 |
| 12100002 | TokenId does not exist. |
| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
| 12100003 | Permission does not exist. |
| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
| 12100004 | The interface is not used together. |
| 12100004 | The interface is not used with |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
**Example**
**Example**
...
@@ -434,26 +458,29 @@ Subscribes to the permission usage status changes of the specified permissions.
...
@@ -434,26 +458,29 @@ Subscribes to the permission usage status changes of the specified permissions.
| type | string | Yes | Event type to subscribe to. The value is **'activeStateChange'**, which indicates the permission usage change event. |
| type | string | Yes | Event type to subscribe to. The value is **'activeStateChange'**, which indicates the permission usage change event. |
| permissionNameList | Array<Permissions> | No | List of permissions to be observed. If this parameter is left empty, the usage changes of all permissions are observed. |
| permissionNameList | Array<Permissions> | Yes | List of permissions to be observed. If this parameter is left empty, the usage changes of all permissions are observed. |
| callback | Callback<[ActiveChangeResponse](#activechangeresponse)> | Yes| Callback invoked to return a change in the permission usage.|
| callback | Callback<[ActiveChangeResponse](#activechangeresponse)> | Yes| Callback invoked to return a change in the permission usage.|
**Error codes**
**Error codes**
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | Parameter invalid. |
| 12100001 | The parameter is invalid. The tokenID is 0 |
| 12100004 | The interface is not used together. |
| 12100004 | The interface is called repeatedly with the same input. |
| 12100005 | The number of listeners exceeds the limit. |
| 12100005 | The registration time has exceeded the limitation. |
| type | string | Yes | Event type to subscribe to. The value is **'activeStateChange'**, which indicates the permission usage change event. |
| type | string | Yes | Event type to subscribe to. The value is **'activeStateChange'**, which indicates the permission usage change event. |
| permissionNameList | Array<Permissions> | No | List of permissions to be observed. If this parameter is left blank, the usage changes of all permissions are unsubscribed from. The value must be the same as that specified in **on()**.|
| permissionNameList | Array<Permissions> | Yes | List of permissions to be observed. If this parameter is left blank, the usage changes of all permissions are unsubscribed from. The value must be the same as that specified in **on()**.|
| callback | Callback<[ActiveChangeResponse](#activechangeresponse)> | No| Callback for the permission usage change event.|
| callback | Callback<[ActiveChangeResponse](#activechangeresponse)> | No| Callback for the permission usage change event.|
**Error codes**
**Error codes**
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md).
| ID| Error Message|
| ID| Error Message|
| -------- | -------- |
| -------- | -------- |
| 12100001 | Parameter invalid. |
| 12100001 | The parameter is invalid. The permissionName in list is all invalid or the list size is larger than 1024. |
| 12100004 | The interface is not used together. |