From 492069959f141f6236db8941a1c86f9aa1967492 Mon Sep 17 00:00:00 2001 From: jerry Date: Sat, 15 Jan 2022 09:07:16 +0000 Subject: [PATCH] multi-user-interface Signed-off-by: jerry --- api/@ohos.application.appManager.d.ts | 18 +++++++- api/application/AbilityContext.d.ts | 44 ++++++++++++++++++++ api/application/ServiceExtensionContext.d.ts | 32 ++++++++++++++ 3 files changed, 92 insertions(+), 2 deletions(-) diff --git a/api/@ohos.application.appManager.d.ts b/api/@ohos.application.appManager.d.ts index f8428c4c82..6ef7423dff 100644 --- a/api/@ohos.application.appManager.d.ts +++ b/api/@ohos.application.appManager.d.ts @@ -59,8 +59,22 @@ declare namespace appManager { * @SysCap appexecfwk * @return Returns the list of AppStateData. */ - function getForegroundApplications(callback: AsyncCallback>): void; - function getForegroundApplications(): Promise>; + function getForegroundApplications(callback: AsyncCallback>): void; + function getForegroundApplications(): Promise>; + + /** + * Kill process with account. + * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap appexecfwk + * @param bundleName The process bundle name. + * @param accountId The account id. + * @systemapi hide this for inner system use + * @return - + */ + function killProcessWithAccount(bundleName: string, accountId: number): Promise; + function killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCallback): void; } export default appManager; diff --git a/api/application/AbilityContext.d.ts b/api/application/AbilityContext.d.ts index 3cec14e13d..bf6f6c4538 100644 --- a/api/application/AbilityContext.d.ts +++ b/api/application/AbilityContext.d.ts @@ -60,6 +60,21 @@ export default class AbilityContext extends Context { startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; startAbility(want: Want, options?: StartOptions): Promise; + /** + * Starts a new ability with account. + * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @sysCap AAFwk + * @param want Indicates the want info to start. + * @param want Indicates the account to start. + * @systemapi hide for inner use. + * @return - + */ + startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; + /** * Starts an ability and returns the execution result when the ability is destroyed. * @@ -72,6 +87,21 @@ export default class AbilityContext extends Context { startAbilityForResult(want: Want, callback: AsyncCallback): void; startAbilityForResult(want: Want): Promise; + /** + * Starts an ability and returns the execution result when the ability is destroyed with account. + * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @sysCap AAFwk + * @param want Indicates the want info to start. + * @param want Indicates the account to start. + * @systemapi hide for inner use. + * @return Returns the {@link AbilityResult}. + */ + startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; + /** * Destroys this Page ability. * @@ -109,6 +139,20 @@ export default class AbilityContext extends Context { */ connectAbility(want: Want, options: ConnectOptions): number; + /** + * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template with account. + * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @sysCap AAFwk + * @param want The element name of the service ability + * @param options The remote object instance + * @param accountId The account to connect + * @systemapi hide for inner use. + * @return Returns the number code of the ability connected + */ + connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + /** * The callback interface was connect successfully. * diff --git a/api/application/ServiceExtensionContext.d.ts b/api/application/ServiceExtensionContext.d.ts index a753bcc03c..200e2b3281 100644 --- a/api/application/ServiceExtensionContext.d.ts +++ b/api/application/ServiceExtensionContext.d.ts @@ -44,6 +44,21 @@ export default class ServiceExtensionContext extends ExtensionContext { startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; startAbility(want: Want, options?: StartOptions): Promise; + /** + * Service extension uses this method to start a specific ability with account. + * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @sysCap AAFwk + * @param parameter Indicates the ability to start. + * @param parameter Indicates the accountId to start. + * @systemapi hide for inner use. + * @return - + */ + startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; + /** * Destroys this service extension. * @@ -72,6 +87,23 @@ export default class ServiceExtensionContext extends ExtensionContext { */ connectAbility(want: Want, options: ConnectOptions): number; + /** + * Connects an ability to a Service extension with account. + * + *

This method can be called by an ability or service extension, but the destination of the connection must be a + * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target + * service extension when the Service extension is connected.

+ * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @sysCap AAFwk + * @param request Indicates the service extension to connect. + * @param request Indicates the account to connect. + * @systemapi hide for inner use. + * @return connection id, int value. + */ + connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + /** * Disconnects an ability to a service extension, in contrast to * {@link connectAbility}. -- Gitee