• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License"),
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/// <reference path="../../component/common_ts_ets_api.d.ts"/>
17
18import { AbilityInfo } from "../bundleManager/AbilityInfo";
19import { AbilityResult } from "../ability/abilityResult";
20import { AsyncCallback } from "../basic";
21import { ConnectOptions } from "../ability/connectOptions";
22import { HapModuleInfo } from "../bundleManager/HapModuleInfo";
23import Context from "./Context";
24import Want from "../@ohos.app.ability.Want";
25import StartOptions from "../@ohos.app.ability.StartOptions";
26import { Configuration } from '../@ohos.app.ability.Configuration';
27import { Caller } from '../@ohos.app.ability.UIAbility';
28import { LocalStorage } from 'StateManagement';
29import image from '../@ohos.multimedia.image';
30import dialogRequest from "../@ohos.app.ability.dialogRequest";
31
32/**
33 * The context of an ability. It allows access to ability-specific resources.
34 * @syscap SystemCapability.Ability.AbilityRuntime.Core
35 * @StageModelOnly
36 * @since 9
37 */
38export default class UIAbilityContext extends Context {
39    /**
40     * Indicates configuration information about an ability.
41     * @type { AbilityInfo }
42     * @syscap SystemCapability.Ability.AbilityRuntime.Core
43     * @StageModelOnly
44     * @since 9
45     */
46    abilityInfo: AbilityInfo;
47
48    /**
49     * Indicates configuration information about the module.
50     * @type { HapModuleInfo }
51     * @syscap SystemCapability.Ability.AbilityRuntime.Core
52     * @StageModelOnly
53     * @since 9
54     */
55    currentHapModuleInfo: HapModuleInfo;
56
57    /**
58     * Indicates configuration information.
59     * @type { Configuration }
60     * @syscap SystemCapability.Ability.AbilityRuntime.Core
61     * @StageModelOnly
62     * @since 9
63     */
64    config: Configuration;
65
66    /**
67     * Starts a new ability. If the caller application is in foreground, you can use this method to start ability;
68     * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
69     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
70     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
71     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
72     * @param want { Want } - Indicates the ability to start.
73     * @param { AsyncCallback<void> } callback - The callback of startAbility.
74     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
75     * @throws { BusinessError } 16000001 - The specified ability does not exist.
76     * @throws { BusinessError } 16000002 - Incorrect ability type.
77     * @throws { BusinessError } 16000004 - Can not start invisible component.
78     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
79     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
80     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
81     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
82     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
83     * @throws { BusinessError } 16000011 - The context does not exist.
84     * @throws { BusinessError } 16000050 - Internal error.
85     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
86     * @throws { BusinessError } 16000055 - Installation-free timed out.
87     * @throws { BusinessError } 16200001 - The caller has been released.
88     * @syscap SystemCapability.Ability.AbilityRuntime.Core
89     * @StageModelOnly
90     * @since 9
91     */
92    startAbility(want: Want, callback: AsyncCallback<void>): void;
93
94    /**
95     * Starts a new ability. If the caller application is in foreground, you can use this method to start ability;
96     * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
97     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
98     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
99     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
100     * @param { Want } want - Indicates the ability to start.
101     * @param { StartOptions } options - Indicates the start options.
102     * @param { AsyncCallback<void> } callback - The callback of startAbility.
103     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
104     * @throws { BusinessError } 16000001 - The specified ability does not exist.
105     * @throws { BusinessError } 16000002 - Incorrect ability type.
106     * @throws { BusinessError } 16000004 - Can not start invisible component.
107     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
108     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
109     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
110     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
111     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
112     * @throws { BusinessError } 16000011 - The context does not exist.
113     * @throws { BusinessError } 16000050 - Internal error.
114     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
115     * @throws { BusinessError } 16000055 - Installation-free timed out.
116     * @throws { BusinessError } 16200001 - The caller has been released.
117     * @syscap SystemCapability.Ability.AbilityRuntime.Core
118     * @StageModelOnly
119     * @since 9
120     */
121    startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
122
123    /**
124     * Starts a new ability. If the caller application is in foreground, you can use this method to start ability;
125     * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
126     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
127     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
128     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
129     * @param { Want } want - Indicates the ability to start.
130     * @param { StartOptions } options - Indicates the start options.
131     * @returns { Promise<void> } The promise returned by the function.
132     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
133     * @throws { BusinessError } 16000001 - The specified ability does not exist.
134     * @throws { BusinessError } 16000002 - Incorrect ability type.
135     * @throws { BusinessError } 16000004 - Can not start invisible component.
136     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
137     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
138     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
139     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
140     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
141     * @throws { BusinessError } 16000011 - The context does not exist.
142     * @throws { BusinessError } 16000050 - Internal error.
143     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
144     * @throws { BusinessError } 16000055 - Installation-free timed out.
145     * @throws { BusinessError } 16200001 - The caller has been released.
146     * @syscap SystemCapability.Ability.AbilityRuntime.Core
147     * @StageModelOnly
148     * @since 9
149     */
150    startAbility(want: Want, options?: StartOptions): Promise<void>;
151
152    /**
153     * Get the caller object of the startup capability.
154     * If the local device starts a new ability, you need to apply for permission:ohos.permission.ABILITY_BACKGROUND_COMMUNICATION to use this method.
155     * If the caller application is in foreground, you can use this method to start ability;
156     * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
157     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
158     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
159     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
160     * @permission ohos.permission.ABILITY_BACKGROUND_COMMUNICATION
161     * @param { Want } want - Indicates the ability to start.
162     * @returns { Promise<Caller> } Returns the Caller interface.
163     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
164     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
165     * @throws { BusinessError } 16000001 - The specified ability does not exist.
166     * @throws { BusinessError } 16000002 - Incorrect ability type.
167     * @throws { BusinessError } 16000004 - Can not start invisible component.
168     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
169     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
170     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
171     * @throws { BusinessError } 16000011 - The context does not exist.
172     * @throws { BusinessError } 16000050 - Internal error.
173     * @throws { BusinessError } 16200001 - The caller has been released.
174     * @syscap SystemCapability.Ability.AbilityRuntime.Core
175     * @StageModelOnly
176     * @since 9
177     */
178    startAbilityByCall(want: Want): Promise<Caller>;
179
180    /**
181     * Starts a new ability with account. If the caller application is in foreground,
182     * you can use this method to start ability; If the caller application is in the background,
183     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
184     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
185     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
186     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
187     * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
188     * @param { Want } want - Indicates the want info to start.
189     * @param { number } accountId - Indicates the account to start.
190     * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount.
191     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
192     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
193     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
194     * @throws { BusinessError } 16000001 - The specified ability does not exist.
195     * @throws { BusinessError } 16000002 - Incorrect ability type.
196     * @throws { BusinessError } 16000004 - Can not start invisible component.
197     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
198     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
199     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
200     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
201     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
202     * @throws { BusinessError } 16000011 - The context does not exist.
203     * @throws { BusinessError } 16000050 - Internal error.
204     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
205     * @throws { BusinessError } 16000055 - Installation-free timed out.
206     * @throws { BusinessError } 16200001 - The caller has been released.
207     * @syscap SystemCapability.Ability.AbilityRuntime.Core
208     * @systemapi
209     * @StageModelOnly
210     * @since 9
211     */
212    startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void;
213
214    /**
215     * Starts a new ability with account. If the caller application is in foreground,
216     * you can use this method to start ability; If the caller application is in the background,
217     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
218     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
219     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
220     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
221     * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
222     * @param { Want } want - Indicates the want info to start.
223     * @param { number } accountId - Indicates the account to start.
224     * @param { StartOptions } options - Indicates the start options.
225     * @param { AsyncCallback<void> } callback - The callback of startAbilityWithAccount.
226     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
227     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
228     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
229     * @throws { BusinessError } 16000001 - The specified ability does not exist.
230     * @throws { BusinessError } 16000002 - Incorrect ability type.
231     * @throws { BusinessError } 16000004 - Can not start invisible component.
232     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
233     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
234     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
235     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
236     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
237     * @throws { BusinessError } 16000011 - The context does not exist.
238     * @throws { BusinessError } 16000050 - Internal error.
239     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
240     * @throws { BusinessError } 16000055 - Installation-free timed out.
241     * @throws { BusinessError } 16200001 - The caller has been released.
242     * @syscap SystemCapability.Ability.AbilityRuntime.Core
243     * @systemapi
244     * @StageModelOnly
245     * @since 9
246     */
247    startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback<void>): void;
248
249    /**
250     * Starts a new ability with account. If the caller application is in foreground,
251     * you can use this method to start ability; If the caller application is in the background,
252     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
253     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
254     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
255     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
256     * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
257     * @param { Want } want - Indicates the want info to start.
258     * @param { number } accountId - Indicates the account to start.
259     * @param { StartOptions } options - Indicates the start options.
260     * @returns { Promise<void> } The promise returned by the function.
261     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
262     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
263     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
264     * @throws { BusinessError } 16000001 - The specified ability does not exist.
265     * @throws { BusinessError } 16000002 - Incorrect ability type.
266     * @throws { BusinessError } 16000004 - Can not start invisible component.
267     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
268     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
269     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
270     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
271     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
272     * @throws { BusinessError } 16000011 - The context does not exist.
273     * @throws { BusinessError } 16000050 - Internal error.
274     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
275     * @throws { BusinessError } 16000055 - Installation-free timed out.
276     * @throws { BusinessError } 16200001 - The caller has been released.
277     * @syscap SystemCapability.Ability.AbilityRuntime.Core
278     * @systemapi
279     * @StageModelOnly
280     * @since 9
281     */
282    startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise<void>;
283
284    /**
285     * Starts an ability and returns the execution result when the ability is destroyed. If the caller application is in foreground,
286     * you can use this method to start ability; If the caller application is in the background,
287     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
288     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
289     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
290     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
291     * @param { Want } want - Indicates the ability to start.
292     * @param { AsyncCallback<AbilityResult> } callback - The callback is used to return the result of startAbility.
293     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
294     * @throws { BusinessError } 16000001 - The specified ability does not exist.
295     * @throws { BusinessError } 16000002 - Incorrect ability type.
296     * @throws { BusinessError } 16000004 - Can not start invisible component.
297     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
298     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
299     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
300     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
301     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
302     * @throws { BusinessError } 16000011 - The context does not exist.
303     * @throws { BusinessError } 16000050 - Internal error.
304     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
305     * @throws { BusinessError } 16000055 - Installation-free timed out.
306     * @throws { BusinessError } 16200001 - The caller has been released.
307     * @syscap SystemCapability.Ability.AbilityRuntime.Core
308     * @StageModelOnly
309     * @since 9
310     */
311    startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void;
312
313    /**
314     * Starts an ability and returns the execution result when the ability is destroyed. If the caller application is in foreground,
315     * you can use this method to start ability; If the caller application is in the background,
316     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
317     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
318     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
319     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
320     * @param { Want } want - Indicates the ability to start.
321     * @param { StartOptions } options - Indicates the start options.
322     * @param { AsyncCallback<AbilityResult> } callback - The callback is used to return the result of startAbility.
323     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
324     * @throws { BusinessError } 16000001 - The specified ability does not exist.
325     * @throws { BusinessError } 16000002 - Incorrect ability type.
326     * @throws { BusinessError } 16000004 - Can not start invisible component.
327     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
328     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
329     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
330     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
331     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
332     * @throws { BusinessError } 16000011 - The context does not exist.
333     * @throws { BusinessError } 16000050 - Internal error.
334     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
335     * @throws { BusinessError } 16000055 - Installation-free timed out.
336     * @throws { BusinessError } 16200001 - The caller has been released.
337     * @syscap SystemCapability.Ability.AbilityRuntime.Core
338     * @StageModelOnly
339     * @since 9
340     */
341    startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void;
342
343    /**
344     * Starts an ability and returns the execution result when the ability is destroyed. If the caller application is in foreground,
345     * you can use this method to start ability; If the caller application is in the background,
346     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
347     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
348     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
349     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
350     * @param { Want } want - Indicates the ability to start.
351     * @param { StartOptions } options - Indicates the start options.
352     * @returns { Promise<AbilityResult> } Returns the result of startAbility.
353     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
354     * @throws { BusinessError } 16000001 - The specified ability does not exist.
355     * @throws { BusinessError } 16000002 - Incorrect ability type.
356     * @throws { BusinessError } 16000004 - Can not start invisible component.
357     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
358     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
359     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
360     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
361     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
362     * @throws { BusinessError } 16000011 - The context does not exist.
363     * @throws { BusinessError } 16000050 - Internal error.
364     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
365     * @throws { BusinessError } 16000055 - Installation-free timed out.
366     * @throws { BusinessError } 16200001 - The caller has been released.
367     * @syscap SystemCapability.Ability.AbilityRuntime.Core
368     * @StageModelOnly
369     * @since 9
370     */
371    startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>;
372
373    /**
374     * Starts an ability and returns the execution result when the ability is destroyed with account.
375     * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background,
376     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
377     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
378     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
379     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
380     * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
381     * @param { Want } want - Indicates the want info to start.
382     * @param { number } accountId - Indicates the account to start.
383     * @param { AsyncCallback<AbilityResult> } callback - The callback is used to return the result of startAbility.
384     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
385     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
386     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
387     * @throws { BusinessError } 16000001 - The specified ability does not exist.
388     * @throws { BusinessError } 16000002 - Incorrect ability type.
389     * @throws { BusinessError } 16000004 - Can not start invisible component.
390     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
391     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
392     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
393     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
394     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
395     * @throws { BusinessError } 16000011 - The context does not exist.
396     * @throws { BusinessError } 16000050 - Internal error.
397     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
398     * @throws { BusinessError } 16000055 - Installation-free timed out.
399     * @throws { BusinessError } 16200001 - The caller has been released.
400     * @syscap SystemCapability.Ability.AbilityRuntime.Core
401     * @systemapi
402     * @StageModelOnly
403     * @since 9
404     */
405    startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback<AbilityResult>): void;
406
407    /**
408     * Starts an ability and returns the execution result when the ability is destroyed with account.
409     * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background,
410     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
411     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
412     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
413     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
414     * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
415     * @param { Want } want - Indicates the want info to start.
416     * @param { number } accountId - Indicates the account to start.
417     * @param { StartOptions } options - Indicates the start options.
418     * @param { AsyncCallback<AbilityResult> } callback - The callback is used to return the result of startAbility.
419     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
420     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
421     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
422     * @throws { BusinessError } 16000001 - The specified ability does not exist.
423     * @throws { BusinessError } 16000002 - Incorrect ability type.
424     * @throws { BusinessError } 16000004 - Can not start invisible component.
425     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
426     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
427     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
428     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
429     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
430     * @throws { BusinessError } 16000011 - The context does not exist.
431     * @throws { BusinessError } 16000050 - Internal error.
432     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
433     * @throws { BusinessError } 16000055 - Installation-free timed out.
434     * @throws { BusinessError } 16200001 - The caller has been released.
435     * @syscap SystemCapability.Ability.AbilityRuntime.Core
436     * @systemapi
437     * @StageModelOnly
438     * @since 9
439     */
440    startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback<void>): void;
441
442    /**
443     * Starts an ability and returns the execution result when the ability is destroyed with account.
444     * If the caller application is in foreground, you can use this method to start ability; If the caller application is in the background,
445     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
446     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
447     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
448     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
449     * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
450     * @param { Want } want - Indicates the want info to start.
451     * @param { number } accountId - Indicates the account to start.
452     * @param { StartOptions } options - Indicates the start options.
453     * @returns { Promise<AbilityResult> } Returns the result of startAbility.
454     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
455     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
456     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
457     * @throws { BusinessError } 16000001 - The specified ability does not exist.
458     * @throws { BusinessError } 16000002 - Incorrect ability type.
459     * @throws { BusinessError } 16000004 - Can not start invisible component.
460     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
461     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
462     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
463     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
464     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
465     * @throws { BusinessError } 16000011 - The context does not exist.
466     * @throws { BusinessError } 16000050 - Internal error.
467     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
468     * @throws { BusinessError } 16000055 - Installation-free timed out.
469     * @throws { BusinessError } 16200001 - The caller has been released.
470     * @syscap SystemCapability.Ability.AbilityRuntime.Core
471     * @systemapi
472     * @StageModelOnly
473     * @since 9
474     */
475    startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise<AbilityResult>;
476
477    /**
478     * Starts a new service extension ability. If the caller application is in foreground, you can use this method to start service extension ability;
479     * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
480     * If the target service extension ability is visible, you can start the target service extension ability;
481     * If the target service extension ability is invisible,
482     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability.
483     * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
484     * @param { Want } want - Indicates the want info to start.
485     * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbility.
486     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
487     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
488     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
489     * @throws { BusinessError } 16000001 - The specified ability does not exist.
490     * @throws { BusinessError } 16000002 - Incorrect ability type.
491     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
492     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
493     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
494     * @throws { BusinessError } 16000011 - The context does not exist.
495     * @throws { BusinessError } 16000050 - Internal error.
496     * @throws { BusinessError } 16200001 - The caller has been released.
497     * @syscap SystemCapability.Ability.AbilityRuntime.Core
498     * @systemapi
499     * @StageModelOnly
500     * @since 9
501     */
502    startServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void;
503
504    /**
505     * Starts a new service extension ability. If the caller application is in foreground, you can use this method to start service extension ability;
506     * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
507     * If the target service extension ability is visible, you can start the target service extension ability;
508     * If the target service extension ability is invisible,
509     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability.
510     * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
511     * @param { Want } want - Indicates the want info to start.
512     * @returns { Promise<void> } The promise returned by the function.
513     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
514     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
515     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
516     * @throws { BusinessError } 16000001 - The specified ability does not exist.
517     * @throws { BusinessError } 16000002 - Incorrect ability type.
518     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
519     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
520     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
521     * @throws { BusinessError } 16000011 - The context does not exist.
522     * @throws { BusinessError } 16000050 - Internal error.
523     * @throws { BusinessError } 16200001 - The caller has been released.
524     * @syscap SystemCapability.Ability.AbilityRuntime.Core
525     * @systemapi
526     * @StageModelOnly
527     * @since 9
528     */
529    startServiceExtensionAbility(want: Want): Promise<void>;
530
531    /**
532     * Starts a new service extension ability with account. If the caller application is in foreground,
533     * you can use this method to start service extension ability; If the caller application is in the background,
534     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
535     * If the target service extension ability is visible, you can start the target service extension ability;
536     * If the target service extension ability is invisible,
537     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability.
538     * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
539     * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
540     * @param { Want } want - Indicates the want info to start.
541     * @param { number } accountId - Indicates the account to start.
542     * @param { AsyncCallback<void> } callback - The callback of startServiceExtensionAbilityWithAccount.
543     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
544     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
545     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
546     * @throws { BusinessError } 16000001 - The specified ability does not exist.
547     * @throws { BusinessError } 16000002 - Incorrect ability type.
548     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
549     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
550     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
551     * @throws { BusinessError } 16000011 - The context does not exist.
552     * @throws { BusinessError } 16000050 - Internal error.
553     * @throws { BusinessError } 16200001 - The caller has been released.
554     * @syscap SystemCapability.Ability.AbilityRuntime.Core
555     * @systemapi
556     * @StageModelOnly
557     * @since 9
558     */
559    startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void;
560
561    /**
562     * Starts a new service extension ability with account. If the caller application is in foreground,
563     * you can use this method to start service extension ability; If the caller application is in the background,
564     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
565     * If the target service extension ability is visible, you can start the target service extension ability;
566     * If the target service extension ability is invisible,
567     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability.
568     * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
569     * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
570     * @param { Want } want - Indicates the want info to start.
571     * @param { number } accountId - Indicates the account to start.
572     * @returns { Promise<void> } The promise returned by the function.
573     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
574     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
575     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
576     * @throws { BusinessError } 16000001 - The specified ability does not exist.
577     * @throws { BusinessError } 16000002 - Incorrect ability type.
578     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
579     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
580     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
581     * @throws { BusinessError } 16000011 - The context does not exist.
582     * @throws { BusinessError } 16000050 - Internal error.
583     * @throws { BusinessError } 16200001 - The caller has been released.
584     * @syscap SystemCapability.Ability.AbilityRuntime.Core
585     * @systemapi
586     * @StageModelOnly
587     * @since 9
588     */
589    startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>;
590
591    /**
592     * Stops other service extension ability. If the caller application is in foreground,
593     * you can use this method to stop service extension ability; If the caller application is in the background,
594     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
595     * If the target service extension ability is visible, you can stop the target service extension ability;
596     * If the target service extension ability is invisible,
597     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability.
598     * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
599     * @param { Want } want - Indicates the want info to start.
600     * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbility.
601     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
602     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
603     * @throws { BusinessError } 16000001 - The specified ability does not exist.
604     * @throws { BusinessError } 16000002 - Incorrect ability type.
605     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
606     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
607     * @throws { BusinessError } 16000011 - The context does not exist.
608     * @throws { BusinessError } 16000050 - Internal error.
609     * @throws { BusinessError } 16200001 - The caller has been released.
610     * @syscap SystemCapability.Ability.AbilityRuntime.Core
611     * @systemapi
612     * @StageModelOnly
613     * @since 9
614     */
615    stopServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void;
616
617    /**
618     * Stops other service extension ability. If the caller application is in foreground,
619     * you can use this method to stop service extension ability; If the caller application is in the background,
620     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
621     * If the target service extension ability is visible, you can stop the target service extension ability;
622     * If the target service extension ability is invisible,
623     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability.
624     * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
625     * @param { Want } want - Indicates the want info to start.
626     * @returns { Promise<void> } The promise returned by the function.
627     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
628     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
629     * @throws { BusinessError } 16000001 - The specified ability does not exist.
630     * @throws { BusinessError } 16000002 - Incorrect ability type.
631     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
632     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
633     * @throws { BusinessError } 16000011 - The context does not exist.
634     * @throws { BusinessError } 16000050 - Internal error.
635     * @throws { BusinessError } 16200001 - The caller has been released.
636     * @syscap SystemCapability.Ability.AbilityRuntime.Core
637     * @systemapi
638     * @StageModelOnly
639     * @since 9
640     */
641    stopServiceExtensionAbility(want: Want): Promise<void>;
642
643    /**
644     * Stops other service extension ability with account. If the caller application is in foreground,
645     * you can use this method to stop service extension ability; If the caller application is in the background,
646     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
647     * If the target service extension ability is visible, you can stop the target service extension ability;
648     * If the target service extension ability is invisible,
649     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability.
650     * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
651     * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
652     * @param { Want } want - Indicates the want info to start.
653     * @param { number } accountId - Indicates the accountId to start.
654     * @param { AsyncCallback<void> } callback - The callback of stopServiceExtensionAbilityWithAccount.
655     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
656     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
657     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
658     * @throws { BusinessError } 16000001 - The specified ability does not exist.
659     * @throws { BusinessError } 16000002 - Incorrect ability type.
660     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
661     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
662     * @throws { BusinessError } 16000011 - The context does not exist.
663     * @throws { BusinessError } 16000050 - Internal error.
664     * @throws { BusinessError } 16200001 - The caller has been released.
665     * @syscap SystemCapability.Ability.AbilityRuntime.Core
666     * @systemapi
667     * @StageModelOnly
668     * @since 9
669     */
670    stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void;
671
672    /**
673     * Stops other service extension ability with account. If the caller application is in foreground,
674     * you can use this method to stop service extension ability; If the caller application is in the background,
675     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
676     * If the target service extension ability is visible, you can stop the target service extension ability;
677     * If the target service extension ability is invisible,
678     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to stop target invisible service extension ability.
679     * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
680     * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
681     * @param { Want } want - Indicates the want info to start.
682     * @param { number } accountId - Indicates the accountId to start.
683     * @returns { Promise<void> } The promise returned by the function.
684     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
685     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
686     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
687     * @throws { BusinessError } 16000001 - The specified ability does not exist.
688     * @throws { BusinessError } 16000002 - Incorrect ability type.
689     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
690     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
691     * @throws { BusinessError } 16000011 - The context does not exist.
692     * @throws { BusinessError } 16000050 - Internal error.
693     * @throws { BusinessError } 16200001 - The caller has been released.
694     * @syscap SystemCapability.Ability.AbilityRuntime.Core
695     * @systemapi
696     * @StageModelOnly
697     * @since 9
698     */
699    stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>;
700
701    /**
702     * Destroys this Page ability.
703     * @param { AsyncCallback<void> } callback - The callback of terminateSelf.
704     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
705     * @throws { BusinessError } 16000001 - The specified ability does not exist.
706     * @throws { BusinessError } 16000004 - Can not start invisible component.
707     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
708     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
709     * @throws { BusinessError } 16000011 - The context does not exist.
710     * @throws { BusinessError } 16000050 - Internal error.
711     * @syscap SystemCapability.Ability.AbilityRuntime.Core
712     * @StageModelOnly
713     * @since 9
714     */
715    terminateSelf(callback: AsyncCallback<void>): void;
716
717    /**
718     * Destroys this Page ability.
719     * @returns { Promise<void> } The promise returned by the function.
720     * @throws { BusinessError } 16000001 - The specified ability does not exist.
721     * @throws { BusinessError } 16000004 - Can not start invisible component.
722     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
723     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
724     * @throws { BusinessError } 16000011 - The context does not exist.
725     * @throws { BusinessError } 16000050 - Internal error.
726     * @syscap SystemCapability.Ability.AbilityRuntime.Core
727     * @StageModelOnly
728     * @since 9
729     */
730    terminateSelf(): Promise<void>;
731
732    /**
733     * Sets the result code and data to be returned by this Page ability to the caller
734     * and destroys this Page ability.
735     * @param { AbilityResult } parameter - Indicates the result to return.
736     * @param { AsyncCallback<void> } callback - The callback of terminateSelfWithResult.
737     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
738     * @throws { BusinessError } 16000001 - The specified ability does not exist.
739     * @throws { BusinessError } 16000004 - Can not start invisible component.
740     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
741     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
742     * @throws { BusinessError } 16000011 - The context does not exist.
743     * @throws { BusinessError } 16000050 - Internal error.
744     * @syscap SystemCapability.Ability.AbilityRuntime.Core
745     * @StageModelOnly
746     * @since 9
747     */
748    terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void;
749
750    /**
751     * Sets the result code and data to be returned by this Page ability to the caller
752     * and destroys this Page ability.
753     * @param { AbilityResult } parameter - Indicates the result to return.
754     * @returns { Promise<void> } The promise returned by the function.
755     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
756     * @throws { BusinessError } 16000001 - The specified ability does not exist.
757     * @throws { BusinessError } 16000004 - Can not start invisible component.
758     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
759     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
760     * @throws { BusinessError } 16000011 - The context does not exist.
761     * @throws { BusinessError } 16000050 - Internal error.
762     * @syscap SystemCapability.Ability.AbilityRuntime.Core
763     * @StageModelOnly
764     * @since 9
765     */
766    terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
767
768    /**
769     * Connects the current ability to an service extension ability using the AbilityInfo.AbilityType.SERVICE template.
770     * If the caller application is in foreground, you can use this method to connect service extension ability;
771     * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
772     * If the target service extension ability is visible, you can connect the target service extension ability;
773     * If the target service extension ability is invisible,
774     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to connect target invisible service extension ability.
775     * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
776     * @param { Want } want - The element name of the service ability
777     * @param { ConnectOptions } options - The remote object instance
778     * @returns { number } Returns the number code of the ability connected
779     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
780     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
781     * @throws { BusinessError } 16000001 - The specified ability does not exist.
782     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
783     * @throws { BusinessError } 16000011 - The context does not exist.
784     * @throws { BusinessError } 16000050 - Internal error.
785     * @syscap SystemCapability.Ability.AbilityRuntime.Core
786     * @StageModelOnly
787     * @since 9
788     */
789    connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
790
791    /**
792     * Connects the current ability to an service extension ability using the AbilityInfo.AbilityType.SERVICE template with account.
793     * If the caller application is in foreground, you can use this method to connect service extension ability;
794     * If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
795     * If the target service extension ability is visible, you can connect the target service extension ability;
796     * If the target service extension ability is invisible,
797     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to connect target invisible service extension ability.
798     * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
799     * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
800     * @param { Want } want - The element name of the service ability
801     * @param { number } accountId - The account to connect
802     * @param { ConnectOptions } options - The remote object instance
803     * @returns { number } Returns the number code of the ability connected
804     * @throws { BusinessError } 201 - The application does not have permission to call the interface.
805     * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
806     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
807     * @throws { BusinessError } 16000001 - The specified ability does not exist.
808     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
809     * @throws { BusinessError } 16000011 - The context does not exist.
810     * @throws { BusinessError } 16000050 - Internal error.
811     * @syscap SystemCapability.Ability.AbilityRuntime.Core
812     * @systemapi
813     * @StageModelOnly
814     * @since 9
815     */
816    connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;
817
818    /**
819     * The callback interface is connected successfully.
820     * @param { number } connection - The number code of the ability connected
821     * @param { AsyncCallback<void> } callback - The callback of disconnectAbility.
822     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
823     * @throws { BusinessError } 16000011 - The context does not exist.
824     * @throws { BusinessError } 16000050 - Internal error.
825     * @syscap SystemCapability.Ability.AbilityRuntime.Core
826     * @StageModelOnly
827     * @since 9
828     */
829    disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback<void>): void;
830
831    /**
832     * The callback interface is connected successfully.
833     * @param { number } connection - The number code of the ability connected
834     * @returns { Promise<void> } The promise returned by the function.
835     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
836     * @throws { BusinessError } 16000011 - The context does not exist.
837     * @throws { BusinessError } 16000050 - Internal error.
838     * @syscap SystemCapability.Ability.AbilityRuntime.Core
839     * @StageModelOnly
840     * @since 9
841     */
842    disconnectServiceExtensionAbility(connection: number): Promise<void>;
843
844    /**
845     * Set mission label of current ability.
846     * @param { string } label - The label of ability that showed in recent missions.
847     * @param { AsyncCallback<void> } callback - The callback of setMissionLabel.
848     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
849     * @throws { BusinessError } 16000011 - The context does not exist.
850     * @throws { BusinessError } 16000050 - Internal error.
851     * @syscap SystemCapability.Ability.AbilityRuntime.Core
852     * @StageModelOnly
853     * @since 9
854     */
855    setMissionLabel(label: string, callback: AsyncCallback<void>): void;
856
857    /**
858     * Set mission label of current ability.
859     * @param { string } label - The label of ability that showed in recent missions.
860     * @returns { Promise<void> } The promise returned by the function.
861     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
862     * @throws { BusinessError } 16000011 - The context does not exist.
863     * @throws { BusinessError } 16000050 - Internal error.
864     * @syscap SystemCapability.Ability.AbilityRuntime.Core
865     * @StageModelOnly
866     * @since 9
867     */
868    setMissionLabel(label: string): Promise<void>;
869
870    /**
871     * Set mission icon of current ability.
872     * @param { image.PixelMap } icon - The icon of ability that showed in recent missions.
873     * @param { AsyncCallback<void> } callback - The callback of setMissionIcon.
874     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
875     * @throws { BusinessError } 16000011 - The context does not exist.
876     * @throws { BusinessError } 16000050 - Internal error.
877     * @syscap SystemCapability.Ability.AbilityRuntime.Core
878     * @systemapi
879     * @StageModelOnly
880     * @since 9
881     */
882    setMissionIcon(icon: image.PixelMap, callback: AsyncCallback<void>): void;
883
884    /**
885     * Set mission icon of current ability.
886     * @param { image.PixelMap } icon - The icon of ability that showed in recent missions.
887     * @returns { Promise<void> } The promise returned by the function.
888     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
889     * @throws { BusinessError } 16000011 - The context does not exist.
890     * @throws { BusinessError } 16000050 - Internal error.
891     * @syscap SystemCapability.Ability.AbilityRuntime.Core
892     * @systemapi
893     * @StageModelOnly
894     * @since 9
895     */
896    setMissionIcon(icon: image.PixelMap): Promise<void>;
897
898    /**
899     * Restore window stage data in ability continuation
900     * @param { LocalStorage } localStorage - the storage data used to restore window stage
901     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
902     * @throws { BusinessError } 16000011 - The context does not exist.
903     * @throws { BusinessError } 16000050 - Internal error.
904     * @syscap SystemCapability.Ability.AbilityRuntime.Core
905     * @StageModelOnly
906     * @since 9
907     */
908    restoreWindowStage(localStorage: LocalStorage): void;
909
910    /**
911     * Check to see ability is in terminating state.
912     * @returns { boolean } Returns true when ability is in terminating state, else returns false.
913     * @syscap SystemCapability.Ability.AbilityRuntime.Core
914     * @throws { BusinessError } 16000011 - The context does not exist.
915     * @StageModelOnly
916     * @since 9
917     */
918    isTerminating(): boolean;
919
920    /**
921     * Starts a specific ability. If ability is multi instance, will start a recent instance. If the caller application is in foreground,
922     * you can use this method to start ability; If the caller application is in the background,
923     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
924     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
925     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
926     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
927     * @param { Want } want - Indicates the ability to start.
928     * @param { AsyncCallback<void> } callback - The callback of startAbility.
929     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
930     * @throws { BusinessError } 16000001 - The specified ability does not exist.
931     * @throws { BusinessError } 16000002 - Incorrect ability type.
932     * @throws { BusinessError } 16000004 - Can not start invisible component.
933     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
934     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
935     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
936     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
937     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
938     * @throws { BusinessError } 16000011 - The context does not exist.
939     * @throws { BusinessError } 16000050 - Internal error.
940     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
941     * @throws { BusinessError } 16000055 - Installation-free timed out.
942     * @throws { BusinessError } 16200001 - The caller has been released.
943     * @syscap SystemCapability.Ability.AbilityRuntime.Core
944     * @systemapi
945     * @StageModelOnly
946     * @since 9
947     */
948    startRecentAbility(want: Want, callback: AsyncCallback<void>): void;
949
950    /**
951     * Starts a specific ability. If ability is multi instance, will start a recent instance. If the caller application is in foreground,
952     * you can use this method to start ability; If the caller application is in the background,
953     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
954     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
955     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
956     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
957     * @param { Want } want - Indicates the ability to start.
958     * @param { StartOptions } options - Indicates the start options.
959     * @param { AsyncCallback<void> } callback - The callback of startAbility.
960     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
961     * @throws { BusinessError } 16000001 - The specified ability does not exist.
962     * @throws { BusinessError } 16000002 - Incorrect ability type.
963     * @throws { BusinessError } 16000004 - Can not start invisible component.
964     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
965     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
966     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
967     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
968     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
969     * @throws { BusinessError } 16000011 - The context does not exist.
970     * @throws { BusinessError } 16000050 - Internal error.
971     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
972     * @throws { BusinessError } 16000055 - Installation-free timed out.
973     * @throws { BusinessError } 16200001 - The caller has been released.
974     * @syscap SystemCapability.Ability.AbilityRuntime.Core
975     * @systemapi
976     * @StageModelOnly
977     * @since 9
978     */
979    startRecentAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
980
981    /**
982     * Starts a specific ability. If ability is multi instance, will start a recent instance. If the caller application is in foreground,
983     * you can use this method to start ability; If the caller application is in the background,
984     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
985     * If the target ability is visible, you can start the target ability; If the target ability is invisible,
986     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
987     * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
988     * @param { Want } want - Indicates the ability to start.
989     * @param { StartOptions } options - Indicates the start options.
990     * @returns { Promise<void> } The promise returned by the function.
991     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
992     * @throws { BusinessError } 16000001 - The specified ability does not exist.
993     * @throws { BusinessError } 16000002 - Incorrect ability type.
994     * @throws { BusinessError } 16000004 - Can not start invisible component.
995     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
996     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
997     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
998     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
999     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
1000     * @throws { BusinessError } 16000011 - The context does not exist.
1001     * @throws { BusinessError } 16000050 - Internal error.
1002     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
1003     * @throws { BusinessError } 16000055 - Installation-free timed out.
1004     * @throws { BusinessError } 16200001 - The caller has been released.
1005     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1006     * @systemapi
1007     * @StageModelOnly
1008     * @since 9
1009     */
1010    startRecentAbility(want: Want, options?: StartOptions): Promise<void>;
1011
1012    /**
1013     * Starts a service extension ability that supports modal dialog. If the caller application is in foreground,
1014     * you can use this method to start service extension ability; If the caller application is in the background,
1015     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
1016     * If the target service extension ability is visible, you can start the target service extension ability;
1017     * If the target service extension ability is invisible,
1018     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability.
1019     * @param want { Want } - Indicates the dialog service to start.
1020     * @param { AsyncCallback<RequestResult> } result - The callback is used to return the request result.
1021     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
1022     * @throws { BusinessError } 16000001 - The specified ability does not exist.
1023     * @throws { BusinessError } 16000002 - Incorrect ability type.
1024     * @throws { BusinessError } 16000004 - Can not start invisible component.
1025     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
1026     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
1027     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
1028     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
1029     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
1030     * @throws { BusinessError } 16000011 - The context does not exist.
1031     * @throws { BusinessError } 16000050 - Internal error.
1032     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
1033     * @throws { BusinessError } 16000055 - Installation-free timed out.
1034     * @throws { BusinessError } 16200001 - The caller has been released.
1035     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1036     * @StageModelOnly
1037     * @since 9
1038     */
1039    requestDialogService(want: Want, result: AsyncCallback<dialogRequest.RequestResult>): void;
1040
1041    /**
1042     * Starts a service extension ability that supports modal dialog. If the caller application is in foreground,
1043     * you can use this method to start service extension ability; If the caller application is in the background,
1044     * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
1045     * If the target service extension ability is visible, you can start the target service extension ability;
1046     * If the target service extension ability is invisible,
1047     * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible service extension ability.
1048     * @param want { Want } - Indicates the dialog service to start.
1049     * @returns { Promise<request.RequestResult> } Returns the request result.
1050     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
1051     * @throws { BusinessError } 16000001 - The specified ability does not exist.
1052     * @throws { BusinessError } 16000002 - Incorrect ability type.
1053     * @throws { BusinessError } 16000004 - Can not start invisible component.
1054     * @throws { BusinessError } 16000005 - The specified process does not have the permission.
1055     * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
1056     * @throws { BusinessError } 16000008 - The crowdtesting application expires.
1057     * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
1058     * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
1059     * @throws { BusinessError } 16000011 - The context does not exist.
1060     * @throws { BusinessError } 16000050 - Internal error.
1061     * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
1062     * @throws { BusinessError } 16000055 - Installation-free timed out.
1063     * @throws { BusinessError } 16200001 - The caller has been released.
1064     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1065     * @StageModelOnly
1066     * @since 9
1067     */
1068    requestDialogService(want: Want): Promise<dialogRequest.RequestResult>;
1069}
1070