1/* 2 * Copyright (c) 2021 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 { ApplicationInfo } from './bundle/applicationInfo'; 23import { AbilityInfo } from './bundle/abilityInfo'; 24import { PermissionDef } from './bundle/PermissionDef'; 25import Want from './@ohos.app.ability.Want'; 26import image from './@ohos.multimedia.image'; 27import { BundleInfo } from './bundle/bundleInfo'; 28import { BundleInstaller } from './bundle/bundleInstaller'; 29 30/** 31 * bundle. 32 * 33 * @namespace bundle 34 * @syscap SystemCapability.BundleManager.BundleFramework 35 * @since 7 36 * @deprecated since 9 37 * @useinstead ohos.bundle.bundleManager 38 */ 39declare namespace bundle { 40 /** 41 * BundleFlag 42 * 43 * @enum { number } 44 * @syscap SystemCapability.BundleManager.BundleFramework 45 * @since 7 46 * @deprecated since 9 47 * @useinstead ohos.bundle.bundleManager.BundleFlag 48 */ 49 enum BundleFlag { 50 /** 51 * @syscap SystemCapability.BundleManager.BundleFramework 52 * @since 7 53 * @deprecated since 9 54 */ 55 GET_BUNDLE_DEFAULT = 0x00000000, 56 /** 57 * @syscap SystemCapability.BundleManager.BundleFramework 58 * @since 7 59 * @deprecated since 9 60 */ 61 GET_BUNDLE_WITH_ABILITIES = 0x00000001, 62 /** 63 * @syscap SystemCapability.BundleManager.BundleFramework 64 * @since 7 65 * @deprecated since 9 66 */ 67 GET_ABILITY_INFO_WITH_PERMISSION = 0x00000002, 68 /** 69 * @syscap SystemCapability.BundleManager.BundleFramework 70 * @since 7 71 * @deprecated since 9 72 */ 73 GET_ABILITY_INFO_WITH_APPLICATION = 0x00000004, 74 /** 75 * @syscap SystemCapability.BundleManager.BundleFramework 76 * @since 7 77 * @deprecated since 9 78 */ 79 GET_APPLICATION_INFO_WITH_PERMISSION = 0x00000008, 80 /** 81 * @syscap SystemCapability.BundleManager.BundleFramework 82 * @since 7 83 * @deprecated since 9 84 */ 85 GET_BUNDLE_WITH_REQUESTED_PERMISSION = 0x00000010, 86 /** 87 * @syscap SystemCapability.BundleManager.BundleFramework 88 * @since 7 89 * @deprecated since 9 90 */ 91 GET_ALL_APPLICATION_INFO = 0xFFFF0000, 92 /** 93 * @syscap SystemCapability.BundleManager.BundleFramework 94 * @since 8 95 * @deprecated since 9 96 */ 97 GET_ABILITY_INFO_WITH_METADATA = 0x00000020, 98 /** 99 * @syscap SystemCapability.BundleManager.BundleFramework 100 * @since 8 101 * @deprecated since 9 102 */ 103 GET_APPLICATION_INFO_WITH_METADATA = 0x00000040, 104 /** 105 * @syscap SystemCapability.BundleManager.BundleFramework 106 * @since 8 107 * @deprecated since 9 108 */ 109 GET_ABILITY_INFO_SYSTEMAPP_ONLY = 0x00000080, 110 /** 111 * @syscap SystemCapability.BundleManager.BundleFramework 112 * @since 8 113 * @deprecated since 9 114 */ 115 GET_ABILITY_INFO_WITH_DISABLE = 0x00000100, 116 /** 117 * @syscap SystemCapability.BundleManager.BundleFramework 118 * @since 8 119 * @deprecated since 9 120 */ 121 GET_APPLICATION_INFO_WITH_DISABLE = 0x00000200 122 } 123 124 /** 125 * ColorMode 126 * 127 * @enum { number } 128 * @syscap SystemCapability.BundleManager.BundleFramework 129 * @since 7 130 * @deprecated since 9 131 */ 132 export enum ColorMode { 133 /** 134 * @syscap SystemCapability.BundleManager.BundleFramework 135 * @since 7 136 * @deprecated since 9 137 */ 138 AUTO_MODE = -1, 139 /** 140 * @syscap SystemCapability.BundleManager.BundleFramework 141 * @since 7 142 * @deprecated since 9 143 */ 144 DARK_MODE = 0, 145 /** 146 * @syscap SystemCapability.BundleManager.BundleFramework 147 * @since 7 148 * @deprecated since 9 149 */ 150 LIGHT_MODE = 1 151 } 152 153 /** 154 * GrantStatus 155 * 156 * @enum { number } 157 * @syscap SystemCapability.BundleManager.BundleFramework 158 * @since 7 159 * @deprecated since 9 160 * @useinstead ohos.bundle.bundleManager.PermissionGrantState 161 */ 162 export enum GrantStatus { 163 /** 164 * @syscap SystemCapability.BundleManager.BundleFramework 165 * @since 7 166 * @deprecated since 9 167 */ 168 PERMISSION_DENIED = -1, 169 /** 170 * @syscap SystemCapability.BundleManager.BundleFramework 171 * @since 7 172 * @deprecated since 9 173 */ 174 PERMISSION_GRANTED = 0 175 } 176 177 /** 178 * AbilityType 179 * 180 * @enum { number } 181 * @syscap SystemCapability.BundleManager.BundleFramework 182 * @since 7 183 * @deprecated since 9 184 * @useinstead ohos.bundle.bundleManager.AbilityType 185 */ 186 export enum AbilityType { 187 /** 188 * Indicates an unknown ability type 189 * 190 * @syscap SystemCapability.BundleManager.BundleFramework 191 * @since 7 192 * @deprecated since 9 193 */ 194 UNKNOWN, 195 196 /** 197 * Indicates that the ability has a UI 198 * 199 * @syscap SystemCapability.BundleManager.BundleFramework 200 * @since 7 201 * @deprecated since 9 202 */ 203 PAGE, 204 205 /** 206 * Indicates that the ability does not have a UI 207 * 208 * @syscap SystemCapability.BundleManager.BundleFramework 209 * @since 7 210 * @deprecated since 9 211 */ 212 SERVICE, 213 214 /** 215 * Indicates that the ability is used to provide data access services 216 * 217 * @syscap SystemCapability.BundleManager.BundleFramework 218 * @since 7 219 * @deprecated since 9 220 */ 221 DATA 222 } 223 224 /** 225 * AbilitySubType 226 * 227 * @enum { number } 228 * @syscap SystemCapability.BundleManager.BundleFramework 229 * @since 7 230 * @deprecated since 9 231 */ 232 export enum AbilitySubType { 233 /** 234 * @syscap SystemCapability.BundleManager.BundleFramework 235 * @since 7 236 * @deprecated since 9 237 */ 238 UNSPECIFIED = 0, 239 /** 240 * @syscap SystemCapability.BundleManager.BundleFramework 241 * @since 7 242 * @deprecated since 9 243 */ 244 CA = 1 245 } 246 247 /** 248 * DisplayOrientation 249 * 250 * @enum { number } 251 * @syscap SystemCapability.BundleManager.BundleFramework 252 * @since 7 253 * @deprecated since 9 254 * @useinstead ohos.bundle.bundleManager.DisplayOrientation 255 */ 256 export enum DisplayOrientation { 257 /** 258 * Indicates that the system automatically determines the display orientation 259 * 260 * @syscap SystemCapability.BundleManager.BundleFramework 261 * @since 7 262 * @deprecated since 9 263 */ 264 UNSPECIFIED, 265 266 /** 267 * Indicates the landscape orientation 268 * 269 * @syscap SystemCapability.BundleManager.BundleFramework 270 * @since 7 271 * @deprecated since 9 272 */ 273 LANDSCAPE, 274 275 /** 276 * Indicates the portrait orientation 277 * 278 * @syscap SystemCapability.BundleManager.BundleFramework 279 * @since 7 280 * @deprecated since 9 281 */ 282 PORTRAIT, 283 284 /** 285 * Indicates the page ability orientation is the same as that of the nearest ability in the stack 286 * 287 * @syscap SystemCapability.BundleManager.BundleFramework 288 * @since 7 289 * @deprecated since 9 290 */ 291 FOLLOW_RECENT 292 } 293 294 /** 295 * LaunchMode 296 * 297 * @enum { number } 298 * @syscap SystemCapability.BundleManager.BundleFramework 299 * @since 7 300 * @deprecated since 9 301 * @useinstead ohos.bundle.bundleManager.LaunchType 302 */ 303 export enum LaunchMode { 304 /** 305 * Indicates that the ability has only one instance 306 * 307 * @syscap SystemCapability.BundleManager.BundleFramework 308 * @since 7 309 * @deprecated since 9 310 */ 311 SINGLETON = 0, 312 313 /** 314 * Indicates that the ability can have multiple instances 315 * 316 * @syscap SystemCapability.BundleManager.BundleFramework 317 * @since 7 318 * @deprecated since 9 319 */ 320 STANDARD = 1 321 } 322 323 /** 324 * BundleOptions 325 * 326 * @typedef BundleOptions 327 * @syscap SystemCapability.BundleManager.BundleFramework 328 * @since 7 329 * @deprecated since 9 330 */ 331 export interface BundleOptions { 332 /** 333 * Indicates the user id 334 * 335 * @syscap SystemCapability.BundleManager.BundleFramework 336 * @since 7 337 * @deprecated since 9 338 */ 339 userId?: number; 340 } 341 342 /** 343 * InstallErrorCode 344 * 345 * @enum { number } 346 * @syscap SystemCapability.BundleManager.BundleFramework 347 * @since 7 348 * @deprecated since 9 349 */ 350 export enum InstallErrorCode { 351 /** 352 * @syscap SystemCapability.BundleManager.BundleFramework 353 * @since 7 354 * @deprecated since 9 355 */ 356 SUCCESS = 0, 357 /** 358 * @syscap SystemCapability.BundleManager.BundleFramework 359 * @since 7 360 * @deprecated since 9 361 */ 362 STATUS_INSTALL_FAILURE = 1, 363 /** 364 * @syscap SystemCapability.BundleManager.BundleFramework 365 * @since 7 366 * @deprecated since 9 367 */ 368 STATUS_INSTALL_FAILURE_ABORTED = 2, 369 /** 370 * @syscap SystemCapability.BundleManager.BundleFramework 371 * @since 7 372 * @deprecated since 9 373 */ 374 STATUS_INSTALL_FAILURE_INVALID = 3, 375 /** 376 * @syscap SystemCapability.BundleManager.BundleFramework 377 * @since 7 378 * @deprecated since 9 379 */ 380 STATUS_INSTALL_FAILURE_CONFLICT = 4, 381 /** 382 * @syscap SystemCapability.BundleManager.BundleFramework 383 * @since 7 384 * @deprecated since 9 385 */ 386 STATUS_INSTALL_FAILURE_STORAGE = 5, 387 /** 388 * @syscap SystemCapability.BundleManager.BundleFramework 389 * @since 7 390 * @deprecated since 9 391 */ 392 STATUS_INSTALL_FAILURE_INCOMPATIBLE = 6, 393 /** 394 * @syscap SystemCapability.BundleManager.BundleFramework 395 * @since 7 396 * @deprecated since 9 397 */ 398 STATUS_UNINSTALL_FAILURE = 7, 399 /** 400 * @syscap SystemCapability.BundleManager.BundleFramework 401 * @since 7 402 * @deprecated since 9 403 */ 404 STATUS_UNINSTALL_FAILURE_BLOCKED = 8, 405 /** 406 * @syscap SystemCapability.BundleManager.BundleFramework 407 * @since 7 408 * @deprecated since 9 409 */ 410 STATUS_UNINSTALL_FAILURE_ABORTED = 9, 411 /** 412 * @syscap SystemCapability.BundleManager.BundleFramework 413 * @since 7 414 * @deprecated since 9 415 */ 416 STATUS_UNINSTALL_FAILURE_CONFLICT = 10, 417 /** 418 * @syscap SystemCapability.BundleManager.BundleFramework 419 * @since 7 420 * @deprecated since 9 421 */ 422 STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT = 0x0B, 423 /** 424 * @syscap SystemCapability.BundleManager.BundleFramework 425 * @since 7 426 * @deprecated since 9 427 */ 428 STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED = 0x0C, 429 /** 430 * @syscap SystemCapability.BundleManager.BundleFramework 431 * @since 8 432 * @deprecated since 9 433 */ 434 STATUS_RECOVER_FAILURE_INVALID = 0x0D, 435 /** 436 * @syscap SystemCapability.BundleManager.BundleFramework 437 * @since 7 438 * @deprecated since 9 439 */ 440 STATUS_ABILITY_NOT_FOUND = 0x40, 441 /** 442 * @syscap SystemCapability.BundleManager.BundleFramework 443 * @since 7 444 * @deprecated since 9 445 */ 446 STATUS_BMS_SERVICE_ERROR = 0x41, 447 /** 448 * @syscap SystemCapability.BundleManager.BundleFramework 449 * @since 8 450 * @deprecated since 9 451 */ 452 STATUS_FAILED_NO_SPACE_LEFT = 0x42, 453 /** 454 * @syscap SystemCapability.BundleManager.BundleFramework 455 * @since 8 456 * @deprecated since 9 457 */ 458 STATUS_GRANT_REQUEST_PERMISSIONS_FAILED = 0x43, 459 /** 460 * @syscap SystemCapability.BundleManager.BundleFramework 461 * @since 8 462 * @deprecated since 9 463 */ 464 STATUS_INSTALL_PERMISSION_DENIED = 0x44, 465 /** 466 * @syscap SystemCapability.BundleManager.BundleFramework 467 * @since 8 468 * @deprecated since 9 469 */ 470 STATUS_UNINSTALL_PERMISSION_DENIED = 0x45 471 } 472 473 /** 474 * Obtains bundleInfo based on bundleName, bundleFlags and options. 475 * 476 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 477 * @param { string } bundleName - Indicates the application bundle name to be queried. 478 * @param { number } bundleFlags - Indicates the application bundle flags to be queried. 479 * @param { BundleOptions } options Indicates the bundle options object. 480 * @param { AsyncCallback<BundleInfo> } callback 481 * @syscap SystemCapability.BundleManager.BundleFramework 482 * @since 7 483 * @deprecated since 9 484 */ 485 function getBundleInfo(bundleName: string, 486 bundleFlags: number, options: BundleOptions, callback: AsyncCallback<BundleInfo>): void; 487 488 /** 489 * Obtains bundleInfo based on bundleName, bundleFlags and options. 490 * 491 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 492 * @param { string } bundleName - Indicates the application bundle name to be queried. 493 * @param { number } bundleFlags - Indicates the application bundle flags to be queried. 494 * @param { AsyncCallback<BundleInfo> } callback 495 * @syscap SystemCapability.BundleManager.BundleFramework 496 * @since 7 497 * @deprecated since 9 498 */ 499 function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>): void; 500 501 /** 502 * Obtains bundleInfo based on bundleName, bundleFlags and options. 503 * 504 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 505 * @param { string } bundleName - Indicates the application bundle name to be queried. 506 * @param { number } bundleFlags - Indicates the application bundle flags to be queried. 507 * @param { BundleOptions } options Indicates the bundle options object. 508 * @returns { Promise<BundleInfo> } Returns the BundleInfo object. 509 * @syscap SystemCapability.BundleManager.BundleFramework 510 * @since 7 511 * @deprecated since 9 512 */ 513 function getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise<BundleInfo>; 514 515 /** 516 * Obtains the interface used to install bundles. 517 * 518 * @permission ohos.permission.INSTALL_BUNDLE 519 * @param { AsyncCallback<BundleInstaller> } callback 520 * @syscap SystemCapability.BundleManager.BundleFramework 521 * @systemapi Hide this for inner system use 522 * @since 7 523 * @deprecated since 9 524 * @useinstead ohos.bundle.installer#getBundleInstaller 525 */ 526 function getBundleInstaller(callback: AsyncCallback<BundleInstaller>): void; 527 528 /** 529 * Obtains the interface used to install bundles. 530 * 531 * @permission ohos.permission.INSTALL_BUNDLE 532 * @returns { Promise<BundleInstaller> } Returns the IBundleInstaller interface. 533 * @syscap SystemCapability.BundleManager.BundleFramework 534 * @systemapi Hide this for inner system use 535 * @since 7 536 * @deprecated since 9 537 * @useinstead ohos.bundle.installer#getBundleInstaller 538 */ 539 function getBundleInstaller(): Promise<BundleInstaller>; 540 541 /** 542 * Obtains information about the current ability. 543 * 544 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 545 * @param { string } bundleName - Indicates the application bundle name to be queried. 546 * @param { string } abilityName - Indicates the ability name. 547 * @param { AsyncCallback<AbilityInfo> } callback 548 * @syscap SystemCapability.BundleManager.BundleFramework 549 * @since 7 550 * @deprecated since 9 551 */ 552 function getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback<AbilityInfo>): void; 553 554 /** 555 * Obtains information about the current ability. 556 * 557 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 558 * @param { string } bundleName - Indicates the application bundle name to be queried. 559 * @param { string } abilityName - Indicates the ability name. 560 * @returns { Promise<AbilityInfo> } Returns the AbilityInfo object for the current ability. 561 * @syscap SystemCapability.BundleManager.BundleFramework 562 * @since 7 563 * @deprecated since 9 564 */ 565 function getAbilityInfo(bundleName: string, abilityName: string): Promise<AbilityInfo>; 566 567 /** 568 * Obtains based on a given bundle name. 569 * 570 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 571 * @param { string } bundleName - Indicates the application bundle name to be queried. 572 * @param { number } bundleFlags - Indicates the flag used to specify information contained 573 * in the ApplicationInfo object that will be returned. 574 * @param { number } userId - Indicates the user ID or do not pass user ID. 575 * @param { AsyncCallback<ApplicationInfo> } callback 576 * @syscap SystemCapability.BundleManager.BundleFramework 577 * @since 7 578 * @deprecated since 9 579 */ 580 function getApplicationInfo(bundleName: string, 581 bundleFlags: number, userId: number, callback: AsyncCallback<ApplicationInfo>): void; 582 583 /** 584 * Obtains based on a given bundle name. 585 * 586 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 587 * @param { string } bundleName - Indicates the application bundle name to be queried. 588 * @param { number } bundleFlags - Indicates the flag used to specify information contained 589 * in the ApplicationInfo object that will be returned. 590 * @param { AsyncCallback<ApplicationInfo> } callback 591 * @syscap SystemCapability.BundleManager.BundleFramework 592 * @since 7 593 * @deprecated since 9 594 */ 595 function getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback<ApplicationInfo>): void; 596 597 /** 598 * Obtains based on a given bundle name. 599 * 600 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 601 * @param { string } bundleName - Indicates the application bundle name to be queried. 602 * @param { number } bundleFlags - Indicates the flag used to specify information contained 603 * in the ApplicationInfo object that will be returned. 604 * @param { number } userId - Indicates the user ID or do not pass user ID. 605 * @returns { Promise<ApplicationInfo> } Returns the ApplicationInfo object. 606 * @syscap SystemCapability.BundleManager.BundleFramework 607 * @since 7 608 * @deprecated since 9 609 */ 610 function getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number): Promise<ApplicationInfo>; 611 612 /** 613 * Query the AbilityInfo by the given Want. 614 * 615 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 616 * @param { Want } want - Indicates the Want containing the application bundle name 617 * to be queried. 618 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that 619 * will be returned. 620 * @param { number } userId - Indicates the user ID. 621 * @param { AsyncCallback<Array<AbilityInfo>> } callback 622 * @syscap SystemCapability.BundleManager.BundleFramework 623 * @since 7 624 * @deprecated since 9 625 */ 626 function queryAbilityByWant(want: Want, 627 bundleFlags: number, userId: number, callback: AsyncCallback<Array<AbilityInfo>>): void; 628 629 /** 630 * Query the AbilityInfo by the given Want. 631 * 632 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 633 * @param { Want } want - Indicates the Want containing the application bundle name 634 * to be queried. 635 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that 636 * will be returned. 637 * @param { AsyncCallback<Array<AbilityInfo>> } callback 638 * @syscap SystemCapability.BundleManager.BundleFramework 639 * @since 7 640 * @deprecated since 9 641 */ 642 function queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Array<AbilityInfo>>): void; 643 644 /** 645 * Query the AbilityInfo by the given Want. 646 * 647 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 648 * @param { Want } want - Indicates the Want containing the application bundle name 649 * to be queried. 650 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that 651 * will be returned. 652 * @param { number } userId - Indicates the user ID. 653 * @returns { Promise<Array<AbilityInfo>> } Returns a list of AbilityInfo objects. 654 * @syscap SystemCapability.BundleManager.BundleFramework 655 * @since 7 656 * @deprecated since 9 657 */ 658 function queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise<Array<AbilityInfo>>; 659 660 /** 661 * Obtains BundleInfo of all bundles available in the system. 662 * 663 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 664 * @param { BundleFlag } bundleFlag - Indicates the flag used to specify information contained 665 * in the BundleInfo that will be returned. 666 * @param { number } userId - Indicates the user ID. 667 * @param { AsyncCallback<Array<BundleInfo>> } callback 668 * @syscap SystemCapability.BundleManager.BundleFramework 669 * @since 7 670 * @deprecated since 9 671 */ 672 function getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback<Array<BundleInfo>>): void; 673 674 /** 675 * Obtains BundleInfo of all bundles available in the system. 676 * 677 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 678 * @param { BundleFlag } bundleFlag - Indicates the flag used to specify information contained 679 * in the BundleInfo that will be returned. 680 * @param { AsyncCallback<Array<BundleInfo>> } callback 681 * @syscap SystemCapability.BundleManager.BundleFramework 682 * @since 7 683 * @deprecated since 9 684 */ 685 function getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback<Array<BundleInfo>>): void; 686 687 /** 688 * Obtains BundleInfo of all bundles available in the system. 689 * 690 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 691 * @param { BundleFlag } bundleFlag - Indicates the flag used to specify information contained 692 * in the BundleInfo that will be returned. 693 * @param { number } userId - Indicates the user ID. 694 * @returns { Promise<Array<BundleInfo>> } Returns a list of BundleInfo objects. 695 * @syscap SystemCapability.BundleManager.BundleFramework 696 * @since 7 697 * @deprecated since 9 698 */ 699 function getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise<Array<BundleInfo>>; 700 701 /** 702 * Obtains information about all installed applications of a specified user. 703 * 704 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 705 * @param { number } bundleFlags - Indicates the flag used to specify information contained 706 * in the ApplicationInfo objects that will be returned. 707 * @param { number } userId - Indicates the user ID. 708 * @param { AsyncCallback<Array<ApplicationInfo>> } callback 709 * @syscap SystemCapability.BundleManager.BundleFramework 710 * @since 7 711 * @deprecated since 9 712 */ 713 function getAllApplicationInfo(bundleFlags: number, 714 userId: number, callback: AsyncCallback<Array<ApplicationInfo>>): void; 715 716 /** 717 * Obtains information about all installed applications of a specified user. 718 * 719 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 720 * @param { number } bundleFlags - Indicates the flag used to specify information contained 721 * in the ApplicationInfo objects that will be returned. 722 * @param { AsyncCallback<Array<ApplicationInfo>> } callback 723 * @syscap SystemCapability.BundleManager.BundleFramework 724 * @since 7 725 * @deprecated since 9 726 */ 727 function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback<Array<ApplicationInfo>>): void; 728 729 /** 730 * Obtains information about all installed applications of a specified user. 731 * 732 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 733 * @param { number } bundleFlags - Indicates the flag used to specify information contained 734 * in the ApplicationInfo objects that will be returned. 735 * @param { number } userId - Indicates the user ID or do not pass user ID. 736 * @returns { Promise<Array<ApplicationInfo>> } Returns a list of ApplicationInfo objects. 737 * @syscap SystemCapability.BundleManager.BundleFramework 738 * @since 7 739 * @deprecated since 9 740 */ 741 function getAllApplicationInfo(bundleFlags: number, userId?: number): Promise<Array<ApplicationInfo>>; 742 743 /** 744 * Obtains bundle name by the given uid. 745 * 746 * @param { number } uid - Indicates the UID of an application. 747 * @param { AsyncCallback<string> } callback 748 * @syscap SystemCapability.BundleManager.BundleFramework 749 * @since 8 750 * @deprecated since 9 751 */ 752 function getNameForUid(uid: number, callback: AsyncCallback<string>): void; 753 754 /** 755 * Obtains bundle name by the given uid. 756 * 757 * @param { number } uid - Indicates the UID of an application. 758 * @returns { Promise<string> } Returns the bundle name. 759 * @syscap SystemCapability.BundleManager.BundleFramework 760 * @since 8 761 * @deprecated since 9 762 */ 763 function getNameForUid(uid: number): Promise<string>; 764 765 /** 766 * Obtains information about an application bundle contained in an ohos Ability Package (HAP). 767 * 768 * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path 769 * to the data directory of the current application. 770 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the 771 * BundleInfo object to be returned. 772 * @param { AsyncCallback<BundleInfo> } callback 773 * @syscap SystemCapability.BundleManager.BundleFramework 774 * @since 7 775 * @deprecated since 9 776 */ 777 function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>): void; 778 779 /** 780 * Obtains information about an application bundle contained in an ohos Ability Package (HAP). 781 * 782 * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path 783 * to the data directory of the current application. 784 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the 785 * BundleInfo object to be returned. 786 * @returns { Promise<BundleInfo> } - Returns the BundleInfo object. 787 * @syscap SystemCapability.BundleManager.BundleFramework 788 * @since 7 789 * @deprecated since 9 790 */ 791 function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number): Promise<BundleInfo>; 792 793 /** 794 * Obtains the Want for starting the main ability of an application based on the 795 * given bundle name. The main ability of an application is the ability that has the 796 * #ACTION_HOME and #ENTITY_HOME Want 797 * filters set in the application's <b>config.json</b> file. 798 * 799 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 800 * @param { string } bundleName - Indicates the bundle name of the application. 801 * @param { AsyncCallback<Want> } callback 802 * @syscap SystemCapability.BundleManager.BundleFramework 803 * @since 7 804 * @deprecated since 9 805 */ 806 function getLaunchWantForBundle(bundleName: string, callback: AsyncCallback<Want>): void; 807 808 /** 809 * Obtains the Want for starting the main ability of an application based on the 810 * given bundle name. The main ability of an application is the ability that has the 811 * #ACTION_HOME and #ENTITY_HOME Want 812 * filters set in the application's <b>config.json</b> file. 813 * 814 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 815 * @param { string } bundleName - Indicates the bundle name of the application. 816 * @returns { Promise<Want> } Returns the Want for starting the application's main ability if any. 817 * @syscap SystemCapability.BundleManager.BundleFramework 818 * @since 7 819 * @deprecated since 9 820 */ 821 function getLaunchWantForBundle(bundleName: string): Promise<Want>; 822 823 /** 824 * Clears cache data of a specified application. 825 * 826 * @permission ohos.permission.REMOVE_CACHE_FILES 827 * @param { string } bundleName - Indicates the bundle name of the application whose cache data is to be cleared. 828 * @param { AsyncCallback<void> } callback Indicates the callback to be invoked for returning the operation result. 829 * @syscap SystemCapability.BundleManager.BundleFramework 830 * @systemapi Hide this for inner system use 831 * @since 8 832 * @deprecated since 9 833 * @useinstead ohos.bundle.bundleManager#cleanBundleCacheFiles 834 */ 835 function cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback<void>): void; 836 837 /** 838 * Clears cache data of a specified application. 839 * 840 * @permission ohos.permission.REMOVE_CACHE_FILES 841 * @param { string } bundleName - Indicates the bundle name of the application whose cache data is to be cleared. 842 * @returns { Promise<void> } 843 * @syscap SystemCapability.BundleManager.BundleFramework 844 * @systemapi Hide this for inner system use 845 * @since 8 846 * @deprecated since 9 847 * @useinstead ohos.bundle.bundleManager#cleanBundleCacheFiles 848 */ 849 function cleanBundleCacheFiles(bundleName: string): Promise<void>; 850 851 /** 852 * Sets whether to enable a specified application. 853 * 854 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 855 * @param { string } bundleName - Indicates the bundle name of the application. 856 * @param { boolean } isEnable - Specifies whether to enable the application. The value true means to enable it, 857 * and the value false means to disable it. 858 * @param { AsyncCallback<void> } callback 859 * @syscap SystemCapability.BundleManager.BundleFramework 860 * @systemapi Hide this for inner system use 861 * @since 8 862 * @deprecated since 9 863 * @useinstead ohos.bundle.bundleManager#setApplicationEnabled 864 */ 865 function setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback<void>): void; 866 867 /** 868 * Sets whether to enable a specified application. 869 * 870 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 871 * @param { string } bundleName - Indicates the bundle name of the application. 872 * @param { boolean } isEnable - Specifies whether to enable the application. The value true means to enable it, 873 * and the value false means to disable it. 874 * @returns { Promise<void> } 875 * @syscap SystemCapability.BundleManager.BundleFramework 876 * @systemapi Hide this for inner system use 877 * @since 8 878 * @deprecated since 9 879 * @useinstead ohos.bundle.bundleManager#setApplicationEnabled 880 */ 881 function setApplicationEnabled(bundleName: string, isEnable: boolean): Promise<void>; 882 883 /** 884 * Sets whether to enable a specified ability. 885 * 886 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 887 * @param { AbilityInfo } info - Indicates information about the ability to set. 888 * @param { boolean } isEnable - Specifies whether to enable the application. The value true means to enable it, 889 * and the value false means to disable it. 890 * @param { AsyncCallback<void> } callback 891 * @syscap SystemCapability.BundleManager.BundleFramework 892 * @systemapi Hide this for inner system use 893 * @since 8 894 * @deprecated since 9 895 * @useinstead ohos.bundle.bundleManager#setAbilityEnabled 896 */ 897 function setAbilityEnabled(info: AbilityInfo, isEnable: boolean, callback: AsyncCallback<void>): void; 898 899 /** 900 * Sets whether to enable a specified ability. 901 * 902 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 903 * @param { AbilityInfo } info - Indicates information about the ability to set. 904 * @param { boolean } isEnable - Specifies whether to enable the application. The value true means to enable it, 905 * and the value false means to disable it. 906 * @returns { Promise<void> } 907 * @syscap SystemCapability.BundleManager.BundleFramework 908 * @systemapi Hide this for inner system use 909 * @since 8 910 * @deprecated since 9 911 * @useinstead ohos.bundle.bundleManager#setAbilityEnabled 912 */ 913 function setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise<void>; 914 915 /** 916 * Get the permission details by permissionName. 917 * 918 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 919 * @param { string } permissionName - Indicates permission name. 920 * @param { AsyncCallback<PermissionDef> } callback 921 * @syscap SystemCapability.BundleManager.BundleFramework 922 * @systemapi 923 * @since 8 924 * @deprecated since 9 925 * @useinstead ohos.bundle.bundleManager#getPermissionDef 926 */ 927 function getPermissionDef(permissionName: string, callback: AsyncCallback<PermissionDef>): void; 928 929 /** 930 * Get the permission details by permissionName. 931 * 932 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 933 * @param { string } permissionName - Indicates permission name. 934 * @returns { Promise<PermissionDef> } Returns permissionDef object. 935 * @syscap SystemCapability.BundleManager.BundleFramework 936 * @systemapi 937 * @since 8 938 * @deprecated since 9 939 * @useinstead ohos.bundle.bundleManager#getPermissionDef 940 */ 941 function getPermissionDef(permissionName: string): Promise<PermissionDef>; 942 943 /** 944 * Obtains the label of a specified ability. 945 * 946 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 947 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 948 * @param { string } abilityName - Indicates the ability name. 949 * @param { AsyncCallback<string> } callback 950 * @syscap SystemCapability.BundleManager.BundleFramework 951 * @since 8 952 * @deprecated since 9 953 */ 954 function getAbilityLabel(bundleName: string, abilityName: string, callback: AsyncCallback<string>): void; 955 956 /** 957 * Obtains the label of a specified ability. 958 * 959 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 960 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 961 * @param { string } abilityName - Indicates the ability name. 962 * @returns { Promise<string> } Returns the label representing the label of the specified ability. 963 * @syscap SystemCapability.BundleManager.BundleFramework 964 * @since 8 965 * @deprecated since 9 966 */ 967 function getAbilityLabel(bundleName: string, abilityName: string): Promise<string>; 968 969 /** 970 * Obtains the icon of a specified ability. 971 * 972 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 973 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 974 * @param { string } abilityName - Indicates the ability name. 975 * @param { AsyncCallback<image.PixelMap> } callback 976 * @syscap SystemCapability.BundleManager.BundleFramework 977 * @since 8 978 * @deprecated since 9 979 * @useinstead ohos.resourceManager#getMediaContent 980 */ 981 function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback<image.PixelMap>): void; 982 983 /** 984 * Obtains the icon of a specified ability. 985 * 986 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 987 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 988 * @param { string } abilityName - Indicates the ability name. 989 * @returns { Promise<image.PixelMap> } Returns the PixelMap object representing the icon of the specified ability. 990 * @syscap SystemCapability.BundleManager.BundleFramework 991 * @since 8 992 * @deprecated since 9 993 * @useinstead ohos.resourceManager#getMediaContent 994 */ 995 function getAbilityIcon(bundleName: string, abilityName: string): Promise<image.PixelMap>; 996 997 /** 998 * Checks whether a specified ability is enabled. 999 * 1000 * @param { AbilityInfo } info - Indicates information about the ability to check. 1001 * @param { AsyncCallback<boolean> } callback 1002 * @syscap SystemCapability.BundleManager.BundleFramework 1003 * @since 8 1004 * @deprecated since 9 1005 */ 1006 function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback<boolean>): void; 1007 1008 /** 1009 * Checks whether a specified ability is enabled. 1010 * 1011 * @param { AbilityInfo } info - Indicates information about the ability to check. 1012 * @returns { Promise<boolean> } Returns true if the ability is enabled; returns false otherwise. 1013 * @syscap SystemCapability.BundleManager.BundleFramework 1014 * @since 8 1015 * @deprecated since 9 1016 */ 1017 function isAbilityEnabled(info: AbilityInfo): Promise<boolean>; 1018 1019 /** 1020 * Checks whether a specified application is enabled. 1021 * 1022 * @param { string } bundleName - Indicates the bundle name of the application. 1023 * @param { AsyncCallback<boolean> } callback 1024 * @syscap SystemCapability.BundleManager.BundleFramework 1025 * @since 8 1026 * @deprecated since 9 1027 */ 1028 function isApplicationEnabled(bundleName: string, callback: AsyncCallback<boolean>): void; 1029 1030 /** 1031 * Checks whether a specified application is enabled. 1032 * 1033 * @param { string } bundleName - Indicates the bundle name of the application. 1034 * @returns { Promise<boolean> } Returns true if the application is enabled; returns false otherwise. 1035 * @syscap SystemCapability.BundleManager.BundleFramework 1036 * @since 8 1037 * @deprecated since 9 1038 */ 1039 function isApplicationEnabled(bundleName: string): Promise<boolean>; 1040} 1041 1042export default bundle; 1043