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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 397 * 2. Incorrect parameter types; 3. Parameter verification failed. 398 * @throws { BusinessError } 16000050 - Internal error. 399 * @syscap SystemCapability.Ability.AbilityRuntime.Core 400 * @since 15 401 */ 402 function off(type: 'applicationState', observerId: number, callback: AsyncCallback<void>): void; 403 404 /** 405 * Unregister application state observer. 406 * 407 * @permission ohos.permission.RUNNING_STATE_OBSERVER 408 * @param { 'applicationState' } type - applicationState. 409 * @param { number } observerId - Indicates the number code of the observer. 410 * @returns { Promise<void> } The promise returned by the function. 411 * @throws { BusinessError } 201 - Permission denied. 412 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 413 * 2. Incorrect parameter types; 3. Parameter verification failed. 414 * @throws { BusinessError } 16000050 - Internal error. 415 * @syscap SystemCapability.Ability.AbilityRuntime.Core 416 * @since 14 417 */ 418 function off(type: 'applicationState', observerId: number): Promise<void>; 419 420 /** 421 * Unregister app foreground or background state observer. 422 * 423 * @permission ohos.permission.RUNNING_STATE_OBSERVER 424 * @param { 'appForegroundState' } type - app foreground or background state. 425 * @param { AppForegroundStateObserver } [observer] - The app foreground state observer. 426 * @throws { BusinessError } 201 - Permission denied. 427 * @throws { BusinessError } 202 - Not system application. 428 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 429 * 2. Incorrect parameter types; 3. Parameter verification failed. 430 * @throws { BusinessError } 16000050 - Internal error. 431 * @syscap SystemCapability.Ability.AbilityRuntime.Core 432 * @systemapi 433 * @since 11 434 */ 435 function off(type: 'appForegroundState', observer?: AppForegroundStateObserver): void; 436 437 /** 438 * Unregister ability first frame state observer. 439 * 440 * @permission ohos.permission.RUNNING_STATE_OBSERVER 441 * @param { 'abilityFirstFrameState' } type - The ability first frame drawing state. 442 * @param { AbilityFirstFrameStateObserver } [observer] - The ability first frame state observer. 443 * @throws { BusinessError } 201 - Permission denied. 444 * @throws { BusinessError } 202 - Not system application. 445 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 446 * 2. Incorrect parameter types; 3. Parameter verification failed. 447 * @throws { BusinessError } 16000050 - Internal error. 448 * @syscap SystemCapability.Ability.AbilityRuntime.Core 449 * @systemapi 450 * @since 12 451 */ 452 function off(type: 'abilityFirstFrameState', observer?: AbilityFirstFrameStateObserver): void; 453 454 /** 455 * getForegroundApplications. 456 * 457 * @permission ohos.permission.GET_RUNNING_INFO 458 * @param { AsyncCallback<Array<AppStateData>> } callback - The callback is used to return the list of AppStateData. 459 * @throws { BusinessError } 201 - Permission denied. 460 * @throws { BusinessError } 202 - Not system application. 461 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 462 * 2. Incorrect parameter types; 3. Parameter verification failed. 463 * @throws { BusinessError } 16000050 - Internal error. 464 * @syscap SystemCapability.Ability.AbilityRuntime.Core 465 * @systemapi 466 * @since 9 467 */ 468 function getForegroundApplications(callback: AsyncCallback<Array<AppStateData>>): void; 469 470 /** 471 * getForegroundApplications. 472 * 473 * @permission ohos.permission.GET_RUNNING_INFO 474 * @returns { Promise<Array<AppStateData>> } Returns the list of AppStateData. 475 * @throws { BusinessError } 201 - Permission denied. 476 * @throws { BusinessError } 202 - Not system application. 477 * @throws { BusinessError } 16000050 - Internal error. 478 * @syscap SystemCapability.Ability.AbilityRuntime.Core 479 * @systemapi 480 * @since 9 481 */ 482 function getForegroundApplications(): Promise<Array<AppStateData>>; 483 484 /** 485 * Kill process with account. 486 * 487 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES 488 * @param { string } bundleName - The process bundle name. 489 * @param { number } accountId - The account id. 490 * @returns { Promise<void> } The promise returned by the function. 491 * @throws { BusinessError } 201 - Permission denied. 492 * @throws { BusinessError } 202 - Not system application. 493 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 494 * 2. Incorrect parameter types; 3. Parameter verification failed. 495 * @throws { BusinessError } 16000050 - Internal error. 496 * @syscap SystemCapability.Ability.AbilityRuntime.Core 497 * @systemapi 498 * @since 9 499 */ 500 /** 501 * Kill process with account. 502 * 503 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.KILL_APP_PROCESSES 504 * or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES 505 * @param { string } bundleName - The process bundle name. 506 * @param { number } accountId - The account id. 507 * @returns { Promise<void> } The promise returned by the function. 508 * @throws { BusinessError } 201 - Permission denied. 509 * @throws { BusinessError } 202 - Not system application. 510 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 511 * 2. Incorrect parameter types; 3. Parameter verification failed. 512 * @throws { BusinessError } 16000050 - Internal error. 513 * @syscap SystemCapability.Ability.AbilityRuntime.Core 514 * @systemapi 515 * @since 14 516 */ 517 function killProcessWithAccount(bundleName: string, accountId: number): Promise<void>; 518 519 /** 520 * Kill process with account. 521 * 522 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.KILL_APP_PROCESSES 523 * or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES 524 * @param { string } bundleName - The process bundle name. 525 * @param { number } accountId - The account id. 526 * @param { boolean } clearPageStack - The flag that indicates whether the page stack need to be cleared. 527 * @param { number } [appIndex] - The application index. 528 * @returns { Promise<void> } The promise returned by the function. 529 * @throws { BusinessError } 201 - Permission denied. 530 * @throws { BusinessError } 202 - Not system application. 531 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 532 * @throws { BusinessError } 16000050 - Internal error. 533 * @syscap SystemCapability.Ability.AbilityRuntime.Core 534 * @systemapi 535 * @since 14 536 */ 537 function killProcessWithAccount(bundleName: string, accountId: number, clearPageStack: boolean, appIndex?: number): 538 Promise<void>; 539 540 /** 541 * Kill process with account. 542 * 543 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES 544 * @param { string } bundleName - The process bundle name. 545 * @param { number } accountId - The account id. 546 * @param { AsyncCallback<void> } callback - The callback of killProcessWithAccount. 547 * @throws { BusinessError } 201 - Permission denied. 548 * @throws { BusinessError } 202 - Not system application. 549 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 550 * 2. Incorrect parameter types; 3. Parameter verification failed. 551 * @throws { BusinessError } 16000050 - Internal error. 552 * @syscap SystemCapability.Ability.AbilityRuntime.Core 553 * @systemapi 554 * @since 9 555 */ 556 /** 557 * Kill process with account. 558 * 559 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.KILL_APP_PROCESSES 560 * or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES 561 * @param { string } bundleName - The process bundle name. 562 * @param { number } accountId - The account id. 563 * @param { AsyncCallback<void> } callback - The callback of killProcessWithAccount. 564 * @throws { BusinessError } 201 - Permission denied. 565 * @throws { BusinessError } 202 - Not system application. 566 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 567 * 2. Incorrect parameter types; 3. Parameter verification failed. 568 * @throws { BusinessError } 16000050 - Internal error. 569 * @syscap SystemCapability.Ability.AbilityRuntime.Core 570 * @systemapi 571 * @since 14 572 */ 573 function killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCallback<void>): void; 574 575 /** 576 * Is user running in stability test. 577 * 578 * @param { AsyncCallback<boolean> } callback - The callback is used to return true if user is running stability test. 579 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 580 * 2. Incorrect parameter types; 3. Parameter verification failed. 581 * @throws { BusinessError } 16000050 - Internal error. 582 * @syscap SystemCapability.Ability.AbilityRuntime.Core 583 * @since 9 584 */ 585 /** 586 * Is user running in stability test. 587 * 588 * @param { AsyncCallback<boolean> } callback - The callback is used to return true if user is running stability test. 589 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 590 * 2. Incorrect parameter types; 3. Parameter verification failed. 591 * @throws { BusinessError } 16000050 - Internal error. 592 * @syscap SystemCapability.Ability.AbilityRuntime.Core 593 * @atomicservice 594 * @since 11 595 */ 596 function isRunningInStabilityTest(callback: AsyncCallback<boolean>): void; 597 598 /** 599 * Is user running in stability test. 600 * 601 * @returns { Promise<boolean> } Returns true if user is running stability test. 602 * @throws { BusinessError } 16000050 - Internal error. 603 * @syscap SystemCapability.Ability.AbilityRuntime.Core 604 * @since 9 605 */ 606 /** 607 * Is user running in stability test. 608 * 609 * @returns { Promise<boolean> } Returns true if user is running stability test. 610 * @throws { BusinessError } 16000050 - Internal error. 611 * @syscap SystemCapability.Ability.AbilityRuntime.Core 612 * @atomicservice 613 * @since 11 614 */ 615 function isRunningInStabilityTest(): Promise<boolean>; 616 617 /** 618 * Kill processes by bundle name 619 * 620 * @permission ohos.permission.CLEAN_BACKGROUND_PROCESSES 621 * @param { string } bundleName - bundle name. 622 * @returns { Promise<void> } The promise returned by the function. 623 * @throws { BusinessError } 201 - Permission denied. 624 * @throws { BusinessError } 202 - Not system application. 625 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 626 * 2. Incorrect parameter types; 3. Parameter verification failed. 627 * @throws { BusinessError } 16000050 - Internal error. 628 * @syscap SystemCapability.Ability.AbilityRuntime.Core 629 * @systemapi 630 * @since 9 631 */ 632 /** 633 * Kill processes by bundle name 634 * 635 * @permission ohos.permission.KILL_APP_PROCESSES or ohos.permission.CLEAN_BACKGROUND_PROCESSES 636 * @param { string } bundleName - bundle name. 637 * @returns { Promise<void> } The promise returned by the function. 638 * @throws { BusinessError } 201 - Permission denied. 639 * @throws { BusinessError } 202 - Not system application. 640 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 641 * 2. Incorrect parameter types; 3. Parameter verification failed. 642 * @throws { BusinessError } 16000050 - Internal error. 643 * @syscap SystemCapability.Ability.AbilityRuntime.Core 644 * @systemapi 645 * @since 14 646 */ 647 function killProcessesByBundleName(bundleName: string): Promise<void>; 648 649 /** 650 * Kill processes by bundle name 651 * 652 * @permission ohos.permission.KILL_APP_PROCESSES or ohos.permission.CLEAN_BACKGROUND_PROCESSES 653 * @param { string } bundleName - bundle name. 654 * @param { boolean } clearPageStack - The flag that indicates whether the page stack need to be cleared. 655 * @param { number } [appIndex] - The application index. 656 * @returns { Promise<void> } The promise returned by the function. 657 * @throws { BusinessError } 201 - Permission denied. 658 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 659 * @throws { BusinessError } 16000050 - Internal error. 660 * @syscap SystemCapability.Ability.AbilityRuntime.Core 661 * @since 14 662 */ 663 function killProcessesByBundleName(bundleName: string, clearPageStack: boolean, appIndex?: number): Promise<void>; 664 665 /** 666 * Kill processes by bundle name 667 * 668 * @permission ohos.permission.CLEAN_BACKGROUND_PROCESSES 669 * @param { string } bundleName - bundle name. 670 * @param { AsyncCallback<void> } callback - The callback of killProcessesByBundleName. 671 * @throws { BusinessError } 201 - Permission denied. 672 * @throws { BusinessError } 202 - Not system application. 673 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 674 * 2. Incorrect parameter types; 3. Parameter verification failed. 675 * @throws { BusinessError } 16000050 - Internal error. 676 * @syscap SystemCapability.Ability.AbilityRuntime.Core 677 * @systemapi 678 * @since 9 679 */ 680 /** 681 * Kill processes by bundle name 682 * 683 * @permission ohos.permission.KILL_APP_PROCESSES or ohos.permission.CLEAN_BACKGROUND_PROCESSES 684 * @param { string } bundleName - bundle name. 685 * @param { AsyncCallback<void> } callback - The callback of killProcessesByBundleName. 686 * @throws { BusinessError } 201 - Permission denied. 687 * @throws { BusinessError } 202 - Not system application. 688 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 689 * 2. Incorrect parameter types; 3. Parameter verification failed. 690 * @throws { BusinessError } 16000050 - Internal error. 691 * @syscap SystemCapability.Ability.AbilityRuntime.Core 692 * @systemapi 693 * @since 14 694 */ 695 function killProcessesByBundleName(bundleName: string, callback: AsyncCallback<void>); 696 697 /** 698 * Clear up application data by bundle name 699 * 700 * @permission ohos.permission.CLEAN_APPLICATION_DATA 701 * @param { string } bundleName - bundle name. 702 * @returns { Promise<void> } The promise returned by the function. 703 * @throws { BusinessError } 201 - Permission denied. 704 * @throws { BusinessError } 202 - Not system application. 705 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 706 * 2. Incorrect parameter types; 3. Parameter verification failed. 707 * @throws { BusinessError } 16000050 - Internal error. 708 * @syscap SystemCapability.Ability.AbilityRuntime.Core 709 * @systemapi 710 * @since 9 711 */ 712 function clearUpApplicationData(bundleName: string): Promise<void>; 713 714 /** 715 * Clear up application data by bundle name 716 * 717 * @permission ohos.permission.CLEAN_APPLICATION_DATA 718 * @param { string } bundleName - bundle name. 719 * @param { AsyncCallback<void> } callback - The callback of clearUpApplicationData. 720 * @throws { BusinessError } 201 - Permission denied. 721 * @throws { BusinessError } 202 - Not system application. 722 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 723 * 2. Incorrect parameter types; 3. Parameter verification failed. 724 * @throws { BusinessError } 16000050 - Internal error. 725 * @syscap SystemCapability.Ability.AbilityRuntime.Core 726 * @systemapi 727 * @since 9 728 */ 729 function clearUpApplicationData(bundleName: string, callback: AsyncCallback<void>); 730 731 /** 732 * Is it a ram-constrained device 733 * 734 * @returns { Promise<boolean> } Returns true if the device is ram-constrained. 735 * @throws { BusinessError } 16000050 - Internal error. 736 * @syscap SystemCapability.Ability.AbilityRuntime.Core 737 * @since 9 738 */ 739 /** 740 * Is it a ram-constrained device 741 * 742 * @returns { Promise<boolean> } Returns true if the device is ram-constrained. 743 * @throws { BusinessError } 16000050 - Internal error. 744 * @syscap SystemCapability.Ability.AbilityRuntime.Core 745 * @atomicservice 746 * @since 11 747 */ 748 function isRamConstrainedDevice(): Promise<boolean>; 749 750 /** 751 * Is it a ram-constrained device 752 * 753 * @param { AsyncCallback<boolean> } callback - The callback is used to return true if the device is ram-constrained. 754 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 755 * 2. Incorrect parameter types; 3. Parameter verification failed. 756 * @throws { BusinessError } 16000050 - Internal error. 757 * @syscap SystemCapability.Ability.AbilityRuntime.Core 758 * @since 9 759 */ 760 /** 761 * Is it a ram-constrained device 762 * 763 * @param { AsyncCallback<boolean> } callback - The callback is used to return true if the device is ram-constrained. 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 * @atomicservice 769 * @since 11 770 */ 771 function isRamConstrainedDevice(callback: AsyncCallback<boolean>): void; 772 773 /** 774 * Get the memory size of the application 775 * 776 * @returns { Promise<number> } Returns the application memory size. 777 * @throws { BusinessError } 16000050 - Internal error. 778 * @syscap SystemCapability.Ability.AbilityRuntime.Core 779 * @since 9 780 */ 781 /** 782 * Get the memory size of the application 783 * 784 * @returns { Promise<number> } Returns the application memory size. 785 * @throws { BusinessError } 16000050 - Internal error. 786 * @syscap SystemCapability.Ability.AbilityRuntime.Core 787 * @atomicservice 788 * @since 11 789 */ 790 function getAppMemorySize(): Promise<number>; 791 792 /** 793 * Get the memory size of the application 794 * 795 * @param { AsyncCallback<number> } callback - The callback is used to return the application memory size. 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 * Get the memory size of the application 804 * 805 * @param { AsyncCallback<number> } callback - The callback is used to return the application memory size. 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 getAppMemorySize(callback: AsyncCallback<number>): void; 814 815 /** 816 * If you apply for permission, you can obtain information about all running processes. 817 * If you do not apply, you can only obtain information about the current process. 818 * 819 * @permission ohos.permission.GET_RUNNING_INFO 820 * @returns { Promise<Array<ProcessInformation>> } Returns the array of {@link ProcessInformation}. 821 * @throws { BusinessError } 16000050 - Internal error. 822 * @syscap SystemCapability.Ability.AbilityRuntime.Core 823 * @since 9 824 */ 825 /** 826 * Get information about the current process. 827 * 828 * @returns { Promise<Array<ProcessInformation>> } Returns the array of {@link ProcessInformation}. 829 * @throws { BusinessError } 16000050 - Internal error. 830 * @syscap SystemCapability.Ability.AbilityRuntime.Core 831 * @atomicservice 832 * @since 11 833 */ 834 function getRunningProcessInformation(): Promise<Array<ProcessInformation>>; 835 836 /** 837 * Get running process information by bundle type. 838 * 839 * @permission ohos.permission.GET_RUNNING_INFO 840 * @param { bundleManager.BundleType } bundleType - the bundle type of the process 841 * @returns { Promise<Array<ProcessInformation>> } Returns the array of {@link ProcessInformation}. 842 * @throws { BusinessError } 201 - Permission denied. 843 * @throws { BusinessError } 202 - Not system application. 844 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 845 * 2. Incorrect parameter types; 3. Parameter verification failed. 846 * @throws { BusinessError } 16000050 - Internal error. 847 * @syscap SystemCapability.Ability.AbilityRuntime.Core 848 * @systemapi 849 * @since 12 850 */ 851 function getRunningProcessInformationByBundleType( 852 bundleType: bundleManager.BundleType): Promise<Array<ProcessInformation>>; 853 854 /** 855 * If you apply for permission, you can obtain information about all running processes. 856 * If you do not apply, you can only obtain information about the current process. 857 * 858 * @permission ohos.permission.GET_RUNNING_INFO 859 * @param { AsyncCallback<Array<ProcessInformation>> } callback - The callback is used to return the array of {@link ProcessInformation}. 860 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 861 * 2. Incorrect parameter types; 3. Parameter verification failed. 862 * @throws { BusinessError } 16000050 - Internal error. 863 * @syscap SystemCapability.Ability.AbilityRuntime.Core 864 * @since 9 865 */ 866 /** 867 * Get information about the current process. 868 * 869 * @param { AsyncCallback<Array<ProcessInformation>> } callback - The callback is used to return the array of {@link ProcessInformation}. 870 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 871 * 2. Incorrect parameter types; 3. Parameter verification failed. 872 * @throws { BusinessError } 16000050 - Internal error. 873 * @syscap SystemCapability.Ability.AbilityRuntime.Core 874 * @atomicservice 875 * @since 11 876 */ 877 function getRunningProcessInformation(callback: AsyncCallback<Array<ProcessInformation>>): void; 878 879 /** 880 * Check whether the shared bundle is running. 881 * 882 * @permission ohos.permission.GET_RUNNING_INFO 883 * @param { string } bundleName - Indicates the bundle name of the shared bundle. 884 * @param { number } versionCode - Indicates the version code of the shared bundle. 885 * @returns { Promise<boolean> } Returns the shared bundle running result. The result is true if running, false otherwise. 886 * @throws { BusinessError } 201 - Permission denied. 887 * @throws { BusinessError } 202 - Not system application. 888 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 889 * 2. Incorrect parameter types; 3. Parameter verification failed. 890 * @throws { BusinessError } 16000050 - Internal error. 891 * @syscap SystemCapability.Ability.AbilityRuntime.Core 892 * @systemapi 893 * @since 10 894 */ 895 function isSharedBundleRunning(bundleName: string, versionCode: number): Promise<boolean>; 896 897 /** 898 * Check whether the shared bundle is running. 899 * 900 * @permission ohos.permission.GET_RUNNING_INFO 901 * @param { string } bundleName - Indicates the bundle name of the shared bundle. 902 * @param { number } versionCode - Indicates the version code of the shared bundle. 903 * @param { AsyncCallback<boolean> } callback - The callback of checking the shared bundle running result. 904 * The result is true if running, false otherwise. 905 * @throws { BusinessError } 201 - Permission denied. 906 * @throws { BusinessError } 202 - Not system application. 907 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 908 * 2. Incorrect parameter types; 3. Parameter verification failed. 909 * @throws { BusinessError } 16000050 - Internal error. 910 * @syscap SystemCapability.Ability.AbilityRuntime.Core 911 * @systemapi 912 * @since 10 913 */ 914 function isSharedBundleRunning(bundleName: string, versionCode: number, callback: AsyncCallback<boolean>): void; 915 916 /** 917 * Obtains memory usage of one process by its pid. 918 * 919 * @param { number } pid - Indicates the pid of the process. 920 * @returns { Promise<number> } Returns the memory usage of the process in KB. 921 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 922 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 923 * 2. Incorrect parameter types; 3. Parameter verification failed. 924 * @throws { BusinessError } 16000050 - Internal error. 925 * @syscap SystemCapability.Ability.AbilityRuntime.Core 926 * @systemapi 927 * @since 10 928 */ 929 function getProcessMemoryByPid(pid: number): Promise<number>; 930 931 /** 932 * Obtains memory usage of one process by its pid. 933 * 934 * @param { number } pid - Indicates the pid of the process. 935 * @param { AsyncCallback<number> } callback - Indicates the callback of getting process memory by pid result. 936 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 937 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 938 * 2. Incorrect parameter types; 3. Parameter verification failed. 939 * @throws { BusinessError } 16000050 - Internal error. 940 * @syscap SystemCapability.Ability.AbilityRuntime.Core 941 * @systemapi 942 * @since 10 943 */ 944 function getProcessMemoryByPid(pid: number, callback: AsyncCallback<number>): void; 945 946 /** 947 * Obtains the process information list of running processes that belong to a specific bundle of current user. 948 * 949 * @param { string } bundleName - Indicates the bundle name of the application to which the processes belong to. 950 * @param { AsyncCallback<Array<ProcessInformation>> } callback - Indicates the callback of getting process information by bundleName result. 951 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 952 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 953 * 2. Incorrect parameter types; 3. Parameter verification failed. 954 * @throws { BusinessError } 16000050 - Internal error. 955 * @syscap SystemCapability.Ability.AbilityRuntime.Core 956 * @systemapi 957 * @since 10 958 */ 959 function getRunningProcessInfoByBundleName(bundleName: string, callback: AsyncCallback<Array<ProcessInformation>>): void; 960 961 /** 962 * Obtains the process information list of running processes that belong to a specific bundle and specific user ID. 963 * 964 * @param { string } bundleName - Indicates the bundle name of the application to which the processes belong to. 965 * @param { number } userId - Indicates the user ID of the application to which the processes belong to. 966 * @param { AsyncCallback<Array<ProcessInformation>> } callback - Indicates the callback of getting process information by bundleName result. 967 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 968 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 969 * 2. Incorrect parameter types; 3. Parameter verification failed. 970 * @throws { BusinessError } 16000050 - Internal error. 971 * @syscap SystemCapability.Ability.AbilityRuntime.Core 972 * @systemapi 973 * @since 10 974 */ 975 function getRunningProcessInfoByBundleName(bundleName: string, userId: number, callback: AsyncCallback<Array<ProcessInformation>>): void; 976 977 /** 978 * Obtains the process information list of running processes that belong to a specific bundle of current user. 979 * 980 * @param { string } bundleName - Indicates the bundle name of the application to which the processes belong to. 981 * @returns { Promise<Array<ProcessInformation>> } Returns a list of process information. 982 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 983 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 984 * 2. Incorrect parameter types; 3. Parameter verification failed. 985 * @throws { BusinessError } 16000050 - Internal error. 986 * @syscap SystemCapability.Ability.AbilityRuntime.Core 987 * @systemapi 988 * @since 10 989 */ 990 function getRunningProcessInfoByBundleName(bundleName: string): Promise<Array<ProcessInformation>>; 991 992 /** 993 * Obtains the process information list of running processes that belong to a specific bundle and specific user ID. 994 * 995 * @param { string } bundleName - Indicates the bundle name of the application to which the processes belong to. 996 * @param { number } userId - Indicates the user ID of the application to which the processes belong to. 997 * @returns { Promise<Array<ProcessInformation>> } Returns a list of process information. 998 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 999 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1000 * 2. Incorrect parameter types; 3. Parameter verification failed. 1001 * @throws { BusinessError } 16000050 - Internal error. 1002 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1003 * @systemapi 1004 * @since 10 1005 */ 1006 function getRunningProcessInfoByBundleName(bundleName: string, userId: number): Promise<Array<ProcessInformation>>; 1007 1008 /** 1009 * Check whether the bundle is running. 1010 * 1011 * @permission ohos.permission.GET_RUNNING_INFO 1012 * @param { string } bundleName - Indicates the bundle name of the bundle. 1013 * @returns { Promise<boolean> } Returns the bundle running result. The result is true if running, false otherwise. 1014 * @throws { BusinessError } 201 - Permission denied. 1015 * @throws { BusinessError } 202 - Not system application. 1016 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1017 * 2. Incorrect parameter types; 3. Parameter verification failed. 1018 * @throws { BusinessError } 16000050 - Internal error. 1019 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1020 * @systemapi 1021 * @since 11 1022 */ 1023 function isApplicationRunning(bundleName: string): Promise<boolean>; 1024 1025 /** 1026 * Check whether the bundle is running. 1027 * 1028 * @permission ohos.permission.GET_RUNNING_INFO 1029 * @param { string } bundleName - Indicates the bundle name of the bundle. 1030 * @param { AsyncCallback<boolean> } callback - The callback of checking the bundle running result. 1031 * The result is true if running, false otherwise. 1032 * @throws { BusinessError } 201 - Permission denied. 1033 * @throws { BusinessError } 202 - Not system application. 1034 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1035 * 2. Incorrect parameter types; 3. Parameter verification failed. 1036 * @throws { BusinessError } 16000050 - Internal error. 1037 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1038 * @systemapi 1039 * @since 11 1040 */ 1041 function isApplicationRunning(bundleName: string, callback: AsyncCallback<boolean>): void; 1042 1043 /** 1044 * Preload the target application, create process and initialize resources. 1045 * 1046 * @permission ohos.permission.PRELOAD_APPLICATION 1047 * @param { string } bundleName - The bundle name of the application to preload. 1048 * @param { number } userId - Indicates the user identification. 1049 * @param { PreloadMode } mode - Preload application mode. 1050 * @param { number } [appIndex] - The index of application clone. 1051 * @returns { Promise<void> } Returns the result of preloadApplication. 1052 * @throws { BusinessError } 201 - The application does not have permission to call the interface. 1053 * @throws { BusinessError } 202 - Not system application. 1054 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1055 * 2. Incorrect parameter types; 3. Parameter verification failed. 1056 * @throws { BusinessError } 16000050 - Internal error. 1057 * @throws { BusinessError } 16300005 - The target bundle does not exist. 1058 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1059 * @systemapi 1060 * @stagemodelonly 1061 * @since 12 1062 */ 1063 function preloadApplication(bundleName: string, userId: number, mode: PreloadMode, appIndex?: number): Promise<void>; 1064 1065 /** 1066 * Get all running multi app info by bundleName 1067 * 1068 * @permission ohos.permission.GET_RUNNING_INFO 1069 * @param { string } bundleName - The bundle name of the application to query. 1070 * @returns { Promise<RunningMultiAppInfo> } Returns the {@link RunningMultiAppInfo} for given bundle. 1071 * @throws { BusinessError } 201 - Permission denied. 1072 * @throws { BusinessError } 202 - Not system application. 1073 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1074 * 2. Incorrect parameter types; 3. Parameter verification failed. 1075 * @throws { BusinessError } 16000072 - App clone or multi-instance is not supported. 1076 * @throws { BusinessError } 18500001 - The bundle does not exist or no patch has been applied. 1077 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1078 * @systemapi 1079 * @stagemodelonly 1080 * @since 12 1081 */ 1082 function getRunningMultiAppInfo(bundleName: string): Promise<RunningMultiAppInfo>; 1083 1084 /** 1085 * Check whether the bundle is running. 1086 * 1087 * @permission ohos.permission.GET_RUNNING_INFO 1088 * @param { string } bundleName - Indicates the bundle name of the bundle. 1089 * @param { number } [appCloneIndex] - app clone index 1090 * @returns { Promise<boolean> } Returns the bundle running result. The result is true if running, false otherwise. 1091 * @throws { BusinessError } 201 - Permission denied. 1092 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1093 * 2. Incorrect parameter types; 3. Parameter verification failed. 1094 * @throws { BusinessError } 16000050 - Internal error. 1095 * @throws { BusinessError } 16000073 - The app clone index is invalid. 1096 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1097 * @since 14 1098 */ 1099 function isAppRunning(bundleName: string, appCloneIndex?: number): Promise<boolean>; 1100 1101 /** 1102 * Clear up application data by bundle name 1103 * 1104 * @permission ohos.permission.CLEAN_APPLICATION_DATA 1105 * @param { string } bundleName - bundle name. 1106 * @param { number } [appCloneIndex] - app clone index 1107 * @returns { Promise<void> } The promise returned by the function. 1108 * @throws { BusinessError } 201 - Permission denied. 1109 * @throws { BusinessError } 202 - Not system application. 1110 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1111 * 2. Incorrect parameter types; 3. Parameter verification failed. 1112 * @throws { BusinessError } 16000050 - Internal error. 1113 * @throws { BusinessError } 16000073 - The app clone index is invalid. 1114 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1115 * @systemapi 1116 * @since 13 1117 */ 1118 function clearUpAppData(bundleName: string, appCloneIndex?: number): Promise<void>; 1119 1120 /** 1121 * Terminate the mission of a UIAbility and back to caller. 1122 * 1123 * @permission ohos.permission.KILL_APP_PROCESSES 1124 * @param { number } missionId - The mission id of the UIAbility need to be terminated. 1125 * @returns { Promise<void> } Returns the result of terminateMission. 1126 * @throws { BusinessError } 201 - Permission denied. 1127 * @throws { BusinessError } 202 - Not system application. 1128 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1129 * 2. Incorrect parameter types; 3. Parameter verification failed. 1130 * @throws { BusinessError } 16000050 - Internal error. 1131 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1132 * @systemapi 1133 * @since 13 1134 */ 1135 function terminateMission(missionId: number): Promise<void>; 1136 1137 /** 1138 * Get pids of processes which belong to specific bundle name and support process cache feature. 1139 * 1140 * @permission ohos.permission.GET_RUNNING_INFO 1141 * @param { string } bundleName - bundle name. 1142 * @returns { Promise<Array<number>> } Returns the list of pid. 1143 * @throws { BusinessError } 201 - Permission denied. 1144 * @throws { BusinessError } 202 - Not system application. 1145 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1146 * 2. Incorrect parameter types; 3. Parameter verification failed. 1147 * @throws { BusinessError } 801 - Capability not supported. 1148 * @throws { BusinessError } 16000050 - Internal error. 1149 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1150 * @systemapi 1151 * @stagemodelonly 1152 * @since 14 1153 */ 1154 function getSupportedProcessCachePids(bundleName : string): Promise<Array<number>>; 1155 1156 /** 1157 * Set keep alive for the specified bundle. 1158 * 1159 * @permission ohos.permission.MANAGE_APP_KEEP_ALIVE 1160 * @param { string } bundleName - bundle name. 1161 * @param { number } userId - user id. 1162 * @param { boolean } enable - flag indicates whether the bundle should be kept alive. 1163 * @returns { Promise<void> } The promise returned by the function. 1164 * @throws { BusinessError } 201 - Permission denied. 1165 * @throws { BusinessError } 202 - Not system application. 1166 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1167 * 2. Incorrect parameter types; 3. Parameter verification failed. 1168 * @throws { BusinessError } 801 - Capability not supported. 1169 * @throws { BusinessError } 16000050 - Internal error. 1170 * @throws { BusinessError } 16300005 - The target bundle does not exist. 1171 * @throws { BusinessError } 16300008 - The target bundle has no MainAbility. 1172 * @throws { BusinessError } 16300009 - The target bundle has no status-bar ability. 1173 * @throws { BusinessError } 16300010 - The target application is not attached to status bar. 1174 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1175 * @systemapi 1176 * @since 14 1177 */ 1178 function setKeepAliveForBundle(bundleName: string, userId: number, enable: boolean): Promise<void>; 1179 1180 /** 1181 * Get keep-alive bundle information. 1182 * 1183 * @permission ohos.permission.MANAGE_APP_KEEP_ALIVE 1184 * @param { KeepAliveAppType } type - type of keep-alive apps to be quried. 1185 * @param { number } [userId] - user id. 1186 * @returns { Promise<Array<KeepAliveBundleInfo>> } Returns the list of KeepAliveBundleInfo. 1187 * @throws { BusinessError } 201 - Permission denied. 1188 * @throws { BusinessError } 202 - Not system application. 1189 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1190 * 2. Incorrect parameter types; 3. Parameter verification failed. 1191 * @throws { BusinessError } 801 - Capability not supported. 1192 * @throws { BusinessError } 16000050 - Internal error. 1193 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1194 * @systemapi 1195 * @since 14 1196 */ 1197 function getKeepAliveBundles(type: KeepAliveAppType, userId?: number): Promise<Array<KeepAliveBundleInfo>>; 1198 1199 /** 1200 * Kill processes in batch. 1201 * 1202 * @permission ohos.permission.KILL_APP_PROCESSES 1203 * @param { Array<number> } pids - The pids of the processes. 1204 * @returns { Promise<void> } The promise returned by the function. 1205 * @throws { BusinessError } 201 - Permission denied. 1206 * @throws { BusinessError } 202 - Not system application. 1207 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1208 * 2. Incorrect parameter types; 3. Parameter verification failed. 1209 * @throws { BusinessError } 801 - Capability not supported. 1210 * @throws { BusinessError } 16000050 - Internal error. 1211 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1212 * @systemapi 1213 * @since 14 1214 */ 1215 function killProcessesInBatch(pids: Array<number>): Promise<void>; 1216 1217 /** 1218 * The ability or extension state data. 1219 * 1220 * @typedef { _AbilityStateData.default } 1221 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1222 * @systemapi 1223 * @since 9 1224 */ 1225 export type AbilityStateData = _AbilityStateData.default; 1226 1227 /** 1228 * The application state data. 1229 * 1230 * @typedef { _AppStateData.default } 1231 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1232 * @systemapi 1233 * @since 9 1234 */ 1235 export type AppStateData = _AppStateData.default; 1236 1237 /** 1238 * The application state observer. 1239 * 1240 * @typedef { _ApplicationStateObserver.default } 1241 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1242 * @since 14 1243 */ 1244 export type ApplicationStateObserver = _ApplicationStateObserver.default; 1245 1246 /** 1247 * The application foreground state observer. 1248 * 1249 * @typedef { _AppForegroundStateObserver.default } 1250 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1251 * @systemapi 1252 * @since 11 1253 */ 1254 export type AppForegroundStateObserver = _AppForegroundStateObserver.default; 1255 1256 /** 1257 * The class of a process information. 1258 * 1259 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1260 * @since 9 1261 */ 1262 /** 1263 * The class of a process information. 1264 * 1265 * @typedef { _ProcessInformation } 1266 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1267 * @atomicservice 1268 * @since 11 1269 */ 1270 export type ProcessInformation = _ProcessInformation; 1271 1272 /** 1273 * The class of a process information. 1274 * 1275 * @typedef { _ProcessData.default } 1276 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1277 * @systemapi 1278 * @since 10 1279 */ 1280 export type ProcessData = _ProcessData.default; 1281 1282 /** 1283 * The ability first frame state observer. 1284 * 1285 * @typedef { _AbilityFirstFrameStateObserver.default } 1286 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1287 * @systemapi 1288 * @since 12 1289 */ 1290 export type AbilityFirstFrameStateObserver = _AbilityFirstFrameStateObserver.default; 1291 1292 /** 1293 * The class of an ability first frame state data. 1294 * 1295 * @typedef { _AbilityFirstFrameStateData.default } 1296 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1297 * @systemapi 1298 * @since 12 1299 */ 1300 export type AbilityFirstFrameStateData = _AbilityFirstFrameStateData.default; 1301 1302 /** 1303 * The class of running multi app information. 1304 * 1305 * @typedef { _RunningMultiAppInfo } 1306 * @syscap SystemCapability.Ability.AbilityRuntime.Core 1307 * @systemapi 1308 * @since 12 1309 */ 1310 export type RunningMultiAppInfo = _RunningMultiAppInfo; 1311} 1312 1313export default appManager; 1314