• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 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
21/*** if arkts 1.1 */
22import type AbilityStartCallback from './application/AbilityStartCallback';
23import type Want from './@ohos.app.ability.Want';
24import type StartOptions from './@ohos.app.ability.StartOptions';
25import type uiExtension from './@ohos.arkui.uiExtension';
26import type { AbilityResult } from './ability/abilityResult';
27/*** endif */
28import type { AsyncCallback } from './@ohos.base';
29import type uiExtensionHost from './@ohos.uiExtensionHost';
30/*** if arkts 1.2 */
31import { AbilityResult } from './ability/abilityResult';
32import { LocalStorage } from '@ohos.arkui.stateManagement';
33/*** endif */
34
35/**
36 * class of ui extension content session.
37 *
38 * @syscap SystemCapability.Ability.AbilityRuntime.Core
39 * @stagemodelonly
40 * @since arkts {'1.1':'10', '1.2':'20'}
41 * @arkts 1.1&1.2
42 */
43declare class UIExtensionContentSession {
44  /**
45   * Send data from an ui extension to an ui extension component.
46   *
47   * @param { object } data - Indicates the data send to ui extension component.
48   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
49   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
50   * 2. Incorrect parameter types.
51   * @throws { BusinessError } 16000050 - Internal error.
52   * @syscap SystemCapability.Ability.AbilityRuntime.Core
53   * @systemapi
54   * @stagemodelonly
55   * @since 10
56   */
57  /**
58   * Send data from an ui extension to an ui extension component.
59   *
60   * @param { Record<string, Object> } data - Indicates the data send to ui extension component.
61   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
62   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
63   * 2. Incorrect parameter types.
64   * @throws { BusinessError } 16000050 - Internal error.
65   * @syscap SystemCapability.Ability.AbilityRuntime.Core
66   * @systemapi
67   * @stagemodelonly
68   * @since arkts {'1.1':'11', '1.2':'20'}
69   * @arkts 1.1&1.2
70   */
71  sendData(data: Record<string, Object>): void;
72
73  /**
74   * Sets the callback for the ui extension to receive data from an ui extension component.
75   *
76   * @param { function } callback - Indicates the receive data callback to set.
77   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
78   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
79   * 2. Incorrect parameter types.
80   * @throws { BusinessError } 16000050 - Internal error.
81   * @syscap SystemCapability.Ability.AbilityRuntime.Core
82   * @systemapi
83   * @stagemodelonly
84   * @since arkts {'1.1':'10', '1.2':'20'}
85   * @arkts 1.1&1.2
86   */
87  setReceiveDataCallback(callback: (data: Record<string, Object>) => void): void;
88
89  /**
90   * Sets the callback with return value for the ui extension to receive data from an ui extension component.
91   *
92   * @param { function } callback - Indicates the receive data callback to set.
93   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
94   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
95   * 2. Incorrect parameter types.
96   * @throws { BusinessError } 16000050 - Internal error.
97   * @syscap SystemCapability.Ability.AbilityRuntime.Core
98   * @systemapi
99   * @stagemodelonly
100   * @since arkts {'1.1':'11', '1.2':'20'}
101   * @arkts 1.1&1.2
102   */
103  setReceiveDataForResultCallback(callback: (data: Record<string, Object>) => Record<string, Object>): void;
104
105  /**
106   * Loads an UI extension content.
107   *
108   * @param { string } path - Path of the page to which the content will be loaded
109   * @param { LocalStorage } [storage] - The data object shared within the content instance loaded by the page
110   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
111   * 2. Incorrect parameter types.
112   * @throws { BusinessError } 16000050 - Internal error.
113   * @syscap SystemCapability.Ability.AbilityRuntime.Core
114   * @stagemodelonly
115   * @since arkts {'1.1':'10', '1.2':'20'}
116   * @arkts 1.1&1.2
117   */
118  loadContent(path: string, storage?: LocalStorage): void;
119
120  /**
121   * Loads content by named router.
122   *
123   * @param { string } name - name of the page to which the content will be loaded.
124   * @param { LocalStorage } [storage] - The data object shared within the content instance loaded by the page.
125   * @throws { BusinessError } 16000050 - Internal error.
126   * @syscap SystemCapability.Ability.AbilityRuntime.Core
127   * @stagemodelonly
128   * @since 18
129   */
130  loadContentByName(name: string, storage?: LocalStorage): void;
131
132  /**
133   * UI extension uses this method to start a specific ability.If the caller application is in foreground,
134   * you can use this method to start ability; If the caller application is in the background,
135   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
136   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
137   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
138   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
139   *
140   * @param { Want } want - Indicates the ability to start.
141   * @param { AsyncCallback<void> } callback - The callback of startAbility.
142   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
143   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
144   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
145   * 2. Incorrect parameter types.
146   * @throws { BusinessError } 16000001 - The specified ability does not exist.
147   * @throws { BusinessError } 16000002 - Incorrect ability type.
148   * @throws { BusinessError } 16000004 - Cannot start an invisible component.
149   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
150   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
151   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
152   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
153   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
154   * @throws { BusinessError } 16000011 - The context does not exist.
155   * @throws { BusinessError } 16000012 - The application is controlled.
156   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
157   * @throws { BusinessError } 16000050 - Internal error.
158   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
159   * @throws { BusinessError } 16000055 - Installation-free timed out.
160   * @throws { BusinessError } 16200001 - The caller has been released.
161   * @syscap SystemCapability.Ability.AbilityRuntime.Core
162   * @systemapi
163   * @stagemodelonly
164   * @since 10
165   */
166  startAbility(want: Want, callback: AsyncCallback<void>): void;
167
168  /**
169   * UI extension uses this method to start a specific ability.If the caller application is in foreground,
170   * you can use this method to start ability; If the caller application is in the background,
171   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
172   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
173   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
174   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
175   *
176   * @param { Want } want - Indicates the ability to start.
177   * @param { StartOptions } options - Indicates the start options.
178   * @param { AsyncCallback<void> } callback - The callback of startAbility.
179   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
180   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
181   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
182   * 2. Incorrect parameter types.
183   * @throws { BusinessError } 16000001 - The specified ability does not exist.
184   * @throws { BusinessError } 16000004 - Cannot start an invisible component.
185   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
186   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
187   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
188   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
189   * @throws { BusinessError } 16000011 - The context does not exist.
190   * @throws { BusinessError } 16000012 - The application is controlled.
191   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
192   * @throws { BusinessError } 16000050 - Internal error.
193   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
194   * @throws { BusinessError } 16000055 - Installation-free timed out.
195   * @throws { BusinessError } 16200001 - The caller has been released.
196   * @syscap SystemCapability.Ability.AbilityRuntime.Core
197   * @systemapi
198   * @stagemodelonly
199   * @since 10
200   */
201  startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
202
203  /**
204   * UI extension uses this method to start a specific ability.If the caller application is in foreground,
205   * you can use this method to start ability; If the caller application is in the background,
206   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
207   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
208   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
209   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
210   *
211   * @param { Want } want - Indicates the ability to start.
212   * @param { StartOptions } [options] - Indicates the start options.
213   * @returns { Promise<void> } The promise returned by the function.
214   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
215   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
216   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
217   * 2. Incorrect parameter types.
218   * @throws { BusinessError } 16000001 - The specified ability does not exist.
219   * @throws { BusinessError } 16000002 - Incorrect ability type.
220   * @throws { BusinessError } 16000004 - Cannot start an invisible component.
221   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
222   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
223   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
224   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
225   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
226   * @throws { BusinessError } 16000011 - The context does not exist.
227   * @throws { BusinessError } 16000012 - The application is controlled.
228   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
229   * @throws { BusinessError } 16000050 - Internal error.
230   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
231   * @throws { BusinessError } 16000055 - Installation-free timed out.
232   * @throws { BusinessError } 16200001 - The caller has been released.
233   * @syscap SystemCapability.Ability.AbilityRuntime.Core
234   * @systemapi
235   * @stagemodelonly
236   * @since 10
237   */
238  startAbility(want: Want, options?: StartOptions): Promise<void>;
239
240  /**
241   * Starts a new ability using the original caller information. If the caller application is in foreground,
242   * you can use this method to start ability; If the caller application is in the background,
243   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
244   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
245   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
246   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
247   *
248   * @param { Want } want - Indicates the ability to start.
249   * @param { AsyncCallback<void> } callback - The callback of startAbility.
250   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
251   * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
252   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
253   * 2. Incorrect parameter types.
254   * @throws { BusinessError } 16000001 - The specified ability does not exist.
255   * @throws { BusinessError } 16000002 - Incorrect ability type.
256   * @throws { BusinessError } 16000004 - Cannot start an invisible component.
257   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
258   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
259   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
260   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
261   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
262   * @throws { BusinessError } 16000011 - The context does not exist.
263   * @throws { BusinessError } 16000012 - The application is controlled.
264   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
265   * @throws { BusinessError } 16000050 - Internal error.
266   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
267   * @throws { BusinessError } 16000055 - Installation-free timed out.
268   * @throws { BusinessError } 16200001 - The caller has been released.
269   * @syscap SystemCapability.Ability.AbilityRuntime.Core
270   * @systemapi
271   * @stagemodelonly
272   * @since 11
273   */
274  startAbilityAsCaller(want: Want, callback: AsyncCallback<void>): void;
275
276  /**
277   * Starts a new ability using the original caller information. If the caller application is in foreground,
278   * you can use this method to start ability; If the caller application is in the background,
279   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
280   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
281   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
282   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
283   *
284   * @param { Want } want - Indicates the ability to start.
285   * @param { StartOptions } options - Indicates the start options.
286   * @param { AsyncCallback<void> } callback - The callback of startAbility.
287   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
288   * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
289   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
290   * 2. Incorrect parameter types.
291   * @throws { BusinessError } 16000001 - The specified ability does not exist.
292   * @throws { BusinessError } 16000004 - Cannot start an invisible component.
293   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
294   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
295   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
296   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
297   * @throws { BusinessError } 16000011 - The context does not exist.
298   * @throws { BusinessError } 16000012 - The application is controlled.
299   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
300   * @throws { BusinessError } 16000050 - Internal error.
301   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
302   * @throws { BusinessError } 16000055 - Installation-free timed out.
303   * @throws { BusinessError } 16200001 - The caller has been released.
304   * @syscap SystemCapability.Ability.AbilityRuntime.Core
305   * @systemapi
306   * @stagemodelonly
307   * @since 11
308   */
309  startAbilityAsCaller(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
310
311  /**
312   * Starts a new ability using the original caller information. If the caller application is in foreground,
313   * you can use this method to start ability; If the caller application is in the background,
314   * you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
315   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
316   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
317   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
318   *
319   * @param { Want } want - Indicates the ability to start.
320   * @param { StartOptions } [options] - Indicates the start options.
321   * @returns { Promise<void> } The promise returned by the function.
322   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
323   * @throws { BusinessError } 202 - The application is not system-app, can not use system-api.
324   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
325   * 2. Incorrect parameter types.
326   * @throws { BusinessError } 16000001 - The specified ability does not exist.
327   * @throws { BusinessError } 16000002 - Incorrect ability type.
328   * @throws { BusinessError } 16000004 - Cannot start an invisible component.
329   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
330   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
331   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
332   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
333   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
334   * @throws { BusinessError } 16000011 - The context does not exist.
335   * @throws { BusinessError } 16000012 - The application is controlled.
336   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
337   * @throws { BusinessError } 16000050 - Internal error.
338   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
339   * @throws { BusinessError } 16000055 - Installation-free timed out.
340   * @throws { BusinessError } 16200001 - The caller has been released.
341   * @syscap SystemCapability.Ability.AbilityRuntime.Core
342   * @systemapi
343   * @stagemodelonly
344   * @since 11
345   */
346  startAbilityAsCaller(want: Want, options?: StartOptions): Promise<void>;
347
348  /**
349   * Starts an ability and returns the execution result when the ability is destroyed.
350   * If the caller application is in foreground, you can use this method to start ability; If the caller application
351   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
352   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
353   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
354   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
355   *
356   * @param { Want } want - Indicates the ability to start.
357   * @param { AsyncCallback<AbilityResult> } callback - The callback is used to return the result of startAbility.
358   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
359   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
360   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
361   * 2. Incorrect parameter types.
362   * @throws { BusinessError } 16000001 - The specified ability does not exist.
363   * @throws { BusinessError } 16000002 - Incorrect ability type.
364   * @throws { BusinessError } 16000004 - Cannot start an invisible component.
365   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
366   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
367   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
368   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
369   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
370   * @throws { BusinessError } 16000011 - The context does not exist.
371   * @throws { BusinessError } 16000012 - The application is controlled.
372   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
373   * @throws { BusinessError } 16000050 - Internal error.
374   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
375   * @throws { BusinessError } 16000055 - Installation-free timed out.
376   * @throws { BusinessError } 16200001 - The caller has been released.
377   * @syscap SystemCapability.Ability.AbilityRuntime.Core
378   * @systemapi
379   * @stagemodelonly
380   * @since 10
381   */
382  startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void;
383
384  /**
385   * Starts an ability and returns the execution result when the ability is destroyed.
386   * If the caller application is in foreground, you can use this method to start ability; If the caller application
387   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
388   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
389   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
390   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
391   *
392   * @param { Want } want - Indicates the ability to start.
393   * @param { StartOptions } options - Indicates the start options.
394   * @param { AsyncCallback<AbilityResult> } callback - The callback is used to return the result of startAbility.
395   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
396   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
397   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
398   * 2. Incorrect parameter types.
399   * @throws { BusinessError } 16000001 - The specified ability does not exist.
400   * @throws { BusinessError } 16000004 - Cannot start an invisible component.
401   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
402   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
403   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
404   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
405   * @throws { BusinessError } 16000011 - The context does not exist.
406   * @throws { BusinessError } 16000012 - The application is controlled.
407   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
408   * @throws { BusinessError } 16000050 - Internal error.
409   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
410   * @throws { BusinessError } 16000055 - Installation-free timed out.
411   * @throws { BusinessError } 16200001 - The caller has been released.
412   * @syscap SystemCapability.Ability.AbilityRuntime.Core
413   * @systemapi
414   * @stagemodelonly
415   * @since 10
416   */
417  startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void;
418
419  /**
420   * Starts an ability and returns the execution result when the ability is destroyed.
421   * If the caller application is in foreground, you can use this method to start ability; If the caller application
422   * is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
423   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
424   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
425   * If the target ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
426   *
427   * @param { Want } want - Indicates the ability to start.
428   * @param { StartOptions } [options] - Indicates the start options.
429   * @returns { Promise<AbilityResult> } Returns the result of startAbility.
430   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
431   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
432   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
433   * 2. Incorrect parameter types.
434   * @throws { BusinessError } 16000001 - The specified ability does not exist.
435   * @throws { BusinessError } 16000002 - Incorrect ability type.
436   * @throws { BusinessError } 16000004 - Cannot start an invisible component.
437   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
438   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
439   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
440   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
441   * @throws { BusinessError } 16000010 - The call with the continuation and prepare continuation flag is forbidden.
442   * @throws { BusinessError } 16000011 - The context does not exist.
443   * @throws { BusinessError } 16000012 - The application is controlled.
444   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
445   * @throws { BusinessError } 16000050 - Internal error.
446   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
447   * @throws { BusinessError } 16000055 - Installation-free timed out.
448   * @throws { BusinessError } 16200001 - The caller has been released.
449   * @syscap SystemCapability.Ability.AbilityRuntime.Core
450   * @systemapi
451   * @stagemodelonly
452   * @since 10
453   */
454  startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>;
455
456  /**
457   * Destroys the UI extension.
458   *
459   * @param { AsyncCallback<void> } callback - The callback of terminateSelf.
460   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
461   * 2. Incorrect parameter types.
462   * @syscap SystemCapability.Ability.AbilityRuntime.Core
463   * @stagemodelonly
464   * @since arkts {'1.1':'10', '1.2':'20'}
465   * @arkts 1.1&1.2
466   */
467  terminateSelf(callback: AsyncCallback<void>): void;
468
469  /**
470   * Destroys the UI extension.
471   *
472   * @returns { Promise<void> } The promise returned by the function.
473   * @syscap SystemCapability.Ability.AbilityRuntime.Core
474   * @stagemodelonly
475   * @since arkts {'1.1':'10', '1.2':'20'}
476   * @arkts 1.1&1.2
477   */
478  terminateSelf(): Promise<void>;
479
480  /**
481   * Destroys the UI extension while returning the specified result code and data to the caller.
482   *
483   * @param { AbilityResult } parameter - Indicates the result to return.
484   * @param { AsyncCallback<void> } callback - The callback of terminateSelfWithResult.
485   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
486   * 2. Incorrect parameter types.
487   * @syscap SystemCapability.Ability.AbilityRuntime.Core
488   * @stagemodelonly
489   * @since arkts {'1.1':'10', '1.2':'20'}
490   * @arkts 1.1&1.2
491   */
492  terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void;
493
494  /**
495   * Destroys the UI extension while returning the specified result code and data to the caller.
496   *
497   * @param { AbilityResult } parameter - Indicates the result to return.
498   * @returns { Promise<void> } The promise returned by the function.
499   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
500   * 2. Incorrect parameter types.
501   * @syscap SystemCapability.Ability.AbilityRuntime.Core
502   * @stagemodelonly
503   * @since arkts {'1.1':'10', '1.2':'20'}
504   * @arkts 1.1&1.2
505   */
506  terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
507
508  /**
509   * Sets the background color of the UI extension.
510   *
511   * @param { string } color - the specified color.
512   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
513   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
514   * 2. Incorrect parameter types.
515   * @throws { BusinessError } 16000050 - Internal error.
516   * @syscap SystemCapability.Ability.AbilityRuntime.Core
517   * @systemapi
518   * @stagemodelonly
519   * @since arkts {'1.1':'10', '1.2':'20'}
520   * @arkts 1.1&1.2
521   */
522  setWindowBackgroundColor(color: string): void;
523
524  /**
525   * Sets whether this window is in privacy mode.
526   *
527   * @permission ohos.permission.PRIVACY_WINDOW
528   * @param { boolean } isPrivacyMode - Whether the window is in privacy mode. The value true means that
529   *                                    the window is in privacy mode, and false means the opposite.
530   * @returns { Promise<void> } Promise that returns no value.
531   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
532   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
533   * 2. Incorrect parameter types.
534   * @syscap SystemCapability.Ability.AbilityRuntime.Core
535   * @stagemodelonly
536   * @since 10
537   */
538  setWindowPrivacyMode(isPrivacyMode: boolean): Promise<void>;
539
540  /**
541   * Sets whether this window is in privacy mode.
542   *
543   * @permission ohos.permission.PRIVACY_WINDOW
544   * @param { boolean } isPrivacyMode - Whether the window is in privacy mode. The value true means that
545   *                                    the window is in privacy mode, and false means the opposite.
546   * @param { AsyncCallback<void> } callback - Callback used to return the result.
547   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
548   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
549   * 2. Incorrect parameter types.
550   * @syscap SystemCapability.Ability.AbilityRuntime.Core
551   * @stagemodelonly
552   * @since 10
553   */
554  setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback<void>): void;
555
556  /**
557   * Starts the UIAbility or UIExtensionAbility by type.
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   *
561   * @param { string } type - The type of target ability.
562   * @param { Record<string, Object> } wantParam - Indicates the want parameter.
563   * @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback.
564   * @param { AsyncCallback<void> } callback - The callback 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;
567   * 2. Incorrect parameter types.
568   * @throws { BusinessError } 16000001 - The specified ability does not exist.
569   * @throws { BusinessError } 16000002 - Incorrect ability type.
570   * @throws { BusinessError } 16000004 - Cannot start an invisible component.
571   * @throws { BusinessError } 16000050 - Internal error.
572   * @throws { BusinessError } 16200001 - The caller has been released.
573   * @syscap SystemCapability.Ability.AbilityRuntime.Core
574   * @stagemodelonly
575   * @since 11
576   */
577  /**
578   * Starts the UIAbility or UIExtensionAbility by type.
579   * If the caller application is in the background, it is not allowed to call this interface.
580   *
581   * @param { string } type - The type of target ability.
582   * @param { Record<string, Object> } wantParam - Indicates the want parameter.
583   * @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback.
584   * @param { AsyncCallback<void> } callback - The callback of startAbility.
585   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
586   * <br>2. Incorrect parameter types.
587   * @throws { BusinessError } 16000050 - Internal error.
588   * @syscap SystemCapability.Ability.AbilityRuntime.Core
589   * @stagemodelonly
590   * @since 12
591   */
592  startAbilityByType(type: string, wantParam: Record<string, Object>,
593    abilityStartCallback: AbilityStartCallback, callback: AsyncCallback<void>): void;
594
595  /**
596   * Starts the UIAbility or UIExtensionAbility by type.
597   * If the target ability is visible, you can start the target ability; If the target ability is invisible,
598   * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
599   *
600   * @param { string } type - The type of target ability.
601   * @param { Record<string, Object> } wantParam - Indicates the want parameter.
602   * @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback.
603   * @returns { Promise<void> } The promise returned by the function.
604   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
605   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
606   * 2. Incorrect parameter types.
607   * @throws { BusinessError } 16000001 - The specified ability does not exist.
608   * @throws { BusinessError } 16000002 - Incorrect ability type.
609   * @throws { BusinessError } 16000004 - Cannot start an invisible component.
610   * @throws { BusinessError } 16000050 - Internal error.
611   * @throws { BusinessError } 16200001 - The caller has been released.
612   * @syscap SystemCapability.Ability.AbilityRuntime.Core
613   * @stagemodelonly
614   * @since 11
615   */
616  /**
617   * Starts the UIAbility or UIExtensionAbility by type.
618   * If the caller application is in the background, it is not allowed to call this interface.
619   *
620   * @param { string } type - The type of target ability.
621   * @param { Record<string, Object> } wantParam - Indicates the want parameter.
622   * @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback.
623   * @returns { Promise<void> } The promise returned by the function.
624   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
625   * <br>2. Incorrect parameter types.
626   * @throws { BusinessError } 16000050 - Internal error.
627   * @syscap SystemCapability.Ability.AbilityRuntime.Core
628   * @stagemodelonly
629   * @since 12
630   */
631  startAbilityByType(type: string, wantParam: Record<string, Object>,
632    abilityStartCallback: AbilityStartCallback): Promise<void>;
633
634  /**
635   * Get the UIExtension Host Window proxy.
636   *
637   * @returns { uiExtensionHost.UIExtensionHostWindowProxy } Returns the UIExtension Host Window proxy.
638   * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
639   * @throws { BusinessError } 16000050 - Internal error.
640   * @syscap SystemCapability.Ability.AbilityRuntime.Core
641   * @systemapi
642   * @stagemodelonly
643   * @since arkts {'1.1':'11', '1.2':'20'}
644   * @arkts 1.1&1.2
645   */
646  getUIExtensionHostWindowProxy(): uiExtensionHost.UIExtensionHostWindowProxy;
647
648  /**
649   * Get the UIExtension Window proxy.
650   *
651   * @returns { uiExtension.WindowProxy } Returns the UIExtension Window proxy.
652   * @throws { BusinessError } 16000050 - Internal error.
653   * @syscap SystemCapability.Ability.AbilityRuntime.Core
654   * @stagemodelonly
655   * @since 12
656   */
657  getUIExtensionWindowProxy(): uiExtension.WindowProxy;
658}
659
660export default UIExtensionContentSession;