• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2025 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 appManager from './@ohos.app.ability.appManager';
23/*** endif */
24
25/**
26 * The definition of AbilityConstant.
27 *
28 * @namespace AbilityConstant
29 * @syscap SystemCapability.Ability.AbilityRuntime.Core
30 * @stagemodelonly
31 * @since 9
32 */
33/**
34 * The definition of AbilityConstant.
35 *
36 * @namespace AbilityConstant
37 * @syscap SystemCapability.Ability.AbilityRuntime.Core
38 * @stagemodelonly
39 * @crossplatform
40 * @since 10
41 */
42/**
43 * The <code>AbilityConstant</code> module defines the UIAbility-related enums, including the initial launch reasons,
44 * reasons for the last exit, ability continuation results, and window modes.
45 *
46 * @namespace AbilityConstant
47 * @syscap SystemCapability.Ability.AbilityRuntime.Core
48 * @stagemodelonly
49 * @crossplatform
50 * @atomicservice
51 * @since arkts {'1.1':'11', '1.2':'20'}
52 * @arkts 1.1&1.2
53 */
54declare namespace AbilityConstant {
55  /**
56   * Indicates that the application is launched by clicking the shortcut icon on the desktop.
57   *
58   * @constant
59   * @syscap SystemCapability.Ability.AbilityBase
60   * @stagemodelonly
61   * @atomicservice
62   * @since 20
63   */
64  const REASON_MESSAGE_DESKTOP_SHORTCUT = 'ReasonMessage_DesktopShortcut';
65  /**
66   * Interface of launch param.
67   *
68   * @typedef LaunchParam
69   * @syscap SystemCapability.Ability.AbilityRuntime.Core
70   * @stagemodelonly
71   * @since 9
72   */
73  /**
74   * Interface of launch param.
75   *
76   * @typedef LaunchParam
77   * @syscap SystemCapability.Ability.AbilityRuntime.Core
78   * @stagemodelonly
79   * @crossplatform
80   * @since 10
81   */
82  /**
83   * Defines the parameters for starting an ability.
84   * The parameter values are automatically passed in by the system when the ability is started. You do not need to
85   * change the values.
86   *
87   * @typedef LaunchParam
88   * @syscap SystemCapability.Ability.AbilityRuntime.Core
89   * @stagemodelonly
90   * @crossplatform
91   * @atomicservice
92   * @since arkts {'1.1':'11', '1.2':'20'}
93   * @arkts 1.1&1.2
94   */
95  export interface LaunchParam {
96    /**
97     * Indicates launch reason.
98     *
99     * @type { LaunchReason }
100     * @syscap SystemCapability.Ability.AbilityRuntime.Core
101     * @stagemodelonly
102     * @since 9
103     */
104    /**
105     * Indicates launch reason.
106     *
107     * @type { LaunchReason }
108     * @syscap SystemCapability.Ability.AbilityRuntime.Core
109     * @stagemodelonly
110     * @crossplatform
111     * @since 10
112     */
113    /**
114     * Ability launch reason, which is an enumerated type.
115     *
116     * @type { LaunchReason }
117     * @syscap SystemCapability.Ability.AbilityRuntime.Core
118     * @stagemodelonly
119     * @crossplatform
120     * @atomicservice
121     * @since arkts {'1.1':'11', '1.2':'20'}
122     * @arkts 1.1&1.2
123     */
124    launchReason: LaunchReason;
125
126    /**
127     * Detailed message that describes the ability launch reason.
128     *
129     * @type { string }
130     * @syscap SystemCapability.Ability.AbilityRuntime.Core
131     * @stagemodelonly
132     * @atomicservice
133     * @since arkts {'1.1':'18', '1.2':'20'}
134     * @arkts 1.1&1.2
135     */
136    launchReasonMessage?: string;
137
138    /**
139     * Indicates last exit reason.
140     *
141     * @type { LastExitReason }
142     * @syscap SystemCapability.Ability.AbilityRuntime.Core
143     * @stagemodelonly
144     * @since 9
145     */
146    /**
147     * Indicates last exit reason.
148     *
149     * @type { LastExitReason }
150     * @syscap SystemCapability.Ability.AbilityRuntime.Core
151     * @stagemodelonly
152     * @crossplatform
153     * @since 10
154     */
155    /**
156     * Reason for the last exit, which is an enumerated type.
157     *
158     * @type { LastExitReason }
159     * @syscap SystemCapability.Ability.AbilityRuntime.Core
160     * @stagemodelonly
161     * @crossplatform
162     * @atomicservice
163     * @since arkts {'1.1':'11', '1.2':'20'}
164     * @arkts 1.1&1.2
165     */
166    lastExitReason: LastExitReason;
167
168    /**
169     * Reason for the last exit.
170     *
171     * @type { string }
172     * @syscap SystemCapability.Ability.AbilityRuntime.Core
173     * @stagemodelonly
174     * @atomicservice
175     * @since arkts {'1.1':'12', '1.2':'20'}
176     * @arkts 1.1&1.2
177     */
178    lastExitMessage: string;
179
180    /**
181     * Detailed information about the last exit.
182     *
183     * @type { LastExitDetailInfo }
184     * @syscap SystemCapability.Ability.AbilityRuntime.Core
185     * @stagemodelonly
186     * @atomicservice
187     * @since arkts {'1.1':'18', '1.2':'20'}
188     * @arkts 1.1&1.2
189     */
190    lastExitDetailInfo?: LastExitDetailInfo;
191  }
192
193  /**
194   * Describes the detailed information about the last exit.
195   *
196   * @typedef LastExitDetailInfo
197   * @syscap SystemCapability.Ability.AbilityRuntime.Core
198   * @stagemodelonly
199   * @atomicservice
200   * @since arkts {'1.1':'18', '1.2':'20'}
201   * @arkts 1.1&1.2
202   */
203  export interface LastExitDetailInfo {
204    /**
205     * ID of the process where the ability is running when it exits last time.
206     *
207     * @type { number }
208     * @syscap SystemCapability.Ability.AbilityRuntime.Core
209     * @stagemodelonly
210     * @atomicservice
211     * @since arkts {'1.1':'18', '1.2':'20'}
212     * @arkts 1.1&1.2
213     */
214    pid: number;
215
216    /**
217     * Name of the process.
218     *
219     * @type { string }
220     * @syscap SystemCapability.Ability.AbilityRuntime.Core
221     * @stagemodelonly
222     * @atomicservice
223     * @since arkts {'1.1':'18', '1.2':'20'}
224     * @arkts 1.1&1.2
225     */
226    processName: string;
227
228    /**
229     * UID of the application.
230     *
231     * @type { number }
232     * @syscap SystemCapability.Ability.AbilityRuntime.Core
233     * @stagemodelonly
234     * @atomicservice
235     * @since arkts {'1.1':'18', '1.2':'20'}
236     * @arkts 1.1&1.2
237     */
238    uid: number;
239
240    /**
241     * Specific reason for the last exit of the ability.
242     *
243     * @type { number }
244     * @syscap SystemCapability.Ability.AbilityRuntime.Core
245     * @stagemodelonly
246     * @atomicservice
247     * @since arkts {'1.1':'18', '1.2':'20'}
248     * @arkts 1.1&1.2
249     */
250    exitSubReason: number;
251
252    /**
253     * Reason why the process was killed.
254     *
255     * @type { string }
256     * @syscap SystemCapability.Ability.AbilityRuntime.Core
257     * @stagemodelonly
258     * @atomicservice
259     * @since arkts {'1.1':'18', '1.2':'20'}
260     * @arkts 1.1&1.2
261     */
262    exitMsg: string;
263
264    /**
265     * RSS value of the process.
266     *
267     * @type { number }
268     * @syscap SystemCapability.Ability.AbilityRuntime.Core
269     * @stagemodelonly
270     * @atomicservice
271     * @since arkts {'1.1':'18', '1.2':'20'}
272     * @arkts 1.1&1.2
273     */
274    rss: number;
275
276    /**
277     * PSS value of the process.
278     *
279     * @type { number }
280     * @syscap SystemCapability.Ability.AbilityRuntime.Core
281     * @stagemodelonly
282     * @atomicservice
283     * @since arkts {'1.1':'18', '1.2':'20'}
284     * @arkts 1.1&1.2
285     */
286    pss: number;
287
288    /**
289     * Exact time when the ability last exits.
290     *
291     * @type { number }
292     * @syscap SystemCapability.Ability.AbilityRuntime.Core
293     * @stagemodelonly
294     * @atomicservice
295     * @since arkts {'1.1':'18', '1.2':'20'}
296     * @arkts 1.1&1.2
297     */
298    timestamp: number;
299
300    /**
301     * The process state when the process exits.
302     *
303     * @type { ?appManager.ProcessState }
304     * @syscap SystemCapability.Ability.AbilityRuntime.Core
305     * @stagemodelonly
306     * @atomicservice
307     * @since 20
308     */
309    processState?: appManager.ProcessState;
310  }
311
312  /**
313   * Type of launch reason.
314   *
315   * @enum { number }
316   * @syscap SystemCapability.Ability.AbilityRuntime.Core
317   * @stagemodelonly
318   * @since 9
319   */
320  /**
321   * Type of launch reason.
322   *
323   * @enum { number }
324   * @syscap SystemCapability.Ability.AbilityRuntime.Core
325   * @stagemodelonly
326   * @crossplatform
327   * @since 10
328   */
329  /**
330   * Enumerates the initial ability launch reasons.
331   * You can use it together with the value of <code>launchParam.launchReason</code> in
332   * <code>onCreate(want, launchParam)</code> of the UIAbility to complete different operations.
333   *
334   * @enum { number }
335   * @syscap SystemCapability.Ability.AbilityRuntime.Core
336   * @stagemodelonly
337   * @crossplatform
338   * @atomicservice
339   * @since arkts {'1.1':'11', '1.2':'20'}
340   * @arkts 1.1&1.2
341   */
342  export enum LaunchReason {
343    /**
344     * Unknown reason.
345     *
346     * @syscap SystemCapability.Ability.AbilityRuntime.Core
347     * @stagemodelonly
348     * @since 9
349     */
350    /**
351     * @syscap SystemCapability.Ability.AbilityRuntime.Core
352     * @stagemodelonly
353     * @crossplatform
354     * @since 10
355     */
356    /**
357     * Unknown reason.
358     *
359     * @syscap SystemCapability.Ability.AbilityRuntime.Core
360     * @stagemodelonly
361     * @crossplatform
362     * @atomicservice
363     * @since arkts {'1.1':'11', '1.2':'20'}
364     * @arkts 1.1&1.2
365     */
366    UNKNOWN = 0,
367
368    /**
369     * Start ability through the startAbility interface.
370     *
371     * @syscap SystemCapability.Ability.AbilityRuntime.Core
372     * @stagemodelonly
373     * @since 9
374     */
375    /**
376     * The ability is started by calling <code>startAbility</code>.
377     *
378     * @syscap SystemCapability.Ability.AbilityRuntime.Core
379     * @stagemodelonly
380     * @atomicservice
381     * @since arkts {'1.1':'11', '1.2':'20'}
382     * @arkts 1.1&1.2
383     */
384    START_ABILITY = 1,
385
386    /**
387     * Start ability through the startAbilityByCall interface.
388     *
389     * @syscap SystemCapability.Ability.AbilityRuntime.Core
390     * @stagemodelonly
391     * @since 9
392     */
393    /**
394     * The ability is started by calling <code>startAbilityByCall</code>.
395     *
396     * @syscap SystemCapability.Ability.AbilityRuntime.Core
397     * @stagemodelonly
398     * @atomicservice
399     * @since arkts {'1.1':'11', '1.2':'20'}
400     * @arkts 1.1&1.2
401     */
402    CALL = 2,
403
404    /**
405     * Start ability through cross-end device migration.
406     *
407     * @syscap SystemCapability.Ability.AbilityRuntime.Core
408     * @stagemodelonly
409     * @since 9
410     */
411    /**
412     * The ability is started by means of cross-device migration.
413     *
414     * @syscap SystemCapability.Ability.AbilityRuntime.Core
415     * @stagemodelonly
416     * @atomicservice
417     * @since arkts {'1.1':'11', '1.2':'20'}
418     * @arkts 1.1&1.2
419     */
420    CONTINUATION = 3,
421
422    /**
423     * After the application is restored, the ability is automatically restored and started when the application fails.
424     *
425     * @syscap SystemCapability.Ability.AbilityRuntime.Core
426     * @stagemodelonly
427     * @since 9
428     */
429    /**
430     * The ability is automatically started when the application is restored from a fault.
431     *
432     * @syscap SystemCapability.Ability.AbilityRuntime.Core
433     * @stagemodelonly
434     * @atomicservice
435     * @since arkts {'1.1':'11', '1.2':'20'}
436     * @arkts 1.1&1.2
437     */
438    APP_RECOVERY = 4,
439
440    /**
441     * Start ability through the acquireShareData interface.
442     *
443     * @syscap SystemCapability.Ability.AbilityRuntime.Core
444     * @stagemodelonly
445     * @since 10
446     */
447    /**
448     * The ability is started by means of atomic service sharing.
449     *
450     * @syscap SystemCapability.Ability.AbilityRuntime.Core
451     * @stagemodelonly
452     * @atomicservice
453     * @since arkts {'1.1':'11', '1.2':'20'}
454     * @arkts 1.1&1.2
455     */
456    SHARE = 5,
457
458    /**
459     * The ability is automatically started upon system boot.
460     *
461     * @syscap SystemCapability.Ability.AbilityRuntime.Core
462     * @stagemodelonly
463     * @since arkts {'1.1':'11', '1.2':'20'}
464     * @arkts 1.1&1.2
465     */
466    AUTO_STARTUP = 8,
467
468    /**
469     * The ability is started by the InsightIntent framework.
470     *
471     * @syscap SystemCapability.Ability.AbilityRuntime.Core
472     * @stagemodelonly
473     * @atomicservice
474     * @since arkts {'1.1':'11', '1.2':'20'}
475     * @arkts 1.1&1.2
476     */
477    INSIGHT_INTENT = 9,
478
479    /**
480     * The ability is started in advance during cross-device migration.
481     *
482     * @syscap SystemCapability.Ability.AbilityRuntime.Core
483     * @stagemodelonly
484     * @atomicservice
485     * @since arkts {'1.1':'12', '1.2':'20'}
486     * @arkts 1.1&1.2
487     */
488    PREPARE_CONTINUATION = 10,
489
490    /**
491     * Start by preload.
492     *
493     * @syscap SystemCapability.Ability.AbilityRuntime.Core
494     * @stagemodelonly
495     * @atomicservice
496     * @since 20
497     * @arkts 1.1&1.2
498     */
499    PRELOAD = 11,
500  }
501
502  /**
503   * Type of last exit reason.
504   *
505   * @enum { number }
506   * @syscap SystemCapability.Ability.AbilityRuntime.Core
507   * @stagemodelonly
508   * @since 9
509   */
510  /**
511   * Type of last exit reason.
512   *
513   * @enum { number }
514   * @syscap SystemCapability.Ability.AbilityRuntime.Core
515   * @stagemodelonly
516   * @crossplatform
517   * @since 10
518   */
519  /**
520   * Enumerates the reasons for the last exit.
521   * You can use it together with the value of <code>launchParam.lastExitReason</code> in
522   * <code>onCreate(want, launchParam)</code> of the UIAbility to complete different operations.
523   *
524   * @enum { number }
525   * @syscap SystemCapability.Ability.AbilityRuntime.Core
526   * @stagemodelonly
527   * @crossplatform
528   * @atomicservice
529   * @since arkts {'1.1':'11', '1.2':'20'}
530   * @arkts 1.1&1.2
531   */
532  export enum LastExitReason {
533    /**
534     * Exit reason : Unknown. The reason for the last exit of the target application is not recorded in the application
535     *               framework.
536     *
537     * @syscap SystemCapability.Ability.AbilityRuntime.Core
538     * @stagemodelonly
539     * @since 9
540     */
541    /**
542     * Exit reason : Unknown. The reason for the last exit of the target application is not recorded in the application
543     *               framework.
544     *
545     * @syscap SystemCapability.Ability.AbilityRuntime.Core
546     * @stagemodelonly
547     * @crossplatform
548     * @since 10
549     */
550    /**
551     * Unknown reason.
552     *
553     * @syscap SystemCapability.Ability.AbilityRuntime.Core
554     * @stagemodelonly
555     * @crossplatform
556     * @atomicservice
557     * @since arkts {'1.1':'11', '1.2':'20'}
558     * @arkts 1.1&1.2
559     */
560    UNKNOWN = 0,
561
562    /**
563     * The ability does not respond.
564     *
565     * @syscap SystemCapability.Ability.AbilityRuntime.Core
566     * @stagemodelonly
567     * @since 9
568     * @deprecated since 10
569     * @useinstead AbilityConstant.LastExitReason#APP_FREEZE
570     */
571    ABILITY_NOT_RESPONDING = 1,
572
573    /**
574     * Exit reason : normally. App exit due to user active close.
575     *
576     * @syscap SystemCapability.Ability.AbilityRuntime.Core
577     * @stagemodelonly
578     * @since 9
579     */
580    /**
581     * The ability exits normally because the user closes the application.
582     *
583     * @syscap SystemCapability.Ability.AbilityRuntime.Core
584     * @stagemodelonly
585     * @atomicservice
586     * @since arkts {'1.1':'11', '1.2':'20'}
587     * @arkts 1.1&1.2
588     */
589    NORMAL = 2,
590
591    /**
592     * Exit reason : cpp crash. The app exit due to native exception signal.
593     *
594     * @syscap SystemCapability.Ability.AbilityRuntime.Core
595     * @stagemodelonly
596     * @since 10
597     */
598    /**
599     * The ability exits due to abnormal signals on the local host.
600     *
601     * @syscap SystemCapability.Ability.AbilityRuntime.Core
602     * @stagemodelonly
603     * @atomicservice
604     * @since arkts {'1.1':'11', '1.2':'20'}
605     * @arkts 1.1&1.2
606     */
607    CPP_CRASH = 3,
608
609    /**
610     * Exit reason : js error. App exit due to js error.
611     *
612     * @syscap SystemCapability.Ability.AbilityRuntime.Core
613     * @stagemodelonly
614     * @since 10
615     */
616    /**
617     * The ability exits due to a JS_ERROR fault triggered when an application has a JS syntax error that is not
618     * captured by developers.
619     *
620     * @syscap SystemCapability.Ability.AbilityRuntime.Core
621     * @stagemodelonly
622     * @atomicservice
623     * @since arkts {'1.1':'11', '1.2':'20'}
624     * @arkts 1.1&1.2
625     */
626    JS_ERROR = 4,
627
628    /**
629     * Exit reason : app freeze. App exit due to appFreeze error.
630     *
631     * @syscap SystemCapability.Ability.AbilityRuntime.Core
632     * @stagemodelonly
633     * @since 10
634     */
635    /**
636     * The ability exits because watchdog detects that the application is frozen.
637     *
638     * @syscap SystemCapability.Ability.AbilityRuntime.Core
639     * @stagemodelonly
640     * @atomicservice
641     * @since arkts {'1.1':'11', '1.2':'20'}
642     * @arkts 1.1&1.2
643     */
644    APP_FREEZE = 5,
645
646    /**
647     * Exit reason : performance control. App exit due to system performance issues, such as device low memory.
648     *
649     * @syscap SystemCapability.Ability.AbilityRuntime.Core
650     * @stagemodelonly
651     * @since 10
652     */
653    /**
654     * The ability exits due to system performance problems, for example, insufficient device memory.
655     *
656     * @syscap SystemCapability.Ability.AbilityRuntime.Core
657     * @stagemodelonly
658     * @atomicservice
659     * @since arkts {'1.1':'11', '1.2':'20'}
660     * @arkts 1.1&1.2
661     */
662    PERFORMANCE_CONTROL = 6,
663
664    /**
665     * Exit reason : resource control. App exit due to resource usage violation, such as exceed cpu/io/memory usage.
666     *
667     * @syscap SystemCapability.Ability.AbilityRuntime.Core
668     * @stagemodelonly
669     * @since 10
670     */
671    /**
672     * The ability exits due to improper use of system resources. The specific error cause can be obtained through
673     * LaunchParam.lastExitMessage. The possible causes are as follows:
674     * - CPU Highload: The CPU load is high.
675     * - CPU_EXT Highload: A fast CPU load detection is carried out.
676     * - IO Manage Control: An I/O management and control operation is carried out.
677     * - App Memory Deterioration: The application memory usage exceeds the threshold.
678     * - Temperature Control: The temperature is too high or too low.
679     * - Memory Pressure: The system is low on memory, triggering ability exiting in ascending order of priority.
680     *
681     * @syscap SystemCapability.Ability.AbilityRuntime.Core
682     * @stagemodelonly
683     * @atomicservice
684     * @since arkts {'1.1':'11', '1.2':'20'}
685     * @arkts 1.1&1.2
686     */
687    RESOURCE_CONTROL = 7,
688
689    /**
690     * Exit reason : upgrade. App exit due to upgrade.
691     *
692     * @syscap SystemCapability.Ability.AbilityRuntime.Core
693     * @stagemodelonly
694     * @since 10
695     */
696    /**
697     * The ability exits due to an update.
698     *
699     * @syscap SystemCapability.Ability.AbilityRuntime.Core
700     * @stagemodelonly
701     * @atomicservice
702     * @since arkts {'1.1':'11', '1.2':'20'}
703     * @arkts 1.1&1.2
704     */
705    UPGRADE = 8,
706
707    /**
708     * The ability exits because of an action in the multitasking center, for example, when users swipe up or hit the
709     * one-click clean button in the multitasking view.
710     *
711     * @syscap SystemCapability.Ability.AbilityRuntime.Core
712     * @stagemodelonly
713     * @atomicservice
714     * @since arkts {'1.1':'18', '1.2':'20'}
715     * @arkts 1.1&1.2
716     */
717    USER_REQUEST = 9,
718
719    /**
720     * The ability exits because it receives a kill signal from the system.
721     *
722     * @syscap SystemCapability.Ability.AbilityRuntime.Core
723     * @stagemodelonly
724     * @atomicservice
725     * @since arkts {'1.1':'18', '1.2':'20'}
726     * @arkts 1.1&1.2
727     */
728    SIGNAL = 10
729  }
730
731  /**
732   * Type of onContinue result.
733   *
734   * @enum { number }
735   * @syscap SystemCapability.Ability.AbilityRuntime.Core
736   * @stagemodelonly
737   * @since 9
738   */
739  /**
740   * Enumerates the ability continuation results.
741   * You can use it together with <code>onContinue(wantParam)</code> of the UIAbility to complete different
742   * operations.
743   *
744   * @enum { number }
745   * @syscap SystemCapability.Ability.AbilityRuntime.Core
746   * @stagemodelonly
747   * @atomicservice
748   * @since arkts {'1.1':'11', '1.2':'20'}
749   * @arkts 1.1&1.2
750   */
751  export enum OnContinueResult {
752    /**
753     * Agree to the result of Ability migration.
754     *
755     * @syscap SystemCapability.Ability.AbilityRuntime.Core
756     * @stagemodelonly
757     * @since 9
758     */
759    /**
760     * The ability continuation is accepted.
761     *
762     * @syscap SystemCapability.Ability.AbilityRuntime.Core
763     * @stagemodelonly
764     * @atomicservice
765     * @since arkts {'1.1':'11', '1.2':'20'}
766     * @arkts 1.1&1.2
767     */
768    AGREE = 0,
769
770    /**
771     * Reject to the result of Ability migration.
772     *
773     * @syscap SystemCapability.Ability.AbilityRuntime.Core
774     * @stagemodelonly
775     * @since 9
776     */
777    /**
778     * The ability continuation is rejected.
779     * If the application is abnormal in onContinue, which results in abnormal display during data restoration, this
780     * error code is returned.
781     *
782     * @syscap SystemCapability.Ability.AbilityRuntime.Core
783     * @stagemodelonly
784     * @atomicservice
785     * @since arkts {'1.1':'11', '1.2':'20'}
786     * @arkts 1.1&1.2
787     */
788    REJECT = 1,
789
790    /**
791     * Mismatch to the result of Ability migration.
792     *
793     * @syscap SystemCapability.Ability.AbilityRuntime.Core
794     * @stagemodelonly
795     * @since 9
796     */
797    /**
798     * The version does not match.
799     * The application on the initiator can obtain the version of the target application from onContinue. If the
800     * ability continuation cannot be performed due to version mismatch, this error code is returned.
801     *
802     * @syscap SystemCapability.Ability.AbilityRuntime.Core
803     * @stagemodelonly
804     * @atomicservice
805     * @since arkts {'1.1':'11', '1.2':'20'}
806     * @arkts 1.1&1.2
807     */
808    MISMATCH = 2
809  }
810
811  /**
812   * Type of memory level.
813   *
814   * @enum { number }
815   * @syscap SystemCapability.Ability.AbilityRuntime.Core
816   * @stagemodelonly
817   * @since 9
818   */
819  /**
820   * Enumerates the memory levels. You can use it in <code>onMemoryLevel(level)</code> of the UIAbility to complete
821   * different operations.
822   *
823   * @enum { number }
824   * @syscap SystemCapability.Ability.AbilityRuntime.Core
825   * @stagemodelonly
826   * @atomicservice
827   * @since arkts {'1.1':'11', '1.2':'20'}
828   * @arkts 1.1&1.2
829   */
830  export enum MemoryLevel {
831    /**
832     * Memory footprint is moderate.
833     *
834     * @syscap SystemCapability.Ability.AbilityRuntime.Core
835     * @stagemodelonly
836     * @since 9
837     */
838    /**
839     * Moderate memory usage.
840     *
841     * @syscap SystemCapability.Ability.AbilityRuntime.Core
842     * @stagemodelonly
843     * @atomicservice
844     * @since arkts {'1.1':'11', '1.2':'20'}
845     * @arkts 1.1&1.2
846     */
847    MEMORY_LEVEL_MODERATE = 0,
848
849    /**
850     * Low memory footprint.
851     *
852     * @syscap SystemCapability.Ability.AbilityRuntime.Core
853     * @stagemodelonly
854     * @since 9
855     */
856    /**
857     * Low memory usage.
858     *
859     * @syscap SystemCapability.Ability.AbilityRuntime.Core
860     * @stagemodelonly
861     * @atomicservice
862     * @since arkts {'1.1':'11', '1.2':'20'}
863     * @arkts 1.1&1.2
864     */
865    MEMORY_LEVEL_LOW = 1,
866
867    /**
868     * High memory footprint.
869     *
870     * @syscap SystemCapability.Ability.AbilityRuntime.Core
871     * @stagemodelonly
872     * @since 9
873     */
874    /**
875     * High memory usage.
876     *
877     * @syscap SystemCapability.Ability.AbilityRuntime.Core
878     * @stagemodelonly
879     * @atomicservice
880     * @since arkts {'1.1':'11', '1.2':'20'}
881     * @arkts 1.1&1.2
882     */
883    MEMORY_LEVEL_CRITICAL = 2
884  }
885
886  /**
887   * Enumerates the window mode when the ability is started.
888   * It can be used together with <code>startAbility</code> to specify the window mode for starting the ability.
889   *
890   * @enum { number }
891   * @syscap SystemCapability.Ability.AbilityRuntime.Core
892   * @stagemodelonly
893   * @since arkts {'1.1':'12', '1.2':'20'}
894   * @arkts 1.1&1.2
895   */
896  export enum WindowMode {
897    /**
898     * Undefined window mode.
899     *
900     * @syscap SystemCapability.Ability.AbilityRuntime.Core
901     * @systemapi
902     * @stagemodelonly
903     * @since arkts {'1.1':'12', '1.2':'20'}
904     * @arkts 1.1&1.2
905     */
906    WINDOW_MODE_UNDEFINED = 0,
907
908    /**
909     * Full screen mode. It takes effect only on 2-in-1 devices and tablets.
910     *
911     * @syscap SystemCapability.Ability.AbilityRuntime.Core
912     * @stagemodelonly
913     * @since arkts {'1.1':'12', '1.2':'20'}
914     * @arkts 1.1&1.2
915     */
916    WINDOW_MODE_FULLSCREEN = 1,
917
918    /**
919     * Primary screen (left screen in the case of horizontal orientation) in split-screen mode. It is valid only in
920     * intra-app redirection scenarios.
921     * It takes effect only on foldable devices and tablets.
922     *
923     * @syscap SystemCapability.Ability.AbilityRuntime.Core
924     * @stagemodelonly
925     * @since arkts {'1.1':'12', '1.2':'20'}
926     * @arkts 1.1&1.2
927     */
928    WINDOW_MODE_SPLIT_PRIMARY = 100,
929
930    /**
931     * Secondary screen (right screen in the case of horizontal orientation) in split-screen mode. It is valid only in
932     * intra-app redirection scenarios.
933     * It takes effect only on foldable devices and tablets.
934     *
935     * @syscap SystemCapability.Ability.AbilityRuntime.Core
936     * @stagemodelonly
937     * @since arkts {'1.1':'12', '1.2':'20'}
938     * @arkts 1.1&1.2
939     */
940    WINDOW_MODE_SPLIT_SECONDARY = 101,
941
942    /**
943     * The ability is displayed in a floating window.
944     *
945     * @syscap SystemCapability.Ability.AbilityRuntime.Core
946     * @systemapi
947     * @stagemodelonly
948     * @since arkts {'1.1':'12', '1.2':'20'}
949     * @arkts 1.1&1.2
950     */
951    WINDOW_MODE_FLOATING = 102
952  }
953
954  /**
955   * Type of onSave result.
956   *
957   * @enum { number }
958   * @syscap SystemCapability.Ability.AbilityRuntime.Core
959   * @stagemodelonly
960   * @since 9
961   */
962  /**
963   * Enumerates the result types for the operation of saving application data. You can use it in
964   * <code>onSaveState(reason, wantParam)</code> of the UIAbility to complete different operations.
965   *
966   * @enum { number }
967   * @syscap SystemCapability.Ability.AbilityRuntime.Core
968   * @stagemodelonly
969   * @atomicservice
970   * @since arkts {'1.1':'11', '1.2':'20'}
971   * @arkts 1.1&1.2
972   */
973  export enum OnSaveResult {
974    /**
975     * Always agree to save the state.
976     *
977     * @syscap SystemCapability.Ability.AbilityRuntime.Core
978     * @stagemodelonly
979     * @since 9
980     */
981    /**
982     * Always agreed to save the status.
983     *
984     * @syscap SystemCapability.Ability.AbilityRuntime.Core
985     * @stagemodelonly
986     * @atomicservice
987     * @since arkts {'1.1':'11', '1.2':'20'}
988     * @arkts 1.1&1.2
989     */
990    ALL_AGREE = 0,
991
992    /**
993     * Refuse to migrate the saved state.
994     *
995     * @syscap SystemCapability.Ability.AbilityRuntime.Core
996     * @stagemodelonly
997     * @since 9
998     */
999    /**
1000     * Rejected to save the status in continuation.
1001     *
1002     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1003     * @stagemodelonly
1004     * @atomicservice
1005     * @since arkts {'1.1':'11', '1.2':'20'}
1006     * @arkts 1.1&1.2
1007     */
1008    CONTINUATION_REJECT = 1,
1009
1010    /**
1011     * Migration mismatch.
1012     *
1013     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1014     * @stagemodelonly
1015     * @since 9
1016     */
1017    /**
1018     * Continuation mismatch.
1019     *
1020     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1021     * @stagemodelonly
1022     * @atomicservice
1023     * @since arkts {'1.1':'11', '1.2':'20'}
1024     * @arkts 1.1&1.2
1025     */
1026    CONTINUATION_MISMATCH = 2,
1027
1028    /**
1029     * Agree to restore the saved state.
1030     *
1031     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1032     * @stagemodelonly
1033     * @since 9
1034     */
1035    /**
1036     * Agreed to restore the saved status.
1037     *
1038     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1039     * @stagemodelonly
1040     * @atomicservice
1041     * @since arkts {'1.1':'11', '1.2':'20'}
1042     * @arkts 1.1&1.2
1043     */
1044    RECOVERY_AGREE = 3,
1045
1046    /**
1047     * Refuse to restore the saved state.
1048     *
1049     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1050     * @stagemodelonly
1051     * @since 9
1052     */
1053    /**
1054     * Rejected to restore the saved status.
1055     *
1056     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1057     * @stagemodelonly
1058     * @atomicservice
1059     * @since arkts {'1.1':'11', '1.2':'20'}
1060     * @arkts 1.1&1.2
1061     */
1062    RECOVERY_REJECT = 4,
1063
1064    /**
1065     * Always refuses to save the state.
1066     *
1067     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1068     * @stagemodelonly
1069     * @since 9
1070     */
1071    /**
1072     * Always rejected to save the status.
1073     *
1074     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1075     * @stagemodelonly
1076     * @atomicservice
1077     * @since arkts {'1.1':'11', '1.2':'20'}
1078     * @arkts 1.1&1.2
1079     */
1080    ALL_REJECT
1081  }
1082
1083  /**
1084   * Type of save state.
1085   *
1086   * @enum { number }
1087   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1088   * @stagemodelonly
1089   * @since 9
1090   */
1091  /**
1092   * Enumerates the scenarios for saving application data. You can use it in
1093   * <code>onSaveState(reason, wantParam)</code> of the UIAbility to complete different operations.
1094   *
1095   * @enum { number }
1096   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1097   * @stagemodelonly
1098   * @atomicservice
1099   * @since arkts {'1.1':'11', '1.2':'20'}
1100   * @arkts 1.1&1.2
1101   */
1102  export enum StateType {
1103    /**
1104     * Migrate and save the state.
1105     *
1106     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1107     * @stagemodelonly
1108     * @since 9
1109     */
1110    /**
1111     * Saving the status in continuation.
1112     *
1113     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1114     * @stagemodelonly
1115     * @atomicservice
1116     * @since arkts {'1.1':'11', '1.2':'20'}
1117     * @arkts 1.1&1.2
1118     */
1119    CONTINUATION = 0,
1120
1121    /**
1122     * App recovery to restore the saved state.
1123     *
1124     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1125     * @stagemodelonly
1126     * @since 9
1127     */
1128    /**
1129     * Saving the status in application recovery.
1130     *
1131     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1132     * @stagemodelonly
1133     * @atomicservice
1134     * @since arkts {'1.1':'11', '1.2':'20'}
1135     * @arkts 1.1&1.2
1136     */
1137    APP_RECOVERY = 1
1138  }
1139
1140  /**
1141   * Continue state.
1142   *
1143   * @enum { number }
1144   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1145   * @stagemodelonly
1146   * @since 10
1147   */
1148  /**
1149   * Enumerates the mission continuation states of the application. It is used in the
1150   * <code>setMissionContinueState</code> API of UIAbilityContext.
1151   *
1152   * @enum { number }
1153   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1154   * @stagemodelonly
1155   * @atomicservice
1156   * @since arkts {'1.1':'11', '1.2':'20'}
1157   * @arkts 1.1&1.2
1158   */
1159  export enum ContinueState {
1160    /**
1161     * Mission continuable active.
1162     *
1163     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1164     * @stagemodelonly
1165     * @since 10
1166     */
1167    /**
1168     * Mission continuation is activated for the current application.
1169     *
1170     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1171     * @stagemodelonly
1172     * @atomicservice
1173     * @since arkts {'1.1':'11', '1.2':'20'}
1174     * @arkts 1.1&1.2
1175     */
1176    ACTIVE = 0,
1177
1178    /**
1179     * Mission continuable inactive.
1180     *
1181     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1182     * @stagemodelonly
1183     * @since 10
1184     */
1185    /**
1186     * Mission continuation is not activated for the current application.
1187     *
1188     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1189     * @stagemodelonly
1190     * @atomicservice
1191     * @since arkts {'1.1':'11', '1.2':'20'}
1192     * @arkts 1.1&1.2
1193     */
1194    INACTIVE = 1
1195  }
1196
1197  /**
1198   * Enumerates the collaboration request results.
1199   * This enum is used in multi-device collaboration scenarios to specify whether the target application accepts the
1200   * collaboration request from the caller application.
1201   * It is used in <code>onCollaborate(wantParam)</code> of the UIAbility.
1202   *
1203   * @enum { number }
1204   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1205   * @stagemodelonly
1206   * @since arkts {'1.1':'18', '1.2':'20'}
1207   * @arkts 1.1&1.2
1208   */
1209  export enum CollaborateResult {
1210    /**
1211     * 	Accepts the collaboration request.
1212     *
1213     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1214     * @stagemodelonly
1215     * @since arkts {'1.1':'18', '1.2':'20'}
1216     * @arkts 1.1&1.2
1217     */
1218    ACCEPT = 0,
1219
1220    /**
1221     * Rejects the collaboration request.
1222     *
1223     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1224     * @stagemodelonly
1225     * @since arkts {'1.1':'18', '1.2':'20'}
1226     * @arkts 1.1&1.2
1227     */
1228    REJECT = 1,
1229  }
1230
1231  /**
1232   * Enumerates the actions triggered when an application is closed by the user. It must be used together with
1233   * <code>onPrepareTermination</code> or <code>onPrepareTerminationAsync</code> of AbilityStage.
1234   *
1235   * @enum { number }
1236   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1237   * @stagemodelonly
1238   * @atomicservice
1239   * @since arkts {'1.1':'15', '1.2':'20'}
1240   * @arkts 1.1&1.2
1241   */
1242  export enum PrepareTermination {
1243    /**
1244     * Executes the termination action immediately. This is the default behavior.
1245     *
1246     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1247     * @stagemodelonly
1248     * @atomicservice
1249     * @since arkts {'1.1':'15', '1.2':'20'}
1250     * @arkts 1.1&1.2
1251     */
1252    TERMINATE_IMMEDIATELY = 0,
1253
1254    /**
1255     * Cancels the termination action.
1256     *
1257     * @syscap SystemCapability.Ability.AbilityRuntime.Core
1258     * @stagemodelonly
1259     * @atomicservice
1260     * @since arkts {'1.1':'15', '1.2':'20'}
1261     * @arkts 1.1&1.2
1262     */
1263    CANCEL = 1
1264  }
1265}
1266
1267export default AbilityConstant;
1268