• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-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
21import { AsyncCallback, Callback } from './@ohos.base';
22import Want from './@ohos.app.ability.Want';
23import { WantAgentInfo as _WantAgentInfo } from './wantAgent/wantAgentInfo';
24import { TriggerInfo as _TriggerInfo } from './wantAgent/triggerInfo';
25
26/**
27 * Provide the method obtain trigger, cancel, and compare and to obtain
28 * the bundle name, UID of an {@link WantAgent} object.
29 *
30 * @namespace wantAgent
31 * @syscap SystemCapability.Ability.AbilityRuntime.Core
32 * @since 9
33 */
34/**
35 * Provide the method obtain trigger, cancel, and compare and to obtain
36 * the bundle name, UID of an {@link WantAgent} object.
37 *
38 * @namespace wantAgent
39 * @syscap SystemCapability.Ability.AbilityRuntime.Core
40 * @atomicservice
41 * @since 12
42 */
43declare namespace wantAgent {
44  /**
45   * Obtains the bundle name of a WantAgent.
46   *
47   * @param { WantAgent } agent - Indicates the WantAgent.
48   * @param { AsyncCallback<string> } callback - The callback is used to return the bundle name.
49   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
50   * 2. Incorrect parameter types.
51   * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry.
52   * @throws { BusinessError } 16000151 - Invalid wantagent object.
53   * @syscap SystemCapability.Ability.AbilityRuntime.Core
54   * @since 9
55   */
56  /**
57   * Obtains the bundle name of a WantAgent.
58   *
59   * @param { WantAgent } agent - Indicates the WantAgent.
60   * @param { AsyncCallback<string> } callback - The callback is used to return the bundle name.
61   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
62   * 2. Incorrect parameter types.
63   * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later.
64   * @throws { BusinessError } 16000151 - Invalid wantagent object.
65   * @syscap SystemCapability.Ability.AbilityRuntime.Core
66   * @atomicservice
67   * @since 12
68   */
69  function getBundleName(agent: WantAgent, callback: AsyncCallback<string>): void;
70
71  /**
72   * Obtains the bundle name of a WantAgent.
73   *
74   * @param { WantAgent } agent - Indicates the WantAgent.
75   * @returns { Promise<string> } Returns the bundle name.
76   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
77   * 2. Incorrect parameter types.
78   * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry.
79   * @throws { BusinessError } 16000151 - Invalid wantagent object.
80   * @syscap SystemCapability.Ability.AbilityRuntime.Core
81   * @since 9
82   */
83  /**
84   * Obtains the bundle name of a WantAgent.
85   *
86   * @param { WantAgent } agent - Indicates the WantAgent.
87   * @returns { Promise<string> } Returns the bundle name.
88   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
89   * 2. Incorrect parameter types.
90   * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later.
91   * @throws { BusinessError } 16000151 - Invalid wantagent object.
92   * @syscap SystemCapability.Ability.AbilityRuntime.Core
93   * @atomicservice
94   * @since 12
95   */
96  function getBundleName(agent: WantAgent): Promise<string>;
97
98  /**
99   * Obtains the UID of a WantAgent.
100   *
101   * @param { WantAgent } agent - Indicates the WantAgent.
102   * @param { AsyncCallback<number> } callback - The callback is used to return the UID.
103   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
104   * 2. Incorrect parameter types.
105   * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry.
106   * @throws { BusinessError } 16000151 - Invalid wantagent object.
107   * @syscap SystemCapability.Ability.AbilityRuntime.Core
108   * @since 9
109   */
110  /**
111   * Obtains the UID of a WantAgent.
112   *
113   * @param { WantAgent } agent - Indicates the WantAgent.
114   * @param { AsyncCallback<number> } callback - The callback is used to return the UID.
115   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
116   * 2. Incorrect parameter types.
117   * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later.
118   * @throws { BusinessError } 16000151 - Invalid wantagent object.
119   * @syscap SystemCapability.Ability.AbilityRuntime.Core
120   * @atomicservice
121   * @since 12
122   */
123  function getUid(agent: WantAgent, callback: AsyncCallback<number>): void;
124
125  /**
126   * Obtains the UID of a WantAgent.
127   *
128   * @param { WantAgent } agent - Indicates the WantAgent.
129   * @returns { Promise<number> } Returns the UID.
130   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
131   * 2. Incorrect parameter types.
132   * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry.
133   * @throws { BusinessError } 16000151 - Invalid wantagent object.
134   * @syscap SystemCapability.Ability.AbilityRuntime.Core
135   * @since 9
136   */
137  /**
138   * Obtains the UID of a WantAgent.
139   *
140   * @param { WantAgent } agent - Indicates the WantAgent.
141   * @returns { Promise<number> } Returns the UID.
142   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
143   * 2. Incorrect parameter types.
144   * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later.
145   * @throws { BusinessError } 16000151 - Invalid wantagent object.
146   * @syscap SystemCapability.Ability.AbilityRuntime.Core
147   * @atomicservice
148   * @since 12
149   */
150  function getUid(agent: WantAgent): Promise<number>;
151
152  /**
153   * Obtains the {@link Want} of an {@link WantAgent}.
154   *
155   * @param { WantAgent } agent - Indicates the WantAgent.
156   * @param { AsyncCallback<Want> } callback - The callback is used to return the Want.
157   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
158   * 2. Incorrect parameter types.
159   * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later.
160   * @throws { BusinessError } 16000015 - Service timeout.
161   * @throws { BusinessError } 16000151 - Invalid wantagent object.
162   * @syscap SystemCapability.Ability.AbilityRuntime.Core
163   * @systemapi
164   * @since 9
165   */
166  function getWant(agent: WantAgent, callback: AsyncCallback<Want>): void;
167
168  /**
169   * Obtains the {@link Want} of an {@link WantAgent}.
170   *
171   * @param { WantAgent } agent - Indicates the WantAgent.
172   * @returns { Promise<Want> } Returns the Want.
173   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
174   * 2. Incorrect parameter types.
175   * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later.
176   * @throws { BusinessError } 16000015 - Service timeout.
177   * @throws { BusinessError } 16000151 - Invalid wantagent object.
178   * @syscap SystemCapability.Ability.AbilityRuntime.Core
179   * @systemapi
180   * @since 9
181   */
182  function getWant(agent: WantAgent): Promise<Want>;
183
184  /**
185   * Cancel a WantAgent. Only the application that creates the WantAgent can cancel it.
186   *
187   * @param { WantAgent } agent - Indicates the WantAgent.
188   * @param { AsyncCallback<void> } callback - The callback of cancel.
189   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
190   * 2. Incorrect parameter types.
191   * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry.
192   * @throws { BusinessError } 16000151 - Invalid wantagent object.
193   * @syscap SystemCapability.Ability.AbilityRuntime.Core
194   * @since 9
195   */
196  /**
197   * Cancel a WantAgent. Only the application that creates the WantAgent can cancel it.
198   *
199   * @param { WantAgent } agent - Indicates the WantAgent.
200   * @param { AsyncCallback<void> } callback - The callback of cancel.
201   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
202   * 2. Incorrect parameter types.
203   * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later.
204   * @throws { BusinessError } 16000151 - Invalid wantagent object.
205   * @syscap SystemCapability.Ability.AbilityRuntime.Core
206   * @atomicservice
207   * @since 12
208   */
209  function cancel(agent: WantAgent, callback: AsyncCallback<void>): void;
210
211  /**
212   * Cancel a WantAgent. Only the application that creates the WantAgent can cancel it.
213   *
214   * @param { WantAgent } agent - Indicates the WantAgent.
215   * @returns { Promise<void> } The promise returned by the function.
216   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
217   * 2. Incorrect parameter types.
218   * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry.
219   * @throws { BusinessError } 16000151 - Invalid wantagent object.
220   * @syscap SystemCapability.Ability.AbilityRuntime.Core
221   * @since 9
222   */
223  /**
224   * Cancel a WantAgent. Only the application that creates the WantAgent can cancel it.
225   *
226   * @param { WantAgent } agent - Indicates the WantAgent.
227   * @returns { Promise<void> } The promise returned by the function.
228   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
229   * 2. Incorrect parameter types.
230   * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later.
231   * @throws { BusinessError } 16000151 - Invalid wantagent object.
232   * @syscap SystemCapability.Ability.AbilityRuntime.Core
233   * @atomicservice
234   * @since 12
235   */
236  function cancel(agent: WantAgent): Promise<void>;
237
238  /**
239   * Triggers a WantAgent.
240   *
241   * @param { WantAgent } agent - Indicates the WantAgent.
242   * @param { TriggerInfo } triggerInfo - Indicates the information required for triggering a WantAgent.
243   * @param { AsyncCallback<CompleteData> } [callback] - The callback is used to return the CompleteData.
244   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
245   * 2. Incorrect parameter types.
246   * @syscap SystemCapability.Ability.AbilityRuntime.Core
247   * @since 9
248   */
249  /**
250   * Triggers a WantAgent.
251   *
252   * @param { WantAgent } agent - Indicates the WantAgent.
253   * @param { TriggerInfo } triggerInfo - Indicates the information required for triggering a WantAgent.
254   * @param { AsyncCallback<CompleteData> } [callback] - The callback is used to return the CompleteData.
255   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
256   * 2. Incorrect parameter types.
257   * @syscap SystemCapability.Ability.AbilityRuntime.Core
258   * @atomicservice
259   * @since 12
260   */
261  function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback<CompleteData>): void;
262
263  /**
264   * Checks whether two WantAgent objects are equal.
265   *
266   * @param { WantAgent } agent - Indicates the WantAgent.
267   * @param { WantAgent } otherAgent - Indicates the other WantAgent.
268   * @param { AsyncCallback<boolean> } callback - Returns true if the two WantAgents are the same.
269   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
270   * 2. Incorrect parameter types.
271   * @syscap SystemCapability.Ability.AbilityRuntime.Core
272   * @since 9
273   */
274  /**
275   * Checks whether two WantAgent objects are equal.
276   *
277   * @param { WantAgent } agent - Indicates the WantAgent.
278   * @param { WantAgent } otherAgent - Indicates the other WantAgent.
279   * @param { AsyncCallback<boolean> } callback - Returns true if the two WantAgents are the same.
280   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
281   * 2. Incorrect parameter types.
282   * @syscap SystemCapability.Ability.AbilityRuntime.Core
283   * @atomicservice
284   * @since 12
285   */
286  function equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback<boolean>): void;
287
288  /**
289   * Checks whether two WantAgent objects are equal.
290   *
291   * @param { WantAgent } agent - Indicates the WantAgent.
292   * @param { WantAgent } otherAgent - Indicates the other WantAgent.
293   * @returns { Promise<boolean> } Returns true if the two WantAgents are the same.
294   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
295   * 2. Incorrect parameter types.
296   * @syscap SystemCapability.Ability.AbilityRuntime.Core
297   * @since 9
298   */
299  /**
300   * Checks whether two WantAgent objects are equal.
301   *
302   * @param { WantAgent } agent - Indicates the WantAgent.
303   * @param { WantAgent } otherAgent - Indicates the other WantAgent.
304   * @returns { Promise<boolean> } Returns true if the two WantAgents are the same.
305   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
306   * 2. Incorrect parameter types.
307   * @syscap SystemCapability.Ability.AbilityRuntime.Core
308   * @atomicservice
309   * @since 12
310   */
311  function equal(agent: WantAgent, otherAgent: WantAgent): Promise<boolean>;
312
313  /**
314   * Obtains a WantAgent object.
315   *
316   * @param { WantAgentInfo } info - Information about the WantAgent object to obtain.
317   * @param { AsyncCallback<WantAgent> } callback - The callback is used to return the created WantAgent.
318   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
319   * 2. Incorrect parameter types.
320   * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry.
321   * @throws { BusinessError } 16000151 - Invalid wantagent object.
322   * @syscap SystemCapability.Ability.AbilityRuntime.Core
323   * @since 9
324   */
325  /**
326   * Obtains a WantAgent object.
327   *
328   * @param { WantAgentInfo } info - Information about the WantAgent object to obtain.
329   * @param { AsyncCallback<WantAgent> } callback - The callback is used to return the created WantAgent.
330   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
331   * 2. Incorrect parameter types.
332   * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later.
333   * @throws { BusinessError } 16000151 - Invalid wantagent object.
334   * @syscap SystemCapability.Ability.AbilityRuntime.Core
335   * @atomicservice
336   * @since 12
337   */
338  function getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void;
339
340  /**
341   * Obtains a WantAgent object.
342   *
343   * @param { WantAgentInfo } info - Information about the WantAgent object to obtain.
344   * @returns { Promise<WantAgent> } Returns the created WantAgent.
345   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
346   * 2. Incorrect parameter types.
347   * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry.
348   * @throws { BusinessError } 16000151 - Invalid wantagent object.
349   * @syscap SystemCapability.Ability.AbilityRuntime.Core
350   * @since 9
351   */
352  /**
353   * Obtains a WantAgent object.
354   *
355   * @param { WantAgentInfo } info - Information about the WantAgent object to obtain.
356   * @returns { Promise<WantAgent> } Returns the created WantAgent.
357   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
358   * 2. Incorrect parameter types.
359   * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later.
360   * @throws { BusinessError } 16000151 - Invalid wantagent object.
361   * @syscap SystemCapability.Ability.AbilityRuntime.Core
362   * @atomicservice
363   * @since 12
364   */
365  function getWantAgent(info: WantAgentInfo): Promise<WantAgent>;
366
367  /**
368   * Obtains the {@link OperationType} of a {@link WantAgent}.
369   *
370   * @param { WantAgent } agent - Indicates the WantAgent.
371   * @param { AsyncCallback<number> } callback - The callback is used to return the OperationType of the WantAgent.
372   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
373   * 2. Incorrect parameter types.
374   * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry.
375   * @throws { BusinessError } 16000015 - Service timeout.
376   * @throws { BusinessError } 16000151 - Invalid wantagent object.
377   * @syscap SystemCapability.Ability.AbilityRuntime.Core
378   * @since 9
379   */
380  /**
381   * Obtains the {@link OperationType} of a {@link WantAgent}.
382   *
383   * @param { WantAgent } agent - Indicates the WantAgent.
384   * @param { AsyncCallback<number> } callback - The callback is used to return the OperationType of the WantAgent.
385   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
386   * 2. Incorrect parameter types.
387   * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later.
388   * @throws { BusinessError } 16000015 - Service timeout.
389   * @throws { BusinessError } 16000151 - Invalid wantagent object.
390   * @syscap SystemCapability.Ability.AbilityRuntime.Core
391   * @atomicservice
392   * @since 12
393   */
394  function getOperationType(agent: WantAgent, callback: AsyncCallback<number>): void;
395
396  /**
397   * Obtains the {@link OperationType} of a {@link WantAgent}.
398   *
399   * @param { WantAgent } agent - Indicates the WantAgent.
400   * @returns { Promise<number> } Returns the OperationType of the WantAgent.
401   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
402   * 2. Incorrect parameter types.
403   * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry.
404   * @throws { BusinessError } 16000015 - Service timeout.
405   * @throws { BusinessError } 16000151 - Invalid wantagent object.
406   * @syscap SystemCapability.Ability.AbilityRuntime.Core
407   * @since 9
408   */
409  /**
410   * Obtains the {@link OperationType} of a {@link WantAgent}.
411   *
412   * @param { WantAgent } agent - Indicates the WantAgent.
413   * @returns { Promise<number> } Returns the OperationType of the WantAgent.
414   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
415   * 2. Incorrect parameter types.
416   * @throws { BusinessError } 16000007 - Service busy. There are concurrent tasks. Try again later.
417   * @throws { BusinessError } 16000015 - Service timeout.
418   * @throws { BusinessError } 16000151 - Invalid wantagent object.
419   * @syscap SystemCapability.Ability.AbilityRuntime.Core
420   * @atomicservice
421   * @since 12
422   */
423  function getOperationType(agent: WantAgent): Promise<number>;
424
425  /**
426   * Enumerates flags for using a WantAgent.
427   *
428   * @enum { number }
429   * @syscap SystemCapability.Ability.AbilityRuntime.Core
430   * @since 9
431   */
432  /**
433   * Enumerates flags for using a WantAgent.
434   *
435   * @enum { number }
436   * @syscap SystemCapability.Ability.AbilityRuntime.Core
437   * @atomicservice
438   * @since 12
439   */
440  export enum WantAgentFlags {
441    /**
442     * Indicates that the WantAgent can be used only once.
443     * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT.
444     *
445     * @syscap SystemCapability.Ability.AbilityRuntime.Core
446     * @since 9
447     */
448    /**
449     * Indicates that the WantAgent can be used only once.
450     * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT.
451     *
452     * @syscap SystemCapability.Ability.AbilityRuntime.Core
453     * @atomicservice
454     * @since 12
455     */
456    ONE_TIME_FLAG = 0,
457
458    /**
459     * Indicates that null is returned if the WantAgent does not exist.
460     * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT.
461     *
462     * @syscap SystemCapability.Ability.AbilityRuntime.Core
463     * @since 9
464     */
465    /**
466     * Indicates that null is returned if the WantAgent does not exist.
467     * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT.
468     *
469     * @syscap SystemCapability.Ability.AbilityRuntime.Core
470     * @atomicservice
471     * @since 12
472     */
473    NO_BUILD_FLAG,
474
475    /**
476     * Indicates that the existing WantAgent should be canceled before a new object is generated.
477     * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT.
478     *
479     * @syscap SystemCapability.Ability.AbilityRuntime.Core
480     * @since 9
481     */
482    /**
483     * Indicates that the existing WantAgent should be canceled before a new object is generated.
484     * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT.
485     *
486     * @syscap SystemCapability.Ability.AbilityRuntime.Core
487     * @atomicservice
488     * @since 12
489     */
490    CANCEL_PRESENT_FLAG,
491
492    /**
493     * Indicates that the system only replaces the extra data of the existing WantAgent with that of the new object.
494     * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT.
495     *
496     * @syscap SystemCapability.Ability.AbilityRuntime.Core
497     * @since 9
498     */
499    /**
500     * Indicates that the system only replaces the extra data of the existing WantAgent with that of the new object.
501     * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT.
502     *
503     * @syscap SystemCapability.Ability.AbilityRuntime.Core
504     * @atomicservice
505     * @since 12
506     */
507    UPDATE_PRESENT_FLAG,
508
509    /**
510     * Indicates that the created WantAgent should be immutable.
511     *
512     * @syscap SystemCapability.Ability.AbilityRuntime.Core
513     * @since 9
514     */
515    /**
516     * Indicates that the created WantAgent should be immutable.
517     *
518     * @syscap SystemCapability.Ability.AbilityRuntime.Core
519     * @atomicservice
520     * @since 12
521     */
522    CONSTANT_FLAG,
523
524    /**
525     * Indicates that the current value of element can be replaced when the WantAgent is triggered.
526     *
527     * @syscap SystemCapability.Ability.AbilityRuntime.Core
528     * @since 9
529     */
530    /**
531     * Indicates that the current value of element can be replaced when the WantAgent is triggered.
532     *
533     * @syscap SystemCapability.Ability.AbilityRuntime.Core
534     * @atomicservice
535     * @since 12
536     */
537    REPLACE_ELEMENT,
538
539    /**
540     * Indicates that the current value of action can be replaced when the WantAgent is triggered.
541     *
542     * @syscap SystemCapability.Ability.AbilityRuntime.Core
543     * @since 9
544     */
545    /**
546     * Indicates that the current value of action can be replaced when the WantAgent is triggered.
547     *
548     * @syscap SystemCapability.Ability.AbilityRuntime.Core
549     * @atomicservice
550     * @since 12
551     */
552    REPLACE_ACTION,
553
554    /**
555     * Indicates that the current value of uri can be replaced when the WantAgent is triggered.
556     *
557     * @syscap SystemCapability.Ability.AbilityRuntime.Core
558     * @since 9
559     */
560    /**
561     * Indicates that the current value of uri can be replaced when the WantAgent is triggered.
562     *
563     * @syscap SystemCapability.Ability.AbilityRuntime.Core
564     * @atomicservice
565     * @since 12
566     */
567    REPLACE_URI,
568
569    /**
570     * Indicates that the current value of entities can be replaced when the WantAgent is triggered.
571     *
572     * @syscap SystemCapability.Ability.AbilityRuntime.Core
573     * @since 9
574     */
575    /**
576     * Indicates that the current value of entities can be replaced when the WantAgent is triggered.
577     *
578     * @syscap SystemCapability.Ability.AbilityRuntime.Core
579     * @atomicservice
580     * @since 12
581     */
582    REPLACE_ENTITIES,
583
584    /**
585     * Indicates that the current value of packageName can be replaced when the WantAgent is triggered.
586     *
587     * @syscap SystemCapability.Ability.AbilityRuntime.Core
588     * @since 9
589     */
590    /**
591     * Indicates that the current value of packageName can be replaced when the WantAgent is triggered.
592     *
593     * @syscap SystemCapability.Ability.AbilityRuntime.Core
594     * @atomicservice
595     * @since 12
596     */
597    REPLACE_BUNDLE
598  }
599
600  /**
601   * Identifies the operation for using a WantAgent, such as starting an ability or sending a common event.
602   *
603   * @enum { number }
604   * @syscap SystemCapability.Ability.AbilityRuntime.Core
605   * @since 9
606   */
607  /**
608   * Identifies the operation for using a WantAgent, such as starting an ability or sending a common event.
609   *
610   * @enum { number }
611   * @syscap SystemCapability.Ability.AbilityRuntime.Core
612   * @atomicservice
613   * @since 12
614   */
615  export enum OperationType {
616    /**
617     * Unknown operation.
618     *
619     * @syscap SystemCapability.Ability.AbilityRuntime.Core
620     * @since 9
621     */
622    /**
623     * Unknown operation.
624     *
625     * @syscap SystemCapability.Ability.AbilityRuntime.Core
626     * @atomicservice
627     * @since 12
628     */
629    UNKNOWN_TYPE = 0,
630
631    /**
632     * Starts an ability with a UI.
633     *
634     * @syscap SystemCapability.Ability.AbilityRuntime.Core
635     * @since 9
636     */
637    /**
638     * Starts an ability with a UI.
639     *
640     * @syscap SystemCapability.Ability.AbilityRuntime.Core
641     * @atomicservice
642     * @since 12
643     */
644    START_ABILITY,
645
646    /**
647     * Starts multiple abilities with a UI.
648     *
649     * @syscap SystemCapability.Ability.AbilityRuntime.Core
650     * @since 9
651     */
652    /**
653     * Starts multiple abilities with a UI.
654     *
655     * @syscap SystemCapability.Ability.AbilityRuntime.Core
656     * @atomicservice
657     * @since 12
658     */
659    START_ABILITIES,
660
661    /**
662     * Starts an ability without a UI.
663     *
664     * @syscap SystemCapability.Ability.AbilityRuntime.Core
665     * @since 9
666     */
667    /**
668     * Starts an ability without a UI.
669     *
670     * @syscap SystemCapability.Ability.AbilityRuntime.Core
671     * @atomicservice
672     * @since 12
673     */
674    START_SERVICE,
675
676    /**
677     * Sends a common event.
678     *
679     * @syscap SystemCapability.Ability.AbilityRuntime.Core
680     * @since 9
681     */
682    /**
683     * Sends a common event.
684     *
685     * @syscap SystemCapability.Ability.AbilityRuntime.Core
686     * @atomicservice
687     * @since 12
688     */
689    SEND_COMMON_EVENT,
690
691    /**
692     * Starts a service extension.
693     *
694     * @syscap SystemCapability.Ability.AbilityRuntime.Core
695     * @systemapi
696     * @stagemodelonly
697     * @since 12
698     */
699    START_SERVICE_EXTENSION = 6
700  }
701
702  /**
703   * Describes the data returned by after wantAgent.trigger is called.
704   *
705   * @typedef CompleteData
706   * @syscap SystemCapability.Ability.AbilityRuntime.Core
707   * @since 9
708   */
709  /**
710   * Describes the data returned by after wantAgent.trigger is called.
711   *
712   * @typedef CompleteData
713   * @syscap SystemCapability.Ability.AbilityRuntime.Core
714   * @atomicservice
715   * @since 12
716   */
717  export interface CompleteData {
718    /**
719     * Triggered WantAgent.
720     *
721     * @type { WantAgent }
722     * @syscap SystemCapability.Ability.AbilityRuntime.Core
723     * @since 9
724     */
725    /**
726     * Triggered WantAgent.
727     *
728     * @type { WantAgent }
729     * @syscap SystemCapability.Ability.AbilityRuntime.Core
730     * @atomicservice
731     * @since 12
732     */
733    info: WantAgent;
734
735    /**
736     * Existing Want that is triggered.
737     *
738     * @type { Want }
739     * @syscap SystemCapability.Ability.AbilityRuntime.Core
740     * @since 9
741     */
742    /**
743     * Existing Want that is triggered.
744     *
745     * @type { Want }
746     * @syscap SystemCapability.Ability.AbilityRuntime.Core
747     * @atomicservice
748     * @since 12
749     */
750    want: Want;
751
752    /**
753     * Request code used to trigger the WantAgent.
754     *
755     * @type { number }
756     * @syscap SystemCapability.Ability.AbilityRuntime.Core
757     * @since 9
758     */
759    /**
760     * Request code used to trigger the WantAgent.
761     *
762     * @type { number }
763     * @syscap SystemCapability.Ability.AbilityRuntime.Core
764     * @atomicservice
765     * @since 12
766     */
767    finalCode: number;
768
769    /**
770     * Final data collected by the common event.
771     *
772     * @type { string }
773     * @syscap SystemCapability.Ability.AbilityRuntime.Core
774     * @since 9
775     */
776    /**
777     * Final data collected by the common event.
778     *
779     * @type { string }
780     * @syscap SystemCapability.Ability.AbilityRuntime.Core
781     * @atomicservice
782     * @since 12
783     */
784    finalData: string;
785
786    /**
787     * Extra data collected by the common event.
788     *
789     * @type { ?object }
790     * @syscap SystemCapability.Ability.AbilityRuntime.Core
791     * @since 9
792     */
793    /**
794     * Extra data collected by the common event.
795     *
796     * @type { ?Record<string, Object> }
797     * @syscap SystemCapability.Ability.AbilityRuntime.Core
798     * @since 11
799     */
800    /**
801     * Extra data collected by the common event.
802     *
803     * @type { ?Record<string, Object> }
804     * @syscap SystemCapability.Ability.AbilityRuntime.Core
805     * @atomicservice
806     * @since 12
807     */
808    extraInfo?: Record<string, Object>;
809  }
810
811  /**
812   * Provides the information required for triggering a WantAgent.
813   *
814   * @typedef { _TriggerInfo }
815   * @syscap SystemCapability.Ability.AbilityRuntime.Core
816   * @since 9
817   */
818  /**
819   * Provides the information required for triggering a WantAgent.
820   *
821   * @typedef { _TriggerInfo }
822   * @syscap SystemCapability.Ability.AbilityRuntime.Core
823   * @atomicservice
824   * @since 12
825   */
826  export type TriggerInfo = _TriggerInfo;
827
828  /**
829   * Provides the information required for triggering a WantAgent.
830   *
831   * @typedef { _WantAgentInfo }
832   * @syscap SystemCapability.Ability.AbilityRuntime.Core
833   * @since 9
834   */
835  /**
836   * Provides the information required for triggering a WantAgent.
837   *
838   * @typedef { _WantAgentInfo }
839   * @syscap SystemCapability.Ability.AbilityRuntime.Core
840   * @atomicservice
841   * @since 12
842   */
843  export type WantAgentInfo = _WantAgentInfo;
844}
845
846/**
847 * WantAgent object.
848 *
849 * @typedef { object }
850 * @syscap SystemCapability.Ability.AbilityRuntime.Core
851 * @since 9
852 */
853export type WantAgent = object;
854
855export default wantAgent;
856