From 0a52a4ca7480235fbad465726433b3f5c0b0b685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E8=8F=B2=E5=A2=A8?= Date: Wed, 21 May 2025 11:15:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EstartAbilities=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 朱菲墨 --- api/application/ServiceExtensionContext.d.ts | 41 ++++++++++++++++++++ api/application/UIExtensionContext.d.ts | 41 ++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/api/application/ServiceExtensionContext.d.ts b/api/application/ServiceExtensionContext.d.ts index f7f002934d..a219d24a3e 100644 --- a/api/application/ServiceExtensionContext.d.ts +++ b/api/application/ServiceExtensionContext.d.ts @@ -2522,4 +2522,45 @@ export default class ServiceExtensionContext extends ExtensionContext { * @since 18 */ openAtomicService(appId: string, options?: AtomicServiceOptions): Promise; + + /** + * Starts multi UIAbility simultaneously. If the caller application is in foreground, you can use + * this method to start abilities; 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. + * + * @param { Array } wantList - Indicates the want info list 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 - Not system application. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000004 - Failed to start the invisible ability. + * @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 } 16000050 - Internal error. + * @throws { BusinessError } 16200001 - The caller has been released. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16000120 - A maximum of four UIAbility instances can be started simultaneously. + * The current parameter exceeds the maximum number. + * @throws { BusinessError } 16000121 - The target component type is not a UIAbility. + * @throws { BusinessError } 16000122 - The target component is blocked by the system module and + * does not support startup. + * @throws { BusinessError } 16000123 - Implicit startup is not supported. + * @throws { BusinessError } 16000124 - Starting a remote UIAbility is not supported. + * @throws { BusinessError } 16000125 - Starting a plugin UIAbility is not supported. + * @throws { BusinessError } 16000126 - Starting DLP files is not supported. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.1&1.2 + */ + startUIAbilities(wantList: Array): Promise; } diff --git a/api/application/UIExtensionContext.d.ts b/api/application/UIExtensionContext.d.ts index c2ff8f8543..d10db56b56 100755 --- a/api/application/UIExtensionContext.d.ts +++ b/api/application/UIExtensionContext.d.ts @@ -1101,4 +1101,45 @@ export default class UIExtensionContext extends ExtensionContext { * @since 18 */ setColorMode(colorMode: ConfigurationConstant.ColorMode): void; + + /** + * Starts multi UIAbility simultaneously. If the caller application is in foreground, you can use + * this method to start abilities; 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. + * + * @param { Array } wantList - Indicates the want info list 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 - Not system application. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000004 - Failed to start the invisible ability. + * @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 } 16000050 - Internal error. + * @throws { BusinessError } 16200001 - The caller has been released. + * @throws { BusinessError } 16000073 - The app clone index is invalid. + * @throws { BusinessError } 16000076 - The app instance key is invalid. + * @throws { BusinessError } 16000080 - Creating a new instance is not supported. + * @throws { BusinessError } 16000120 - A maximum of four UIAbility instances can be started simultaneously. + * The current parameter exceeds the maximum number. + * @throws { BusinessError } 16000121 - The target component type is not a UIAbility. + * @throws { BusinessError } 16000122 - The target component is blocked by the system module and + * does not support startup. + * @throws { BusinessError } 16000123 - Implicit startup is not supported. + * @throws { BusinessError } 16000124 - Starting a remote UIAbility is not supported. + * @throws { BusinessError } 16000125 - Starting a plugin UIAbility is not supported. + * @throws { BusinessError } 16000126 - Starting DLP files is not supported. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 20 + * @arkts 1.1&1.2 + */ + startUIAbilities(wantList: Array): Promise; } -- Gitee