• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit AbilityKit
19 */
20
21import { AsyncCallback } from './@ohos.base';
22import { ProcessInformation as _ProcessInformation } from './application/ProcessInformation';
23import bundleManager from './@ohos.bundle.bundleManager';
24import { RunningMultiAppInfo as _RunningMultiAppInfo } from './application/RunningMultiAppInfo';
25/*** if arkts 1.1 */
26import * as _ApplicationStateObserver from './application/ApplicationStateObserver';
27import type * as _AppForegroundStateObserver from './application/AppForegroundStateObserver';
28import * as _AbilityStateData from './application/AbilityStateData';
29import * as _AppStateData from './application/AppStateData';
30import type * as _ProcessData from './application/ProcessData';
31import * as _AbilityFirstFrameStateObserver from './application/AbilityFirstFrameStateObserver';
32import * as _AbilityFirstFrameStateData from './application/AbilityFirstFrameStateData';
33/*** endif */
34/*** if arkts 1.2 */
35import _AbilityStateData from './application/AbilityStateData';
36import _AppStateData from './application/AppStateData';
37/*** endif */
38
39/**
40 * This module provides the function of app manager service.
41 *
42 * @namespace appManager
43 * @syscap SystemCapability.Ability.AbilityRuntime.Core
44 * @since 9
45 */
46/**
47 * This module provides the function of app manager service.
48 *
49 * @namespace appManager
50 * @syscap SystemCapability.Ability.AbilityRuntime.Core
51 * @atomicservice
52 * @since arkts {'1.1':'11', '1.2':'20'}
53 * @arkts 1.1&1.2
54 */
55declare namespace appManager {
56  /**
57   * Enum for the application state
58   *
59   * @enum { number }
60   * @syscap SystemCapability.Ability.AbilityRuntime.Core
61   * @systemapi
62   * @since arkts {'1.1':'9', '1.2':'20'}
63   * @arkts 1.1&1.2
64   */
65  export enum ApplicationState {
66    /**
67     * The state in which the application is being created.
68     *
69     * @syscap SystemCapability.Ability.AbilityRuntime.Core
70     * @systemapi
71     * @since arkts {'1.1':'9', '1.2':'20'}
72     * @arkts 1.1&1.2
73     */
74    STATE_CREATE,
75
76    /**
77     * The state that the application is in when it switches to the foreground.
78     *
79     * @syscap SystemCapability.Ability.AbilityRuntime.Core
80     * @systemapi
81     * @since arkts {'1.1':'9', '1.2':'20'}
82     * @arkts 1.1&1.2
83     */
84    STATE_FOREGROUND,
85
86    /**
87     * The state in which the application is in focus.
88     *
89     * @syscap SystemCapability.Ability.AbilityRuntime.Core
90     * @systemapi
91     * @since 9
92     */
93    STATE_ACTIVE,
94
95    /**
96     * The state in which the application is invisible in the background.
97     *
98     * @syscap SystemCapability.Ability.AbilityRuntime.Core
99     * @systemapi
100     * @since arkts {'1.1':'9', '1.2':'20'}
101     * @arkts 1.1&1.2
102     */
103    STATE_BACKGROUND,
104
105    /**
106     * The state that the application is in when it is destroyed.
107     *
108     * @syscap SystemCapability.Ability.AbilityRuntime.Core
109     * @systemapi
110     * @since arkts {'1.1':'9', '1.2':'20'}
111     * @arkts 1.1&1.2
112     */
113    STATE_DESTROY
114  }
115
116  /**
117   * Enum for the process state
118   *
119   * @enum { number }
120   * @syscap SystemCapability.Ability.AbilityRuntime.Core
121   * @since 10
122   */
123  /**
124   * Enum for the process state
125   *
126   * @enum { number }
127   * @syscap SystemCapability.Ability.AbilityRuntime.Core
128   * @atomicservice
129   * @since arkts {'1.1':'11', '1.2':'20'}
130   * @arkts 1.1&1.2
131   */
132  export enum ProcessState {
133    /**
134     * The state that the process is in when it is being created.
135     *
136     * @syscap SystemCapability.Ability.AbilityRuntime.Core
137     * @since 10
138     */
139    /**
140     * The state that the process is in when it is being created.
141     *
142     * @syscap SystemCapability.Ability.AbilityRuntime.Core
143     * @atomicservice
144     * @since arkts {'1.1':'11', '1.2':'20'}
145     * @arkts 1.1&1.2
146     */
147    STATE_CREATE,
148
149    /**
150     * The state in which the process is in when it switches to the foreground.
151     *
152     * @syscap SystemCapability.Ability.AbilityRuntime.Core
153     * @since 10
154     */
155    /**
156     * The state in which the process is in when it switches to the foreground.
157     *
158     * @syscap SystemCapability.Ability.AbilityRuntime.Core
159     * @atomicservice
160     * @since arkts {'1.1':'11', '1.2':'20'}
161     * @arkts 1.1&1.2
162     */
163    STATE_FOREGROUND,
164
165    /**
166     * The state in which the process is in focus.
167     *
168     * @syscap SystemCapability.Ability.AbilityRuntime.Core
169     * @since 10
170     */
171    /**
172     * The state in which the process is in focus.
173     *
174     * @syscap SystemCapability.Ability.AbilityRuntime.Core
175     * @atomicservice
176     * @since arkts {'1.1':'11', '1.2':'20'}
177     * @arkts 1.1&1.2
178     */
179    STATE_ACTIVE,
180
181    /**
182     * The state in which a process is invisible in the background.
183     *
184     * @syscap SystemCapability.Ability.AbilityRuntime.Core
185     * @since 10
186     */
187    /**
188     * The state in which a process is invisible in the background.
189     *
190     * @syscap SystemCapability.Ability.AbilityRuntime.Core
191     * @atomicservice
192     * @since arkts {'1.1':'11', '1.2':'20'}
193     * @arkts 1.1&1.2
194     */
195    STATE_BACKGROUND,
196
197    /**
198     * The state that the process is in when it is destroyed.
199     *
200     * @syscap SystemCapability.Ability.AbilityRuntime.Core
201     * @since 10
202     */
203    /**
204     * The state that the process is in when it is destroyed.
205     *
206     * @syscap SystemCapability.Ability.AbilityRuntime.Core
207     * @atomicservice
208     * @since arkts {'1.1':'11', '1.2':'20'}
209     * @arkts 1.1&1.2
210     */
211    STATE_DESTROY
212  }
213
214  /**
215   * Enum for the preload mode
216   *
217   * @enum { number }
218   * @syscap SystemCapability.Ability.AbilityRuntime.Core
219   * @systemapi
220   * @stagemodelonly
221   * @since arkts {'1.1':'12', '1.2':'20'}
222   * @arkts 1.1&1.2
223   */
224  export enum PreloadMode {
225    /**
226     * Preload application when press the app icon down.
227     *
228     * @syscap SystemCapability.Ability.AbilityRuntime.Core
229     * @systemapi
230     * @stagemodelonly
231     * @since arkts {'1.1':'12', '1.2':'20'}
232     * @arkts 1.1&1.2
233     */
234    PRESS_DOWN
235  }
236
237  /**
238   * Indicates the type of keep-alive apps.
239   * @enum { number }
240   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
241   * @systemapi
242   * @since 14
243   */
244    export enum KeepAliveAppType {
245      /**
246       * All apps.
247       *
248       * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
249       * @systemapi
250       * @since 14
251       */
252      ALL = 0,
253
254      /**
255       * 3rd party app.
256       *
257       * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
258       * @systemapi
259       * @since 14
260       */
261      THIRD_PARTY = 1,
262
263      /**
264       * System app.
265       *
266       * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
267       * @systemapi
268       * @since 14
269       */
270      SYSTEM = 2
271    }
272
273    /**
274     * Setter who sets the keep-alive flag for a bundle.
275     * @enum { number }
276     * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
277     * @systemapi
278     * @since 14
279     */
280    export enum KeepAliveSetter {
281      /**
282       * Indicates the bundle is set keep-alive by system.
283       *
284       * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
285       * @systemapi
286       * @since 14
287       */
288      SYSTEM = 0,
289
290      /**
291       * Indicates the bundle is set keep-alive by user.
292       *
293       * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
294       * @systemapi
295       * @since 14
296       */
297      USER = 1
298    }
299
300    /**
301     * The class of keep-alive bundle information.
302     *
303     * @typedef KeepAliveBundleInfo
304     * @syscap SystemCapability.Ability.AbilityRuntime.Core
305     * @systemapi
306     * @since 14
307     */
308    export interface KeepAliveBundleInfo {
309      /**
310       * The name of the bundle.
311       *
312       * @type { string }
313       * @syscap SystemCapability.Ability.AbilityRuntime.Core
314       * @systemapi
315       * @since 14
316       */
317      bundleName: string;
318
319      /**
320       * App type.
321       *
322       * @type { KeepAliveAppType }
323       * @syscap SystemCapability.Ability.AbilityRuntime.Core
324       * @systemapi
325       * @since 14
326       */
327      type: KeepAliveAppType;
328
329      /**
330       * The setter who sets the keep-alive flag.
331       *
332       * @type { KeepAliveSetter }
333       * @syscap SystemCapability.Ability.AbilityRuntime.Core
334       * @systemapi
335       * @since 14
336       */
337      setter: KeepAliveSetter;
338
339      /**
340       * The user id of setter.
341       *
342       * @type { ?number }
343       * @syscap SystemCapability.Ability.AbilityRuntime.Core
344       * @systemapi
345       * @since 20
346       */
347      setterUserId?: number;
348
349      /**
350       * Weather allow user to cancel keep-alive status.
351       *
352       * @type { ?boolean }
353       * @syscap SystemCapability.Ability.AbilityRuntime.Core
354       * @systemapi
355       * @since 20
356       */
357      allowUserToCancel?: boolean;
358    }
359
360  /**
361   * Register application state observer.
362   *
363   * @permission ohos.permission.RUNNING_STATE_OBSERVER
364   * @param { 'applicationState' } type - applicationState.
365   * @param { ApplicationStateObserver } observer - The application state observer.
366   * @returns { number } Returns the number code of the observer.
367   * @throws { BusinessError } 201 - Permission denied.
368   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
369   * 2. Incorrect parameter types; 3. Parameter verification failed.
370   * @throws { BusinessError } 16000050 - Internal error.
371   * @syscap SystemCapability.Ability.AbilityRuntime.Core
372   * @since 14
373   */
374  function on(type: 'applicationState', observer: ApplicationStateObserver): number;
375
376  /**
377   * Register application state observer.
378   *
379   * @permission ohos.permission.RUNNING_STATE_OBSERVER
380   * @param { 'applicationState' } type - applicationState.
381   * @param { ApplicationStateObserver } observer - The application state observer.
382   * @param { Array<string> } bundleNameList - The list of bundleName. The max length is 128.
383   * @returns { number } Returns the number code of the observer.
384   * @throws { BusinessError } 201 - Permission denied.
385   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
386   * 2. Incorrect parameter types; 3. Parameter verification failed.
387   * @throws { BusinessError } 16000050 - Internal error.
388   * @syscap SystemCapability.Ability.AbilityRuntime.Core
389   * @since 14
390   */
391  function on(type: 'applicationState', observer: ApplicationStateObserver, bundleNameList: Array<string>): number;
392
393  /**
394   * Register app foreground or background state observer.
395   *
396   * @permission ohos.permission.RUNNING_STATE_OBSERVER
397   * @param { 'appForegroundState' } type - app foreground or background state.
398   * @param { AppForegroundStateObserver } observer - The app foreground state observer.
399   * @throws { BusinessError } 201 - Permission denied.
400   * @throws { BusinessError } 202 - Not system application.
401   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
402   * 2. Incorrect parameter types; 3. Parameter verification failed.
403   * @throws { BusinessError } 16000050 - Internal error.
404   * @syscap SystemCapability.Ability.AbilityRuntime.Core
405   * @systemapi
406   * @since 11
407   */
408  function on(type: 'appForegroundState', observer: AppForegroundStateObserver): void;
409
410  /**
411   * Register ability first frame state observe.
412   *
413   * @permission ohos.permission.RUNNING_STATE_OBSERVER
414   * @param { 'abilityFirstFrameState' } type - The ability first frame drawing state.
415   * @param { AbilityFirstFrameStateObserver } observer - The ability first frame state observer.
416   * @param { string } [bundleName] - The target bundle name.
417   * @throws { BusinessError } 201 - Permission denied.
418   * @throws { BusinessError } 202 - Not system application.
419   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
420   * 2. Incorrect parameter types; 3. Parameter verification failed.
421   * @throws { BusinessError } 16000050 - Internal error.
422   * @syscap SystemCapability.Ability.AbilityRuntime.Core
423   * @systemapi
424   * @since 12
425   */
426  function on(type: 'abilityFirstFrameState', observer: AbilityFirstFrameStateObserver, bundleName?: string): void;
427
428  /**
429   * Unregister application state observer.
430   *
431   * @permission ohos.permission.RUNNING_STATE_OBSERVER
432   * @param { 'applicationState' } type - applicationState.
433   * @param { number } observerId - Indicates the number code of the observer.
434   * @param { AsyncCallback<void> } callback - The callback of off.
435   * @throws { BusinessError } 201 - Permission denied.
436   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
437   * 2. Incorrect parameter types; 3. Parameter verification failed.
438   * @throws { BusinessError } 16000050 - Internal error.
439   * @syscap SystemCapability.Ability.AbilityRuntime.Core
440   * @since 15
441   */
442  function off(type: 'applicationState', observerId: number, callback: AsyncCallback<void>): void;
443
444  /**
445   * Unregister application state observer.
446   *
447   * @permission ohos.permission.RUNNING_STATE_OBSERVER
448   * @param { 'applicationState' } type - applicationState.
449   * @param { number } observerId - Indicates the number code of the observer.
450   * @returns { Promise<void> } The promise returned by the function.
451   * @throws { BusinessError } 201 - Permission denied.
452   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
453   * 2. Incorrect parameter types; 3. Parameter verification failed.
454   * @throws { BusinessError } 16000050 - Internal error.
455   * @syscap SystemCapability.Ability.AbilityRuntime.Core
456   * @since 14
457   */
458  function off(type: 'applicationState', observerId: number): Promise<void>;
459
460  /**
461   * Unregister app foreground or background state observer.
462   *
463   * @permission ohos.permission.RUNNING_STATE_OBSERVER
464   * @param { 'appForegroundState' } type - app foreground or background state.
465   * @param { AppForegroundStateObserver } [observer] - The app foreground state observer.
466   * @throws { BusinessError } 201 - Permission denied.
467   * @throws { BusinessError } 202 - Not system application.
468   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
469   * 2. Incorrect parameter types; 3. Parameter verification failed.
470   * @throws { BusinessError } 16000050 - Internal error.
471   * @syscap SystemCapability.Ability.AbilityRuntime.Core
472   * @systemapi
473   * @since 11
474   */
475  function off(type: 'appForegroundState', observer?: AppForegroundStateObserver): void;
476
477  /**
478   * Unregister ability first frame state observer.
479   *
480   * @permission ohos.permission.RUNNING_STATE_OBSERVER
481   * @param { 'abilityFirstFrameState' } type - The ability first frame drawing state.
482   * @param { AbilityFirstFrameStateObserver } [observer] - The ability first frame state observer.
483   * @throws { BusinessError } 201 - Permission denied.
484   * @throws { BusinessError } 202 - Not system application.
485   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
486   * 2. Incorrect parameter types; 3. Parameter verification failed.
487   * @throws { BusinessError } 16000050 - Internal error.
488   * @syscap SystemCapability.Ability.AbilityRuntime.Core
489   * @systemapi
490   * @since 12
491   */
492  function off(type: 'abilityFirstFrameState', observer?: AbilityFirstFrameStateObserver): void;
493
494  /**
495   * getForegroundApplications.
496   *
497   * @permission ohos.permission.GET_RUNNING_INFO
498   * @param { AsyncCallback<Array<AppStateData>> } callback - The callback is used to return the list of AppStateData.
499   * @throws { BusinessError } 201 - Permission denied.
500   * @throws { BusinessError } 202 - Not system application.
501   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
502   * 2. Incorrect parameter types; 3. Parameter verification failed.
503   * @throws { BusinessError } 16000050 - Internal error.
504   * @syscap SystemCapability.Ability.AbilityRuntime.Core
505   * @systemapi
506   * @since arkts {'1.1':'9', '1.2':'20'}
507   * @arkts 1.1&1.2
508   */
509  function getForegroundApplications(callback: AsyncCallback<Array<AppStateData>>): void;
510
511  /**
512   * getForegroundApplications.
513   *
514   * @permission ohos.permission.GET_RUNNING_INFO
515   * @returns { Promise<Array<AppStateData>> } Returns the list of AppStateData.
516   * @throws { BusinessError } 201 - Permission denied.
517   * @throws { BusinessError } 202 - Not system application.
518   * @throws { BusinessError } 16000050 - Internal error.
519   * @syscap SystemCapability.Ability.AbilityRuntime.Core
520   * @systemapi
521   * @since arkts {'1.1':'9', '1.2':'20'}
522   * @arkts 1.1&1.2
523   */
524  function getForegroundApplications(): Promise<Array<AppStateData>>;
525
526  /**
527   * Kill process with account.
528   *
529   * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES
530   * @param { string } bundleName - The process bundle name.
531   * @param { number } accountId - The account id.
532   * @returns { Promise<void> } The promise returned by the function.
533   * @throws { BusinessError } 201 - Permission denied.
534   * @throws { BusinessError } 202 - Not system application.
535   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
536   * 2. Incorrect parameter types; 3. Parameter verification failed.
537   * @throws { BusinessError } 16000050 - Internal error.
538   * @syscap SystemCapability.Ability.AbilityRuntime.Core
539   * @systemapi
540   * @since 9
541   */
542  /**
543   * Kill process with account.
544   *
545   * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.KILL_APP_PROCESSES
546   *     or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES
547   * @param { string } bundleName - The process bundle name.
548   * @param { number } accountId - The account id.
549   * @returns { Promise<void> } The promise returned by the function.
550   * @throws { BusinessError } 201 - Permission denied.
551   * @throws { BusinessError } 202 - Not system application.
552   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
553   *     2. Incorrect parameter types; 3. Parameter verification failed.
554   * @throws { BusinessError } 16000050 - Internal error.
555   * @syscap SystemCapability.Ability.AbilityRuntime.Core
556   * @systemapi
557   * @since 14
558   */
559  function killProcessWithAccount(bundleName: string, accountId: number): Promise<void>;
560
561  /**
562   * Kill process with account.
563   *
564   * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.KILL_APP_PROCESSES
565   *     or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES
566   * @param { string } bundleName - The process bundle name.
567   * @param { number } accountId - The account id.
568   * @param { boolean } clearPageStack - The flag that indicates whether the page stack need to be cleared.
569   * @param { number } [appIndex] - The application index.
570   * @returns { Promise<void> } The promise returned by the function.
571   * @throws { BusinessError } 201 - Permission denied.
572   * @throws { BusinessError } 202 - Not system application.
573   * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
574   * @throws { BusinessError } 16000050 - Internal error.
575   * @syscap SystemCapability.Ability.AbilityRuntime.Core
576   * @systemapi
577   * @since 14
578   */
579  function killProcessWithAccount(bundleName: string, accountId: number, clearPageStack: boolean, appIndex?: number):
580    Promise<void>;
581
582  /**
583   * Kill process with account.
584   *
585   * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES
586   * @param { string } bundleName - The process bundle name.
587   * @param { number } accountId - The account id.
588   * @param { AsyncCallback<void> } callback - The callback of killProcessWithAccount.
589   * @throws { BusinessError } 201 - Permission denied.
590   * @throws { BusinessError } 202 - Not system application.
591   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
592   * 2. Incorrect parameter types; 3. Parameter verification failed.
593   * @throws { BusinessError } 16000050 - Internal error.
594   * @syscap SystemCapability.Ability.AbilityRuntime.Core
595   * @systemapi
596   * @since 9
597   */
598  /**
599   * Kill process with account.
600   *
601   * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.KILL_APP_PROCESSES
602   *     or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES
603   * @param { string } bundleName - The process bundle name.
604   * @param { number } accountId - The account id.
605   * @param { AsyncCallback<void> } callback - The callback of killProcessWithAccount.
606   * @throws { BusinessError } 201 - Permission denied.
607   * @throws { BusinessError } 202 - Not system application.
608   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
609   *     2. Incorrect parameter types; 3. Parameter verification failed.
610   * @throws { BusinessError } 16000050 - Internal error.
611   * @syscap SystemCapability.Ability.AbilityRuntime.Core
612   * @systemapi
613   * @since 14
614   */
615  function killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCallback<void>): void;
616
617  /**
618   * Is user running in stability test.
619   *
620   * @param { AsyncCallback<boolean> } callback - The callback is used to return true if user is running stability test.
621   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
622   * 2. Incorrect parameter types; 3. Parameter verification failed.
623   * @throws { BusinessError } 16000050 - Internal error.
624   * @syscap SystemCapability.Ability.AbilityRuntime.Core
625   * @since 9
626   */
627  /**
628   * Is user running in stability test.
629   *
630   * @param { AsyncCallback<boolean> } callback - The callback is used to return true if user is running stability test.
631   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
632   * 2. Incorrect parameter types; 3. Parameter verification failed.
633   * @throws { BusinessError } 16000050 - Internal error.
634   * @syscap SystemCapability.Ability.AbilityRuntime.Core
635   * @atomicservice
636   * @since 11
637   */
638  function isRunningInStabilityTest(callback: AsyncCallback<boolean>): void;
639
640  /**
641   * Is user running in stability test.
642   *
643   * @returns { Promise<boolean> } Returns true if user is running stability test.
644   * @throws { BusinessError } 16000050 - Internal error.
645   * @syscap SystemCapability.Ability.AbilityRuntime.Core
646   * @since 9
647   */
648  /**
649   * Is user running in stability test.
650   *
651   * @returns { Promise<boolean> } Returns true if user is running stability test.
652   * @throws { BusinessError } 16000050 - Internal error.
653   * @syscap SystemCapability.Ability.AbilityRuntime.Core
654   * @atomicservice
655   * @since 11
656   */
657  function isRunningInStabilityTest(): Promise<boolean>;
658
659  /**
660   * Kill processes by bundle name
661   *
662   * @permission ohos.permission.CLEAN_BACKGROUND_PROCESSES
663   * @param { string } bundleName - bundle name.
664   * @returns { Promise<void> } The promise returned by the function.
665   * @throws { BusinessError } 201 - Permission denied.
666   * @throws { BusinessError } 202 - Not system application.
667   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
668   * 2. Incorrect parameter types; 3. Parameter verification failed.
669   * @throws { BusinessError } 16000050 - Internal error.
670   * @syscap SystemCapability.Ability.AbilityRuntime.Core
671   * @systemapi
672   * @since 9
673   */
674  /**
675   * Kill processes by bundle name
676   *
677   * @permission ohos.permission.KILL_APP_PROCESSES or ohos.permission.CLEAN_BACKGROUND_PROCESSES
678   * @param { string } bundleName - bundle name.
679   * @returns { Promise<void> } The promise returned by the function.
680   * @throws { BusinessError } 201 - Permission denied.
681   * @throws { BusinessError } 202 - Not system application.
682   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
683   *     2. Incorrect parameter types; 3. Parameter verification failed.
684   * @throws { BusinessError } 16000050 - Internal error.
685   * @syscap SystemCapability.Ability.AbilityRuntime.Core
686   * @systemapi
687   * @since 14
688   */
689  function killProcessesByBundleName(bundleName: string): Promise<void>;
690
691  /**
692   * Kill processes by bundle name
693   *
694   * @permission ohos.permission.KILL_APP_PROCESSES or ohos.permission.CLEAN_BACKGROUND_PROCESSES
695   * @param { string } bundleName - bundle name.
696   * @param { boolean } clearPageStack - The flag that indicates whether the page stack need to be cleared.
697   * @param { number } [appIndex] - The index of clone app.
698   * @returns { Promise<void> } The promise returned by the function.
699   * @throws { BusinessError } 201 - Permission denied.
700   * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
701   * @throws { BusinessError } 16000050 - Internal error.
702   * @syscap SystemCapability.Ability.AbilityRuntime.Core
703   * @since 14
704   */
705  function killProcessesByBundleName(bundleName: string, clearPageStack: boolean, appIndex?: number): Promise<void>;
706
707  /**
708   * Kill processes by bundle name
709   *
710   * @permission ohos.permission.CLEAN_BACKGROUND_PROCESSES
711   * @param { string } bundleName - bundle name.
712   * @param { AsyncCallback<void> } callback - The callback of killProcessesByBundleName.
713   * @throws { BusinessError } 201 - Permission denied.
714   * @throws { BusinessError } 202 - Not system application.
715   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
716   * 2. Incorrect parameter types; 3. Parameter verification failed.
717   * @throws { BusinessError } 16000050 - Internal error.
718   * @syscap SystemCapability.Ability.AbilityRuntime.Core
719   * @systemapi
720   * @since 9
721   */
722  /**
723   * Kill processes by bundle name
724   *
725   * @permission ohos.permission.KILL_APP_PROCESSES or ohos.permission.CLEAN_BACKGROUND_PROCESSES
726   * @param { string } bundleName - bundle name.
727   * @param { AsyncCallback<void> } callback - The callback of killProcessesByBundleName.
728   * @throws { BusinessError } 201 - Permission denied.
729   * @throws { BusinessError } 202 - Not system application.
730   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
731   *     2. Incorrect parameter types; 3. Parameter verification failed.
732   * @throws { BusinessError } 16000050 - Internal error.
733   * @syscap SystemCapability.Ability.AbilityRuntime.Core
734   * @systemapi
735   * @since 14
736   */
737  function killProcessesByBundleName(bundleName: string, callback: AsyncCallback<void>);
738
739  /**
740   * Clear up application data by bundle name
741   *
742   * @permission ohos.permission.CLEAN_APPLICATION_DATA
743   * @param { string } bundleName - bundle name.
744   * @returns { Promise<void> } The promise returned by the function.
745   * @throws { BusinessError } 201 - Permission denied.
746   * @throws { BusinessError } 202 - Not system application.
747   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
748   * 2. Incorrect parameter types; 3. Parameter verification failed.
749   * @throws { BusinessError } 16000050 - Internal error.
750   * @syscap SystemCapability.Ability.AbilityRuntime.Core
751   * @systemapi
752   * @since 9
753   */
754  function clearUpApplicationData(bundleName: string): Promise<void>;
755
756  /**
757   * Clear up application data by bundle name
758   *
759   * @permission ohos.permission.CLEAN_APPLICATION_DATA
760   * @param { string } bundleName - bundle name.
761   * @param { AsyncCallback<void> } callback - The callback of clearUpApplicationData.
762   * @throws { BusinessError } 201 - Permission denied.
763   * @throws { BusinessError } 202 - Not system application.
764   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
765   * 2. Incorrect parameter types; 3. Parameter verification failed.
766   * @throws { BusinessError } 16000050 - Internal error.
767   * @syscap SystemCapability.Ability.AbilityRuntime.Core
768   * @systemapi
769   * @since 9
770   */
771  function clearUpApplicationData(bundleName: string, callback: AsyncCallback<void>);
772
773  /**
774   * Is it a ram-constrained device
775   *
776   * @returns { Promise<boolean> } Returns true if the device is ram-constrained.
777   * @throws { BusinessError } 16000050 - Internal error.
778   * @syscap SystemCapability.Ability.AbilityRuntime.Core
779   * @since 9
780   */
781  /**
782   * Is it a ram-constrained device
783   *
784   * @returns { Promise<boolean> } Returns true if the device is ram-constrained.
785   * @throws { BusinessError } 16000050 - Internal error.
786   * @syscap SystemCapability.Ability.AbilityRuntime.Core
787   * @atomicservice
788   * @since 11
789   */
790  function isRamConstrainedDevice(): Promise<boolean>;
791
792  /**
793   * Is it a ram-constrained device
794   *
795   * @param { AsyncCallback<boolean> } callback - The callback is used to return true if the device is ram-constrained.
796   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
797   * 2. Incorrect parameter types; 3. Parameter verification failed.
798   * @throws { BusinessError } 16000050 - Internal error.
799   * @syscap SystemCapability.Ability.AbilityRuntime.Core
800   * @since 9
801   */
802  /**
803   * Is it a ram-constrained device
804   *
805   * @param { AsyncCallback<boolean> } callback - The callback is used to return true if the device is ram-constrained.
806   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
807   * 2. Incorrect parameter types; 3. Parameter verification failed.
808   * @throws { BusinessError } 16000050 - Internal error.
809   * @syscap SystemCapability.Ability.AbilityRuntime.Core
810   * @atomicservice
811   * @since 11
812   */
813  function isRamConstrainedDevice(callback: AsyncCallback<boolean>): void;
814
815  /**
816   * Get the memory size of the application
817   *
818   * @returns { Promise<number> } Returns the application memory size.
819   * @throws { BusinessError } 16000050 - Internal error.
820   * @syscap SystemCapability.Ability.AbilityRuntime.Core
821   * @since 9
822   */
823  /**
824   * Get the memory size of the application
825   *
826   * @returns { Promise<number> } Returns the application memory size.
827   * @throws { BusinessError } 16000050 - Internal error.
828   * @syscap SystemCapability.Ability.AbilityRuntime.Core
829   * @atomicservice
830   * @since 11
831   */
832  function getAppMemorySize(): Promise<number>;
833
834  /**
835   * Get the memory size of the application
836   *
837   * @param { AsyncCallback<number> } callback - The callback is used to return the application memory size.
838   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
839   * 2. Incorrect parameter types; 3. Parameter verification failed.
840   * @throws { BusinessError } 16000050 - Internal error.
841   * @syscap SystemCapability.Ability.AbilityRuntime.Core
842   * @since 9
843   */
844  /**
845   * Get the memory size of the application
846   *
847   * @param { AsyncCallback<number> } callback - The callback is used to return the application memory size.
848   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
849   * 2. Incorrect parameter types; 3. Parameter verification failed.
850   * @throws { BusinessError } 16000050 - Internal error.
851   * @syscap SystemCapability.Ability.AbilityRuntime.Core
852   * @atomicservice
853   * @since 11
854   */
855  function getAppMemorySize(callback: AsyncCallback<number>): void;
856
857  /**
858   * If you apply for permission, you can obtain information about all running processes.
859   * If you do not apply, you can only obtain information about the current process.
860   *
861   * @permission ohos.permission.GET_RUNNING_INFO
862   * @returns { Promise<Array<ProcessInformation>> } Returns the array of {@link ProcessInformation}.
863   * @throws { BusinessError } 16000050 - Internal error.
864   * @syscap SystemCapability.Ability.AbilityRuntime.Core
865   * @since 9
866   */
867  /**
868   * Get information about the current process.
869   *
870   * @returns { Promise<Array<ProcessInformation>> } Returns the array of {@link ProcessInformation}.
871   * @throws { BusinessError } 16000050 - Internal error.
872   * @syscap SystemCapability.Ability.AbilityRuntime.Core
873   * @atomicservice
874   * @since arkts {'1.1':'11', '1.2':'20'}
875   * @arkts 1.1&1.2
876   */
877  function getRunningProcessInformation(): Promise<Array<ProcessInformation>>;
878
879  /**
880   * Get running process information by bundle type.
881   *
882   * @permission ohos.permission.GET_RUNNING_INFO
883   * @param { bundleManager.BundleType } bundleType - the bundle type of the process
884   * @returns { Promise<Array<ProcessInformation>> } Returns the array of {@link ProcessInformation}.
885   * @throws { BusinessError } 201 - Permission denied.
886   * @throws { BusinessError } 202 - Not system application.
887   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
888   * 2. Incorrect parameter types; 3. Parameter verification failed.
889   * @throws { BusinessError } 16000050 - Internal error.
890   * @syscap SystemCapability.Ability.AbilityRuntime.Core
891   * @systemapi
892   * @since 12
893   */
894  function getRunningProcessInformationByBundleType(
895    bundleType: bundleManager.BundleType): Promise<Array<ProcessInformation>>;
896
897  /**
898   * If you apply for permission, you can obtain information about all running processes.
899   * If you do not apply, you can only obtain information about the current process.
900   *
901   * @permission ohos.permission.GET_RUNNING_INFO
902   * @param { AsyncCallback<Array<ProcessInformation>> } callback - The callback is used to return the array of {@link ProcessInformation}.
903   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
904   * 2. Incorrect parameter types; 3. Parameter verification failed.
905   * @throws { BusinessError } 16000050 - Internal error.
906   * @syscap SystemCapability.Ability.AbilityRuntime.Core
907   * @since 9
908   */
909  /**
910   * Get information about the current process.
911   *
912   * @param { AsyncCallback<Array<ProcessInformation>> } callback - The callback is used to return the array of {@link ProcessInformation}.
913   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
914   * 2. Incorrect parameter types; 3. Parameter verification failed.
915   * @throws { BusinessError } 16000050 - Internal error.
916   * @syscap SystemCapability.Ability.AbilityRuntime.Core
917   * @atomicservice
918   * @since arkts {'1.1':'11', '1.2':'20'}
919   * @arkts 1.1&1.2
920   */
921  function getRunningProcessInformation(callback: AsyncCallback<Array<ProcessInformation>>): void;
922
923  /**
924   * Check whether the shared bundle is running.
925   *
926   * @permission ohos.permission.GET_RUNNING_INFO
927   * @param { string } bundleName - Indicates the bundle name of the shared bundle.
928   * @param { number } versionCode - Indicates the version code of the shared bundle.
929   * @returns { Promise<boolean> } Returns the shared bundle running result. The result is true if running, false otherwise.
930   * @throws { BusinessError } 201 - Permission denied.
931   * @throws { BusinessError } 202 - Not system application.
932   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
933   * 2. Incorrect parameter types; 3. Parameter verification failed.
934   * @throws { BusinessError } 16000050 - Internal error.
935   * @syscap SystemCapability.Ability.AbilityRuntime.Core
936   * @systemapi
937   * @since 10
938   */
939  function isSharedBundleRunning(bundleName: string, versionCode: number): Promise<boolean>;
940
941  /**
942   * Check whether the shared bundle is running.
943   *
944   * @permission ohos.permission.GET_RUNNING_INFO
945   * @param { string } bundleName - Indicates the bundle name of the shared bundle.
946   * @param { number } versionCode - Indicates the version code of the shared bundle.
947   * @param { AsyncCallback<boolean> } callback - The callback of checking the shared bundle running result.
948   *                                              The result is true if running, false otherwise.
949   * @throws { BusinessError } 201 - Permission denied.
950   * @throws { BusinessError } 202 - Not system application.
951   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
952   * 2. Incorrect parameter types; 3. Parameter verification failed.
953   * @throws { BusinessError } 16000050 - Internal error.
954   * @syscap SystemCapability.Ability.AbilityRuntime.Core
955   * @systemapi
956   * @since 10
957   */
958  function isSharedBundleRunning(bundleName: string, versionCode: number, callback: AsyncCallback<boolean>): void;
959
960  /**
961   * Obtains memory usage of one process by its pid.
962   *
963   * @param { number } pid - Indicates the pid of the process.
964   * @returns { Promise<number> } Returns the memory usage of the process in KB.
965   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
966   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
967   * 2. Incorrect parameter types; 3. Parameter verification failed.
968   * @throws { BusinessError } 16000050 - Internal error.
969   * @syscap SystemCapability.Ability.AbilityRuntime.Core
970   * @systemapi
971   * @since 10
972   */
973  function getProcessMemoryByPid(pid: number): Promise<number>;
974
975  /**
976   * Obtains memory usage of one process by its pid.
977   *
978   * @param { number } pid - Indicates the pid of the process.
979   * @param { AsyncCallback<number> } callback - Indicates the callback of getting process memory by pid result.
980   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
981   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
982   * 2. Incorrect parameter types; 3. Parameter verification failed.
983   * @throws { BusinessError } 16000050 - Internal error.
984   * @syscap SystemCapability.Ability.AbilityRuntime.Core
985   * @systemapi
986   * @since 10
987   */
988  function getProcessMemoryByPid(pid: number, callback: AsyncCallback<number>): void;
989
990  /**
991   * Obtains the process information list of running processes that belong to a specific bundle of current user.
992   *
993   * @param { string } bundleName - Indicates the bundle name of the application to which the processes belong to.
994   * @param { AsyncCallback<Array<ProcessInformation>> } callback - Indicates the callback of getting process information by bundleName result.
995   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
996   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
997   * 2. Incorrect parameter types; 3. Parameter verification failed.
998   * @throws { BusinessError } 16000050 - Internal error.
999   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1000   * @systemapi
1001   * @since arkts {'1.1':'10', '1.2':'20'}
1002   * @arkts 1.1&1.2
1003   */
1004  function getRunningProcessInfoByBundleName(bundleName: string, callback: AsyncCallback<Array<ProcessInformation>>): void;
1005
1006  /**
1007   * Obtains the process information list of running processes that belong to a specific bundle and specific user ID.
1008   *
1009   * @param { string } bundleName - Indicates the bundle name of the application to which the processes belong to.
1010   * @param { number } userId - Indicates the user ID of the application to which the processes belong to.
1011   * @param { AsyncCallback<Array<ProcessInformation>> } callback - Indicates the callback of getting process information by bundleName result.
1012   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
1013   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1014   * 2. Incorrect parameter types; 3. Parameter verification failed.
1015   * @throws { BusinessError } 16000050 - Internal error.
1016   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1017   * @systemapi
1018   * @since arkts {'1.1':'10', '1.2':'20'}
1019   * @arkts 1.1&1.2
1020   */
1021  function getRunningProcessInfoByBundleName(bundleName: string, userId: number, callback: AsyncCallback<Array<ProcessInformation>>): void;
1022
1023  /**
1024   * Obtains the process information list of running processes that belong to a specific bundle of current user.
1025   *
1026   * @param { string } bundleName - Indicates the bundle name of the application to which the processes belong to.
1027   * @returns { Promise<Array<ProcessInformation>> } Returns a list of process information.
1028   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
1029   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1030   * 2. Incorrect parameter types; 3. Parameter verification failed.
1031   * @throws { BusinessError } 16000050 - Internal error.
1032   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1033   * @systemapi
1034   * @since arkts {'1.1':'10', '1.2':'20'}
1035   * @arkts 1.1&1.2
1036   */
1037  function getRunningProcessInfoByBundleName(bundleName: string): Promise<Array<ProcessInformation>>;
1038
1039  /**
1040   * Obtains the process information list of running processes that belong to a specific bundle and specific user ID.
1041   *
1042   * @param { string } bundleName - Indicates the bundle name of the application to which the processes belong to.
1043   * @param { number } userId - Indicates the user ID of the application to which the processes belong to.
1044   * @returns { Promise<Array<ProcessInformation>> } Returns a list of process information.
1045   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
1046   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1047   * 2. Incorrect parameter types; 3. Parameter verification failed.
1048   * @throws { BusinessError } 16000050 - Internal error.
1049   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1050   * @systemapi
1051   * @since arkts {'1.1':'10', '1.2':'20'}
1052   * @arkts 1.1&1.2
1053   */
1054  function getRunningProcessInfoByBundleName(bundleName: string, userId: number): Promise<Array<ProcessInformation>>;
1055
1056  /**
1057   * Check whether the bundle is running.
1058   *
1059   * @permission ohos.permission.GET_RUNNING_INFO
1060   * @param { string } bundleName - Indicates the bundle name of the bundle.
1061   * @returns { Promise<boolean> } Returns the bundle running result. The result is true if running, false otherwise.
1062   * @throws { BusinessError } 201 - Permission denied.
1063   * @throws { BusinessError } 202 - Not system application.
1064   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1065   * 2. Incorrect parameter types; 3. Parameter verification failed.
1066   * @throws { BusinessError } 16000050 - Internal error.
1067   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1068   * @systemapi
1069   * @since 11
1070   */
1071  function isApplicationRunning(bundleName: string): Promise<boolean>;
1072
1073  /**
1074   * Check whether the bundle is running.
1075   *
1076   * @permission ohos.permission.GET_RUNNING_INFO
1077   * @param { string } bundleName - Indicates the bundle name of the bundle.
1078   * @param { AsyncCallback<boolean> } callback - The callback of checking the bundle running result.
1079   *                                              The result is true if running, false otherwise.
1080   * @throws { BusinessError } 201 - Permission denied.
1081   * @throws { BusinessError } 202 - Not system application.
1082   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1083   * 2. Incorrect parameter types; 3. Parameter verification failed.
1084   * @throws { BusinessError } 16000050 - Internal error.
1085   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1086   * @systemapi
1087   * @since 11
1088   */
1089  function isApplicationRunning(bundleName: string, callback: AsyncCallback<boolean>): void;
1090
1091  /**
1092   * Preload the target application, create process and initialize resources.
1093   *
1094   * @permission ohos.permission.PRELOAD_APPLICATION
1095   * @param { string } bundleName - The bundle name of the application to preload.
1096   * @param { number } userId - Indicates the user identification.
1097   * @param { PreloadMode } mode - Preload application mode.
1098   * @param { number } [appIndex] - The index of application clone.
1099   * @returns { Promise<void> } Returns the result of preloadApplication.
1100   * @throws { BusinessError } 201 - The application does not have permission to call the interface.
1101   * @throws { BusinessError } 202 - Not system application.
1102   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1103   * 2. Incorrect parameter types; 3. Parameter verification failed.
1104   * @throws { BusinessError } 16000050 - Internal error.
1105   * @throws { BusinessError } 16300005 - The target bundle does not exist.
1106   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1107   * @systemapi
1108   * @stagemodelonly
1109   * @since 12
1110   */
1111  function preloadApplication(bundleName: string, userId: number, mode: PreloadMode, appIndex?: number): Promise<void>;
1112
1113  /**
1114   * Get all running multi app info by bundleName
1115   *
1116   * @permission ohos.permission.GET_RUNNING_INFO
1117   * @param { string } bundleName - The bundle name of the application to query.
1118   * @returns { Promise<RunningMultiAppInfo> } Returns the {@link RunningMultiAppInfo} for given bundle.
1119   * @throws { BusinessError } 201 - Permission denied.
1120   * @throws { BusinessError } 202 - Not system application.
1121   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1122   * 2. Incorrect parameter types; 3. Parameter verification failed.
1123   * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported.
1124   * @throws { BusinessError } 18500001 - The bundle does not exist or no patch has been applied.
1125   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1126   * @systemapi
1127   * @stagemodelonly
1128   * @since arkts {'1.1':'12', '1.2':'20'}
1129   * @arkts 1.1&1.2
1130   */
1131  function getRunningMultiAppInfo(bundleName: string): Promise<RunningMultiAppInfo>;
1132
1133  /**
1134  * Check whether the bundle is running.
1135  *
1136  * @permission ohos.permission.GET_RUNNING_INFO
1137  * @param { string } bundleName - Indicates the bundle name of the bundle.
1138  * @param { number } [appCloneIndex] - app clone index
1139  * @returns { Promise<boolean> } Returns the bundle running result. The result is true if running, false otherwise.
1140  * @throws { BusinessError } 201 - Permission denied.
1141  * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1142  * 2. Incorrect parameter types; 3. Parameter verification failed.
1143  * @throws { BusinessError } 16000050 - Internal error.
1144  * @throws { BusinessError } 16000073 - The app clone index is invalid.
1145  * @syscap SystemCapability.Ability.AbilityRuntime.Core
1146  * @since 14
1147  */
1148  function isAppRunning(bundleName: string, appCloneIndex?: number): Promise<boolean>;
1149
1150  /**
1151   * Clear up application data by bundle name
1152   *
1153   * @permission ohos.permission.CLEAN_APPLICATION_DATA
1154   * @param { string } bundleName - bundle name.
1155   * @param { number } [appCloneIndex] - app clone index
1156   * @returns { Promise<void> } The promise returned by the function.
1157   * @throws { BusinessError } 201 - Permission denied.
1158   * @throws { BusinessError } 202 - Not system application.
1159   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1160   *    2. Incorrect parameter types; 3. Parameter verification failed.
1161   * @throws { BusinessError } 16000050 - Internal error.
1162   * @throws { BusinessError } 16000073 - The app clone index is invalid.
1163   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1164   * @systemapi
1165   * @since 13
1166   */
1167  function clearUpAppData(bundleName: string, appCloneIndex?: number): Promise<void>;
1168
1169  /**
1170   * Terminate the mission of a UIAbility and back to caller.
1171   *
1172   * @permission ohos.permission.KILL_APP_PROCESSES
1173   * @param { number } missionId - The mission id of the UIAbility need to be terminated.
1174   * @returns { Promise<void> } Returns the result of terminateMission.
1175   * @throws { BusinessError } 201 - Permission denied.
1176   * @throws { BusinessError } 202 - Not system application.
1177   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1178   *     2. Incorrect parameter types; 3. Parameter verification failed.
1179   * @throws { BusinessError } 16000050 - Internal error.
1180   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1181   * @systemapi
1182   * @since 13
1183   */
1184  function terminateMission(missionId: number): Promise<void>;
1185
1186  /**
1187   * Get pids of processes which belong to specific bundle name and support process cache feature.
1188   *
1189   * @permission ohos.permission.GET_RUNNING_INFO
1190   * @param { string } bundleName - bundle name.
1191   * @returns { Promise<Array<number>> } Returns the list of pid.
1192   * @throws { BusinessError } 201 - Permission denied.
1193   * @throws { BusinessError } 202 - Not system application.
1194   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1195   * 2. Incorrect parameter types; 3. Parameter verification failed.
1196   * @throws { BusinessError } 801 - Capability not supported.
1197   * @throws { BusinessError } 16000050 - Internal error.
1198   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1199   * @systemapi
1200   * @stagemodelonly
1201   * @since 14
1202   */
1203  function getSupportedProcessCachePids(bundleName : string): Promise<Array<number>>;
1204
1205  /**
1206   * Set keep alive for the specified bundle.
1207   *
1208   * @permission ohos.permission.MANAGE_APP_KEEP_ALIVE
1209   * @param { string } bundleName - bundle name.
1210   * @param { number } userId - user id.
1211   * @param { boolean } enable - flag indicates whether the bundle should be kept alive.
1212   * @returns { Promise<void> } The promise returned by the function.
1213   * @throws { BusinessError } 201 - Permission denied.
1214   * @throws { BusinessError } 202 - Not system application.
1215   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1216   * 2. Incorrect parameter types; 3. Parameter verification failed.
1217   * @throws { BusinessError } 801 - Capability not supported.
1218   * @throws { BusinessError } 16000050 - Internal error.
1219   * @throws { BusinessError } 16300005 - The target bundle does not exist.
1220   * @throws { BusinessError } 16300008 - The target bundle has no MainAbility.
1221   * @throws { BusinessError } 16300009 - The target bundle has no status-bar ability.
1222   * @throws { BusinessError } 16300010 - The target application is not attached to the status bar.
1223   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1224   * @systemapi
1225   * @since 14
1226   */
1227    function setKeepAliveForBundle(bundleName: string, userId: number, enable: boolean): Promise<void>;
1228
1229  /**
1230   * Get keep-alive bundle information.
1231   *
1232   * @permission ohos.permission.MANAGE_APP_KEEP_ALIVE
1233   * @param { KeepAliveAppType } type - type of keep-alive apps to be quried.
1234   * @param { number } [userId] - user id.
1235   * @returns { Promise<Array<KeepAliveBundleInfo>> } Returns the list of KeepAliveBundleInfo.
1236   * @throws { BusinessError } 201 - Permission denied.
1237   * @throws { BusinessError } 202 - Not system application.
1238   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1239   * 2. Incorrect parameter types; 3. Parameter verification failed.
1240   * @throws { BusinessError } 801 - Capability not supported.
1241   * @throws { BusinessError } 16000050 - Internal error.
1242   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1243   * @systemapi
1244   * @since 14
1245   */
1246  function getKeepAliveBundles(type: KeepAliveAppType, userId?: number): Promise<Array<KeepAliveBundleInfo>>;
1247
1248  /**
1249   * Set keep alive for the specified app service extension.
1250   *
1251   * @permission ohos.permission.MANAGE_APP_KEEP_ALIVE
1252   * @param { string } bundleName - bundle name.
1253   * @param { boolean } enabled - True indicates to enable process keep-alive, while false indicates to disable it.
1254   * @returns { Promise<void> } The promise returned by the function.
1255   * @throws { BusinessError } 201 - Permission denied.
1256   * @throws { BusinessError } 202 - Not system application.
1257   * @throws { BusinessError } 801 - Capability not supported.
1258   * @throws { BusinessError } 16000050 - Internal error.
1259   * @throws { BusinessError } 16000081 - Failed to obtain the target application information.
1260   * @throws { BusinessError } 16000202 - Invalid main element type.
1261   * @throws { BusinessError } 16000203 - Cannot change the keep-alive status.
1262   * @throws { BusinessError } 16000204 - The target bundle is not in u1.
1263   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1264   * @systemapi
1265   * @since 20
1266   */
1267  function setKeepAliveForAppServiceExtension(bundleName: string, enabled: boolean): Promise<void>;
1268
1269  /**
1270   * Get keep-alive bundle information.
1271   *
1272   * @permission ohos.permission.MANAGE_APP_KEEP_ALIVE
1273   * @returns { Promise<Array<KeepAliveBundleInfo>> } Returns the list of KeepAliveBundleInfo.
1274   * @throws { BusinessError } 201 - Permission denied.
1275   * @throws { BusinessError } 202 - Not system application.
1276   * @throws { BusinessError } 801 - Capability not supported.
1277   * @throws { BusinessError } 16000050 - Internal error.
1278   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1279   * @systemapi
1280   * @since 20
1281   */
1282  function getKeepAliveAppServiceExtensions(): Promise<Array<KeepAliveBundleInfo>>;
1283
1284  /**
1285   * Kill processes in batch.
1286   *
1287   * @permission ohos.permission.KILL_APP_PROCESSES
1288   * @param { Array<number> } pids - The pids of the processes.
1289   * @returns { Promise<void> } The promise returned by the function.
1290   * @throws { BusinessError } 201 - Permission denied.
1291   * @throws { BusinessError } 202 - Not system application.
1292   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1293   *     2. Incorrect parameter types; 3. Parameter verification failed.
1294   * @throws { BusinessError } 801 - Capability not supported.
1295   * @throws { BusinessError } 16000050 - Internal error.
1296   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1297   * @systemapi
1298   * @since 14
1299   */
1300  function killProcessesInBatch(pids: Array<number>): Promise<void>;
1301
1302  /**
1303   * The ability or extension state data.
1304   *
1305   * @typedef { _AbilityStateData.default }
1306   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1307   * @since 14
1308   */
1309  export type AbilityStateData = _AbilityStateData.default;
1310
1311  /**
1312   * The application state data.
1313   *
1314   * @typedef { _AppStateData.default }
1315   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1316   * @since 14
1317   */
1318  export type AppStateData = _AppStateData.default;
1319
1320  /**
1321   * The application state data.
1322   *
1323   * @typedef { _AppStateData }
1324   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1325   * @since 20
1326   * @arkts 1.2
1327   */
1328  export type AppStateData = _AppStateData;
1329
1330  /**
1331   * The application state observer.
1332   *
1333   * @typedef { _ApplicationStateObserver.default }
1334   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1335   * @since 14
1336   */
1337  export type ApplicationStateObserver = _ApplicationStateObserver.default;
1338
1339  /**
1340   * The application foreground state observer.
1341   *
1342   * @typedef { _AppForegroundStateObserver.default }
1343   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1344   * @systemapi
1345   * @since 11
1346   */
1347  export type AppForegroundStateObserver = _AppForegroundStateObserver.default;
1348
1349  /**
1350   * The class of a process information.
1351   *
1352   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1353   * @since 9
1354   */
1355  /**
1356   * The class of a process information.
1357   *
1358   * @typedef { _ProcessInformation }
1359   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1360   * @atomicservice
1361   * @since arkts {'1.1':'11', '1.2':'20'}
1362   * @arkts 1.1&1.2
1363   */
1364  export type ProcessInformation = _ProcessInformation;
1365
1366  /**
1367   * The class of a process information.
1368   *
1369   * @typedef { _ProcessData.default }
1370   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1371   * @since 14
1372   */
1373  export type ProcessData = _ProcessData.default;
1374
1375  /**
1376   * The ability first frame state observer.
1377   *
1378   * @typedef { _AbilityFirstFrameStateObserver.default }
1379   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1380   * @systemapi
1381   * @since 12
1382   */
1383  export type AbilityFirstFrameStateObserver = _AbilityFirstFrameStateObserver.default;
1384
1385  /**
1386   * The class of an ability first frame state data.
1387   *
1388   * @typedef { _AbilityFirstFrameStateData.default }
1389   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1390   * @systemapi
1391   * @since 12
1392   */
1393  export type AbilityFirstFrameStateData = _AbilityFirstFrameStateData.default;
1394
1395  /**
1396   * The class of running multi app information.
1397   *
1398   * @typedef { _RunningMultiAppInfo }
1399   * @syscap SystemCapability.Ability.AbilityRuntime.Core
1400   * @systemapi
1401   * @since arkts {'1.1':'12', '1.2':'20'}
1402   * @arkts 1.1&1.2
1403   */
1404  export type RunningMultiAppInfo = _RunningMultiAppInfo;
1405}
1406
1407export default appManager;
1408