• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023-2024 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/**
17 * @file
18 * @kit AbilityKit
19 */
20
21import type { AbilityResult } from '../ability/abilityResult';
22import type { AsyncCallback } from '../@ohos.base';
23import type { ConnectOptions } from '../ability/connectOptions';
24import ExtensionContext from './ExtensionContext';
25import type Want from '../@ohos.app.ability.Want';
26import type StartOptions from '../@ohos.app.ability.StartOptions';
27import type AtomicServiceOptions from '../@ohos.app.ability.AtomicServiceOptions';
28import OpenLinkOptions from '../@ohos.app.ability.OpenLinkOptions';
29import type UIServiceProxy from './UIServiceProxy';
30import type UIServiceExtensionConnectCallback from './UIServiceExtensionConnectCallback';
31
32/**
33 * The context of UI extension. It allows access to UIExtension-specific resources.
34 *
35 * @extends ExtensionContext
36 * @syscap SystemCapability.Ability.AbilityRuntime.Core
37 * @stagemodelonly
38 * @since 10
39 */
40export default class UIExtensionContext extends ExtensionContext {
41  /**
42   * UI extension uses this method to start a specific ability.If the caller application is in foreground,
43   * you can use this method to start ability; If the caller application is in the background,
44   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
45   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
46   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
47   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
48   *
49   * @param { Want } want - Indicates the ability to start.
50   * @param { AsyncCallback<void> } callback - The callback of startAbility.
51   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
52   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
53   * @throws { BusinessError } 16000001 - The specified ability does not exist.
54   * @throws { BusinessError } 16000002 - Incorrect ability type.
55   * @throws { BusinessError } 16000004 - Can not start invisible component.
56   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
57   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
58   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
59   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
60   * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
61   * @throws { BusinessError } 16000011 - The context does not exist.
62   * @throws { BusinessError } 16000012 - The application is controlled.
63   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
64   * @throws { BusinessError } 16000050 - Internal error.
65   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
66   * @throws { BusinessError } 16000055 - Installation-free timed out.
67   * @throws { BusinessError } 16200001 - The caller has been released.
68   * @syscap SystemCapability.Ability.AbilityRuntime.Core
69   * @stagemodelonly
70   * @since 10
71   */
72  /**
73   * UI extension uses this method to start a specific ability.If the caller application is in foreground,
74   * you can use this method to start ability; If the caller application is in the background,
75   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
76   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
77   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
78   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
79   *
80   * @param { Want } want - Indicates the ability to start.
81   * @param { AsyncCallback<void> } callback - The callback of startAbility.
82   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
83   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
84   * @throws { BusinessError } 16000001 - The specified ability does not exist.
85   * @throws { BusinessError } 16000002 - Incorrect ability type.
86   * @throws { BusinessError } 16000004 - Can not start invisible component.
87   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
88   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
89   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
90   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
91   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
92   * @throws { BusinessError } 16000011 - The context does not exist.
93   * @throws { BusinessError } 16000012 - The application is controlled.
94   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
95   * @throws { BusinessError } 16000018 - The application is not allow jumping to other applications.
96   * @throws { BusinessError } 16000019 - Can not match any component.
97   * @throws { BusinessError } 16000050 - Internal error.
98   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
99   * @throws { BusinessError } 16000055 - Installation-free timed out.
100   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
101   * @throws { BusinessError } 16000070 - The extension cannot start the service.
102   * @throws { BusinessError } 16000073 - The app clone index is invalid.
103   * @throws { BusinessError } 16200001 - The caller has been released.
104   * @syscap SystemCapability.Ability.AbilityRuntime.Core
105   * @stagemodelonly
106   * @since 12
107   */
108  /**
109   * UI extension uses this method to start a specific ability.If the caller application is in foreground,
110   * you can use this method to start ability; If the caller application is in the background,
111   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
112   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
113   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
114   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
115   *
116   * @param { Want } want - Indicates the ability to start.
117   * @param { AsyncCallback<void> } callback - The callback of startAbility.
118   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
119   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
120   * @throws { BusinessError } 16000001 - The specified ability does not exist.
121   * @throws { BusinessError } 16000002 - Incorrect ability type.
122   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
123   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
124   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
125   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
126   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
127   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
128   * @throws { BusinessError } 16000011 - The context does not exist.
129   * @throws { BusinessError } 16000012 - The application is controlled.
130   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
131   * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version 11 or later.
132   * @throws { BusinessError } 16000019 - No matching ability is found.
133   * @throws { BusinessError } 16000050 - Internal error.
134   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
135   * @throws { BusinessError } 16000055 - Installation-free timed out.
136   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
137   * @throws { BusinessError } 16000070 - The extension cannot start the service.
138   * @throws { BusinessError } 16000071 - App clone is not supported.
139   * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported.
140   * @throws { BusinessError } 16000073 - The app clone index is invalid.
141   * @throws { BusinessError } 16000076 - The app instance key is invalid.
142   * @throws { BusinessError } 16000077 - The number of app instances reaches the limit.
143   * @throws { BusinessError } 16000078 - The multi-instance is not supported.
144   * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified.
145   * @throws { BusinessError } 16000080 - Creating a new instance is not supported.
146   * @throws { BusinessError } 16200001 - The caller has been released.
147   * @syscap SystemCapability.Ability.AbilityRuntime.Core
148   * @stagemodelonly
149   * @since 14
150   */
151  startAbility(want: Want, callback: AsyncCallback<void>): void;
152
153  /**
154   * UI extension uses this method to start a specific ability.If the caller application is in foreground,
155   * you can use this method to start ability; If the caller application is in the background,
156   * 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   *
161   * @param { Want } want - Indicates the ability to start.
162   * @param { StartOptions } options - Indicates the start options.
163   * @param { AsyncCallback<void> } callback - The callback of startAbility.
164   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
165   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
166   * @throws { BusinessError } 16000001 - The specified ability does not exist.
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 } 16000009 - An ability cannot be started or stopped in Wukong mode.
172   * @throws { BusinessError } 16000011 - The context does not exist.
173   * @throws { BusinessError } 16000012 - The application is controlled.
174   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
175   * @throws { BusinessError } 16000050 - Internal error.
176   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
177   * @throws { BusinessError } 16000055 - Installation-free timed out.
178   * @throws { BusinessError } 16200001 - The caller has been released.
179   * @syscap SystemCapability.Ability.AbilityRuntime.Core
180   * @stagemodelonly
181   * @since 10
182   */
183  /**
184   * UI extension uses this method to start a specific ability.If the caller application is in foreground,
185   * you can use this method to start ability; If the caller application is in the background,
186   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
187   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
188   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
189   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
190   *
191   * @param { Want } want - Indicates the ability to start.
192   * @param { StartOptions } options - Indicates the start options.
193   * @param { AsyncCallback<void> } callback - The callback of startAbility.
194   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
195   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
196   * @throws { BusinessError } 16000001 - The specified ability does not exist.
197   * @throws { BusinessError } 16000004 - Can not start invisible component.
198   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
199   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
200   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
201   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
202   * @throws { BusinessError } 16000011 - The context does not exist.
203   * @throws { BusinessError } 16000012 - The application is controlled.
204   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
205   * @throws { BusinessError } 16000018 - The application is not allow jumping to other applications.
206   * @throws { BusinessError } 16000019 - Can not match any component.
207   * @throws { BusinessError } 16000050 - Internal error.
208   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
209   * @throws { BusinessError } 16000055 - Installation-free timed out.
210   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
211   * @throws { BusinessError } 16000070 - The extension cannot start the service.
212   * @throws { BusinessError } 16000073 - The app clone index is invalid.
213   * @throws { BusinessError } 16200001 - The caller has been released.
214   * @syscap SystemCapability.Ability.AbilityRuntime.Core
215   * @stagemodelonly
216   * @since 12
217   */
218  /**
219   * UI extension uses this method to start a specific ability.If the caller application is in foreground,
220   * you can use this method to start ability; If the caller application is in the background,
221   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
222   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
223   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
224   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
225   *
226   * @param { Want } want - Indicates the ability to start.
227   * @param { StartOptions } options - Indicates the start options.
228   * @param { AsyncCallback<void> } callback - The callback of startAbility.
229   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
230   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
231   * @throws { BusinessError } 16000001 - The specified ability does not exist.
232   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
233   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
234   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
235   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
236   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
237   * @throws { BusinessError } 16000011 - The context does not exist.
238   * @throws { BusinessError } 16000012 - The application is controlled.
239   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
240   * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version 11 or later.
241   * @throws { BusinessError } 16000019 - No matching ability is found.
242   * @throws { BusinessError } 16000050 - Internal error.
243   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
244   * @throws { BusinessError } 16000055 - Installation-free timed out.
245   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
246   * @throws { BusinessError } 16000070 - The extension cannot start the service.
247   * @throws { BusinessError } 16000071 - App clone is not supported.
248   * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported.
249   * @throws { BusinessError } 16000073 - The app clone index is invalid.
250   * @throws { BusinessError } 16000076 - The app instance key is invalid.
251   * @throws { BusinessError } 16000077 - The number of app instances reaches the limit.
252   * @throws { BusinessError } 16000078 - The multi-instance is not supported.
253   * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified.
254   * @throws { BusinessError } 16000080 - Creating a new instance is not supported.
255   * @throws { BusinessError } 16200001 - The caller has been released.
256   * @syscap SystemCapability.Ability.AbilityRuntime.Core
257   * @stagemodelonly
258   * @since 14
259   */
260  startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
261
262  /**
263   * UI extension uses this method to start a specific ability.If the caller application is in foreground,
264   * you can use this method to start ability; If the caller application is in the background,
265   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
266   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
267   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
268   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
269   *
270   * @param { Want } want - Indicates the ability to start.
271   * @param { StartOptions } [options] - Indicates the start options.
272   * @returns { Promise<void> } The promise returned by the function.
273   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
274   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
275   * @throws { BusinessError } 16000001 - The specified ability does not exist.
276   * @throws { BusinessError } 16000002 - Incorrect ability type.
277   * @throws { BusinessError } 16000004 - Can not start invisible component.
278   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
279   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
280   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
281   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
282   * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
283   * @throws { BusinessError } 16000011 - The context does not exist.
284   * @throws { BusinessError } 16000012 - The application is controlled.
285   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
286   * @throws { BusinessError } 16000050 - Internal error.
287   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
288   * @throws { BusinessError } 16000055 - Installation-free timed out.
289   * @throws { BusinessError } 16200001 - The caller has been released.
290   * @syscap SystemCapability.Ability.AbilityRuntime.Core
291   * @stagemodelonly
292   * @since 10
293   */
294  /**
295   * UI extension uses this method to start a specific ability.If the caller application is in foreground,
296   * you can use this method to start ability; If the caller application is in the background,
297   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
298   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
299   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
300   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
301   *
302   * @param { Want } want - Indicates the ability to start.
303   * @param { StartOptions } [options] - Indicates the start options.
304   * @returns { Promise<void> } The promise returned by the function.
305   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
306   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
307   * @throws { BusinessError } 16000001 - The specified ability does not exist.
308   * @throws { BusinessError } 16000002 - Incorrect ability type.
309   * @throws { BusinessError } 16000004 - Can not start invisible component.
310   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
311   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
312   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
313   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
314   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
315   * @throws { BusinessError } 16000011 - The context does not exist.
316   * @throws { BusinessError } 16000012 - The application is controlled.
317   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
318   * @throws { BusinessError } 16000018 - The application is not allow jumping to other applications.
319   * @throws { BusinessError } 16000019 - Can not match any component.
320   * @throws { BusinessError } 16000050 - Internal error.
321   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
322   * @throws { BusinessError } 16000055 - Installation-free timed out.
323   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
324   * @throws { BusinessError } 16000070 - The extension cannot start the service.
325   * @throws { BusinessError } 16000073 - The app clone index is invalid.
326   * @throws { BusinessError } 16200001 - The caller has been released.
327   * @syscap SystemCapability.Ability.AbilityRuntime.Core
328   * @stagemodelonly
329   * @since 12
330   */
331  /**
332   * UI extension uses this method to start a specific ability.If the caller application is in foreground,
333   * you can use this method to start ability; If the caller application is in the background,
334   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
335   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
336   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
337   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
338   *
339   * @param { Want } want - Indicates the ability to start.
340   * @param { StartOptions } [options] - Indicates the start options.
341   * @returns { Promise<void> } The promise returned by the function.
342   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
343   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
344   * @throws { BusinessError } 16000001 - The specified ability does not exist.
345   * @throws { BusinessError } 16000002 - Incorrect ability type.
346   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
347   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
348   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
349   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
350   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
351   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
352   * @throws { BusinessError } 16000011 - The context does not exist.
353   * @throws { BusinessError } 16000012 - The application is controlled.
354   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
355   * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version 11 or later.
356   * @throws { BusinessError } 16000019 - No matching ability is found.
357   * @throws { BusinessError } 16000050 - Internal error.
358   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
359   * @throws { BusinessError } 16000055 - Installation-free timed out.
360   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
361   * @throws { BusinessError } 16000070 - The extension cannot start the service.
362   * @throws { BusinessError } 16000071 - App clone is not supported.
363   * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported.
364   * @throws { BusinessError } 16000073 - The app clone index is invalid.
365   * @throws { BusinessError } 16000076 - The app instance key is invalid.
366   * @throws { BusinessError } 16000077 - The number of app instances reaches the limit.
367   * @throws { BusinessError } 16000078 - The multi-instance is not supported.
368   * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified.
369   * @throws { BusinessError } 16000080 - Creating a new instance is not supported.
370   * @throws { BusinessError } 16200001 - The caller has been released.
371   * @syscap SystemCapability.Ability.AbilityRuntime.Core
372   * @stagemodelonly
373   * @since 14
374   */
375  startAbility(want: Want, options?: StartOptions): Promise<void>;
376
377  /**
378   * UI extension uses this method to start a specific ability by implicit want.If the caller application is in foreground,
379   * you can use this method to start ability; If the caller application is in the background,
380   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
381   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
382   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
383   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
384   *
385   * @param { string } link - Indicates the ability to start.
386   * @param { OpenLinkOptions } [options] - Indicates the open link options.
387   * @param { AsyncCallback<AbilityResult> } [callback] - The callback is used to return the ability result.
388   * @returns { Promise<void> } The promise returned by the function.
389   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
390   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
391   * @throws { BusinessError } 16000001 - The specified ability does not exist.
392   * @throws { BusinessError } 16000002 - Incorrect ability type.
393   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
394   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
395   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
396   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
397   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
398   * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
399   * @throws { BusinessError } 16000011 - The context does not exist.
400   * @throws { BusinessError } 16000012 - The application is controlled.
401   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
402   * @throws { BusinessError } 16000019 - No matching ability is found.
403   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
404   * @throws { BusinessError } 16200001 - The caller has been released.
405   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
406   * @syscap SystemCapability.Ability.AbilityRuntime.Core
407   * @stagemodelonly
408   * @since 12
409   */
410  openLink(link: string, options?: OpenLinkOptions, callback?: AsyncCallback<AbilityResult>): Promise<void>;
411
412  /**
413   * Starts an ability and returns the execution result when the ability is destroyed.
414   * If the caller application is in foreground, you can use this method to start ability; If the caller application
415   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
416   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
417   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
418   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
419   *
420   * @param { Want } want - Indicates the ability to start.
421   * @param { AsyncCallback<AbilityResult> } callback - The callback is used to return the result of startAbility.
422   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
423   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
424   * @throws { BusinessError } 16000001 - The specified ability does not exist.
425   * @throws { BusinessError } 16000002 - Incorrect ability type.
426   * @throws { BusinessError } 16000004 - Can not start invisible component.
427   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
428   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
429   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
430   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
431   * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
432   * @throws { BusinessError } 16000011 - The context does not exist.
433   * @throws { BusinessError } 16000012 - The application is controlled.
434   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
435   * @throws { BusinessError } 16000050 - Internal error.
436   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
437   * @throws { BusinessError } 16000055 - Installation-free timed out.
438   * @throws { BusinessError } 16200001 - The caller has been released.
439   * @syscap SystemCapability.Ability.AbilityRuntime.Core
440   * @stagemodelonly
441   * @since 10
442   */
443  /**
444   * Starts an ability and returns the execution result when the ability is destroyed.
445   * If the caller application is in foreground, you can use this method to start ability; If the caller application
446   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
447   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
448   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
449   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
450   *
451   * @param { Want } want - Indicates the ability to start.
452   * @param { AsyncCallback<AbilityResult> } callback - The callback is used to return the result of startAbility.
453   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
454   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
455   * @throws { BusinessError } 16000001 - The specified ability does not exist.
456   * @throws { BusinessError } 16000002 - Incorrect ability type.
457   * @throws { BusinessError } 16000004 - Can not start invisible component.
458   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
459   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
460   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
461   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
462   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
463   * @throws { BusinessError } 16000011 - The context does not exist.
464   * @throws { BusinessError } 16000012 - The application is controlled.
465   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
466   * @throws { BusinessError } 16000018 - The application is not allow jumping to other applications.
467   * @throws { BusinessError } 16000019 - Can not match any component.
468   * @throws { BusinessError } 16000050 - Internal error.
469   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
470   * @throws { BusinessError } 16000055 - Installation-free timed out.
471   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
472   * @throws { BusinessError } 16000070 - The extension cannot start the service.
473   * @throws { BusinessError } 16000073 - The app clone index is invalid.
474   * @throws { BusinessError } 16200001 - The caller has been released.
475   * @syscap SystemCapability.Ability.AbilityRuntime.Core
476   * @stagemodelonly
477   * @since 12
478   */
479  /**
480   * Starts an ability and returns the execution result when the ability is destroyed.
481   * If the caller application is in foreground, you can use this method to start ability; If the caller application
482   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
483   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
484   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
485   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
486   *
487   * @param { Want } want - Indicates the ability to start.
488   * @param { AsyncCallback<AbilityResult> } callback - The callback is used to return the result of startAbility.
489   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
490   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
491   * @throws { BusinessError } 16000001 - The specified ability does not exist.
492   * @throws { BusinessError } 16000002 - Incorrect ability type.
493   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
494   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
495   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
496   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
497   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
498   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
499   * @throws { BusinessError } 16000011 - The context does not exist.
500   * @throws { BusinessError } 16000012 - The application is controlled.
501   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
502   * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version 11 or later.
503   * @throws { BusinessError } 16000019 - No matching ability is found.
504   * @throws { BusinessError } 16000050 - Internal error.
505   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
506   * @throws { BusinessError } 16000055 - Installation-free timed out.
507   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
508   * @throws { BusinessError } 16000070 - The extension cannot start the service.
509   * @throws { BusinessError } 16000071 - App clone is not supported.
510   * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported.
511   * @throws { BusinessError } 16000073 - The app clone index is invalid.
512   * @throws { BusinessError } 16000076 - The app instance key is invalid.
513   * @throws { BusinessError } 16000077 - The number of app instances reaches the limit.
514   * @throws { BusinessError } 16000078 - The multi-instance is not supported.
515   * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified.
516   * @throws { BusinessError } 16000080 - Creating a new instance is not supported.
517   * @throws { BusinessError } 16200001 - The caller has been released.
518   * @syscap SystemCapability.Ability.AbilityRuntime.Core
519   * @stagemodelonly
520   * @since 14
521   */
522  startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void;
523
524  /**
525   * Starts an ability and returns the execution result when the ability is destroyed.
526   * If the caller application is in foreground, you can use this method to start ability; If the caller application
527   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
528   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
529   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
530   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
531   *
532   * @param { Want } want - Indicates the ability to start.
533   * @param { StartOptions } options - Indicates the start options.
534   * @param { AsyncCallback<AbilityResult> } callback - The callback is used to return the result of startAbility.
535   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
536   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
537   * @throws { BusinessError } 16000001 - The specified ability does not exist.
538   * @throws { BusinessError } 16000004 - Can not start invisible component.
539   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
540   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
541   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
542   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
543   * @throws { BusinessError } 16000011 - The context does not exist.
544   * @throws { BusinessError } 16000012 - The application is controlled.
545   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
546   * @throws { BusinessError } 16000050 - Internal error.
547   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
548   * @throws { BusinessError } 16000055 - Installation-free timed out.
549   * @throws { BusinessError } 16200001 - The caller has been released.
550   * @syscap SystemCapability.Ability.AbilityRuntime.Core
551   * @stagemodelonly
552   * @since 10
553   */
554  /**
555   * Starts an ability and returns the execution result when the ability is destroyed.
556   * If the caller application is in foreground, you can use this method to start ability; If the caller application
557   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
558   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
559   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
560   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
561   *
562   * @param { Want } want - Indicates the ability to start.
563   * @param { StartOptions } options - Indicates the start options.
564   * @param { AsyncCallback<AbilityResult> } callback - The callback is used to return the result of startAbility.
565   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
566   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
567   * @throws { BusinessError } 16000001 - The specified ability does not exist.
568   * @throws { BusinessError } 16000004 - Can not start invisible component.
569   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
570   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
571   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
572   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
573   * @throws { BusinessError } 16000011 - The context does not exist.
574   * @throws { BusinessError } 16000012 - The application is controlled.
575   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
576   * @throws { BusinessError } 16000018 - The application is not allow jumping to other applications.
577   * @throws { BusinessError } 16000019 - Can not match any component.
578   * @throws { BusinessError } 16000050 - Internal error.
579   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
580   * @throws { BusinessError } 16000055 - Installation-free timed out.
581   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
582   * @throws { BusinessError } 16000070 - The extension cannot start the service.
583   * @throws { BusinessError } 16000073 - The app clone index is invalid.
584   * @throws { BusinessError } 16200001 - The caller has been released.
585   * @syscap SystemCapability.Ability.AbilityRuntime.Core
586   * @stagemodelonly
587   * @since 12
588   */
589  /**
590   * Starts an ability and returns the execution result when the ability is destroyed.
591   * If the caller application is in foreground, you can use this method to start ability; If the caller application
592   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
593   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
594   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
595   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
596   *
597   * @param { Want } want - Indicates the ability to start.
598   * @param { StartOptions } options - Indicates the start options.
599   * @param { AsyncCallback<AbilityResult> } callback - The callback is used to return the result of startAbility.
600   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
601   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
602   * @throws { BusinessError } 16000001 - The specified ability does not exist.
603   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
604   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
605   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
606   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
607   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
608   * @throws { BusinessError } 16000011 - The context does not exist.
609   * @throws { BusinessError } 16000012 - The application is controlled.
610   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
611   * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version 11 or later.
612   * @throws { BusinessError } 16000019 - No matching ability is found.
613   * @throws { BusinessError } 16000050 - Internal error.
614   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
615   * @throws { BusinessError } 16000055 - Installation-free timed out.
616   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
617   * @throws { BusinessError } 16000070 - The extension cannot start the service.
618   * @throws { BusinessError } 16000071 - App clone is not supported.
619   * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported.
620   * @throws { BusinessError } 16000073 - The app clone index is invalid.
621   * @throws { BusinessError } 16000076 - The app instance key is invalid.
622   * @throws { BusinessError } 16000077 - The number of app instances reaches the limit.
623   * @throws { BusinessError } 16000078 - The multi-instance is not supported.
624   * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified.
625   * @throws { BusinessError } 16000080 - Creating a new instance is not supported.
626   * @throws { BusinessError } 16200001 - The caller has been released.
627   * @syscap SystemCapability.Ability.AbilityRuntime.Core
628   * @stagemodelonly
629   * @since 14
630   */
631  startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void;
632
633  /**
634   * Starts an ability and returns the execution result when the ability is destroyed.
635   * If the caller application is in foreground, you can use this method to start ability; If the caller application
636   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
637   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
638   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
639   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
640   *
641   * @param { Want } want - Indicates the ability to start.
642   * @param { StartOptions } [options] - Indicates the start options.
643   * @returns { Promise<AbilityResult> } Returns the result of startAbility.
644   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
645   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
646   * @throws { BusinessError } 16000001 - The specified ability does not exist.
647   * @throws { BusinessError } 16000002 - Incorrect ability type.
648   * @throws { BusinessError } 16000004 - Can not start invisible component.
649   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
650   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
651   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
652   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
653   * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
654   * @throws { BusinessError } 16000011 - The context does not exist.
655   * @throws { BusinessError } 16000012 - The application is controlled.
656   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
657   * @throws { BusinessError } 16000050 - Internal error.
658   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
659   * @throws { BusinessError } 16000055 - Installation-free timed out.
660   * @throws { BusinessError } 16200001 - The caller has been released.
661   * @syscap SystemCapability.Ability.AbilityRuntime.Core
662   * @stagemodelonly
663   * @since 10
664   */
665  /**
666   * Starts an ability and returns the execution result when the ability is destroyed.
667   * If the caller application is in foreground, you can use this method to start ability; If the caller application
668   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
669   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
670   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
671   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
672   *
673   * @param { Want } want - Indicates the ability to start.
674   * @param { StartOptions } [options] - Indicates the start options.
675   * @returns { Promise<AbilityResult> } Returns the result of startAbility.
676   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
677   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
678   * @throws { BusinessError } 16000001 - The specified ability does not exist.
679   * @throws { BusinessError } 16000002 - Incorrect ability type.
680   * @throws { BusinessError } 16000004 - Can not start invisible component.
681   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
682   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
683   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
684   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
685   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
686   * @throws { BusinessError } 16000011 - The context does not exist.
687   * @throws { BusinessError } 16000012 - The application is controlled.
688   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
689   * @throws { BusinessError } 16000018 - The application is not allow jumping to other applications.
690   * @throws { BusinessError } 16000019 - Can not match any component.
691   * @throws { BusinessError } 16000050 - Internal error.
692   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
693   * @throws { BusinessError } 16000055 - Installation-free timed out.
694   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
695   * @throws { BusinessError } 16000070 - The extension cannot start the service.
696   * @throws { BusinessError } 16000073 - The app clone index is invalid.
697   * @throws { BusinessError } 16200001 - The caller has been released.
698   * @syscap SystemCapability.Ability.AbilityRuntime.Core
699   * @stagemodelonly
700   * @since 12
701   */
702  /**
703   * Starts an ability and returns the execution result when the ability is destroyed.
704   * If the caller application is in foreground, you can use this method to start ability; If the caller application
705   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
706   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
707   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
708   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
709   *
710   * @param { Want } want - Indicates the ability to start.
711   * @param { StartOptions } [options] - Indicates the start options.
712   * @returns { Promise<AbilityResult> } Returns the result of startAbility.
713   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
714   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
715   * @throws { BusinessError } 16000001 - The specified ability does not exist.
716   * @throws { BusinessError } 16000002 - Incorrect ability type.
717   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
718   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
719   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
720   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
721   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
722   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
723   * @throws { BusinessError } 16000011 - The context does not exist.
724   * @throws { BusinessError } 16000012 - The application is controlled.
725   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
726   * @throws { BusinessError } 16000018 - Redirection to a third-party application is not allowed in API version 11 or later.
727   * @throws { BusinessError } 16000019 - No matching ability is found.
728   * @throws { BusinessError } 16000050 - Internal error.
729   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
730   * @throws { BusinessError } 16000055 - Installation-free timed out.
731   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
732   * @throws { BusinessError } 16000070 - The extension cannot start the service.
733   * @throws { BusinessError } 16000071 - App clone is not supported.
734   * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported.
735   * @throws { BusinessError } 16000073 - The app clone index is invalid.
736   * @throws { BusinessError } 16000076 - The app instance key is invalid.
737   * @throws { BusinessError } 16000077 - The number of app instances reaches the limit.
738   * @throws { BusinessError } 16000078 - The multi-instance is not supported.
739   * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified.
740   * @throws { BusinessError } 16000080 - Creating a new instance is not supported.
741   * @throws { BusinessError } 16200001 - The caller has been released.
742   * @syscap SystemCapability.Ability.AbilityRuntime.Core
743   * @stagemodelonly
744   * @since 14
745   */
746  startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>;
747
748  /**
749   * Starts a new ability using the original caller information, and returns the execution result when the ability
750   * is destroyed.
751   * If the caller application is in foreground, you can use this method to start ability; If the caller application
752   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
753   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
754   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
755   *
756   * @param { Want } want - Indicates the ability to start.
757   * @param { StartOptions } [options] - Indicates the start options.
758   * @returns { Promise<AbilityResult> } Returns the result of startAbility.
759   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
760   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
761   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
762   * @throws { BusinessError } 16000001 - The specified ability does not exist.
763   * @throws { BusinessError } 16000004 - Can not start invisible component.
764   * @throws { BusinessError } 16000050 - Internal error.
765   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
766   * @throws { BusinessError } 16000070 - The extension cannot start the service.
767   * @throws { BusinessError } 16000073 - The app clone index is invalid.
768   * @syscap SystemCapability.Ability.AbilityRuntime.Core
769   * @systemapi
770   * @stagemodelonly
771   * @since 12
772   */
773  /**
774   * Starts a new ability using the original caller information, and returns the execution result when the ability
775   * is destroyed.
776   * If the caller application is in foreground, you can use this method to start ability; If the caller application
777   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
778   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
779   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
780   *
781   * @param { Want } want - Indicates the ability to start.
782   * @param { StartOptions } [options] - Indicates the start options.
783   * @returns { Promise<AbilityResult> } Returns the result of startAbility.
784   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
785   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
786   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
787   * @throws { BusinessError } 16000001 - The specified ability does not exist.
788   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
789   * @throws { BusinessError } 16000050 - Internal error.
790   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
791   * @throws { BusinessError } 16000070 - The extension cannot start the service.
792   * @throws { BusinessError } 16000071 - App clone is not supported.
793   * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported.
794   * @throws { BusinessError } 16000073 - The app clone index is invalid.
795   * @throws { BusinessError } 16000076 - The app instance key is invalid.
796   * @throws { BusinessError } 16000077 - The number of app instances reaches the limit.
797   * @throws { BusinessError } 16000078 - The multi-instance is not supported.
798   * @throws { BusinessError } 16000079 - The APP_INSTANCE_KEY cannot be specified.
799   * @throws { BusinessError } 16000080 - Creating a new instance is not supported.
800   * @syscap SystemCapability.Ability.AbilityRuntime.Core
801   * @systemapi
802   * @stagemodelonly
803   * @since 14
804   */
805  startAbilityForResultAsCaller(want: Want, options?: StartOptions): Promise<AbilityResult>;
806
807  /**
808   * Connects the current ability to an service extension ability.
809   * If the target service extension ability is visible, you can connect the target service extension ability;
810   * If the target service extension ability is invisible,
811   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to connect target invisible service extension ability.
812   * If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
813   *
814   * @param { Want } want - The element name of the service ability
815   * @param { ConnectOptions } options - The remote object instance
816   * @returns { number } Returns the number code of the ability connected
817   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
818   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
819   * @throws { BusinessError } 16000001 - The specified ability does not exist.
820   * @throws { BusinessError } 16000002 - Incorrect ability type.
821   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
822   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
823   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
824   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
825   * @throws { BusinessError } 16000011 - The context does not exist.
826   * @throws { BusinessError } 16000050 - Internal error.
827   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
828   * @throws { BusinessError } 16000055 - Installation-free timed out.
829   * @throws { BusinessError } 16000070 - The extension cannot start the service.
830   * @syscap SystemCapability.Ability.AbilityRuntime.Core
831   * @stagemodelonly
832   * @since 10
833   */
834  connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
835
836  /**
837   * Disconnect an ability from a service extension, in contrast to {@link connectAbility}.
838   *
839   * @param { number } connection - The number code of the ability connected
840   * @param { AsyncCallback<void> } callback - The callback of disconnectAbility.
841   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
842   * @throws { BusinessError } 16000011 - The context does not exist.
843   * @throws { BusinessError } 16000050 - Internal error.
844   * @syscap SystemCapability.Ability.AbilityRuntime.Core
845   * @stagemodelonly
846   * @since 10
847   */
848  disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback<void>): void;
849
850  /**
851   * Disconnect an ability from a service extension, in contrast to {@link connectAbility}.
852   *
853   * @param { number } connection - The number code of the ability connected
854   * @returns { Promise<void> } The promise returned by the function.
855   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
856   * @throws { BusinessError } 16000011 - The context does not exist.
857   * @throws { BusinessError } 16000050 - Internal error.
858   * @syscap SystemCapability.Ability.AbilityRuntime.Core
859   * @stagemodelonly
860   * @since 10
861   */
862  disconnectServiceExtensionAbility(connection: number): Promise<void>;
863
864  /**
865   * Report to system when the extension is drawn completed.
866   *
867   * @param { AsyncCallback<void> } callback - The callback of startUIExtensionAbility.
868   * @throws { BusinessError } 16000011 - The context does not exist.
869   * @throws { BusinessError } 16000050 - Internal error.
870   * @syscap SystemCapability.Ability.AbilityRuntime.Core
871   * @stagemodelonly
872   * @since 12
873   */
874  reportDrawnCompleted(callback: AsyncCallback<void>): void;
875
876  /**
877   * Destroys the UI extension.
878   *
879   * @param { AsyncCallback<void> } callback - The callback of terminateSelf.
880   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
881   * @syscap SystemCapability.Ability.AbilityRuntime.Core
882   * @stagemodelonly
883   * @since 12
884   */
885  terminateSelf(callback: AsyncCallback<void>): void;
886
887  /**
888   * Destroys the UI extension.
889   *
890   * @returns { Promise<void> } The promise returned by the function.
891   * @syscap SystemCapability.Ability.AbilityRuntime.Core
892   * @stagemodelonly
893   * @since 12
894   */
895  terminateSelf(): Promise<void>;
896
897  /**
898   * Destroys the UI extension while returning the specified result code and data to the caller.
899   *
900   * @param { AbilityResult } parameter - Indicates the result to return.
901   * @param { AsyncCallback<void> } callback - The callback of terminateSelfWithResult.
902   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
903   * @syscap SystemCapability.Ability.AbilityRuntime.Core
904   * @stagemodelonly
905   * @since 12
906   */
907  terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void;
908
909  /**
910   * Destroys the UI extension while returning the specified result code and data to the caller.
911   *
912   * @param { AbilityResult } parameter - Indicates the result to return.
913   * @returns { Promise<void> } The promise returned by the function.
914   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
915   * @syscap SystemCapability.Ability.AbilityRuntime.Core
916   * @stagemodelonly
917   * @since 12
918   */
919  terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
920
921  /**
922   * Full-screen pop-us startup atomic service.
923   *
924   * @param { string } appId - Globally unique identifier of an application, which is allocated by the cloud.
925   * @param { AtomicServiceOptions } [options] - Indicates the atomic service start options.
926   * @returns { Promise<AbilityResult> } Returns the result of openAtomicService.
927   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
928   * @throws { BusinessError } 16000002 - Incorrect ability type.
929   * @throws { BusinessError } 16000003 - The specified ID does not exist.
930   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
931   * @throws { BusinessError } 16000011 - The context does not exist.
932   * @throws { BusinessError } 16000012 - The application is controlled.
933   * @throws { BusinessError } 16000050 - Internal error.
934   * @throws { BusinessError } 16000069 - The extension cannot start the third party application.
935   * @throws { BusinessError } 16200001 - The caller has been released.
936   * @syscap SystemCapability.Ability.AbilityRuntime.Core
937   * @stagemodelonly
938   * @since 12
939   */
940  openAtomicService(appId: string, options?: AtomicServiceOptions): Promise<AbilityResult>;
941
942  /**
943   * Starts a UI service extension ability.
944   * If the target UI service extension ability is visible, you can start the target UI service extension ability;
945   * If the target UI service extension ability is invisible,
946   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible UI service extension ability.
947   *
948   * @param { Want } want - Indicates the want info to start.
949   * @returns { Promise<void> } The promise returned by the function.
950   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
951   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
952   * 2. Incorrect parameter types; 3. Parameter verification failed.
953   * @throws { BusinessError } 801 - Capability not supported.
954   * @throws { BusinessError } 16000001 - The specified ability does not exist.
955   * @throws { BusinessError } 16000002 - Incorrect ability type.
956   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
957   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
958   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
959   * @throws { BusinessError } 16000011 - The context does not exist.
960   * @throws { BusinessError } 16000012 - The application is controlled.
961   * @throws { BusinessError } 16000013 - The EDM prohibits the application from launching.
962   * @throws { BusinessError } 16000019 - No matching ability is found.
963   * @throws { BusinessError } 16000050 - Internal error.
964   * @throws { BusinessError } 16200001 - The caller has been released.
965   * @syscap SystemCapability.Ability.AbilityRuntime.Core
966   * @stagemodelonly
967   * @since 14
968   */
969  startUIServiceExtensionAbility(want: Want): Promise<void>;
970
971  /**
972   * Connects to a UI service extension ability.
973   * If the target UI service extension ability is visible, you can connect the target UI service extension ability;
974   * If the target UI service extension ability is invisible,
975   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to connect target invisible UI service extension ability.
976   *
977   * @param { Want } want - Indicates the want info to connect.
978   * @param { UIServiceExtensionConnectCallback } callback - The callback of connection.
979   * @returns { Promise<UIServiceProxy> } The promise to get UIServiceProxy.
980   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
981   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
982   * 2. Incorrect parameter types; 3. Parameter verification failed.
983   * @throws { BusinessError } 801 - Capability not supported.
984   * @throws { BusinessError } 16000001 - The specified ability does not exist.
985   * @throws { BusinessError } 16000002 - Incorrect ability type.
986   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
987   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
988   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
989   * @throws { BusinessError } 16000011 - The context does not exist.
990   * @throws { BusinessError } 16000013 - The EDM prohibits the application from launching.
991   * @throws { BusinessError } 16000050 - Internal error.
992   * @throws { BusinessError } 16000055 - Installation-free timed out.
993   * @syscap SystemCapability.Ability.AbilityRuntime.Core
994   * @stagemodelonly
995   * @since 14
996   */
997  connectUIServiceExtensionAbility(want: Want, callback: UIServiceExtensionConnectCallback) : Promise<UIServiceProxy>;
998
999  /**
1000   * Disconnects from a UI service extension, in contrast to {@link connectUIServiceExtensionAbility}.
1001   *
1002   * @param { UIServiceProxy } proxy - The UI service proxy return by connectUIServiceExtensionAbility.
1003   * @returns { Promise<void> } The promise returned by the function.
1004   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1005   * 2. Incorrect parameter types; 3. Parameter verification failed.
1006   * @throws { BusinessError } 16000011 - The context does not exist.
1007   * @throws { BusinessError } 16000050 - Internal error.
1008   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1009   * @stagemodelonly
1010   * @since 14
1011   */
1012  disconnectUIServiceExtensionAbility(proxy: UIServiceProxy): Promise<void>;
1013
1014  /**
1015   * Set the uiextension to either not allow being covered by the host page or allow it.
1016   *
1017   * @param { boolean } isForbidden - Indicates the bool value of uiextension can be covered by host page.
1018   *                                  True indicates not allowing.
1019   *                                  False indicates allowing.
1020   * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
1021   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
1022   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1023   * @systemapi
1024   * @stagemodelonly
1025   * @since 15
1026   */
1027  setHostPageOverlayForbidden(isForbidden: boolean) : void;
1028}
1029