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