From 85edd48d4f38d2ce3bba69210eccbb402ef1e83a Mon Sep 17 00:00:00 2001 From: zhangzezhong Date: Thu, 31 Jul 2025 16:00:50 +0800 Subject: [PATCH] =?UTF-8?q?overload=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangzezhong --- ...ohos.app.ability.InsightIntentContext.d.ts | 75 +- ...app.ability.UIExtensionContentSession.d.ts | 133 +++- api/@ohos.app.ability.abilityManager.d.ts | 123 ++- api/@ohos.app.ability.appManager.d.ts | 730 ++++++++++++++++-- api/@ohos.app.ability.application.d.ts | 50 +- ...@ohos.app.ability.insightIntentDriver.d.ts | 85 +- api/@ohos.app.ability.missionManager.d.ts | 96 ++- api/@ohos.app.ability.wantAgent.d.ts | 356 ++++++++- ...ohos.application.uriPermissionManager.d.ts | 195 ++++- api/application/AbilityDelegator.d.ts | 666 ++++++++++++++-- api/application/ApplicationContext.d.ts | 398 +++++++++- api/application/Context.d.ts | 52 +- api/application/ServiceExtensionContext.d.ts | 346 ++++++++- api/application/UIAbilityContext.d.ts | 723 +++++++++++++++-- api/application/UIExtensionContext.d.ts | 438 ++++++++++- 15 files changed, 4130 insertions(+), 336 deletions(-) diff --git a/api/@ohos.app.ability.InsightIntentContext.d.ts b/api/@ohos.app.ability.InsightIntentContext.d.ts index d60333a727..1a03f8565e 100644 --- a/api/@ohos.app.ability.InsightIntentContext.d.ts +++ b/api/@ohos.app.ability.InsightIntentContext.d.ts @@ -57,11 +57,41 @@ declare class InsightIntentContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ startAbility(want: Want, callback: AsyncCallback): void; + /** + * Starts a new ability. + * This interface only allows you to start abilities within the same bundle and specify the bundleName. + * This interface only allows called in UIAbility insight intent execute mode. + * + * @param { Want } want - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000061 - Operation not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + startAbilityWithWantCallback(want: Want, callback: AsyncCallback): void; + /** * Starts a new ability. * This interface only allows you to start abilities within the same bundle and specify the bundleName. @@ -88,10 +118,45 @@ declare class InsightIntentContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ startAbility(want: Want): Promise; -} + /** + * Starts a new ability. + * This interface only allows you to start abilities within the same bundle and specify the bundleName. + * This interface only allows called in UIAbility insight intent execute mode. + * + * @param { Want } want - Indicates the ability to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000061 - Operation not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + startAbilityWithWantReturnsPromise(want: Want): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload startAbility { startAbilityWithWantCallback, startAbilityWithWantReturnsPromise } +} export default InsightIntentContext; \ No newline at end of file diff --git a/api/@ohos.app.ability.UIExtensionContentSession.d.ts b/api/@ohos.app.ability.UIExtensionContentSession.d.ts index bd9c0479e1..b57629f065 100644 --- a/api/@ohos.app.ability.UIExtensionContentSession.d.ts +++ b/api/@ohos.app.ability.UIExtensionContentSession.d.ts @@ -461,22 +461,50 @@ declare class UIExtensionContentSession { * 2. Incorrect parameter types. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ terminateSelf(callback: AsyncCallback): void; + /** + * Destroys the UI extension. + * + * @param { AsyncCallback } callback - The callback of terminateSelf. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + terminateSelfWithCallback(callback: AsyncCallback): void; + /** * Destroys the UI extension. * * @returns { Promise } The promise returned by the function. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ terminateSelf(): Promise; + /** + * Destroys the UI extension. + * + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + terminateSelfReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload terminateSelf{ terminateSelfWithCallback, terminateSelfReturnsPromise } + /** * Destroys the UI extension while returning the specified result code and data to the caller. * @@ -486,11 +514,25 @@ declare class UIExtensionContentSession { * 2. Incorrect parameter types. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; + /** + * Destroys the UI extension while returning the specified result code and data to the caller. + * + * @param { AbilityResult } parameter - Indicates the result to return. + * @param { AsyncCallback } callback - The callback of terminateSelfWithResult. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + terminateSelfWithResultWithParameterCallback(parameter: AbilityResult, callback: AsyncCallback): void; + + /** * Destroys the UI extension while returning the specified result code and data to the caller. * @@ -500,11 +542,33 @@ declare class UIExtensionContentSession { * 2. Incorrect parameter types. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ terminateSelfWithResult(parameter: AbilityResult): Promise; + /** + * Destroys the UI extension while returning the specified result code and data to the caller. + * + * @param { AbilityResult } parameter - Indicates the result to return. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + terminateSelfWithResultWithParameterReturnsPromise(parameter: AbilityResult): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload terminateSelfWithResult { + terminateSelfWithResultWithParameterCallback, + terminateSelfWithResultWithParameterReturnsPromise + } + /** * Sets the background color of the UI extension. * @@ -587,12 +651,30 @@ declare class UIExtensionContentSession { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ startAbilityByType(type: string, wantParam: Record, abilityStartCallback: AbilityStartCallback, callback: AsyncCallback): void; + /** + * Starts the UIAbility or UIExtensionAbility by type. + * If the caller application is in the background, it is not allowed to call this interface. + * + * @param { string } type - The type of target ability. + * @param { Record } wantParam - Indicates the want parameter. + * @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startAbilityByTypeWithTypeWantParamStartCallbackCallback(type: string, wantParam: Record, + abilityStartCallback: AbilityStartCallback, callback: AsyncCallback): void; + /** * Starts the UIAbility or UIExtensionAbility by type. * If the target ability is visible, you can start the target ability; If the target ability is invisible, @@ -627,12 +709,39 @@ declare class UIExtensionContentSession { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ startAbilityByType(type: string, wantParam: Record, abilityStartCallback: AbilityStartCallback): Promise; + /** + * Starts the UIAbility or UIExtensionAbility by type. + * If the caller application is in the background, it is not allowed to call this interface. + * + * @param { string } type - The type of target ability. + * @param { Record } wantParam - Indicates the want parameter. + * @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startAbilityByTypeWithTypeWantParamStartCallbackReturnsPromise(type: string, wantParam: Record, + abilityStartCallback: AbilityStartCallback): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload startAbilityByType { + startAbilityByTypeWithTypeWantParamStartCallbackCallback, + startAbilityByTypeWithTypeWantParamStartCallbackReturnsPromise + } + /** * Get the UIExtension Host Window proxy. * diff --git a/api/@ohos.app.ability.abilityManager.d.ts b/api/@ohos.app.ability.abilityManager.d.ts index 5059b1ead8..dc28be5fdd 100644 --- a/api/@ohos.app.ability.abilityManager.d.ts +++ b/api/@ohos.app.ability.abilityManager.d.ts @@ -269,11 +269,23 @@ declare namespace abilityManager { * @returns { Promise> } Returns the array of AbilityRunningInfo. * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ function getAbilityRunningInfos(): Promise>; + /** + * If you apply for permission, you can obtain information about all abilities. If you do not apply, you can only + * obtain information about the current ability. + * + * @permission ohos.permission.GET_RUNNING_INFO + * @returns { Promise> } Returns the array of AbilityRunningInfo. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.2 + */ + function getAbilityRunningInfosReturnsPromise(): Promise>; + /** * If you apply for permission, you can obtain information about all abilities. If you do not apply, you can only * obtain information about the current ability. @@ -287,11 +299,37 @@ declare namespace abilityManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function getAbilityRunningInfos(callback: AsyncCallback>): void; + /** + * If you apply for permission, you can obtain information about all abilities. If you do not apply, you can only + * obtain information about the current ability. + * + * @permission ohos.permission.GET_RUNNING_INFO + * @param { AsyncCallback> } callback - The callback is used to return the array of + * AbilityRunningInfo. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getAbilityRunningInfosWithCallback(): Promise>; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getAbilityRunningInfos { + getAbilityRunningInfosReturnsPromise, + getAbilityRunningInfosWithCallback + } + /** * If you apply for permission, you can obtain information about all extensions. If you do not apply, you can only * obtain information about the current extension. @@ -335,11 +373,16 @@ declare namespace abilityManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function getTopAbility(): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + function getTopAbilityReturnsPromise(): Promise; + /** * Get the top ability information of the display. * @@ -350,11 +393,31 @@ declare namespace abilityManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function getTopAbility(callback: AsyncCallback): void; + /** + * Get the top ability information of the display. + * + * @param { AsyncCallback } callback - The callback is used to return elementName info of top ability. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getTopAbilityWithCallback(callback: AsyncCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getTopAbility { getTopAbilityReturnsPromise, getTopAbilityWithCallback } + /** * Acquire the shared data from target ability. * @@ -459,11 +522,27 @@ declare namespace abilityManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function getForegroundUIAbilities(callback: AsyncCallback>): void; + /** + * Get the foreground ui abilities. + * + * @permission ohos.permission.GET_RUNNING_INFO + * @param { AsyncCallback> } callback - The callback is used to return the list of AbilityStateDatas. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getForegroundUIAbilitiesWithCallback(callback: AsyncCallback>): void; + /** * Get the foreground ui abilities. * @@ -474,11 +553,31 @@ declare namespace abilityManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function getForegroundUIAbilities(): Promise>; + /** + * Get the foreground ui abilities. + * + * @permission ohos.permission.GET_RUNNING_INFO + * @returns { Promise> } Returns the list of AbilityStateDatas. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getForegroundUIAbilitiesReturnsPromise(): Promise>; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getForegroundUIAbilities { getForegroundUIAbilitiesWithCallback, getForegroundUIAbilitiesReturnsPromise } + /** * Querying whether to allow embedded startup of atomic service. * diff --git a/api/@ohos.app.ability.appManager.d.ts b/api/@ohos.app.ability.appManager.d.ts index b56c5932d8..e72ca06747 100644 --- a/api/@ohos.app.ability.appManager.d.ts +++ b/api/@ohos.app.ability.appManager.d.ts @@ -386,11 +386,27 @@ declare namespace appManager { * 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ function on(type: 'applicationState', observer: ApplicationStateObserver): int; + /** + * Register application state observer. + * + * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { 'applicationState' } type - applicationState. + * @param { ApplicationStateObserver } observer - The application state observer. + * @returns { int } Returns the number code of the observer. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.2 + */ + function onApplicationStateWithObserver(type: 'applicationState', observer: ApplicationStateObserver): int; + /** * Register application state observer. * @@ -404,11 +420,28 @@ declare namespace appManager { * 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ function on(type: 'applicationState', observer: ApplicationStateObserver, bundleNameList: Array): int; + /** + * Register application state observer. + * + * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { 'applicationState' } type - applicationState. + * @param { ApplicationStateObserver } observer - The application state observer. + * @param { Array } bundleNameList - The list of bundleName. The max length is 128. + * @returns { int } Returns the number code of the observer. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.2 + */ + function onApplicationStateWithObserverBundleNameList(type: 'applicationState', observer: ApplicationStateObserver, bundleNameList: Array): int; + /** * Register app foreground or background state observer. * @@ -422,11 +455,28 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function on(type: 'appForegroundState', observer: AppForegroundStateObserver): void; + /** + * Register app foreground or background state observer. + * + * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { 'appForegroundState' } type - app foreground or background state. + * @param { AppForegroundStateObserver } observer - The app foreground state observer. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function onAppForegroundState(type: 'appForegroundState', observer: AppForegroundStateObserver): void; + /** * Register ability first frame state observe. * @@ -441,11 +491,29 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function on(type: 'abilityFirstFrameState', observer: AbilityFirstFrameStateObserver, bundleName?: string): void; + /** + * Register ability first frame state observe. + * + * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { 'abilityFirstFrameState' } type - The ability first frame drawing state. + * @param { AbilityFirstFrameStateObserver } observer - The ability first frame state observer. + * @param { string } [bundleName] - The target bundle name. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function onAbilityFirstFrameState(type: 'abilityFirstFrameState', observer: AbilityFirstFrameStateObserver, bundleName?: string): void; + /** * Unregister application state observer. * @@ -458,11 +526,27 @@ declare namespace appManager { * 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since arkts {'1.1':'15', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 15 */ function off(type: 'applicationState', observerId: int, callback: AsyncCallback): void; + /** + * Unregister application state observer. + * + * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { 'applicationState' } type - applicationState. + * @param { int } observerId - Indicates the number code of the observer. + * @param { AsyncCallback } callback - The callback of off. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.2 + */ + function offApplicationState(type: 'applicationState', observerId: int, callback: AsyncCallback): void; + /** * Unregister application state observer. * @@ -475,11 +559,27 @@ declare namespace appManager { * 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ function off(type: 'applicationState', observerId: int): Promise; + /** + * Unregister application state observer. + * + * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { 'applicationState' } type - applicationState. + * @param { int } observerId - Indicates the number code of the observer. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.2 + */ + function offApplicationStateReturnsPromise(type: 'applicationState', observerId: int): Promise; + /** * Unregister app foreground or background state observer. * @@ -493,11 +593,28 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function off(type: 'appForegroundState', observer?: AppForegroundStateObserver): void; + /** + * Unregister app foreground or background state observer. + * + * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { 'appForegroundState' } type - app foreground or background state. + * @param { AppForegroundStateObserver } [observer] - The app foreground state observer. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function offAppForegroundState(type: 'appForegroundState', observer?: AppForegroundStateObserver): void; + /** * Unregister ability first frame state observer. * @@ -511,11 +628,48 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function off(type: 'abilityFirstFrameState', observer?: AbilityFirstFrameStateObserver): void; + /** + * Unregister ability first frame state observer. + * + * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { 'abilityFirstFrameState' } type - The ability first frame drawing state. + * @param { AbilityFirstFrameStateObserver } [observer] - The ability first frame state observer. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function offAbilityFirstFrameState(type: 'abilityFirstFrameState', observer?: AbilityFirstFrameStateObserver): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload on { + onAbilityFirstFrameState, + onAppForegroundState, + onApplicationStateWithObserver, + onApplicationStateWithObserverBundleNameList } + + /** + * @since 20 + * @arkts 1.2 + */ + overload off { + offAbilityFirstFrameState, + offAppForegroundState, + offApplicationState, + offApplicationStateReturnsPromise } + /** * getForegroundApplications. * @@ -528,11 +682,27 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function getForegroundApplications(callback: AsyncCallback>): void; + /** + * getForegroundApplications. + * + * @permission ohos.permission.GET_RUNNING_INFO + * @param { AsyncCallback> } callback - The callback is used to return the list of AppStateData. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getForegroundApplicationsWithCallback(callback: AsyncCallback>): void; + /** * getForegroundApplications. * @@ -543,11 +713,34 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function getForegroundApplications(): Promise>; + /** + * getForegroundApplications. + * + * @permission ohos.permission.GET_RUNNING_INFO + * @returns { Promise> } Returns the list of AppStateData. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getForegroundApplicationsReturnsPromise(): Promise>; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getForegroundApplications { + getForegroundApplicationsWithCallback, + getForegroundApplicationsReturnsPromise + } + /** * Kill process with account. * @@ -579,11 +772,30 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ function killProcessWithAccount(bundleName: string, accountId: int): Promise; + /** + * Kill process with account. + * + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.KILL_APP_PROCESSES + * or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES + * @param { string } bundleName - The process bundle name. + * @param { int } accountId - The account id. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function killProcessWithAccountWithBundleNameAccountIdReturnsPromise(bundleName: string, accountId: int): Promise; + /** * Kill process with account. * @@ -600,12 +812,33 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ function killProcessWithAccount(bundleName: string, accountId: int, clearPageStack: boolean, appIndex?: int): Promise; + /** + * Kill process with account. + * + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.KILL_APP_PROCESSES + * or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES + * @param { string } bundleName - The process bundle name. + * @param { int } accountId - The account id. + * @param { boolean } clearPageStack - The flag that indicates whether the page stack need to be cleared. + * @param { int } [appIndex] - The application index. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function killProcessWithAccountWithBundleNameAccountIdClearPageStackAppIndexReturnsPromise + (bundleName: string, accountId: int, clearPageStack: boolean, appIndex?: int): Promise; + /** * Kill process with account. * @@ -637,11 +870,41 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ function killProcessWithAccount(bundleName: string, accountId: int, callback: AsyncCallback): void; + /** + * Kill process with account. + * + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.KILL_APP_PROCESSES + * or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES + * @param { string } bundleName - The process bundle name. + * @param { int } accountId - The account id. + * @param { AsyncCallback } callback - The callback of killProcessWithAccount. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function killProcessWithAccountWithBundleNameAccountIdCallback(bundleName: string, accountId: int, callback: AsyncCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload killProcessWithAccount { + killProcessWithAccountWithBundleNameAccountIdCallback, + killProcessWithAccountWithBundleNameAccountIdReturnsPromise, + killProcessWithAccountWithBundleNameAccountIdClearPageStackAppIndexReturnsPromise + } + + /** * Is user running in stability test. * @@ -661,11 +924,24 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function isRunningInStabilityTest(callback: AsyncCallback): void; + /** + * Is user running in stability test. + * + * @param { AsyncCallback } callback - The callback is used to return true if user is running stability test. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function isRunningInStabilityTestWithCallback(callback: AsyncCallback): void; + /** * Is user running in stability test. * @@ -681,11 +957,31 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function isRunningInStabilityTest(): Promise; + /** + * Is user running in stability test. + * + * @returns { Promise } Returns true if user is running stability test. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function isRunningInStabilityTestReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload isRunningInStabilityTest { + isRunningInStabilityTestWithCallback, + isRunningInStabilityTestReturnsPromise + } + /** * Kill processes by bundle name * @@ -714,11 +1010,28 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ function killProcessesByBundleName(bundleName: string): Promise; + /** + * Kill processes by bundle name + * + * @permission ohos.permission.KILL_APP_PROCESSES or ohos.permission.CLEAN_BACKGROUND_PROCESSES + * @param { string } bundleName - bundle name. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function killProcessesByBundleNameWithBundleNameReturnsPromise(bundleName: string): Promise; + /** * Kill processes by bundle name * @@ -731,11 +1044,28 @@ declare namespace appManager { * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ function killProcessesByBundleName(bundleName: string, clearPageStack: boolean, appIndex?: int): Promise; + /** + * Kill processes by bundle name + * + * @permission ohos.permission.KILL_APP_PROCESSES or ohos.permission.CLEAN_BACKGROUND_PROCESSES + * @param { string } bundleName - bundle name. + * @param { boolean } clearPageStack - The flag that indicates whether the page stack need to be cleared. + * @param { int } [appIndex] - The index of clone app. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 20 + * @arkts 1.2 + */ + function killProcessesByBundleNameWithBundleNameClearPageStackAppIndexReturnsPromise( + bundleName: string, clearPageStack: boolean, appIndex?: int): Promise; + /** * Kill processes by bundle name * @@ -768,6 +1098,22 @@ declare namespace appManager { */ function killProcessesByBundleName(bundleName: string, callback: AsyncCallback); + /** + * @since 20 + * @arkts 1.2 + */ + function killProcessesByBundleNameWithBundleNameCallback(bundleName: string, callback: AsyncCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload killProcessesByBundleName { + killProcessesByBundleNameWithBundleNameCallback, + killProcessesByBundleNameWithBundleNameReturnsPromise, + killProcessesByBundleNameWithBundleNameClearPageStackAppIndexReturnsPromise + } + /** * Clear up application data by bundle name * @@ -817,11 +1163,22 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function isRamConstrainedDevice(): Promise; + /** + * Is it a ram-constrained device + * + * @returns { Promise } Returns true if the device is ram-constrained. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function isRamConstrainedDeviceReturnsPromise(): Promise; + /** * Is it a ram-constrained device * @@ -841,11 +1198,33 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function isRamConstrainedDevice(callback: AsyncCallback): void; + /** + * Is it a ram-constrained device + * + * @param { AsyncCallback } callback - The callback is used to return true if the device is ram-constrained. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function isRamConstrainedDeviceWithCallback(callback: AsyncCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload isRamConstrainedDevice { + isRamConstrainedDeviceWithCallback, + isRamConstrainedDeviceReturnsPromise + } + /** * Get the memory size of the application * @@ -861,11 +1240,22 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function getAppMemorySize(): Promise; + /** + * Get the memory size of the application + * + * @returns { Promise } Returns the application memory size. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function getAppMemorySizeReturnsPromise(): Promise; + /** * Get the memory size of the application * @@ -885,11 +1275,33 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function getAppMemorySize(callback: AsyncCallback): void; + /** + * Get the memory size of the application + * + * @param { AsyncCallback } callback - The callback is used to return the application memory size. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function getAppMemorySizeWithCallback(callback: AsyncCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getAppMemorySize { + getAppMemorySizeWithCallback, + getAppMemorySizeReturnsPromise + } + /** * If you apply for permission, you can obtain information about all running processes. * If you do not apply, you can only obtain information about the current process. @@ -907,11 +1319,22 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function getRunningProcessInformation(): Promise>; + /** + * Get information about the current process. + * + * @returns { Promise> } Returns the array of {@link ProcessInformation}. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function getRunningProcessInformationReturnsPromise(): Promise>; + /** * Get running process information by bundle type. * @@ -952,11 +1375,33 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function getRunningProcessInformation(callback: AsyncCallback>): void; + /** + * Get information about the current process. + * + * @param { AsyncCallback> } callback - The callback is used to return the array of {@link ProcessInformation}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function getRunningProcessInformationWithCallback(callback: AsyncCallback>): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getRunningProcessInformation { + getRunningProcessInformationWithCallback, + getRunningProcessInformationReturnsPromise + } + /** * Check whether the shared bundle is running. * @@ -971,11 +1416,29 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function isSharedBundleRunning(bundleName: string, versionCode: long): Promise; + /** + * Check whether the shared bundle is running. + * + * @permission ohos.permission.GET_RUNNING_INFO + * @param { string } bundleName - Indicates the bundle name of the shared bundle. + * @param { long } versionCode - Indicates the version code of the shared bundle. + * @returns { Promise } Returns the shared bundle running result. The result is true if running, false otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function isSharedBundleRunningWithBundleNameVersionCodeReturnsPromise(bundleName: string, versionCode: long): Promise; + /** * Check whether the shared bundle is running. * @@ -991,11 +1454,39 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function isSharedBundleRunning(bundleName: string, versionCode: long, callback: AsyncCallback): void; + /** + * Check whether the shared bundle is running. + * + * @permission ohos.permission.GET_RUNNING_INFO + * @param { string } bundleName - Indicates the bundle name of the shared bundle. + * @param { long } versionCode - Indicates the version code of the shared bundle. + * @param { AsyncCallback } callback - The callback of checking the shared bundle running result. + * The result is true if running, false otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function isSharedBundleRunningWithBundleNameVersionCodeCallback(bundleName: string, versionCode: long, callback: AsyncCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload isSharedBundleRunning { + isSharedBundleRunningWithBundleNameVersionCodeCallback, + isSharedBundleRunningWithBundleNameVersionCodeReturnsPromise + } + /** * Obtains memory usage of one process by its pid. * @@ -1007,11 +1498,26 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function getProcessMemoryByPid(pid: int): Promise; + /** + * Obtains memory usage of one process by its pid. + * + * @param { int } pid - Indicates the pid of the process. + * @returns { Promise } Returns the memory usage of the process in KB. + * @throws { BusinessError } 202 - Permission denied, non-system app called system api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getProcessMemoryByPidWithPidReturnsPromise(pid: int): Promise; + /** * Obtains memory usage of one process by its pid. * @@ -1023,11 +1529,35 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function getProcessMemoryByPid(pid: int, callback: AsyncCallback): void; + /** + * Obtains memory usage of one process by its pid. + * + * @param { int } pid - Indicates the pid of the process. + * @param { AsyncCallback } callback - Indicates the callback of getting process memory by pid result. + * @throws { BusinessError } 202 - Permission denied, non-system app called system api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getProcessMemoryByPidWithPidCallback(pid: int, callback: AsyncCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getProcessMemoryByPid { + getProcessMemoryByPidWithPidCallback, + getProcessMemoryByPidWithPidReturnsPromise + } + /** * Obtains the process information list of running processes that belong to a specific bundle of current user. * @@ -1039,11 +1569,26 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function getRunningProcessInfoByBundleName(bundleName: string, callback: AsyncCallback>): void; + /** + * Obtains the process information list of running processes that belong to a specific bundle of current user. + * + * @param { string } bundleName - Indicates the bundle name of the application to which the processes belong to. + * @param { AsyncCallback> } callback - Indicates the callback of getting process information by bundleName result. + * @throws { BusinessError } 202 - Permission denied, non-system app called system api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getRunningProcessInfoByBundleNameWithBundleNameCallback(bundleName: string, callback: AsyncCallback>): void; + /** * Obtains the process information list of running processes that belong to a specific bundle and specific user ID. * @@ -1056,11 +1601,28 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function getRunningProcessInfoByBundleName(bundleName: string, userId: int, callback: AsyncCallback>): void; + /** + * Obtains the process information list of running processes that belong to a specific bundle and specific user ID. + * + * @param { string } bundleName - Indicates the bundle name of the application to which the processes belong to. + * @param { int } userId - Indicates the user ID of the application to which the processes belong to. + * @param { AsyncCallback> } callback - Indicates the callback of getting process information by bundleName result. + * @throws { BusinessError } 202 - Permission denied, non-system app called system api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getRunningProcessInfoByBundleNameWithBundleNameUserIdCallback( + bundleName: string, userId: int, callback: AsyncCallback>): void; + /** * Obtains the process information list of running processes that belong to a specific bundle of current user. * @@ -1072,11 +1634,27 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function getRunningProcessInfoByBundleName(bundleName: string): Promise>; + /** + * Obtains the process information list of running processes that belong to a specific bundle of current user. + * + * @param { string } bundleName - Indicates the bundle name of the application to which the processes belong to. + * @returns { Promise> } Returns a list of process information. + * @throws { BusinessError } 202 - Permission denied, non-system app called system api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getRunningProcessInfoByBundleNameWithBundleNameReturnsPromise( + bundleName: string): Promise>; + /** * Obtains the process information list of running processes that belong to a specific bundle and specific user ID. * @@ -1089,11 +1667,39 @@ declare namespace appManager { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function getRunningProcessInfoByBundleName(bundleName: string, userId: int): Promise>; + /** + * Obtains the process information list of running processes that belong to a specific bundle and specific user ID. + * + * @param { string } bundleName - Indicates the bundle name of the application to which the processes belong to. + * @param { int } userId - Indicates the user ID of the application to which the processes belong to. + * @returns { Promise> } Returns a list of process information. + * @throws { BusinessError } 202 - Permission denied, non-system app called system api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getRunningProcessInfoByBundleNameWithBundleNameUserIdReturnsPromise( + bundleName: string, userId: int): Promise>; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getRunningProcessInfoByBundleName { + getRunningProcessInfoByBundleNameWithBundleNameCallback, + getRunningProcessInfoByBundleNameWithBundleNameReturnsPromise, + getRunningProcessInfoByBundleNameWithBundleNameUserIdCallback, + getRunningProcessInfoByBundleNameWithBundleNameUserIdReturnsPromise + } + /** * Check whether the bundle is running. * diff --git a/api/@ohos.app.ability.application.d.ts b/api/@ohos.app.ability.application.d.ts index 71a7199e91..b4a9677d7b 100644 --- a/api/@ohos.app.ability.application.d.ts +++ b/api/@ohos.app.ability.application.d.ts @@ -42,11 +42,25 @@ declare namespace application { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export function createModuleContext(context: Context, moduleName: string): Promise; + /** + * Create a module context + * + * @param { Context } context - Indicates current context. + * @param { string } moduleName - Indicates the module name. + * @returns { Promise } Returns the application context. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + export function createModuleContextWithContextModuleNameReturnsPromise(context: Context, moduleName: string): Promise; + /** * Create a module context * @@ -61,11 +75,39 @@ declare namespace application { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ export function createModuleContext(context: Context, bundleName: string, moduleName: string): Promise; + /** + * Create a module context + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { Context } context - Indicates current context. + * @param { string } bundleName - Indicates the bundle name. + * @param { string } moduleName - Indicates the module name. + * @returns { Promise } Returns the application context. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Permission denied, non-system app called system api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + export function createModuleContextWithContextBundleNameModuleNameReturnsPromise( + context: Context, bundleName: string, moduleName: string): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload createModuleContext { + createModuleContextWithContextModuleNameReturnsPromise, + createModuleContextWithContextBundleNameModuleNameReturnsPromise + } + /** * Create a module context of plugin. * diff --git a/api/@ohos.app.ability.insightIntentDriver.d.ts b/api/@ohos.app.ability.insightIntentDriver.d.ts index 7aac48bfcb..59abd3ad86 100644 --- a/api/@ohos.app.ability.insightIntentDriver.d.ts +++ b/api/@ohos.app.ability.insightIntentDriver.d.ts @@ -188,11 +188,45 @@ declare namespace insightIntentDriver { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @StageModelOnly - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function execute(param: ExecuteParam, callback: AsyncCallback): void; + /** + * Execute insight intent. + * If the caller application is in foreground, you can use this method to execute insight intent; + * If the caller application is in background, you need to apply for permission: ohos.permission.START_ABILITIES_FROM_BACKGROUND; + * If the execute mode is UI_ABILITY_BACKGROUND, you need to apply for permission: ohos.permission.ABILITY_BACKGROUND_COMMUNICATION. + * + * @permission ohos.permission.EXECUTE_INSIGHT_INTENT + * @param { ExecuteParam } param - Execute parameter. + * @param { AsyncCallback } callback - The callback of executeIntent. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @StageModelOnly + * @since 20 + * @arkts 1.2 + */ + function executeWithParamCallback(param: ExecuteParam, callback: AsyncCallback): void; + /** * Execute insight intent. * If the caller application is in foreground, you can use this method to execute insight intent; @@ -223,11 +257,54 @@ declare namespace insightIntentDriver { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @StageModelOnly - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ function execute(param: ExecuteParam): Promise; + /** + * Execute insight intent. + * If the caller application is in foreground, you can use this method to execute insight intent; + * If the caller application is in background, you need to apply for permission: ohos.permission.START_ABILITIES_FROM_BACKGROUND; + * If the execute mode is UI_ABILITY_BACKGROUND, you need to apply for permission: ohos.permission.ABILITY_BACKGROUND_COMMUNICATION. + * + * @permission ohos.permission.EXECUTE_INSIGHT_INTENT + * @param { ExecuteParam } param - Execute parameter. + * @returns { Promise } Returns the execute result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @StageModelOnly + * @since 20 + * @arkts 1.2 + */ + function executeWithParamReturnsPromise(param: ExecuteParam): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload execute { + executeWithParamCallback, + executeWithParamReturnsPromise + } + /** * Enum for intent type. * diff --git a/api/@ohos.app.ability.missionManager.d.ts b/api/@ohos.app.ability.missionManager.d.ts index 36a47ddd11..43fdf02cad 100644 --- a/api/@ohos.app.ability.missionManager.d.ts +++ b/api/@ohos.app.ability.missionManager.d.ts @@ -102,11 +102,28 @@ declare namespace missionManager { * 2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function getMissionInfo(deviceId: string, missionId: int, callback: AsyncCallback): void; + /** + * Get the missionInfo with the given missionId. + * + * @permission ohos.permission.MANAGE_MISSIONS + * @param { string } deviceId - Indicates the device to be queried. + * @param { int } missionId - Indicates mission id to be queried. + * @param { AsyncCallback } callback - The callback is used to return the MissionInfo of the given id. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getMissionInfoWithDeviceIdMissionIdCallback(deviceId: string, missionId: int, callback: AsyncCallback): void; + /** * Get the missionInfo with the given missionId. * @@ -120,11 +137,37 @@ declare namespace missionManager { * 2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function getMissionInfo(deviceId: string, missionId: int): Promise; + /** + * Get the missionInfo with the given missionId. + * + * @permission ohos.permission.MANAGE_MISSIONS + * @param { string } deviceId - Indicates the device to be queried. + * @param { int } missionId - Indicates mission id to be queried. + * @returns { Promise } Returns the MissionInfo of the given id. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getMissionInfoWithDeviceIdMissionIdReturnsPromise(deviceId: string, missionId: int): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getMissionInfo { + getMissionInfoWithDeviceIdMissionIdCallback, + getMissionInfoWithDeviceIdMissionIdReturnsPromise + } + /** * Get missionInfos in the given deviceId with maximum number of numMax. * @@ -344,11 +387,26 @@ declare namespace missionManager { * 2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function clearAllMissions(callback: AsyncCallback): void; + /** + * Clear all missions in the ability manager service. + * + * @permission ohos.permission.MANAGE_MISSIONS + * @param { AsyncCallback } callback - The callback of clearAllMissions. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function clearAllMissionsWithCallback(callback: AsyncCallback): void; + /** * Clear all missions in the ability manager service. * @@ -358,11 +416,33 @@ declare namespace missionManager { * @throws { BusinessError } 202 - Not system application. * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function clearAllMissions(): Promise; + /** + *Clear all missions in the ability manager service. + * + * @permission ohos.permission.MANAGE_MISSIONS + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function clearAllMissionsReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload clearAllMissions { + clearAllMissionsWithCallback, + clearAllMissionsReturnsPromise + } + /** * Schedule the given mission to foreground. * diff --git a/api/@ohos.app.ability.wantAgent.d.ts b/api/@ohos.app.ability.wantAgent.d.ts index c06e02e9fb..044dd2430d 100644 --- a/api/@ohos.app.ability.wantAgent.d.ts +++ b/api/@ohos.app.ability.wantAgent.d.ts @@ -76,11 +76,27 @@ declare namespace wantAgent { * @throws { BusinessError } 16000151 - Invalid wantAgent object. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function getBundleName(agent: WantAgent, callback: AsyncCallback): void; + /** + * Obtains the bundle name of a WantAgent object. + * This API uses an asynchronous callback to return the result. + * + * @param { WantAgent } agent - Target WantAgent object. + * @param { AsyncCallback } callback - Callback used to return the bundle name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later. + * @throws { BusinessError } 16000151 - Invalid wantAgent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function getBundleNameWithAgentCallback(agent: WantAgent, callback: AsyncCallback): void; + /** * Obtains the bundle name of a WantAgent. * @@ -105,11 +121,36 @@ declare namespace wantAgent { * @throws { BusinessError } 16000151 - Invalid wantAgent object. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function getBundleName(agent: WantAgent): Promise; + /** + * Obtains the bundle name of a WantAgent object. + * This API uses a promise to return the result. + * + * @param { WantAgent } agent - Target WantAgent object. + * @returns { Promise } Promise used to return the bundle name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later. + * @throws { BusinessError } 16000151 - Invalid wantAgent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function getBundleNameWithAgentReturnsPromise(agent: WantAgent): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getBundleName { + getBundleNameWithAgentCallback, + getBundleNameWithAgentReturnsPromise + } + /** * Obtains the UID of a WantAgent. * @@ -134,11 +175,27 @@ declare namespace wantAgent { * @throws { BusinessError } 16000151 - Invalid wantAgent object. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function getUid(agent: WantAgent, callback: AsyncCallback): void; + /** + * Obtains the user ID of a WantAgent object. + * This API uses an asynchronous callback to return the result. + * + * @param { WantAgent } agent - Target WantAgent object. + * @param { AsyncCallback } callback - Callback used to return the user ID. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later. + * @throws { BusinessError } 16000151 - Invalid wantAgent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function getUidWithAgentCallback(agent: WantAgent, callback: AsyncCallback): void; + /** * Obtains the UID of a WantAgent. * @@ -163,11 +220,33 @@ declare namespace wantAgent { * @throws { BusinessError } 16000151 - Invalid wantAgent object. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function getUid(agent: WantAgent): Promise; + /** + * Obtains the user ID of a WantAgent object. + * This API uses a promise to return the result. + * + * @param { WantAgent } agent - Target WantAgent object. + * @returns { Promise } Promise used to return the user ID. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later. + * @throws { BusinessError } 16000151 - Invalid wantAgent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function getUidWithAgentReturnsPromise(agent: WantAgent): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getUid { getUidWithAgentCallback, getUidWithAgentReturnsPromise } + /** * Obtains the Want in a WantAgent object. * This API uses an asynchronous callback to return the result. @@ -181,11 +260,28 @@ declare namespace wantAgent { * @throws { BusinessError } 16000151 - Invalid wantAgent object. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function getWant(agent: WantAgent, callback: AsyncCallback): void; + /** + * Obtains the Want in a WantAgent object. + * This API uses an asynchronous callback to return the result. + * + * @param { WantAgent } agent - Target WantAgent object. + * @param { AsyncCallback } callback - Callback used to return the Want. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later. + * @throws { BusinessError } 16000015 - Service timeout. + * @throws { BusinessError } 16000151 - Invalid wantAgent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getWantWithAgentCallback(agent: WantAgent, callback: AsyncCallback): void; + /** * Obtains the Want in a WantAgent object. * This API uses a promise to return the result. @@ -199,11 +295,37 @@ declare namespace wantAgent { * @throws { BusinessError } 16000151 - Invalid wantAgent object. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ function getWant(agent: WantAgent): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + function getWantWithAgentReturnsPromise(agent: WantAgent): Promise; + + /** + * Obtains the Want in a WantAgent object. + * This API uses a promise to return the result. + * + * @param { WantAgent } agent - Target WantAgent object. + * @returns { Promise } Promise used to return the Want. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later. + * @throws { BusinessError } 16000015 - Service timeout. + * @throws { BusinessError } 16000151 - Invalid wantAgent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 20 + * @arkts 1.2 + */ + overload getWant { + getWantWithAgentCallback, + getWantWithAgentReturnsPromise + } + /** * Cancel a WantAgent. Only the application that creates the WantAgent can cancel it. * @@ -228,11 +350,27 @@ declare namespace wantAgent { * @throws { BusinessError } 16000151 - Invalid wantAgent object. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function cancel(agent: WantAgent, callback: AsyncCallback): void; + /** + * Cancels a WantAgent object. + * This API uses an asynchronous callback to return the result. + * + * @param { WantAgent } agent - Target WantAgent object. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later. + * @throws { BusinessError } 16000151 - Invalid wantAgent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function cancelWithAgentCallback(agent: WantAgent, callback: AsyncCallback): void; + /** * Cancel a WantAgent. Only the application that creates the WantAgent can cancel it. * @@ -257,11 +395,36 @@ declare namespace wantAgent { * @throws { BusinessError } 16000151 - Invalid wantAgent object. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function cancel(agent: WantAgent): Promise; + /** + * Cancels a WantAgent object. + * This API uses an asynchronous callback to return the result. + * + * @param { WantAgent } agent - Target WantAgent object. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later. + * @throws { BusinessError } 16000151 - Invalid wantAgent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function cancelWithAgentReturnsPromise(agent: WantAgent): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload cancel { + cancelWithAgentCallback, + cancelWithAgentReturnsPromise + } + /** * Triggers a WantAgent. * @@ -335,11 +498,28 @@ declare namespace wantAgent { * 2. Incorrect parameter types. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback): void; + /** + * Checks whether two WantAgent objects are equal, so as to determine whether the same operation is from the + * same application. + * This API uses an asynchronous callback to return the result. + * + * @param { WantAgent } agent - The first WantAgent object. + * @param { WantAgent } otherAgent - The second WantAgent object. + * @param { AsyncCallback } callback - Callback used to return the result. The value true means + * that the two WantAgent objects are equal, and false means the opposite. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function equalWithAgentOtherAgentCallback(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback): void; + /** * Checks whether two WantAgent objects are equal. * @@ -364,11 +544,37 @@ declare namespace wantAgent { * 2. Incorrect parameter types. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function equal(agent: WantAgent, otherAgent: WantAgent): Promise; + /** + * Checks whether two WantAgent objects are equal, so as to determine whether the same operation is from the + * same application. + * This API uses a promise to return the result. + * + * @param { WantAgent } agent - The first WantAgent object. + * @param { WantAgent } otherAgent - The second WantAgent object. + * @returns { Promise } Promise used to return the result. The value true means that the two + * WantAgent objects are equal, and false means the opposite. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function equalWithAgentOtherAgentReturnsPromise(agent: WantAgent, otherAgent: WantAgent): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload equal { + equalWithAgentOtherAgentCallback, + equalWithAgentOtherAgentReturnsPromise + } + /** * Obtains a WantAgent object. * @@ -398,11 +604,32 @@ declare namespace wantAgent { * @throws { BusinessError } 16000151 - Invalid wantAgent object. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void; + /** + * Obtains a WantAgent object. + * This API uses an asynchronous callback to return the result. + * If the creation fails, a null WantAgent object is returned. + * + *

**NOTE**: + *
Third-party applications can set only their own abilities. + *

+ * + * @param { WantAgentInfo } info - Information about the WantAgent object to obtain. + * @param { AsyncCallback } callback - Callback used to return the WantAgent object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later. + * @throws { BusinessError } 16000151 - Invalid wantAgent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function getWantAgentWithInfoCallback(info: WantAgentInfo, callback: AsyncCallback): void; + /** * Obtains a WantAgent object. * @@ -432,11 +659,41 @@ declare namespace wantAgent { * @throws { BusinessError } 16000151 - Invalid wantAgent object. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function getWantAgent(info: WantAgentInfo): Promise; + /** + * Obtains a WantAgent object. + * This API uses a promise to return the result. + * If the creation fails, a null WantAgent object is returned. + * + *

**NOTE**: + *
Third-party applications can set only their own abilities. + *

+ * + * @param { WantAgentInfo } info - Information about the WantAgent object to obtain. + * @returns { Promise } Promise used to return the WantAgent object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later. + * @throws { BusinessError } 16000151 - Invalid wantAgent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function getWantAgentWithInfoReturnsPromise(info: WantAgentInfo): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getWantAgent { + getWantAgentWithInfoCallback, + getWantAgentWithInfoReturnsPromise + } + /** * Obtains the {@link OperationType} of a WantAgent. * @@ -463,11 +720,28 @@ declare namespace wantAgent { * @throws { BusinessError } 16000151 - Invalid wantAgent object. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function getOperationType(agent: WantAgent, callback: AsyncCallback): void; + /** + * Obtains the operation type of a WantAgent object. + * This API uses an asynchronous callback to return the result. + * + * @param { WantAgent } agent - Target WantAgent object. + * @param { AsyncCallback } callback - Callback used to return the operation type. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later. + * @throws { BusinessError } 16000015 - Service timeout. + * @throws { BusinessError } 16000151 - Invalid wantAgent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function getOperationTypeWithAgentCallback(agent: WantAgent, callback: AsyncCallback): void; + /** * Obtains the {@link OperationType} of a WantAgent. * @@ -494,11 +768,37 @@ declare namespace wantAgent { * @throws { BusinessError } 16000151 - Invalid wantAgent object. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function getOperationType(agent: WantAgent): Promise; + /** + * Obtains the operation type of a WantAgent object. + * This API uses a promise to return the result. + * + * @param { WantAgent } agent - Indicates the WantAgent. + * @returns { Promise } Returns the OperationType of the WantAgent. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later. + * @throws { BusinessError } 16000015 - Service timeout. + * @throws { BusinessError } 16000151 - Invalid wantAgent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function getOperationTypeWithAgentReturnsPromise(agent: WantAgent): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getOperationType { + getOperationTypeWithAgentCallback, + getOperationTypeWithAgentReturnsPromise + } + /** * Enables or disables the WantAgent multithreading feature. * diff --git a/api/@ohos.application.uriPermissionManager.d.ts b/api/@ohos.application.uriPermissionManager.d.ts index a69039892a..5a04d0abe6 100644 --- a/api/@ohos.application.uriPermissionManager.d.ts +++ b/api/@ohos.application.uriPermissionManager.d.ts @@ -75,8 +75,7 @@ declare namespace uriPermissionManager { * @throws { BusinessError } 16000060 - A sandbox application cannot grant URI permission. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide this for inner system use. - * @since arkts {'1.1':'19', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 19 */ function grantUriPermission( uri: string, @@ -85,6 +84,38 @@ declare namespace uriPermissionManager { callback: AsyncCallback ): void; + /** + * 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 { AsyncCallback } callback - the callback of grantUriPermission. + * @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 } 801 - Capability not supported. + * @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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + function grantUriPermissionWithUriFlagTargetBundleNameCallback( + uri: string, + flag: wantConstant.Flags, + targetBundleName: string, + callback: AsyncCallback + ): void; + /** * Grant URI to another application * @@ -130,11 +161,38 @@ declare namespace uriPermissionManager { * @throws { BusinessError } 16000060 - A sandbox application cannot grant URI permission. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide this for inner system use. - * @since arkts {'1.1':'19', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 19 */ 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. + * @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 } 801 - Capability not supported. + * @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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + function grantUriPermissionWithUriFlagTargetBundleNameReturnsPromise( + uri: string, flag: wantConstant.Flags, targetBundleName: string): Promise; + /** * Grant URI to another application * @@ -184,11 +242,50 @@ declare namespace uriPermissionManager { * @throws { BusinessError } 16000081 - Failed to obtain the target application information. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide this for inner system use. - * @since arkts {'1.1':'19', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 19 */ function grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: string, appCloneIndex: int): 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 { int } 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 } 801 - Capability not supported. + * @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 - Failed to obtain the target application information. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + function grantUriPermissionWithUriFlagTargetBundleNameAppCloneIndexReturnsPromise( + uri: string, flag: wantConstant.Flags, targetBundleName: string, appCloneIndex: int): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload grantUriPermission { + grantUriPermissionWithUriFlagTargetBundleNameReturnsPromise, + grantUriPermissionWithUriFlagTargetBundleNameAppCloneIndexReturnsPromise, + grantUriPermissionWithUriFlagTargetBundleNameCallback + } + /** * Revoke URI from one application * @@ -238,11 +335,31 @@ declare namespace uriPermissionManager { * @throws { BusinessError } 16000059 - Invalid URI type. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide this for inner system use - * @since arkts {'1.1':'19', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 19 */ function revokeUriPermission(uri: string, targetBundleName: string, callback: AsyncCallback): void; + /** + * Revoke URI from one application + * + * @param { string } uri - File URI. + * @param { string } targetBundleName - Indicates the bundle name of authorization target. + * @param { AsyncCallback } callback - the callback of revokeUriPermission. + * @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 } 801 - Capability not supported. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000059 - Invalid URI type. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use + * @since 20 + * @arkts 1.2 + */ + function revokeUriPermissionWithUriTargetBundleNameCallback( + uri: string, targetBundleName: string, callback: AsyncCallback): void; + /** * Revoke URI from one application * @@ -292,11 +409,31 @@ declare namespace uriPermissionManager { * @throws { BusinessError } 16000059 - Invalid URI type. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide this for inner system use - * @since arkts {'1.1':'19', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 19 */ 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. + * @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 } 801 - Capability not supported. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000059 - Invalid URI type. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use + * @since 20 + * @arkts 1.2 + */ + function revokeUriPermissionWithUriTargetBundleNameReturnsPromise( + uri: string, targetBundleName: string): Promise; + /** * Revoke URI from one application * @@ -332,10 +469,42 @@ declare namespace uriPermissionManager { * @throws { BusinessError } 16000081 - Failed to obtain the target application information. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide this for inner system use - * @since arkts {'1.1':'19', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 19 + */ + function revokeUriPermission(uri: string, targetBundleName: string, appCloneIndex: int): Promise; + + /** + * Revoke URI from one application + * + * @param { string } uri - File URI. + * @param { string } targetBundleName - Indicates the bundle name of authorization target. + * @param { int } 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 } 801 - Capability not supported. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000059 - Invalid URI type. + * @throws { BusinessError } 16000081 - Failed to obtain the target application information. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use + * @since 20 + * @arkts 1.2 + */ + function revokeUriPermissionWithUriTargetBundleNameAppCloneIndexReturnsPromise( + uri: string, targetBundleName: string, appCloneIndex: int): Promise; + + /** + * @since 20 + * @arkts 1.2 */ - function revokeUriPermission(uri: string, targetBundleName: string, appCloneIndex: int): Promise; + overload revokeUriPermission { + revokeUriPermissionWithUriTargetBundleNameReturnsPromise, + revokeUriPermissionWithUriTargetBundleNameAppCloneIndexReturnsPromise, + revokeUriPermissionWithUriTargetBundleNameCallback + } /** * Grant URIs in UDkey to another application diff --git a/api/application/AbilityDelegator.d.ts b/api/application/AbilityDelegator.d.ts index ab449c33ae..91de66a231 100644 --- a/api/application/AbilityDelegator.d.ts +++ b/api/application/AbilityDelegator.d.ts @@ -84,10 +84,24 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + + /** + * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability in this process. + * + * @param { AbilityMonitor } monitor - AbilityMonitor object + * @param { AsyncCallback } callback - The callback of addAbilityMonitor. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling AddAbilityMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + addAbilityMonitorWithMonitorCallback(monitor: AbilityMonitor, callback: AsyncCallback): void; /** * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability in this process. @@ -120,11 +134,34 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ addAbilityMonitor(monitor: AbilityMonitor): Promise; + /** + * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability in this process. + * + * @param { AbilityMonitor } monitor - AbilityMonitor object + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling AddAbilityMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + addAbilityMonitorWithMonitorReturnsPromise(monitor: AbilityMonitor): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload addAbilityMonitor { + addAbilityMonitorWithMonitorCallback, + addAbilityMonitorWithMonitorReturnsPromise + } + /** * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability in this process. * @@ -180,11 +217,25 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + /** + * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage in this process. + * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { AsyncCallback } callback - The callback of addAbilityStageMonitor. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling AddAbilityStageMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + addAbilityStageMonitorWithMonitorCallback(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + /** * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage in this process. * @@ -216,11 +267,34 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; + /** + * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage in this process. + * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling AddAbilityStageMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + addAbilityStageMonitorWithMonitorReturnsPromise(monitor: AbilityStageMonitor): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload addAbilityStageMonitor { + addAbilityStageMonitorWithMonitorCallback, + addAbilityStageMonitorWithMonitorReturnsPromise + } + /** * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage in this process. * @@ -276,11 +350,25 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + /** + * Remove a specified AbilityMonitor object from the application memory. + * + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { AsyncCallback } callback - The callback of removeAbilityMonitor. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling RemoveAbilityMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + removeAbilityMonitorWithMonitorCallback(monitor: AbilityMonitor, callback: AsyncCallback): void; + /** * Remove a specified AbilityMonitor object from the application memory. * @@ -312,11 +400,34 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ removeAbilityMonitor(monitor: AbilityMonitor): Promise; + /** + * Remove a specified AbilityMonitor object from the application memory. + * + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling RemoveAbilityMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + removeAbilityMonitorWithMonitorReturnsPromise(monitor: AbilityMonitor): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload removeAbilityMonitor { + removeAbilityMonitorWithMonitorCallback, + removeAbilityMonitorWithMonitorReturnsPromise + } + /** * Remove a specified AbilityMonitor object from the application memory. * @@ -372,11 +483,25 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + /** + * Remove a specified AbilityStageMonitor object from the application memory. + * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { AsyncCallback } callback - The callback of removeAbilityStageMonitor. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling RemoveAbilityStageMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + removeAbilityStageMonitorWithMonitorCallback(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + /** * Remove a specified AbilityStageMonitor object from the application memory. * @@ -408,11 +533,34 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; + /** + * Remove a specified AbilityStageMonitor object from the application memory. + * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling RemoveAbilityStageMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + removeAbilityStageMonitorWithMonitorReturnsPromise(monitor: AbilityStageMonitor): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload removeAbilityStageMonitor { + removeAbilityStageMonitorWithMonitorCallback, + removeAbilityStageMonitorWithMonitorReturnsPromise + } + /** * Remove a specified AbilityStageMonitor object from the application memory. * @@ -468,11 +616,25 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + /** + * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. + * + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { AsyncCallback } callback - The callback is used to return the Ability object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling WaitAbilityMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + waitAbilityMonitorWithMonitorCallback(monitor: AbilityMonitor, callback: AsyncCallback): void; + /** * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. * @@ -507,11 +669,26 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ waitAbilityMonitor(monitor: AbilityMonitor, timeout: long, callback: AsyncCallback): void; + /** + * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. + * + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { long } timeout - Maximum wait time, in milliseconds. + * @param { AsyncCallback } callback - The callback is used to return the Ability object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling WaitAbilityMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + waitAbilityMonitorWithMonitorTimeoutCallback(monitor: AbilityMonitor, timeout: long, callback: AsyncCallback): void; + /** * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. * @@ -546,11 +723,36 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ waitAbilityMonitor(monitor: AbilityMonitor, timeout?: long): Promise; + /** + * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. + * + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { long } [timeout] - Maximum wait time, in milliseconds. + * @returns { Promise } Returns the Ability object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling WaitAbilityMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + waitAbilityMonitorWithMonitorTimeoutReturnsPromise(monitor: AbilityMonitor, timeout?: long): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload waitAbilityMonitor { + waitAbilityMonitorWithMonitorCallback, + waitAbilityMonitorWithMonitorTimeoutCallback, + waitAbilityMonitorWithMonitorTimeoutReturnsPromise + } + /** * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. * @@ -582,11 +784,25 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + /** + * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. + * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { AsyncCallback } callback - The callback is used to return the AbilityStage object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling WaitAbilityStageMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + waitAbilityStageMonitorWithMonitorCallback(monitor: AbilityMonitor, callback: AsyncCallback): void; + /** * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. * @@ -621,11 +837,26 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: long, callback: AsyncCallback): void; + /** + * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. + * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { long } timeout - Maximum wait time, in milliseconds. + * @param { AsyncCallback } callback - The callback is used to return the AbilityStage object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling WaitAbilityStageMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + waitAbilityStageMonitorWithMonitorTimeoutCallback(monitor: AbilityStageMonitor, timeout: long, callback: AsyncCallback): void; + /** * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. * @@ -660,11 +891,36 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: long): Promise; + /** + * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. + * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { long } [timeout] - Maximum wait time, in milliseconds. + * @returns { Promise } Returns the AbilityStage object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling WaitAbilityStageMonitor failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + waitAbilityStageMonitorWithMonitorTimeoutReturnsPromise(monitor: AbilityStageMonitor, timeout?: long): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload waitAbilityStageMonitor { + waitAbilityStageMonitorWithMonitorCallback, + waitAbilityStageMonitorWithMonitorTimeoutCallback, + waitAbilityStageMonitorWithMonitorTimeoutReturnsPromise + } + /** * Obtain the application context. * @@ -753,11 +1009,24 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ getCurrentTopAbility(callback: AsyncCallback): void; + /** + * Obtain the ability that is currently being displayed in this process. + * + * @param { AsyncCallback } callback - The callback is used to return the Ability object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling GetCurrentTopAbility failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + getCurrentTopAbilityWithCallback(callback: AsyncCallback): void; + /** * Obtain the ability that is currently being displayed in this process. * @@ -783,11 +1052,32 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ getCurrentTopAbility(): Promise; + /** + * Obtain the ability that is currently being displayed in this process. + * + * @returns { Promise } Returns the Ability object. + * @throws { BusinessError } 16000100 - Calling GetCurrentTopAbility failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + getCurrentTopAbilityReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getCurrentTopAbility { + getCurrentTopAbilityWithCallback, + getCurrentTopAbilityReturnsPromise + } + /** * Start a new ability. * @@ -859,11 +1149,39 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ startAbility(want: Want, callback: AsyncCallback): void; + /** + * Start a new ability. + * + * @param { Want } want - Indicates the ability to start + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + startAbilityWithWantCallback(want: Want, callback: AsyncCallback): void; + /** * Start a new ability. * @@ -935,11 +1253,48 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ startAbility(want: Want): Promise; + /** + * Start a new ability. + * + * @param { Want } want - Indicates the ability to start + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + startAbilityWithWantReturnsPromise(want: Want): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload startAbility { + startAbilityWithWantCallback, + startAbilityWithWantReturnsPromise + } + /** * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. * @@ -971,11 +1326,25 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ doAbilityForeground(ability: UIAbility, callback: AsyncCallback): void; + /** + * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. + * + * @param { UIAbility } ability - The ability object. + * @param { AsyncCallback } callback - The callback of doAbilityForeground. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling DoAbilityForeground failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + doAbilityForegroundWithAbilityCallback(ability: UIAbility, callback: AsyncCallback): void; + /** * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. * @@ -1007,11 +1376,34 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ doAbilityForeground(ability: UIAbility): Promise; + /** + * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. + * + * @param { UIAbility } ability - The ability object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling DoAbilityForeground failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + doAbilityForegroundWithAbilityReturnsPromise(ability: UIAbility): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload doAbilityForeground { + doAbilityForegroundWithAbilityCallback, + doAbilityForegroundWithAbilityReturnsPromise + } + /** * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. * @@ -1043,11 +1435,25 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ doAbilityBackground(ability: UIAbility, callback: AsyncCallback): void; + /** + * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. + * + * @param { UIAbility } ability - The ability object. + * @param { AsyncCallback } callback - The callback of doAbilityBackground. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling DoAbilityBackground failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + doAbilityBackgroundWithAbilityCallback(ability: UIAbility, callback: AsyncCallback): void; + /** * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. * @@ -1079,11 +1485,34 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ doAbilityBackground(ability: UIAbility): Promise; + /** + * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. + * + * @param { UIAbility } ability - The ability object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling DoAbilityBackground failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + doAbilityBackgroundWithAbilityReturnsPromise(ability: UIAbility): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload doAbilityBackground { + doAbilityBackgroundWithAbilityCallback, + doAbilityBackgroundWithAbilityReturnsPromise + } + /** * Prints log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. @@ -1112,11 +1541,24 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ print(msg: string, callback: AsyncCallback): void; + /** + * Prints log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * + * @param { string } msg - Log information + * @param { AsyncCallback } callback - The callback of print. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + printWithMsgCallback(msg: string, callback: AsyncCallback): void; + /** * Prints log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. @@ -1145,11 +1587,33 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ print(msg: string): Promise; + /** + * Prints log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * + * @param { string } msg - Log information + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + printWithMsgReturnsPromise(msg: string): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload print { + printWithMsgCallback, + printWithMsgReturnsPromise + } + /** * Prints log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. @@ -1198,11 +1662,22 @@ export interface AbilityDelegator { * @param { AsyncCallback } callback - The callback of executeShellCommand. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ executeShellCommand(cmd: string, callback: AsyncCallback): void; + /** + * Execute the given command in the aa tools side. + * + * @param { string } cmd - Shell command + * @param { AsyncCallback } callback - The callback of executeShellCommand. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + executeShellCommandWithCmdCallback(cmd: string, callback: AsyncCallback): void; + /** * Execute the given command in the aa tools side. * @@ -1220,11 +1695,23 @@ export interface AbilityDelegator { * @param { AsyncCallback } callback - The callback of executeShellCommand. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ executeShellCommand(cmd: string, timeoutSecs: long, callback: AsyncCallback): void; + /** + * Execute the given command in the aa tools side. + * + * @param { string } cmd - Shell command + * @param { long } timeoutSecs - Timeout, in seconds + * @param { AsyncCallback } callback - The callback of executeShellCommand. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + executeShellCommandWithCmdTimeoutSecsCallback(cmd: string, timeoutSecs: long, callback: AsyncCallback): void; + /** * Execute the given command in the aa tools side. * @@ -1242,11 +1729,33 @@ export interface AbilityDelegator { * @returns { Promise } the promise returned by the function. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ executeShellCommand(cmd: string, timeoutSecs?: long): Promise; + /** + * Execute the given command in the aa tools side. + * + * @param { string } cmd - Shell command + * @param { long } [timeoutSecs] - Timeout, in seconds + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + executeShellCommandWithCmdTimeoutSecsReturnsPromise(cmd: string, timeoutSecs?: long): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload executeShellCommand { + executeShellCommandWithCmdCallback, + executeShellCommandWithCmdTimeoutSecsCallback, + executeShellCommandWithCmdTimeoutSecsReturnsPromise + } + /** * Finish the test and print log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. @@ -1284,11 +1793,27 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ finishTest(msg: string, code: long, callback: AsyncCallback): void; + /** + * Finish the test and print log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * + * @param { string } msg - Log information. + * @param { long } code - Result code. + * @param { AsyncCallback } callback - The callback of finishTest. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling FinishTest failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + finishTestWithMsgCodeCallback(msg: string, code: long, callback: AsyncCallback): void; + /** * Finish the test and print log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. @@ -1326,11 +1851,36 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ finishTest(msg: string, code: long): Promise; + /** + * Finish the test and print log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * + * @param { string } msg - Log information. + * @param { long } code - Result code. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000100 - Calling FinishTest failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + finishTestWithMsgCodeReturnsPromise(msg: string, code: long): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload finishTest { + finishTestWithMsgCodeCallback, + finishTestWithMsgCodeReturnsPromise + } + /** * Used to set a list of mock data. * @param { Record } mockList - An object with string keys and string values. The keys represent the diff --git a/api/application/ApplicationContext.d.ts b/api/application/ApplicationContext.d.ts index 4c4726d482..adfe561942 100644 --- a/api/application/ApplicationContext.d.ts +++ b/api/application/ApplicationContext.d.ts @@ -102,11 +102,32 @@ declare class ApplicationContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ on(type: 'abilityLifecycle', callback: AbilityLifecycleCallback): int; + /** + * Registers a listener to monitor the ability lifecycle of the application. + * This API uses an asynchronous callback to return the result. + * + *

**NOTE**: + *
It can be called only by the main thread. + *

+ * + * @param { 'abilityLifecycle' } type - Event type. + * @param { AbilityLifecycleCallback } callback - Callback used to return the ID of the registered listener. + * @returns { int } Returns the number code of the callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + onAbilityLifecycle(type: 'abilityLifecycle', callback: AbilityLifecycleCallback): int; + /** * Unregister ability lifecycle callback. * @@ -148,11 +169,33 @@ declare class ApplicationContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ off(type: 'abilityLifecycle', callbackId: int, callback: AsyncCallback): void; + /** + * Unregisters the listener that monitors the ability lifecycle of the application. + * This API uses an asynchronous callback to return the result. + * + *

**NOTE**: + *
It can be called only by the main thread. + *

+ * + * @param { 'abilityLifecycle' } type - Event type. + * @param { int } callbackId - ID of the listener to unregister. + * @param { AsyncCallback } callback - Callback used to return the result. If the deregistration is successful, + * err is undefined. Otherwise, err is an error object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + offAbilityLifecycleWithCallbackId(type: 'abilityLifecycle', callbackId: int, callback: AsyncCallback): void; + /** * Unregister ability lifecycle callback. * @@ -193,11 +236,32 @@ declare class ApplicationContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'abilityLifecycle', callbackId: int): Promise; + /** + * Unregisters the listener that monitors the ability lifecycle of the application. + * This API uses a promise to return the result. + * + *

**NOTE**: + *
It can be called only by the main thread. + *

+ * + * @param { 'abilityLifecycle' } type - Event type. + * @param { int } callbackId - ID of the listener to unregister. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + offAbilityLifecycleWithCallbackIdReturnsPromise(type: 'abilityLifecycle', callbackId: int): Promise; + /** * Register environment callback. * @@ -219,11 +283,25 @@ declare class ApplicationContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ on(type: 'environment', callback: EnvironmentCallback): int; + /** + * Register environment callback. + * + * @param { 'environment' } type - environment. + * @param { EnvironmentCallback } callback - The environment callback. + * @returns { int } Returns the number code of the callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + onEnvironment(type: 'environment', callback: EnvironmentCallback): int; + /** * Unregister environment callback. * @@ -245,11 +323,25 @@ declare class ApplicationContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ off(type: 'environment', callbackId: int, callback: AsyncCallback): void; + /** + * Unregister environment callback. + * + * @param { 'environment' } type - environment. + * @param { int } callbackId - Indicates the number code of the callback. + * @param { AsyncCallback } callback - The callback of unregisterEnvironmentCallback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + offEnvironmentWithCallbackId(type: 'environment', callbackId: int, callback: AsyncCallback): void; + /** * Unregister environment callback. * @@ -271,11 +363,25 @@ declare class ApplicationContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ off(type: 'environment', callbackId: int): Promise; + /** + * Unregister environment callback. + * + * @param { 'environment' } type - environment. + * @param { int } callbackId - Indicates the number code of the callback. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + offEnvironmentWithCallbackIdReturnsPromise(type: 'environment', callbackId: int): Promise; + /** * Register applicationStateChange callback. * @@ -315,11 +421,33 @@ declare class ApplicationContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ on(type: 'applicationStateChange', callback: ApplicationStateChangeCallback): void; + /** + * Registers a listener for application foreground/background state changes. + * This API uses an asynchronous callback to return the result. + * + *

**NOTE**: + *
It can be called only by the main thread. + *

+ * + * @param { 'applicationStateChange' } type - Event type. + * @param { ApplicationStateChangeCallback } callback - Callback used to return the result. You can define a callback + * for switching from the background to the foreground and a callback for switching from the foreground to the + * background. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + onApplicationStateChange(type: 'applicationStateChange', callback: ApplicationStateChangeCallback): void; + /** * Unregister applicationStateChange callback. * @@ -361,11 +489,57 @@ declare class ApplicationContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ off(type: 'applicationStateChange', callback?: ApplicationStateChangeCallback): void; + /** + * Unregisters the listener for application foreground/background state changes. + * This API uses an asynchronous callback to return the result. + * + *

**NOTE**: + *
It can be called only by the main thread. + *
A listener must have been registered by calling ApplicationContext.on('applicationStateChange'). + *

+ * + * @param { 'applicationStateChange' } type - Event type. + * @param { ApplicationStateChangeCallback } [callback] - Callback used to return the result.The value can be a + * callback defined by ApplicationContext.on('applicationStateChange') or empty. + * - If a defined callback is passed in, the listener for that callback is unregistered. + * - If no value is passed in, all the listeners for the corresponding event are unregistered. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + offApplicationStateChange(type: 'applicationStateChange', callback?: ApplicationStateChangeCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload on { + onEnvironment, + onApplicationStateChange, + onAbilityLifecycle + } + + /** + * @since 20 + * @arkts 1.2 + */ + overload off { + offEnvironmentWithCallbackId, + offAbilityLifecycleWithCallbackId, + offEnvironmentWithCallbackIdReturnsPromise, + offAbilityLifecycleWithCallbackIdReturnsPromise, + offApplicationStateChange + } + /** * Get information about running processes * @@ -403,11 +577,29 @@ declare class ApplicationContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ getRunningProcessInformation(): Promise>; + /** + * Obtains information about the running processes. + * This API uses a promise to return the result. + * + * @returns { Promise> } Promise used to return the API call result and the process running + * information. You can perform error handling or custom processing in this callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + getRunningProcessInformationReturnsPromise(): Promise>; + /** * Get information about running processes * @@ -445,11 +637,38 @@ declare class ApplicationContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ getRunningProcessInformation(callback: AsyncCallback>): void; + /** + * Obtains information about the running processes. + * This API uses an asynchronous callback to return the result. + * + * @param { AsyncCallback> } callback - Callback used to return the information about the + * running processes. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + getRunningProcessInformationWithCallback(callback: AsyncCallback>): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getRunningProcessInformation { + getRunningProcessInformationWithCallback, + getRunningProcessInformationReturnsPromise, + } + /** * Kill all processes of the application * @@ -478,11 +697,33 @@ declare class ApplicationContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ killAllProcesses(): Promise; + /** + * Kills all processes of this application. + * The application will not go through the normal lifecycle when exiting. + * This API uses a promise to return the result. + * + *

**NOTE**: + *
It can be called only by the main thread. + *
This API is used to forcibly exit an application in abnormal scenarios. To exit an application properly, + * call terminateSelf(). + *

+ * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 16000011 - The context does not exist. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + killAllProcessesReturnsPromise(): Promise; + /** * Kills all processes of this application. * The application will not go through the normal lifecycle when exiting. @@ -502,11 +743,34 @@ declare class ApplicationContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ killAllProcesses(clearPageStack: boolean): Promise; + /** + * Kills all processes of this application. + * The application will not go through the normal lifecycle when exiting. + * This API uses a promise to return the result. + * + *

**NOTE**: + *
It can be called only by the main thread. + *
This API is used to forcibly exit an application in abnormal scenarios. To exit an application properly, + * call terminateSelf(). + *

+ * + * @param { boolean } clearPageStack - Whether to clear the page stack. The value true means to clear + * the page stack, and false means the opposite. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @throws { BusinessError } 16000011 - The context does not exist. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + killAllProcessesWithClearPageStackReturnsPromise(clearPageStack: boolean): Promise; + /** * Kill all processes of the application * @@ -541,10 +805,20 @@ declare class ApplicationContext extends Context { killAllProcesses(callback: AsyncCallback); /** - * Kill all processes of the application + * Kills all processes of this application. + * The application will not go through the normal lifecycle when exiting. + * This API uses an asynchronous callback to return the result. + * + *

**NOTE**: + *
It can be called only by the main thread. + *
This API is used to forcibly exit an application in abnormal scenarios. To exit an application properly, + * call terminateSelf(). + *

* - * @param { AsyncCallback } callback - The callback of killAllProcesses. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @param { AsyncCallback } callback - Callback used to return the result. If all the processes are killed, + * err is undefined. Otherwise, err is an error object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. * @throws { BusinessError } 16000011 - The context does not exist. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly @@ -552,7 +826,17 @@ declare class ApplicationContext extends Context { * @since 20 * @arkts 1.2 */ - killAllProcesses(callback: AsyncCallback): void; + killAllProcessesWithCallback(callback: AsyncCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload killAllProcesses { + killAllProcessesWithCallback, + killAllProcessesReturnsPromise, + killAllProcessesWithClearPageStackReturnsPromise + } /** * Set colorMode of the application @@ -621,11 +905,30 @@ declare class ApplicationContext extends Context { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ clearUpApplicationData(): Promise; + /** + * Clears up the application data and revokes the permissions that the application has requested from users. + * This API uses a promise to return the result. + * + *

**NOTE**: + *
It can be called only by the main thread. + *
This API stops the application process. After the application process is stopped, all subsequent callbacks + * will not be triggered. + *

+ * + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + clearUpApplicationDataReturnsPromise(): Promise; + /** * Clears up the application data and revokes the permissions that the application has requested from users. * This API uses an asynchronous callback to return the result. @@ -644,11 +947,42 @@ declare class ApplicationContext extends Context { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ clearUpApplicationData(callback: AsyncCallback): void; + /** + * Clears up the application data and revokes the permissions that the application has requested from users. + * This API uses an asynchronous callback to return the result. + * + *

**NOTE**: + *
It can be called only by the main thread. + *
This API stops the application process. After the application process is stopped, all subsequent callbacks + * will not be triggered. + *

+ * + * @param { AsyncCallback } callback - Callback used to return the result. If the application data is cleared + * up, error is undefined; otherwise, error is an error object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + clearUpApplicationDataWithCallback(callback: AsyncCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload clearUpApplicationData { + clearUpApplicationDataWithCallback, + clearUpApplicationDataReturnsPromise, + } + /** * Restarts the application and starts the specified UIAbility. * The onDestroy callback is not triggered during the restart. diff --git a/api/application/Context.d.ts b/api/application/Context.d.ts index 39034010ce..49c85a653e 100644 --- a/api/application/Context.d.ts +++ b/api/application/Context.d.ts @@ -600,11 +600,29 @@ declare class Context extends BaseContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ getGroupDir(dataGroupID: string, callback: AsyncCallback): void; + /** + * Obtains the shared directory based on a group ID. + * This API uses an asynchronous callback to return the result. + * + * @param { string } dataGroupID - Group ID, which is assigned by the system when an atomic service project + * is created. + * @param { AsyncCallback } callback - Group ID, which is assigned by the system when an atomic service + * project is created. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 16000011 - The context does not exist. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + getGroupDirWitdhDataGroupIDCallback(dataGroupID: string, callback: AsyncCallback): void; + /** * Get group dir by the groupId. * @@ -629,11 +647,37 @@ declare class Context extends BaseContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ getGroupDir(dataGroupID: string): Promise; + /** + * Obtains the shared directory based on a group ID. + * This API uses a promise to return the result. + * + * @param { string } dataGroupID - Group ID, which is assigned by the system when an atomic service project + * is created. + * @returns { Promise } Promise used to return the result. If no shared directory exists, null is returned. + * Only the encryption level EL2 is supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000011 - The context does not exist. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + getGroupDirWitdhDataGroupIDReturnsPromise(dataGroupID: string): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getGroupDir { + getGroupDirWitdhDataGroupIDCallback, + getGroupDirWitdhDataGroupIDReturnsPromise + } + /** * Creates a resource management object for a module. * diff --git a/api/application/ServiceExtensionContext.d.ts b/api/application/ServiceExtensionContext.d.ts index 282dbd664a..ae7948140a 100644 --- a/api/application/ServiceExtensionContext.d.ts +++ b/api/application/ServiceExtensionContext.d.ts @@ -174,11 +174,55 @@ declare class ServiceExtensionContext extends ExtensionContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ startAbility(want: Want, callback: AsyncCallback): void; + /** + * Service extension uses this method to start a specific ability. If the caller application is in foreground, + * you can use this method to start ability; If the caller application is in the background, + * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startAbilityWithWantCallback(want: Want, callback: AsyncCallback): void; + /** * Service extension uses this method to start a specific ability. * @@ -310,10 +354,53 @@ declare class ServiceExtensionContext extends ExtensionContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + + /** + * Service extension uses this method to start a specific ability. If the caller application is in foreground, + * you can use this method to start ability; If the caller application is in the background, + * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startAbilityWithWantOptionsCallback(want: Want, options: StartOptions, callback: AsyncCallback): void; /** * Service extension uses this method to start a specific ability. @@ -452,11 +539,66 @@ declare class ServiceExtensionContext extends ExtensionContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ startAbility(want: Want, options?: StartOptions): Promise; + /** + * Service extension uses this method to start a specific ability. If the caller application is in foreground, + * you can use this method to start ability; If the caller application is in the background, + * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } [options] - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startAbilityWithWantOptionsReturnsPromise(want: Want, options?: StartOptions): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload startAbility { + startAbilityWithWantCallback, + startAbilityWithWantOptionsCallback, + startAbilityWithWantOptionsReturnsPromise + } + /** * Service extension uses this method to start a specific ability by implicit want. If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, @@ -1303,11 +1445,43 @@ declare class ServiceExtensionContext extends ExtensionContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + /** + * Starts a new service extension ability. + * If the target service extension ability is visible, you can start the target service extension ability; + * If the target service extension ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. + * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startServiceExtensionAbilityWithWantCallback(want: Want, callback: AsyncCallback): void; + /** * Starts a new service extension ability. * @@ -1387,11 +1561,52 @@ declare class ServiceExtensionContext extends ExtensionContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ startServiceExtensionAbility(want: Want): Promise; + /** + * Starts a new service extension ability. + * If the target service extension ability is visible, you can start the target service extension ability; + * If the target service extension ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. + * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startServiceExtensionAbilityWithWantReturnsPromise(want: Want): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload startServiceExtensionAbility { + startServiceExtensionAbilityWithWantCallback, + startServiceExtensionAbilityWithWantReturnsPromise + } + /** * Starts a new service extension ability with account. * @@ -1614,11 +1829,16 @@ declare class ServiceExtensionContext extends ExtensionContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + /** + * @since 20 + * @arkts 1.2 + */ + stopServiceExtensionAbilityWithWantCallback(want: Want, callback: AsyncCallback): void; + /** * Stops a service within the same application. * @@ -1668,6 +1888,12 @@ declare class ServiceExtensionContext extends ExtensionContext { */ stopServiceExtensionAbility(want: Want): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + stopServiceExtensionAbilityWithWantReturnsPromise(want: Want): Promise; + /** * Stops a service within the same application with account. * @@ -1803,11 +2029,27 @@ declare class ServiceExtensionContext extends ExtensionContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ terminateSelf(callback: AsyncCallback): void; + /** + * Destroys this service extension. + * + * @param { AsyncCallback } callback - The callback of terminateSelf. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + terminateSelfWithCallback(callback: AsyncCallback): void; + /** * Destroys this service extension. * @@ -1833,11 +2075,34 @@ declare class ServiceExtensionContext extends ExtensionContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ terminateSelf(): Promise; + /** + * Destroys this service extension. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + terminateSelfReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload terminateSelf { + terminateSelfWithCallback, + terminateSelfReturnsPromise + } + /** * Connects an ability to a Service extension. *

This method can be called by an ability or service extension, but the destination of the connection must be a @@ -1965,11 +2230,27 @@ declare class ServiceExtensionContext extends ExtensionContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ disconnectServiceExtensionAbility(connection: long, callback: AsyncCallback): void; + /** + * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. + * + * @param { long } connection - the connection id returned from connectAbility api. + * @param { AsyncCallback } callback - The callback of disconnectAbility. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + disconnectServiceExtensionAbilityWithConnectionCallback(connection: long, callback: AsyncCallback): void; + /** * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. * @@ -1982,11 +2263,36 @@ declare class ServiceExtensionContext extends ExtensionContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ disconnectServiceExtensionAbility(connection: long): Promise; + /** + * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. + * + * @param { long } connection - the connection id returned from connectAbility api. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + disconnectServiceExtensionAbilityWithConnectionReturnsPromise(connection: long): Promise; + + /*** + * @since 20 + * @arkts 1.2 + */ + overload disconnectServiceExtensionAbility { + disconnectServiceExtensionAbilityWithConnectionCallback, + disconnectServiceExtensionAbilityWithConnectionReturnsPromise + } + /** * Get the caller object of the startup capability. * diff --git a/api/application/UIAbilityContext.d.ts b/api/application/UIAbilityContext.d.ts index 235db32ce6..6d3dd2e757 100644 --- a/api/application/UIAbilityContext.d.ts +++ b/api/application/UIAbilityContext.d.ts @@ -337,11 +337,55 @@ declare class UIAbilityContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ startAbility(want: Want, callback: AsyncCallback): void; + /** + * Starts a new ability. If the caller application is in foreground, you can use this method to start ability; + * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + startAbilityWithWantCallback(want: Want, callback: AsyncCallback): void; + /** * Starts a new ability. * @@ -549,11 +593,58 @@ declare class UIAbilityContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + /** + * Starts a new ability. If the caller application is in foreground, you can use this method to start ability; + * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not support. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000067 - The StartOptions check failed. + * @throws { BusinessError } 16000068 - The ability is already running. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @throws { BusinessError } 16300003 - The target application is not the current application. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + startAbilityWithWantOptionsCallback(want: Want, options: StartOptions, callback: AsyncCallback): void; + /** * Starts a new ability. * @@ -772,11 +863,70 @@ declare class UIAbilityContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ startAbility(want: Want, options?: StartOptions): Promise; + /** + * Starts a new ability. If the caller application is in foreground, you can use this method to start ability; + * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } [options] - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not support. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000067 - The StartOptions check failed. + * @throws { BusinessError } 16000068 - The ability is already running. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @throws { BusinessError } 16300003 - The target application is not the current application. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + startAbilityWithWantOptionsReturnsPromise(want: Want, options?: StartOptions): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload startAbility { + startAbilityWithWantCallback, + startAbilityWithWantOptionsCallback, + startAbilityWithWantOptionsReturnsPromise + } + /** * Starts a new ability by implicit want. If the caller application is in foreground, you can use this method to start ability; * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. @@ -1988,11 +2138,56 @@ declare class UIAbilityContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ startAbilityForResult(want: Want, callback: AsyncCallback): void; + /** + * Starts an ability and returns the execution result when the ability is destroyed. If the caller application is in foreground, + * you can use this method to start ability; If the caller application is in the background, + * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + startAbilityForResultWithWantCallback(want: Want, callback: AsyncCallback): void; + /** * Starts an ability and returns the execution result when the ability is destroyed. * @@ -2193,11 +2388,55 @@ declare class UIAbilityContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback): void; + /** + * Starts an ability and returns the execution result when the ability is destroyed. If the caller application is in foreground, + * you can use this method to start ability; If the caller application is in the background, + * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + startAbilityForResultWithWantOptionsCallback(want: Want, options: StartOptions, callback: AsyncCallback): void; + /** * Starts an ability and returns the execution result when the ability is destroyed. * @@ -2408,25 +2647,22 @@ declare class UIAbilityContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ startAbilityForResult(want: Want, options?: StartOptions): Promise; - + /** - * Starts an ability and returns the execution result when the ability is destroyed with account. - * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, + * Starts an ability and returns the execution result when the ability is destroyed. If the caller application is in foreground, + * you can use this method to start ability; If the caller application is in the background, * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. * If the target ability is visible, you can start the target ability; If the target ability is invisible, * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. * - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the account to start. - * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } [options] - Indicates the start options. + * @returns { Promise } Returns the result of startAbility. * @throws { BusinessError } 201 - The application does not have permission to call the interface. - * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @throws { BusinessError } 16000001 - The specified ability does not exist. * @throws { BusinessError } 16000002 - Incorrect ability type. @@ -2437,8 +2673,68 @@ declare class UIAbilityContext extends Context { * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. * @throws { BusinessError } 16000011 - The context does not exist. - * @throws { BusinessError } 16000050 - Internal error. - * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + startAbilityForResultWithWantOptionsReturnsPromise(want: Want, options?: StartOptions): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload startAbilityForResult { + startAbilityForResultWithWantCallback, + startAbilityForResultWithWantOptionsCallback, + startAbilityForResultWithWantOptionsReturnsPromise + } + + + /** + * Starts an ability and returns the execution result when the ability is destroyed with account. + * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background, + * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. * @throws { BusinessError } 16000055 - Installation-free timed out. * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core @@ -2914,11 +3210,42 @@ declare class UIAbilityContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + /** + * Starts a new service extension ability. + * If the target service extension ability is visible, you can start the target service extension ability; + * If the target service extension ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. + * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startServiceExtensionAbilityWithWantCallback(want: Want, callback: AsyncCallback): void; + /** * Starts a new service extension ability. * @@ -2995,11 +3322,51 @@ declare class UIAbilityContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ startServiceExtensionAbility(want: Want): Promise; + /** + * Starts a new service extension ability. + * If the target service extension ability is visible, you can start the target service extension ability; + * If the target service extension ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability. + * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startServiceExtensionAbilityWithWantReturnsPromise(want: Want): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload startServiceExtensionAbility { + startServiceExtensionAbilityWithWantCallback, + startServiceExtensionAbilityWithWantReturnsPromise + } + /** * Starts a new service extension ability with account. * @@ -3408,11 +3775,27 @@ declare class UIAbilityContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ terminateSelf(callback: AsyncCallback): void; + /** + * Destroys this Page ability. + * + * @param { AsyncCallback } callback - The callback of terminateSelf. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + terminateSelfWithCallback(callback: AsyncCallback): void; + /** * Destroys this Page ability. * @@ -3450,11 +3833,35 @@ declare class UIAbilityContext extends Context { * @stagemodelonly * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ terminateSelf(): Promise; + /** + * Destroys this Page ability. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + terminateSelfReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload terminateSelf { + terminateSelfWithCallback, + terminateSelfReturnsPromise + } + /** * Destroys the Page ability while returning the specified result code and data to the caller. * @@ -3496,11 +3903,27 @@ declare class UIAbilityContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; + /** + * Destroys the Page ability while returning the specified result code and data to the caller. + * + * @param { AbilityResult } parameter - Indicates the result to return. + * @param { AsyncCallback } callback - The callback of terminateSelfWithResult. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + terminateSelfWithResultWithParameterCallback(parameter: AbilityResult, callback: AsyncCallback): void; + /** * Destroys the Page ability while returning the specified result code and data to the caller. * @@ -3542,11 +3965,36 @@ declare class UIAbilityContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ terminateSelfWithResult(parameter: AbilityResult): Promise; + /** + * Destroys the Page ability while returning the specified result code and data to the caller. + * + * @param { AbilityResult } parameter - Indicates the result to return. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + terminateSelfWithResultWithParameterReturnsPromise(parameter: AbilityResult): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload terminateSelfWithResult { + terminateSelfWithResultWithParameterCallback, + terminateSelfWithResultWithParameterReturnsPromise + } + /** * Return to caller application with specified result code and data while not destroying current ability. * If the current application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. @@ -3675,11 +4123,25 @@ declare class UIAbilityContext extends Context { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ disconnectServiceExtensionAbility(connection: long, callback: AsyncCallback): void; + /** + * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. + * + * @param { long } connection - The number code of the ability connected + * @param { AsyncCallback } callback - The callback of disconnectAbility. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + disconnectServiceExtensionAbilityWithConnectionCallback(connection: long, callback: AsyncCallback): void; + /** * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. * @@ -3690,11 +4152,34 @@ declare class UIAbilityContext extends Context { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ disconnectServiceExtensionAbility(connection: long): Promise; + /** + * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. + * + * @param { long } connection - The number code of the ability connected + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + disconnectServiceExtensionAbilityWithConnectionReturnsPromise(connection: long): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload disconnectServiceExtensionAbility { + disconnectServiceExtensionAbilityWithConnectionCallback, + disconnectServiceExtensionAbilityWithConnectionReturnsPromise + } + /** * Set mission label of current ability. * @@ -3718,11 +4203,26 @@ declare class UIAbilityContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ setMissionLabel(label: string, callback: AsyncCallback): void; + /** + * Set mission label of current ability. + * + * @param { string } label - The label of ability that showed in recent missions. + * @param { AsyncCallback } callback - The callback of setMissionLabel. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + setMissionLabelWithLabelCallback(label: string, callback: AsyncCallback): void; + /** * Set mission label of current ability. * @@ -3746,11 +4246,35 @@ declare class UIAbilityContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ setMissionLabel(label: string): Promise; + /** + * Set mission label of current ability. + * + * @param { string } label - The label of ability that showed in recent missions. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + setMissionLabelWithLabelReturnsPromise(label: string): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload setMissionLabel { + setMissionLabelWithLabelCallback, + setMissionLabelWithLabelReturnsPromise + } + /** * Set mission icon of current ability. * @@ -4508,12 +5032,31 @@ declare class UIAbilityContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ startAbilityByType(type: string, wantParam: Record, abilityStartCallback: AbilityStartCallback, callback: AsyncCallback): void; + /** + * Starts the UIAbility or UIExtensionAbility by type. + * If the caller application is in the background, it is not allowed to call this interface. + * + * @param { string } type - The type of target ability. + * @param { Record } wantParam - Indicates the want parameter. + * @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + *
2.Incorrect parameter types. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + startAbilityByTypeWithTypeWantParamAbilityStartCallbackCallback(type: string, wantParam: Record, + abilityStartCallback: AbilityStartCallback, callback: AsyncCallback): void; + /** * Starts the UIAbility or UIExtensionAbility by type. * If the target ability is visible, you can start the target ability; If the target ability is invisible, @@ -4550,12 +5093,40 @@ declare class UIAbilityContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ startAbilityByType(type: string, wantParam: Record, abilityStartCallback: AbilityStartCallback): Promise; + /** + * Starts the UIAbility or UIExtensionAbility by type. + * If the caller application is in the background, it is not allowed to call this interface. + * + * @param { string } type - The type of target ability. + * @param { Record } wantParam - Indicates the want parameter. + * @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + *
2.Incorrect parameter types. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + startAbilityByTypeWithTypeWantParamAbilityStartCallbackReturnsPromise(type: string, wantParam: Record, + abilityStartCallback: AbilityStartCallback): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload startAbilityByType { + startAbilityByTypeWithTypeWantParamAbilityStartCallbackCallback, + startAbilityByTypeWithTypeWantParamAbilityStartCallbackReturnsPromise + } + /** * Requests the Modal UIExtensionAbility. * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, @@ -4593,11 +5164,32 @@ declare class UIAbilityContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ requestModalUIExtension(pickerWant: Want, callback: AsyncCallback): void; + /** + * Requests the specified foreground application to start the UIExtensionAbility of the corresponding type. The foreground + * application is specified by bundleName in want.parameters. If bundleName is left unspecified, or if the application + * specified by bundleName is not running in the foreground or does not exist, the UIExtensionAbility is directly started + * on the system interface. The UIExtensionAbility to start is determined by the combination of the bundleName, abilityName, + * and moduleName fields in want, and its type is determined by the ability.want.params.uiExtensionType field in want.parameters. + * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. + * + * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. + * @param { AsyncCallback } callback - The callback of requestModalUIExtension. + * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + requestModalUIExtensionWithPickerWantCallback(pickerWant: Want, callback: AsyncCallback): void; + /** * Requests the Modal UIExtensionAbility. * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, @@ -4635,11 +5227,42 @@ declare class UIAbilityContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ requestModalUIExtension(pickerWant: Want): Promise; + /** + * Requests the specified foreground application to start the UIExtensionAbility of the corresponding type. The foreground + * application is specified by bundleName in want.parameters. If bundleName is left unspecified, or if the application + * specified by bundleName is not running in the foreground or does not exist, the UIExtensionAbility is directly started + * on the system interface. The UIExtensionAbility to start is determined by the combination of the bundleName, abilityName, + * and moduleName fields in want, and its type is determined by the ability.want.params.uiExtensionType field in want.parameters. + * If the target UIExtensionAbility is visible, you can start the target UIExtensionAbility; If the target UIExtensionAbility is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UIExtensionAbility. + * + * @param { Want } pickerWant - Indicates the UIExtensionAbility to start. + * @returns { Promise } The promise returned by the requestModalUIExtension. + * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + requestModalUIExtensionWithPickerWantReturnsPromise(pickerWant: Want): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload requestModalUIExtension { + requestModalUIExtensionWithPickerWantCallback, + requestModalUIExtensionWithPickerWantReturnsPromise + } + + /** * Full-screen pop-us startup atomic service. * diff --git a/api/application/UIExtensionContext.d.ts b/api/application/UIExtensionContext.d.ts index 9babbbb735..a405a6c191 100755 --- a/api/application/UIExtensionContext.d.ts +++ b/api/application/UIExtensionContext.d.ts @@ -155,11 +155,56 @@ declare class UIExtensionContext extends ExtensionContext { * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ startAbility(want: Want, callback: AsyncCallback): void; + /** + * UI extension uses this method to start a specific ability.If the caller application is in foreground, + * you can use this method to start ability; If the caller application is in the background, + * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000069 - The extension cannot start the third party application. + * @throws { BusinessError } 16000070 - The extension cannot start the service. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startAbilityWithWantCallback(connection: long, callback: AsyncCallback): void; + /** * UI extension uses this method to start a specific ability.If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, @@ -265,11 +310,55 @@ declare class UIExtensionContext extends ExtensionContext { * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + /** + * UI extension uses this method to start a specific ability.If the caller application is in foreground, + * you can use this method to start ability; If the caller application is in the background, + * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000069 - The extension cannot start the third party application. + * @throws { BusinessError } 16000070 - The extension cannot start the service. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startAbilityWithWantOptionsCallback(want: Want, options: StartOptions, callback: AsyncCallback): void; + /** * UI extension uses this method to start a specific ability.If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, @@ -381,11 +470,67 @@ declare class UIExtensionContext extends ExtensionContext { * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ startAbility(want: Want, options?: StartOptions): Promise; + /** + * UI extension uses this method to start a specific ability.If the caller application is in foreground, + * you can use this method to start ability; If the caller application is in the background, + * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } [options] - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000069 - The extension cannot start the third party application. + * @throws { BusinessError } 16000070 - The extension cannot start the service. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startAbilityWithWantOptionsReturnsPromise(want: Want, options?: StartOptions): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload startAbility { + startAbilityWithWantCallback, + startAbilityWithWantOptionsCallback, + startAbilityWithWantOptionsReturnsPromise + } + /** * UI extension uses this method to start a specific ability by implicit want.If the caller application is in foreground, * you can use this method to start ability; If the caller application is in the background, @@ -529,11 +674,56 @@ declare class UIExtensionContext extends ExtensionContext { * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ startAbilityForResult(want: Want, callback: AsyncCallback): void; + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * If the caller application is in foreground, you can use this method to start ability; If the caller application + * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000069 - The extension cannot start the third party application. + * @throws { BusinessError } 16000070 - The extension cannot start the service. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startAbilityForResultWithWantCallback(want: Want, callback: AsyncCallback): void; + /** * Starts an ability and returns the execution result when the ability is destroyed. * If the caller application is in foreground, you can use this method to start ability; If the caller application @@ -639,11 +829,55 @@ declare class UIExtensionContext extends ExtensionContext { * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback): void; + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * If the caller application is in foreground, you can use this method to start ability; If the caller application + * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000069 - The extension cannot start the third party application. + * @throws { BusinessError } 16000070 - The extension cannot start the service. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startAbilityForResultWithWantOptionsCallback(want: Want, options: StartOptions, callback: AsyncCallback): void; + /** * Starts an ability and returns the execution result when the ability is destroyed. * If the caller application is in foreground, you can use this method to start ability; If the caller application @@ -755,11 +989,67 @@ declare class UIExtensionContext extends ExtensionContext { * @throws { BusinessError } 16200001 - The caller has been released. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ startAbilityForResult(want: Want, options?: StartOptions): Promise; + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * If the caller application is in foreground, you can use this method to start ability; If the caller application + * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC. + * + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } [options] - Indicates the start options. + * @returns { Promise } Returns the result of startAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Cannot start an invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version greater than 11. + * @throws { BusinessError } 16000019 - No matching ability is found. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000069 - The extension cannot start the third party application. + * @throws { BusinessError } 16000070 - The extension cannot start the service. + * @throws { BusinessError } 16000071 - App clone is not supported. + * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000077 - The number of app instances reaches the limit. + * @throws { BusinessError } 16000078 - The multi-instance is not supported. + * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + startAbilityForResultWithWantStartOptionsReturnsPromise(want: Want, options?: StartOptions): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload startAbilityForResult { + startAbilityForResultWithWantCallback, + startAbilityForResultWithWantOptionsCallback, + startAbilityForResultWithWantStartOptionsReturnsPromise + } + /** * Starts a new ability using the original caller information, and returns the execution result when the ability * is destroyed. @@ -859,11 +1149,25 @@ declare class UIExtensionContext extends ExtensionContext { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ disconnectServiceExtensionAbility(connection: long, callback: AsyncCallback): void; + /** + * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. + * + * @param { long } connection - The number code of the ability connected + * @param { AsyncCallback } callback - The callback of disconnectAbility. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + disconnectServiceExtensionAbilityWithConnectionCallback(connection: long, callback: AsyncCallback): void; + /** * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. * @@ -874,11 +1178,34 @@ declare class UIExtensionContext extends ExtensionContext { * @throws { BusinessError } 16000050 - Internal error. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'10', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ disconnectServiceExtensionAbility(connection: long): Promise; + /** + * Disconnect an ability from a service extension, in contrast to {@link connectAbility}. + * + * @param { long } connection - The number code of the ability connected + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + disconnectServiceExtensionAbilityWithConnectionReturnsPromise(connection: long): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload disconnectServiceExtensionAbility { + disconnectServiceExtensionAbilityWithConnectionCallback, + disconnectServiceExtensionAbilityWithConnectionReturnsPromise + } + /** * Report to system when the extension is drawn completed. * @@ -899,22 +1226,52 @@ declare class UIExtensionContext extends ExtensionContext { * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ terminateSelf(callback: AsyncCallback): void; + /** + * Destroys the UI extension. + * + * @param { AsyncCallback } callback - The callback of terminateSelf. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + terminateSelfWithCallback(callback: AsyncCallback): void; + /** * Destroys the UI extension. * * @returns { Promise } The promise returned by the function. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ terminateSelf(): Promise; + /** + * Destroys the UI extension. + * + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + terminateSelfReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload terminateSelf { + terminateSelfWithCallback, + terminateSelfReturnsPromise + } + /** * Destroys the UI extension while returning the specified result code and data to the caller. * @@ -923,11 +1280,23 @@ declare class UIExtensionContext extends ExtensionContext { * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; + /** + * Destroys the UI extension while returning the specified result code and data to the caller. + * + * @param { AbilityResult } parameter - Indicates the result to return. + * @param { AsyncCallback } callback - The callback of terminateSelfWithResult. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + terminateSelfWithResultWithParameterCallback(parameter: AbilityResult, callback: AsyncCallback): void; + /** * Destroys the UI extension while returning the specified result code and data to the caller. * @@ -936,11 +1305,32 @@ declare class UIExtensionContext extends ExtensionContext { * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ terminateSelfWithResult(parameter: AbilityResult): Promise; + /** + * Destroys the UI extension while returning the specified result code and data to the caller. + * + * @param { AbilityResult } parameter - Indicates the result to return. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 20 + * @arkts 1.2 + */ + terminateSelfWithResultWithParameterReturnsPromise(parameter: AbilityResult): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload terminateSelfWithResult { + terminateSelfWithResultWithParameterCallback, + terminateSelfWithResultWithParameterReturnsPromise + } + /** * Full-screen pop-us startup atomic service. * -- Gitee