From 22311241ac987c2f3ecfab8b0b4727670e0abb0f Mon Sep 17 00:00:00 2001 From: lsq Date: Fri, 25 Nov 2022 12:43:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9D=83=E9=99=90=E5=BC=B9?= =?UTF-8?q?=E6=A1=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lsq Change-Id: I17660a92f21e4684b3b7e74cdb1ff6c01fb1e2eb Signed-off-by: lsq --- api/@ohos.abilityAccessCtrl.d.ts | 31 ++++++++++++++++++++++++------- api/@ohos.privacyManager.d.ts | 5 +++-- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/api/@ohos.abilityAccessCtrl.d.ts b/api/@ohos.abilityAccessCtrl.d.ts index 23474f7e6f..1d6ee36e68 100644 --- a/api/@ohos.abilityAccessCtrl.d.ts +++ b/api/@ohos.abilityAccessCtrl.d.ts @@ -15,6 +15,8 @@ import { AsyncCallback, Callback } from './basic'; import { Permissions } from './permissions'; +import Context from "./application/Context"; +import PermissionRequestResult from "./application/PermissionRequestResult"; /** * @syscap SystemCapability.Security.AccessToken @@ -22,7 +24,7 @@ import { Permissions } from './permissions'; declare namespace abilityAccessCtrl { /** * Obtains the AtManager instance. - * @return returns the instance of the AtManager. + * @returns returns the instance of the AtManager. * @since 8 */ function createAtManager(): AtManager; @@ -36,7 +38,7 @@ import { Permissions } from './permissions'; * Checks whether a specified application has been granted the given permission. * @param tokenID The tokenId of specified application. * @param permissionName The permission name to be verified. - * @return Returns permission verify result. + * @returns Returns permission verify result. * @since 8 * @deprecated since 9 * @useinstead ohos.abilityAccessCtrl.AtManager#checkAccessToken @@ -47,7 +49,7 @@ import { Permissions } from './permissions'; * Checks whether a specified application has been granted the given permission. * @param tokenID The tokenId of specified application. * @param permissionName The permission name to be verified. Permissions type only support the valid permission name. - * @return Returns permission verify result. + * @returns Returns permission verify result. * @since 9 */ verifyAccessToken(tokenID: number, permissionName: Permissions): Promise; @@ -58,7 +60,7 @@ import { Permissions } from './permissions'; * @param permissionName The permission name to be verified. * @throws { BusinessError } 401 - The parameter check failed. * @throws { BusinessError } 12100001 - The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. - * @return Returns permission verify result. + * @returns Returns permission verify result. * @since 9 */ verifyAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus; @@ -69,11 +71,25 @@ import { Permissions } from './permissions'; * @param permissionName The permission name to be verified. * @throws { BusinessError } 401 - The parameter check failed. * @throws { BusinessError } 12100001 - The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. - * @return Returns permission verify result. + * @returns Returns permission verify result. * @since 9 */ checkAccessToken(tokenID: number, permissionName: Permissions): Promise; + /** + * Requests certain permissions from the user. + * + * @param context The context that initiates the permission request. + * @param permissions Indicates the list of permissions to be requested. This parameter cannot be null or empty. + * @returns Returns the {@link PermissionRequestResult}. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 12100001 - The parameter is invalid. The context is invalid when it does not belong to the application itself. + * @since 9 + * @StageModelOnly + */ + requestPermissionsFromUser(context: Context, permissions: Array, requestCallback: AsyncCallback) : void; + requestPermissionsFromUser(context: Context, permissions: Array) : Promise; + /** * Grants a specified user_grant permission to the given application. * @param tokenID The tokenId of specified application. @@ -118,7 +134,7 @@ import { Permissions } from './permissions'; * Queries specified permission flag of the given application. * @param tokenID The tokenId of specified application. * @param permissionName The permission name to be granted. - * @return Return permission flag. + * @returns Return permission flag. * @throws { BusinessError } 401 - The parameter check failed. * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission specified below. * @throws { BusinessError } 12100001 - The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. @@ -134,7 +150,7 @@ import { Permissions } from './permissions'; /** * Queries permission management version. - * @return Return permission version. + * @returns Return permission version. * @systemapi * @since 9 */ @@ -244,3 +260,4 @@ import { Permissions } from './permissions'; } export default abilityAccessCtrl; + export { Permissions }; \ No newline at end of file diff --git a/api/@ohos.privacyManager.d.ts b/api/@ohos.privacyManager.d.ts index 3df5040052..5ebddceac4 100644 --- a/api/@ohos.privacyManager.d.ts +++ b/api/@ohos.privacyManager.d.ts @@ -44,7 +44,7 @@ import { Permissions } from './permissions' /** * Queries the access records of sensitive permission. * @param request The request of permission used records. - * @return Return the response of permission used records. + * @returns Return the response of permission used records. * @throws { BusinessError } 401 - The parameter check failed. * @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.PERMISSION_USED_STATS". * @throws { BusinessError } 12100001 - The parameter is invalid. the value of flag in request is invalid. @@ -365,4 +365,5 @@ import { Permissions } from './permissions' } } -export default privacyManager; \ No newline at end of file +export default privacyManager; +export { Permissions }; \ No newline at end of file -- Gitee