新增支持分身应用grantUriPermission接口

Signed-off-by: 段嗣钊 <duansizhao@huawei.com>
Change-Id: Id97730321de74329610780b7549352a69974b29c
This commit is contained in:
段嗣钊 2024-11-01 11:32:01 +08:00
parent 8aad78c616
commit abee08a618
2 changed files with 55 additions and 0 deletions

View File

@ -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',
}
/**

View File

@ -84,6 +84,33 @@ declare namespace uriPermissionManager {
*/
function grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: string): Promise<number>;
/**
* 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<void> } - 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<void>;
/**
* Revoke URI from one application
*
@ -155,6 +182,26 @@ declare namespace uriPermissionManager {
* @since 12
*/
function revokeUriPermission(uri: string, targetBundleName: string): Promise<number>;
/**
* 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<void> } - 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<void>;
}
export default uriPermissionManager;