From abee08a61859c870f362a8c48138ce90a039334b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E5=97=A3=E9=92=8A?= Date: Fri, 1 Nov 2024 11:32:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=94=AF=E6=8C=81=E5=88=86?= =?UTF-8?q?=E8=BA=AB=E5=BA=94=E7=94=A8grantUriPermission=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 段嗣钊 Change-Id: Id97730321de74329610780b7549352a69974b29c --- api/@ohos.app.ability.wantConstant.d.ts | 8 ++++ ...ohos.application.uriPermissionManager.d.ts | 47 +++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/api/@ohos.app.ability.wantConstant.d.ts b/api/@ohos.app.ability.wantConstant.d.ts index f9ffbb0b0..b1f988485 100644 --- a/api/@ohos.app.ability.wantConstant.d.ts +++ b/api/@ohos.app.ability.wantConstant.d.ts @@ -316,6 +316,14 @@ declare namespace wantConstant { * @since 14 */ CREATE_APP_INSTANCE_KEY = 'ohos.extra.param.key.createAppInstance', + + /** + * Indicates the app clone index of caller. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 14 + */ + CALLER_APP_CLONE_INDEX = 'ohos.param.callerAppCloneIndex', } /** diff --git a/api/@ohos.application.uriPermissionManager.d.ts b/api/@ohos.application.uriPermissionManager.d.ts index cb78e7279..8ec43d996 100644 --- a/api/@ohos.application.uriPermissionManager.d.ts +++ b/api/@ohos.application.uriPermissionManager.d.ts @@ -84,6 +84,33 @@ declare namespace uriPermissionManager { */ function grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: string): Promise; + /** + * Grant URI to another application + * + * @permission ohos.permission.PROXY_AUTHORIZATION_URI + * @param { string } uri - File URI. + * @param { wantConstant.Flags } flag - wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, + * wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION or + * wantConstant.Flags.FLAG_AUTH_PERSISTABLE_URI_PERMISSION. + * @param { string } targetBundleName - Indicates the bundle name of authorization target. + * @param { number } appCloneIndex - Indicates the clone index of target application. + * @returns { Promise } - the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000058 - Invalid URI flag. + * @throws { BusinessError } 16000059 - Invalid URI type. + * @throws { BusinessError } 16000060 - A sandbox application cannot grant URI permission. + * @throws { BusinessError } 16000081 - Get target application info failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use. + * @since 14 + */ + function grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: string, appCloneIndex: number): Promise; + /** * Revoke URI from one application * @@ -155,6 +182,26 @@ declare namespace uriPermissionManager { * @since 12 */ function revokeUriPermission(uri: string, targetBundleName: string): Promise; + + /** + * Revoke URI from one application + * + * @param { string } uri - File URI. + * @param { string } targetBundleName - Indicates the bundle name of authorization target. + * @param { number } appCloneIndex - Indicates the clone index of target application. + * @returns { Promise } - the promise returned by the function. + * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000059 - Invalid URI type. + * @throws { BusinessError } 16000081 - Get target application info failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use + * @since 14 + */ + function revokeUriPermission(uri: string, targetBundleName: string, appCloneIndex: number): Promise; } export default uriPermissionManager; \ No newline at end of file