From 8d090209a92a2c27a81e217bc308b998685c5545 Mon Sep 17 00:00:00 2001 From: xia-bubai Date: Mon, 4 Aug 2025 21:38:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8F=AF=E9=80=89=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=8F=8F=E8=BF=B0=E4=B8=AD=E5=8A=A0=E4=B8=8A[]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xia-bubai --- api/@ohos.abilityAccessCtrl.d.ts | 4 ++-- api/@ohos.privacyManager.d.ts | 32 ++++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/api/@ohos.abilityAccessCtrl.d.ts b/api/@ohos.abilityAccessCtrl.d.ts index ac4ecda0fd..ecbcf98f4d 100644 --- a/api/@ohos.abilityAccessCtrl.d.ts +++ b/api/@ohos.abilityAccessCtrl.d.ts @@ -555,7 +555,7 @@ declare namespace abilityAccessCtrl { * It should correspond to the value registered by function of "on", whose type is "permissionStateChange". * @param { Array } permissionList - A list of permissions that specify the permissions to be listened on. * It should correspond to the value registered by function of "on", whose type is "permissionStateChange". - * @param { Callback } callback - Callback for the result from unregistering permissions. + * @param { Callback } [callback] - Callback for the result from unregistering permissions. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.GET_SENSITIVE_PERMISSIONS". * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app. @@ -580,7 +580,7 @@ declare namespace abilityAccessCtrl { * @param { 'selfPermissionStateChange' } type - Event type. * @param { Array } permissionList - A list of permissions that specify the permissions to be listened on. * It should correspond to the value registered by function of "on", whose type is "selfPermissionStateChange". - * @param { Callback } callback - Callback for the result from unregistering permissions. + * @param { Callback } [callback] - Callback for the result from unregistering permissions. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. * @throws { BusinessError } 12100001 - Invalid parameter. The permissionNames in the list are all invalid. * @throws { BusinessError } 12100004 - The API is not used in pair with 'on'. diff --git a/api/@ohos.privacyManager.d.ts b/api/@ohos.privacyManager.d.ts index 14ab8b5a54..d75603b32e 100644 --- a/api/@ohos.privacyManager.d.ts +++ b/api/@ohos.privacyManager.d.ts @@ -57,7 +57,7 @@ declare namespace privacyManager { * @param { Permissions } permissionName - Name of the permission accessed. * @param { int } successCount - Number of successful accesses to the permission. * @param { int } failCount - Number of failed accesses to the permission. - * @param { AddPermissionUsedRecordOptions } options - Options to be added. + * @param { AddPermissionUsedRecordOptions } [options] - Options to be added. * @returns { Promise } Promise that returns no value. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS". @@ -184,8 +184,8 @@ declare namespace privacyManager { * @permission ohos.permission.PERMISSION_USED_STATS * @param { number } tokenID - Token ID of the application. * @param { Permissions } permissionName - Name of the permission to be started. - * @param { number } pid - Pid of the application, default -1. - * @param { PermissionUsedType } usedType - Used type of the permission accessed, default NORMAL_TYPE. + * @param { number } [pid] - Pid of the application, default -1. + * @param { PermissionUsedType } [usedType] - Used type of the permission accessed, default NORMAL_TYPE. * @returns { Promise } Promise that returns no value. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS". @@ -262,7 +262,7 @@ declare namespace privacyManager { * @permission ohos.permission.PERMISSION_USED_STATS * @param { number } tokenID - Token ID of the application. * @param { Permissions } permissionName - Name of the permission to be stopped. - * @param { number } pid - Pid of the application, default -1. + * @param { number } [pid] - Pid of the application, default -1. * @returns { Promise } Promise that returns no value. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS". @@ -362,7 +362,7 @@ declare namespace privacyManager { * Obtains the used type of the permission accessed. * * @permission ohos.permission.PERMISSION_USED_STATS - * @param { number } tokenId - Token ID of the application. By default, all token IDs of the device are returned. + * @param { int } tokenId - Token ID of the application. By default, all token IDs of the device are returned. * @param { Permissions } permissionName - Name of the permission to query. By default, all permissions of the device are returned. * @returns { Promise> } Promise used to return the information obtained. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. @@ -375,7 +375,27 @@ declare namespace privacyManager { * @systemapi * @since 12 */ - function getPermissionUsedTypeInfos(tokenId?: number, permissionName?: Permissions): Promise>; + + /** + * Obtains the used type of the permission accessed. + * + * @permission ohos.permission.PERMISSION_USED_STATS + * @param { int | null } [tokenId] - Token ID of the application. By default, all token IDs of the device + * are returned. + * @param { Permissions } [permissionName] - Name of the permission to query. By default, all permissions + * of the device are returned. + * @returns { Promise> } Promise used to return the information obtained. + * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission + * "ohos.permission.PERMISSION_USED_STATS". + * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app. + * @throws { BusinessError } 12100001 - Invalid parameter. PermissionName exceeds 256 characters. + * @throws { BusinessError } 12100002 - The input tokenId does not exist. + * @throws { BusinessError } 12100003 - The input permissionName does not exist. + * @syscap SystemCapability.Security.AccessToken + * @systemapi + * @since 20 + */ + function getPermissionUsedTypeInfos(tokenId?: int | null, permissionName?: Permissions): Promise>; /** * Sets the toggle state of permission access records for the current user. -- Gitee