Provides APIs for privacy management, such as management of permission usage records.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module are system APIs and cannot be called by third-party applications.
Adds a permission usage record when an application protected by the permission is called by another service or application. This API uses a promise to return the result.
The permission usage record includes the application identity of the invoker, name of the permission used, and number of successful and failed accesses to the application.
**Required permissions**: ohos.permission.PERMISSION_USED_STATS (available only to system applications)
| Promise<number> | Promise used to return the result. If **0** is returned, the record is added successfully. If **-1** is returned, the record fails to be added.|
```
```
**Example**
```js
vartokenID=appInfo.accessTokenId;// accessTokenId can be obtained by using getApplicationInfo().
Adds a permission usage record when an application protected by the permission is called by another service or application. This API uses an asynchronous callback to return the result.
The permission usage record includes the application identity of the invoker, name of the permission used, and number of successful and failed accesses to the application.
**Required permissions**: ohos.permission.PERMISSION_USED_STATS (available only to system applications)
| tokenID | number | Yes | Application token ID of the invoker. |
| permissionName | string | Yes | Name of the permission.|
| successCount | number | Yes | Number of successful accesses.|
| failCount | number | Yes | Number of failed accesses.|
| callback | AsyncCallback<number> | Yes | Callback used to return the result. If **0** is returned, the record is added successfully. If **-1** is returned, the record fails to be added.|
**Example**
```js
vartokenID=appInfo.accessTokenId;// accessTokenId can be obtained by using getApplicationInfo().
| tokenId | number | No | Token ID of the application. |
| isRemote | boolean | No | Whether the token ID belongs to a remote device. The default value is **false**.|
| deviceId | string | No | ID of the device hosting the target application. |
| bundleName | string | No | Bundle name of the target application.|
| permissionRecords | Array<[PermissionUsedRecord](#PermissionUsedRecord)> | No | Permission usage records of the specified application obtained. |
| permissionName | string | No | Name of the permission. |
| accessCount | number | No | Total number of times that the permission is accessed.|
| rejectCount | number | No | Total number of times that the access to the permission is rejected.|
| lastAccessTime | number | No | Last time when the permission was accessed, in ms.|
| lastRejectTime | number | No | Last time when the access to the permission was rejected, in ms.|
| lastAccessDuration | number | No | Last access duration, in ms.|
| accessRecords | Array<[UsedRecordDetail](#usedrecorddetail)> | No | Access records. This parameter is valid only when **flag** is **FLAG_PERMISSION_USAGE_SUMMARY**. By default, 10 records are provided. |
| rejectRecords | Array<[UsedRecordDetail](#usedrecorddetail)> | No | Rejected records. This parameter is valid only when **flag** is **FLAG_PERMISSION_USAGE_SUMMARY**. By default, 10 records are provided. |