!14545 新增支持分身应用grantUriPermission接口

Merge pull request !14545 from 段嗣钊/master1101
This commit is contained in:
openharmony_ci 2024-11-07 13:49:04 +00:00 committed by Gitee
commit e462598629
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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;