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 * @type { ?number } 336 * @syscap SystemCapability.BundleManager.BundleFramework 337 * @since 7 338 * @deprecated since 9 339 */ 340 userId?: number; 341 } 342 343 /** 344 * InstallErrorCode 345 * 346 * @enum { number } 347 * @syscap SystemCapability.BundleManager.BundleFramework 348 * @since 7 349 * @deprecated since 9 350 */ 351 export enum InstallErrorCode { 352 /** 353 * @syscap SystemCapability.BundleManager.BundleFramework 354 * @since 7 355 * @deprecated since 9 356 */ 357 SUCCESS = 0, 358 /** 359 * @syscap SystemCapability.BundleManager.BundleFramework 360 * @since 7 361 * @deprecated since 9 362 */ 363 STATUS_INSTALL_FAILURE = 1, 364 /** 365 * @syscap SystemCapability.BundleManager.BundleFramework 366 * @since 7 367 * @deprecated since 9 368 */ 369 STATUS_INSTALL_FAILURE_ABORTED = 2, 370 /** 371 * @syscap SystemCapability.BundleManager.BundleFramework 372 * @since 7 373 * @deprecated since 9 374 */ 375 STATUS_INSTALL_FAILURE_INVALID = 3, 376 /** 377 * @syscap SystemCapability.BundleManager.BundleFramework 378 * @since 7 379 * @deprecated since 9 380 */ 381 STATUS_INSTALL_FAILURE_CONFLICT = 4, 382 /** 383 * @syscap SystemCapability.BundleManager.BundleFramework 384 * @since 7 385 * @deprecated since 9 386 */ 387 STATUS_INSTALL_FAILURE_STORAGE = 5, 388 /** 389 * @syscap SystemCapability.BundleManager.BundleFramework 390 * @since 7 391 * @deprecated since 9 392 */ 393 STATUS_INSTALL_FAILURE_INCOMPATIBLE = 6, 394 /** 395 * @syscap SystemCapability.BundleManager.BundleFramework 396 * @since 7 397 * @deprecated since 9 398 */ 399 STATUS_UNINSTALL_FAILURE = 7, 400 /** 401 * @syscap SystemCapability.BundleManager.BundleFramework 402 * @since 7 403 * @deprecated since 9 404 */ 405 STATUS_UNINSTALL_FAILURE_BLOCKED = 8, 406 /** 407 * @syscap SystemCapability.BundleManager.BundleFramework 408 * @since 7 409 * @deprecated since 9 410 */ 411 STATUS_UNINSTALL_FAILURE_ABORTED = 9, 412 /** 413 * @syscap SystemCapability.BundleManager.BundleFramework 414 * @since 7 415 * @deprecated since 9 416 */ 417 STATUS_UNINSTALL_FAILURE_CONFLICT = 10, 418 /** 419 * @syscap SystemCapability.BundleManager.BundleFramework 420 * @since 7 421 * @deprecated since 9 422 */ 423 STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT = 0x0B, 424 /** 425 * @syscap SystemCapability.BundleManager.BundleFramework 426 * @since 7 427 * @deprecated since 9 428 */ 429 STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED = 0x0C, 430 /** 431 * @syscap SystemCapability.BundleManager.BundleFramework 432 * @since 8 433 * @deprecated since 9 434 */ 435 STATUS_RECOVER_FAILURE_INVALID = 0x0D, 436 /** 437 * @syscap SystemCapability.BundleManager.BundleFramework 438 * @since 7 439 * @deprecated since 9 440 */ 441 STATUS_ABILITY_NOT_FOUND = 0x40, 442 /** 443 * @syscap SystemCapability.BundleManager.BundleFramework 444 * @since 7 445 * @deprecated since 9 446 */ 447 STATUS_BMS_SERVICE_ERROR = 0x41, 448 /** 449 * @syscap SystemCapability.BundleManager.BundleFramework 450 * @since 8 451 * @deprecated since 9 452 */ 453 STATUS_FAILED_NO_SPACE_LEFT = 0x42, 454 /** 455 * @syscap SystemCapability.BundleManager.BundleFramework 456 * @since 8 457 * @deprecated since 9 458 */ 459 STATUS_GRANT_REQUEST_PERMISSIONS_FAILED = 0x43, 460 /** 461 * @syscap SystemCapability.BundleManager.BundleFramework 462 * @since 8 463 * @deprecated since 9 464 */ 465 STATUS_INSTALL_PERMISSION_DENIED = 0x44, 466 /** 467 * @syscap SystemCapability.BundleManager.BundleFramework 468 * @since 8 469 * @deprecated since 9 470 */ 471 STATUS_UNINSTALL_PERMISSION_DENIED = 0x45 472 } 473 474 /** 475 * Obtains bundleInfo based on bundleName, bundleFlags and options. 476 * 477 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 478 * @param { string } bundleName - Indicates the application bundle name to be queried. 479 * @param { number } bundleFlags - Indicates the application bundle flags to be queried. 480 * @param { BundleOptions } options Indicates the bundle options object. 481 * @param { AsyncCallback<BundleInfo> } callback 482 * @syscap SystemCapability.BundleManager.BundleFramework 483 * @since 7 484 * @deprecated since 9 485 */ 486 function getBundleInfo(bundleName: string, 487 bundleFlags: number, options: BundleOptions, callback: AsyncCallback<BundleInfo>): void; 488 489 /** 490 * Obtains bundleInfo based on bundleName, bundleFlags and options. 491 * 492 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 493 * @param { string } bundleName - Indicates the application bundle name to be queried. 494 * @param { number } bundleFlags - Indicates the application bundle flags to be queried. 495 * @param { AsyncCallback<BundleInfo> } callback 496 * @syscap SystemCapability.BundleManager.BundleFramework 497 * @since 7 498 * @deprecated since 9 499 */ 500 function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>): void; 501 502 /** 503 * Obtains bundleInfo based on bundleName, bundleFlags and options. 504 * 505 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 506 * @param { string } bundleName - Indicates the application bundle name to be queried. 507 * @param { number } bundleFlags - Indicates the application bundle flags to be queried. 508 * @param { BundleOptions } options Indicates the bundle options object. 509 * @returns { Promise<BundleInfo> } Returns the BundleInfo object. 510 * @syscap SystemCapability.BundleManager.BundleFramework 511 * @since 7 512 * @deprecated since 9 513 */ 514 function getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise<BundleInfo>; 515 516 /** 517 * Obtains the interface used to install bundles. 518 * 519 * @permission ohos.permission.INSTALL_BUNDLE 520 * @param { AsyncCallback<BundleInstaller> } callback 521 * @syscap SystemCapability.BundleManager.BundleFramework 522 * @systemapi Hide this for inner system use 523 * @since 7 524 * @deprecated since 9 525 * @useinstead ohos.bundle.installer#getBundleInstaller 526 */ 527 function getBundleInstaller(callback: AsyncCallback<BundleInstaller>): void; 528 529 /** 530 * Obtains the interface used to install bundles. 531 * 532 * @permission ohos.permission.INSTALL_BUNDLE 533 * @returns { Promise<BundleInstaller> } Returns the IBundleInstaller interface. 534 * @syscap SystemCapability.BundleManager.BundleFramework 535 * @systemapi Hide this for inner system use 536 * @since 7 537 * @deprecated since 9 538 * @useinstead ohos.bundle.installer#getBundleInstaller 539 */ 540 function getBundleInstaller(): Promise<BundleInstaller>; 541 542 /** 543 * Obtains information about the current ability. 544 * 545 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 546 * @param { string } bundleName - Indicates the application bundle name to be queried. 547 * @param { string } abilityName - Indicates the ability name. 548 * @param { AsyncCallback<AbilityInfo> } callback 549 * @syscap SystemCapability.BundleManager.BundleFramework 550 * @since 7 551 * @deprecated since 9 552 */ 553 function getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback<AbilityInfo>): void; 554 555 /** 556 * Obtains information about the current ability. 557 * 558 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 559 * @param { string } bundleName - Indicates the application bundle name to be queried. 560 * @param { string } abilityName - Indicates the ability name. 561 * @returns { Promise<AbilityInfo> } Returns the AbilityInfo object for the current ability. 562 * @syscap SystemCapability.BundleManager.BundleFramework 563 * @since 7 564 * @deprecated since 9 565 */ 566 function getAbilityInfo(bundleName: string, abilityName: string): Promise<AbilityInfo>; 567 568 /** 569 * Obtains based on a given bundle name. 570 * 571 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 572 * @param { string } bundleName - Indicates the application bundle name to be queried. 573 * @param { number } bundleFlags - Indicates the flag used to specify information contained 574 * in the ApplicationInfo object that will be returned. 575 * @param { number } userId - Indicates the user ID or do not pass user ID. 576 * @param { AsyncCallback<ApplicationInfo> } callback 577 * @syscap SystemCapability.BundleManager.BundleFramework 578 * @since 7 579 * @deprecated since 9 580 */ 581 function getApplicationInfo(bundleName: string, 582 bundleFlags: number, userId: number, callback: AsyncCallback<ApplicationInfo>): void; 583 584 /** 585 * Obtains based on a given bundle name. 586 * 587 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 588 * @param { string } bundleName - Indicates the application bundle name to be queried. 589 * @param { number } bundleFlags - Indicates the flag used to specify information contained 590 * in the ApplicationInfo object that will be returned. 591 * @param { AsyncCallback<ApplicationInfo> } callback 592 * @syscap SystemCapability.BundleManager.BundleFramework 593 * @since 7 594 * @deprecated since 9 595 */ 596 function getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback<ApplicationInfo>): void; 597 598 /** 599 * Obtains based on a given bundle name. 600 * 601 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 602 * @param { string } bundleName - Indicates the application bundle name to be queried. 603 * @param { number } bundleFlags - Indicates the flag used to specify information contained 604 * in the ApplicationInfo object that will be returned. 605 * @param { number } userId - Indicates the user ID or do not pass user ID. 606 * @returns { Promise<ApplicationInfo> } Returns the ApplicationInfo object. 607 * @syscap SystemCapability.BundleManager.BundleFramework 608 * @since 7 609 * @deprecated since 9 610 */ 611 function getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number): Promise<ApplicationInfo>; 612 613 /** 614 * Query the AbilityInfo by the given Want. 615 * 616 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 617 * @param { Want } want - Indicates the Want containing the application bundle name 618 * to be queried. 619 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that 620 * will be returned. 621 * @param { number } userId - Indicates the user ID. 622 * @param { AsyncCallback<Array<AbilityInfo>> } callback 623 * @syscap SystemCapability.BundleManager.BundleFramework 624 * @since 7 625 * @deprecated since 9 626 */ 627 function queryAbilityByWant(want: Want, 628 bundleFlags: number, userId: number, callback: AsyncCallback<Array<AbilityInfo>>): void; 629 630 /** 631 * Query the AbilityInfo by the given Want. 632 * 633 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 634 * @param { Want } want - Indicates the Want containing the application bundle name 635 * to be queried. 636 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that 637 * will be returned. 638 * @param { AsyncCallback<Array<AbilityInfo>> } callback 639 * @syscap SystemCapability.BundleManager.BundleFramework 640 * @since 7 641 * @deprecated since 9 642 */ 643 function queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Array<AbilityInfo>>): void; 644 645 /** 646 * Query the AbilityInfo by the given Want. 647 * 648 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 649 * @param { Want } want - Indicates the Want containing the application bundle name 650 * to be queried. 651 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that 652 * will be returned. 653 * @param { number } userId - Indicates the user ID. 654 * @returns { Promise<Array<AbilityInfo>> } Returns a list of AbilityInfo objects. 655 * @syscap SystemCapability.BundleManager.BundleFramework 656 * @since 7 657 * @deprecated since 9 658 */ 659 function queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise<Array<AbilityInfo>>; 660 661 /** 662 * Obtains BundleInfo of all bundles available in the system. 663 * 664 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 665 * @param { BundleFlag } bundleFlag - Indicates the flag used to specify information contained 666 * in the BundleInfo that will be returned. 667 * @param { number } userId - Indicates the user ID. 668 * @param { AsyncCallback<Array<BundleInfo>> } callback 669 * @syscap SystemCapability.BundleManager.BundleFramework 670 * @since 7 671 * @deprecated since 9 672 */ 673 function getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback<Array<BundleInfo>>): void; 674 675 /** 676 * Obtains BundleInfo of all bundles available in the system. 677 * 678 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 679 * @param { BundleFlag } bundleFlag - Indicates the flag used to specify information contained 680 * in the BundleInfo that will be returned. 681 * @param { AsyncCallback<Array<BundleInfo>> } callback 682 * @syscap SystemCapability.BundleManager.BundleFramework 683 * @since 7 684 * @deprecated since 9 685 */ 686 function getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback<Array<BundleInfo>>): void; 687 688 /** 689 * Obtains BundleInfo of all bundles available in the system. 690 * 691 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 692 * @param { BundleFlag } bundleFlag - Indicates the flag used to specify information contained 693 * in the BundleInfo that will be returned. 694 * @param { number } userId - Indicates the user ID. 695 * @returns { Promise<Array<BundleInfo>> } Returns a list of BundleInfo objects. 696 * @syscap SystemCapability.BundleManager.BundleFramework 697 * @since 7 698 * @deprecated since 9 699 */ 700 function getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise<Array<BundleInfo>>; 701 702 /** 703 * Obtains information about all installed applications of a specified user. 704 * 705 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 706 * @param { number } bundleFlags - Indicates the flag used to specify information contained 707 * in the ApplicationInfo objects that will be returned. 708 * @param { number } userId - Indicates the user ID. 709 * @param { AsyncCallback<Array<ApplicationInfo>> } callback 710 * @syscap SystemCapability.BundleManager.BundleFramework 711 * @since 7 712 * @deprecated since 9 713 */ 714 function getAllApplicationInfo(bundleFlags: number, 715 userId: number, callback: AsyncCallback<Array<ApplicationInfo>>): void; 716 717 /** 718 * Obtains information about all installed applications of a specified user. 719 * 720 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 721 * @param { number } bundleFlags - Indicates the flag used to specify information contained 722 * in the ApplicationInfo objects that will be returned. 723 * @param { AsyncCallback<Array<ApplicationInfo>> } callback 724 * @syscap SystemCapability.BundleManager.BundleFramework 725 * @since 7 726 * @deprecated since 9 727 */ 728 function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback<Array<ApplicationInfo>>): void; 729 730 /** 731 * Obtains information about all installed applications of a specified user. 732 * 733 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 734 * @param { number } bundleFlags - Indicates the flag used to specify information contained 735 * in the ApplicationInfo objects that will be returned. 736 * @param { number } userId - Indicates the user ID or do not pass user ID. 737 * @returns { Promise<Array<ApplicationInfo>> } Returns a list of ApplicationInfo objects. 738 * @syscap SystemCapability.BundleManager.BundleFramework 739 * @since 7 740 * @deprecated since 9 741 */ 742 function getAllApplicationInfo(bundleFlags: number, userId?: number): Promise<Array<ApplicationInfo>>; 743 744 /** 745 * Obtains bundle name by the given uid. 746 * 747 * @param { number } uid - Indicates the UID of an application. 748 * @param { AsyncCallback<string> } callback 749 * @syscap SystemCapability.BundleManager.BundleFramework 750 * @since 8 751 * @deprecated since 9 752 */ 753 function getNameForUid(uid: number, callback: AsyncCallback<string>): void; 754 755 /** 756 * Obtains bundle name by the given uid. 757 * 758 * @param { number } uid - Indicates the UID of an application. 759 * @returns { Promise<string> } Returns the bundle name. 760 * @syscap SystemCapability.BundleManager.BundleFramework 761 * @since 8 762 * @deprecated since 9 763 */ 764 function getNameForUid(uid: number): Promise<string>; 765 766 /** 767 * Obtains information about an application bundle contained in an ohos Ability Package (HAP). 768 * 769 * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path 770 * to the data directory of the current application. 771 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the 772 * BundleInfo object to be returned. 773 * @param { AsyncCallback<BundleInfo> } callback 774 * @syscap SystemCapability.BundleManager.BundleFramework 775 * @since 7 776 * @deprecated since 9 777 */ 778 function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>): void; 779 780 /** 781 * Obtains information about an application bundle contained in an ohos Ability Package (HAP). 782 * 783 * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path 784 * to the data directory of the current application. 785 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the 786 * BundleInfo object to be returned. 787 * @returns { Promise<BundleInfo> } - Returns the BundleInfo object. 788 * @syscap SystemCapability.BundleManager.BundleFramework 789 * @since 7 790 * @deprecated since 9 791 */ 792 function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number): Promise<BundleInfo>; 793 794 /** 795 * Obtains the Want for starting the main ability of an application based on the 796 * given bundle name. The main ability of an application is the ability that has the 797 * #ACTION_HOME and #ENTITY_HOME Want 798 * filters set in the application's <b>config.json</b> file. 799 * 800 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 801 * @param { string } bundleName - Indicates the bundle name of the application. 802 * @param { AsyncCallback<Want> } callback 803 * @syscap SystemCapability.BundleManager.BundleFramework 804 * @since 7 805 * @deprecated since 9 806 */ 807 function getLaunchWantForBundle(bundleName: string, callback: AsyncCallback<Want>): void; 808 809 /** 810 * Obtains the Want for starting the main ability of an application based on the 811 * given bundle name. The main ability of an application is the ability that has the 812 * #ACTION_HOME and #ENTITY_HOME Want 813 * filters set in the application's <b>config.json</b> file. 814 * 815 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 816 * @param { string } bundleName - Indicates the bundle name of the application. 817 * @returns { Promise<Want> } Returns the Want for starting the application's main ability if any. 818 * @syscap SystemCapability.BundleManager.BundleFramework 819 * @since 7 820 * @deprecated since 9 821 */ 822 function getLaunchWantForBundle(bundleName: string): Promise<Want>; 823 824 /** 825 * Clears cache data of a specified application. 826 * 827 * @permission ohos.permission.REMOVE_CACHE_FILES 828 * @param { string } bundleName - Indicates the bundle name of the application whose cache data is to be cleared. 829 * @param { AsyncCallback<void> } callback Indicates the callback to be invoked for returning the operation result. 830 * @syscap SystemCapability.BundleManager.BundleFramework 831 * @systemapi Hide this for inner system use 832 * @since 8 833 * @deprecated since 9 834 * @useinstead ohos.bundle.bundleManager#cleanBundleCacheFiles 835 */ 836 function cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback<void>): void; 837 838 /** 839 * Clears cache data of a specified application. 840 * 841 * @permission ohos.permission.REMOVE_CACHE_FILES 842 * @param { string } bundleName - Indicates the bundle name of the application whose cache data is to be cleared. 843 * @returns { Promise<void> } 844 * @syscap SystemCapability.BundleManager.BundleFramework 845 * @systemapi Hide this for inner system use 846 * @since 8 847 * @deprecated since 9 848 * @useinstead ohos.bundle.bundleManager#cleanBundleCacheFiles 849 */ 850 function cleanBundleCacheFiles(bundleName: string): Promise<void>; 851 852 /** 853 * Sets whether to enable a specified application. 854 * 855 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 856 * @param { string } bundleName - Indicates the bundle name of the application. 857 * @param { boolean } isEnable - Specifies whether to enable the application. The value true means to enable it, 858 * and the value false means to disable it. 859 * @param { AsyncCallback<void> } callback 860 * @syscap SystemCapability.BundleManager.BundleFramework 861 * @systemapi Hide this for inner system use 862 * @since 8 863 * @deprecated since 9 864 * @useinstead ohos.bundle.bundleManager#setApplicationEnabled 865 */ 866 function setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback<void>): void; 867 868 /** 869 * Sets whether to enable a specified application. 870 * 871 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 872 * @param { string } bundleName - Indicates the bundle name of the application. 873 * @param { boolean } isEnable - Specifies whether to enable the application. The value true means to enable it, 874 * and the value false means to disable it. 875 * @returns { Promise<void> } 876 * @syscap SystemCapability.BundleManager.BundleFramework 877 * @systemapi Hide this for inner system use 878 * @since 8 879 * @deprecated since 9 880 * @useinstead ohos.bundle.bundleManager#setApplicationEnabled 881 */ 882 function setApplicationEnabled(bundleName: string, isEnable: boolean): Promise<void>; 883 884 /** 885 * Sets whether to enable a specified ability. 886 * 887 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 888 * @param { AbilityInfo } info - Indicates information about the ability to set. 889 * @param { boolean } isEnable - Specifies whether to enable the application. The value true means to enable it, 890 * and the value false means to disable it. 891 * @param { AsyncCallback<void> } callback 892 * @syscap SystemCapability.BundleManager.BundleFramework 893 * @systemapi Hide this for inner system use 894 * @since 8 895 * @deprecated since 9 896 * @useinstead ohos.bundle.bundleManager#setAbilityEnabled 897 */ 898 function setAbilityEnabled(info: AbilityInfo, isEnable: boolean, callback: AsyncCallback<void>): void; 899 900 /** 901 * Sets whether to enable a specified ability. 902 * 903 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 904 * @param { AbilityInfo } info - Indicates information about the ability to set. 905 * @param { boolean } isEnable - Specifies whether to enable the application. The value true means to enable it, 906 * and the value false means to disable it. 907 * @returns { Promise<void> } 908 * @syscap SystemCapability.BundleManager.BundleFramework 909 * @systemapi Hide this for inner system use 910 * @since 8 911 * @deprecated since 9 912 * @useinstead ohos.bundle.bundleManager#setAbilityEnabled 913 */ 914 function setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise<void>; 915 916 /** 917 * Get the permission details by permissionName. 918 * 919 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 920 * @param { string } permissionName - Indicates permission name. 921 * @param { AsyncCallback<PermissionDef> } callback 922 * @syscap SystemCapability.BundleManager.BundleFramework 923 * @systemapi 924 * @since 8 925 * @deprecated since 9 926 * @useinstead ohos.bundle.bundleManager#getPermissionDef 927 */ 928 function getPermissionDef(permissionName: string, callback: AsyncCallback<PermissionDef>): void; 929 930 /** 931 * Get the permission details by permissionName. 932 * 933 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 934 * @param { string } permissionName - Indicates permission name. 935 * @returns { Promise<PermissionDef> } Returns permissionDef object. 936 * @syscap SystemCapability.BundleManager.BundleFramework 937 * @systemapi 938 * @since 8 939 * @deprecated since 9 940 * @useinstead ohos.bundle.bundleManager#getPermissionDef 941 */ 942 function getPermissionDef(permissionName: string): Promise<PermissionDef>; 943 944 /** 945 * Obtains the label of a specified ability. 946 * 947 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 948 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 949 * @param { string } abilityName - Indicates the ability name. 950 * @param { AsyncCallback<string> } callback 951 * @syscap SystemCapability.BundleManager.BundleFramework 952 * @since 8 953 * @deprecated since 9 954 */ 955 function getAbilityLabel(bundleName: string, abilityName: string, callback: AsyncCallback<string>): void; 956 957 /** 958 * Obtains the label of a specified ability. 959 * 960 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 961 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 962 * @param { string } abilityName - Indicates the ability name. 963 * @returns { Promise<string> } Returns the label representing the label of the specified ability. 964 * @syscap SystemCapability.BundleManager.BundleFramework 965 * @since 8 966 * @deprecated since 9 967 */ 968 function getAbilityLabel(bundleName: string, abilityName: string): Promise<string>; 969 970 /** 971 * Obtains the icon of a specified ability. 972 * 973 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 974 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 975 * @param { string } abilityName - Indicates the ability name. 976 * @param { AsyncCallback<image.PixelMap> } callback 977 * @syscap SystemCapability.BundleManager.BundleFramework 978 * @since 8 979 * @deprecated since 9 980 * @useinstead ohos.resourceManager#getMediaContent 981 */ 982 function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback<image.PixelMap>): void; 983 984 /** 985 * Obtains the icon of a specified ability. 986 * 987 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 988 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 989 * @param { string } abilityName - Indicates the ability name. 990 * @returns { Promise<image.PixelMap> } Returns the PixelMap object representing the icon of the specified ability. 991 * @syscap SystemCapability.BundleManager.BundleFramework 992 * @since 8 993 * @deprecated since 9 994 * @useinstead ohos.resourceManager#getMediaContent 995 */ 996 function getAbilityIcon(bundleName: string, abilityName: string): Promise<image.PixelMap>; 997 998 /** 999 * Checks whether a specified ability is enabled. 1000 * 1001 * @param { AbilityInfo } info - Indicates information about the ability to check. 1002 * @param { AsyncCallback<boolean> } callback 1003 * @syscap SystemCapability.BundleManager.BundleFramework 1004 * @since 8 1005 * @deprecated since 9 1006 */ 1007 function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback<boolean>): void; 1008 1009 /** 1010 * Checks whether a specified ability is enabled. 1011 * 1012 * @param { AbilityInfo } info - Indicates information about the ability to check. 1013 * @returns { Promise<boolean> } Returns true if the ability is enabled; returns false otherwise. 1014 * @syscap SystemCapability.BundleManager.BundleFramework 1015 * @since 8 1016 * @deprecated since 9 1017 */ 1018 function isAbilityEnabled(info: AbilityInfo): Promise<boolean>; 1019 1020 /** 1021 * Checks whether a specified application is enabled. 1022 * 1023 * @param { string } bundleName - Indicates the bundle name of the application. 1024 * @param { AsyncCallback<boolean> } callback 1025 * @syscap SystemCapability.BundleManager.BundleFramework 1026 * @since 8 1027 * @deprecated since 9 1028 */ 1029 function isApplicationEnabled(bundleName: string, callback: AsyncCallback<boolean>): void; 1030 1031 /** 1032 * Checks whether a specified application is enabled. 1033 * 1034 * @param { string } bundleName - Indicates the bundle name of the application. 1035 * @returns { Promise<boolean> } Returns true if the application is enabled; returns false otherwise. 1036 * @syscap SystemCapability.BundleManager.BundleFramework 1037 * @since 8 1038 * @deprecated since 9 1039 */ 1040 function isApplicationEnabled(bundleName: string): Promise<boolean>; 1041} 1042 1043export default bundle; 1044