diff --git a/api/@ohos.abilityAccessCtrl.d.ts b/api/@ohos.abilityAccessCtrl.d.ts index ecbcf98f4d575d7cf13b027a30e300728a1fa72d..0a84068c969bdbea232f5fff594113291d99ac48 100644 --- a/api/@ohos.abilityAccessCtrl.d.ts +++ b/api/@ohos.abilityAccessCtrl.d.ts @@ -232,7 +232,6 @@ declare namespace abilityAccessCtrl { * @param { Array } permissionList - Indicates the list of permissions to be requested. This parameter cannot be null or empty. * @param { AsyncCallback } requestCallback Callback for the result from requesting permissions. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. - * @throws { BusinessError } 12100001 - Invalid parameter. The context is invalid when it does not belong to the application itself. * @syscap SystemCapability.Security.AccessToken * @stagemodelonly * @crossplatform @@ -289,6 +288,20 @@ declare namespace abilityAccessCtrl { * @since arkts {'1.1':'11', '1.2':'20'} * @arkts 1.1&1.2 */ + /** + * Requests certain permissions from the user. + * + * @param { Context } context - The context that initiates the permission request. + *
The context must belong to the Stage model and only supports UIAbilityContext and UIExtensionContext. + * @param { Array } permissionList - Indicates the list of permissions to be requested. This parameter cannot be null or empty. + * @returns { Promise } Returns result of requesting permissions. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Security.AccessToken + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 12 + */ requestPermissionsFromUser(context: Context, permissionList: Array): Promise; /** @@ -503,7 +516,6 @@ declare namespace abilityAccessCtrl { * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app. * @throws { BusinessError } 12100001 - Invalid parameter. Possible causes: 1. The tokenIDList or permissionList exceeds the size limit; * 2. The tokenIDs or permissionNames in the list are all invalid. - * @throws { BusinessError } 12100004 - The API is used repeatedly with the same input. * @throws { BusinessError } 12100005 - The registration time has exceeded the limit. * @throws { BusinessError } 12100007 - The service is abnormal. * @throws { BusinessError } 12100008 - Out of memory. @@ -560,9 +572,7 @@ declare namespace abilityAccessCtrl { * @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. * @throws { BusinessError } 12100001 - Invalid parameter. The tokenIDList or permissionList is not in the listening list. - * @throws { BusinessError } 12100004 - The API is not used in pair with 'on'. * @throws { BusinessError } 12100007 - The service is abnormal. - * @throws { BusinessError } 12100008 - Out of memory. * @syscap SystemCapability.Security.AccessToken * @systemapi * @since 9 @@ -582,7 +592,6 @@ declare namespace abilityAccessCtrl { * 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. * @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'. * @throws { BusinessError } 12100007 - The service is abnormal. * @syscap SystemCapability.Security.AccessToken @@ -605,7 +614,6 @@ declare namespace abilityAccessCtrl { * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. * @throws { BusinessError } 12100001 - Invalid parameter. Possible causes: 1. The context is invalid because it does not belong to the application itself; * 2. The permission list contains the permission that is not declared in the module.json file; 3. The permission list is invalid because the permissions in it do not belong to the same permission group. - * @throws { BusinessError } 12100010 - The request already exists. * @throws { BusinessError } 12100011 - All permissions in the permission list have been granted. * @throws { BusinessError } 12100012 - The permission list contains the permission that has not been revoked by the user. * @syscap SystemCapability.Security.AccessToken @@ -625,7 +633,6 @@ declare namespace abilityAccessCtrl { * @returns { Promise } Returns the status of the specified global switch. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. * @throws { BusinessError } 12100001 - Invalid parameter. Possible causes: 1. The context is invalid because it does not belong to the application itself; 2. The type of global switch is not support. - * @throws { BusinessError } 12100010 - The request already exists. * @throws { BusinessError } 12100013 - The specific global switch is already open. * @syscap SystemCapability.Security.AccessToken * @stagemodelonly diff --git a/api/@ohos.privacyManager.d.ts b/api/@ohos.privacyManager.d.ts index d75603b32e85c691ce2a5ec9c45a5d2d3a8edf66..b924ba024c55959ad74679f19c584e57846949b8 100644 --- a/api/@ohos.privacyManager.d.ts +++ b/api/@ohos.privacyManager.d.ts @@ -121,10 +121,7 @@ declare namespace privacyManager { * @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. The value of flag, begin, or end in request is invalid. - * @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process. - * @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission. * @throws { BusinessError } 12100007 - The service is abnormal. - * @throws { BusinessError } 12100008 - Out of memory. * @syscap SystemCapability.Security.AccessToken * @systemapi * @since 9 @@ -141,10 +138,7 @@ declare namespace privacyManager { * @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. The value of flag, begin, or end in request is invalid. - * @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process. - * @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission. * @throws { BusinessError } 12100007 - The service is abnormal. - * @throws { BusinessError } 12100008 - Out of memory. * @syscap SystemCapability.Security.AccessToken * @systemapi * @since 9 @@ -176,6 +170,27 @@ declare namespace privacyManager { * @systemapi * @since 9 */ + /** + * Start using sensitive permission. + * + * @permission ohos.permission.PERMISSION_USED_STATS + * @param { number } tokenID - Token ID of the application. + * @param { Permissions } permissionName - Name of the permission to be started. + * @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". + * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app. + * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, + * or the type of the specified tokenID is not of the application type. + * @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission. + * @throws { BusinessError } 12100004 - The API is used repeatedly with the same input. + * It means the application specified by the tokenID has been using the specified permission. + * @throws { BusinessError } 12100007 - The service is abnormal. + * @throws { BusinessError } 12100008 - Out of memory. + * @syscap SystemCapability.Security.AccessToken + * @systemapi + * @since 12 + */ function startUsingPermission(tokenID: number, permissionName: Permissions): Promise; /** @@ -192,7 +207,6 @@ declare namespace privacyManager { * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app. * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, * the type of the specified tokenID is not of the application type, or usedType is invalid. - * @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process. * @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission. * @throws { BusinessError } 12100004 - The API is used repeatedly with the same input. * It means the application specified by the tokenID has been using the specified permission. @@ -231,6 +245,27 @@ declare namespace privacyManager { * @systemapi * @since 9 */ + /** + * Start using sensitive permission. + * + * @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 { AsyncCallback } callback - Asynchronous callback interface. + * @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". + * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app. + * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, + * or the type of the specified tokenID is not of the application type. + * @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission. + * @throws { BusinessError } 12100004 - The API is used repeatedly with the same input. + * It means the application specified by the tokenID has been using the specified permission. + * @throws { BusinessError } 12100007 - The service is abnormal. + * @throws { BusinessError } 12100008 - Out of memory. + * @syscap SystemCapability.Security.AccessToken + * @systemapi + * @since 12 + */ function startUsingPermission(tokenID: number, permissionName: Permissions, callback: AsyncCallback): void; /** @@ -254,6 +289,26 @@ declare namespace privacyManager { * @systemapi * @since 9 */ + /** + * Stop using sensitive permission. + * + * @permission ohos.permission.PERMISSION_USED_STATS + * @param { number } tokenID - Token ID of the application. + * @param { Permissions } permissionName - Name of the permission to be stopped. + * @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". + * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app. + * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, + * or the type of the specified tokenID is not of the application type. + * @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission. + * @throws { BusinessError } 12100004 - The API is not used in pair with 'startUsingPermission'. + * @throws { BusinessError } 12100007 - The service is abnormal. + * @throws { BusinessError } 12100008 - Out of memory. + * @syscap SystemCapability.Security.AccessToken + * @systemapi + * @since 12 + */ function stopUsingPermission(tokenID: number, permissionName: Permissions): Promise; /** @@ -269,7 +324,6 @@ declare namespace privacyManager { * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app. * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, * or the type of the specified tokenID is not of the application type. - * @throws { BusinessError } 12100002 - The specified tokenID does not exist or refer to an application process. * @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission. * @throws { BusinessError } 12100004 - The API is not used in pair with 'startUsingPermission'. * @throws { BusinessError } 12100007 - The service is abnormal. @@ -305,6 +359,26 @@ declare namespace privacyManager { * @systemapi * @since 9 */ + /** + * Stop using sensitive permission. + * + * @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 { AsyncCallback } callback - Asynchronous callback interface. + * @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". + * @throws { BusinessError } 202 - Not system app. Interface caller is not a system app. + * @throws { BusinessError } 12100001 - Invalid parameter. The tokenID is 0, the permissionName exceeds 256 characters, + * or the type of the specified tokenID is not of the application type. + * @throws { BusinessError } 12100003 - The specified permission does not exist or is not a user_grant permission. + * @throws { BusinessError } 12100004 - The API is not used in pair with 'startUsingPermission'. + * @throws { BusinessError } 12100007 - The service is abnormal. + * @throws { BusinessError } 12100008 - Out of memory. + * @syscap SystemCapability.Security.AccessToken + * @systemapi + * @since 12 + */ function stopUsingPermission(tokenID: number, permissionName: Permissions, callback: AsyncCallback): void; /** @@ -1031,4 +1105,4 @@ declare namespace privacyManager { } export default privacyManager; -export { Permissions }; \ No newline at end of file +export { Permissions };