1# @ohos.bundle (Bundle) 2 3The **bundle** module provides APIs for obtaining information about an application, including [bundle information](js-apis-bundle-BundleInfo.md), [application information](js-apis-bundle-ApplicationInfo.md), and [ability information](js-apis-bundle-AbilityInfo.md). It also provides APIs to obtain and set the application disabling state. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8## Modules to Import 9 10```ts 11import bundle from '@ohos.bundle'; 12``` 13 14## Required Permissions 15 16| Required Permissions | Permission Level | Description | 17|--------------------------------------------|--------------|---------------| 18| ohos.permission.GET_BUNDLE_INFO | normal | Permission to query information about a specified bundle.| 19| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED| system_basic | Permission to query information about all bundles. | 20| ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall bundles. | 21| ohos.permission.MANAGE_DISPOSED_APP_STATUS | system_core | Permission to set and query the application disposal status. | 22 23For details, see [Permission Levels](../../security/accesstoken-overview.md#permission-levels). 24 25## bundle.getApplicationInfo<sup>deprecated<sup> 26 27> This API is deprecated since API version 9. You are advised to use [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo) instead. 28 29getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number): Promise\<ApplicationInfo> 30 31Obtains the application information based on a given bundle name. This API uses a promise to return the result. 32 33No permission is required for obtaining the caller's own information. 34 35**Required permissions** 36 37ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 38 39**System capability** 40 41SystemCapability.BundleManager.BundleFramework 42 43**Parameters** 44 45| Name | Type | Mandatory| Description | 46| ----------- | ------ | ---- | ------------------------------------------------------------ | 47| bundleName | string | Yes | Bundle name. | 48| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the application information flags in [BundleFlag](#bundleflagdeprecated).| 49| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. | 50 51**Return value** 52 53| Type | Description | 54| ------------------------- | ------------------ | 55| Promise\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Promise used to return the application information.| 56 57**Example** 58 59```ts 60let bundleName = "com.example.myapplication"; 61let bundleFlags = 0; 62let userId = 100; 63bundle.getApplicationInfo(bundleName, bundleFlags, userId) 64.then((data) => { 65 console.info('Operation successful. Data: ' + JSON.stringify(data)); 66}).catch((error) => { 67 console.error('Operation failed. Cause: ' + JSON.stringify(error)); 68}) 69``` 70 71## bundle.getApplicationInfo<sup>deprecated<sup> 72 73> This API is deprecated since API version 9. You are advised to use [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo) instead. 74 75getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback\<ApplicationInfo>): void 76 77Obtains the application information of the specified user based on a given bundle name. This API uses an asynchronous callback to return the result. 78 79No permission is required for obtaining the caller's own information. 80 81**Required permissions** 82 83ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 84 85**System capability** 86 87SystemCapability.BundleManager.BundleFramework 88 89**Parameters** 90 91| Name | Type | Mandatory| Description | 92| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 93| bundleName | string | Yes | Bundle name. | 94| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the application information flags in [BundleFlag](#bundleflagdeprecated).| 95| userId | number | Yes | User ID. The value must be greater than or equal to 0. | 96| callback | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes | Callback used to return the application information. | 97 98**Example** 99 100```ts 101let bundleName = "com.example.myapplication"; 102let bundleFlags = 0; 103let userId = 100; 104bundle.getApplicationInfo(bundleName, bundleFlags, userId, (err, data) => { 105 if (err) { 106 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 107 return; 108 } 109 console.info('Operation successful. Data:' + JSON.stringify(data)); 110 }) 111``` 112 113## bundle.getApplicationInfo<sup>deprecated<sup> 114 115> This API is deprecated since API version 9. You are advised to use [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo) instead. 116 117 118getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<ApplicationInfo>): void 119 120Obtains the application information based on a given bundle name. This API uses an asynchronous callback to return the result. 121 122No permission is required for obtaining the caller's own information. 123 124**Required permissions** 125 126ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 127 128**System capability** 129 130SystemCapability.BundleManager.BundleFramework 131 132**Parameters** 133 134| Name | Type | Mandatory| Description | 135| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 136| bundleName | string | Yes | Bundle name. | 137| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the application information flags in [BundleFlag](#bundleflagdeprecated).| 138| callback | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes | Callback used to return the application information. | 139 140**Example** 141 142```ts 143let bundleName = "com.example.myapplication"; 144let bundleFlags = 0; 145bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => { 146 if (err) { 147 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 148 return; 149 } 150 console.info('Operation successful. Data:' + JSON.stringify(data)); 151 }) 152``` 153 154 155## bundle.getAllBundleInfo<sup>deprecated<sup> 156 157> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead. 158 159getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise\<Array\<BundleInfo\>\> 160 161Obtains the information of all bundles of the specified user. This API uses a promise to return the result. 162 163**Required permissions** 164 165ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 166 167**System capability** 168 169SystemCapability.BundleManager.BundleFramework 170 171**Parameters** 172 173| Name | Type | Mandatory| Description | 174| ---------- | ---------- | ---- | ------------------------------------------------------------ | 175| bundleFlag | BundleFlag | Yes | Type of information that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 176| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. | 177 178**Return value** 179 180| Type | Description | 181| --------------------------- | -------------------------- | 182| Promise<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Promise used to return the information of all bundles.| 183 184**Example** 185 186```ts 187let bundleFlag = 0; 188let userId = 100; 189bundle.getAllBundleInfo(bundleFlag, userId) 190.then((data) => { 191 console.info('Operation successful. Data: ' + JSON.stringify(data)); 192}).catch((error) => { 193 console.error('Operation failed. Cause: ' + JSON.stringify(error)); 194}) 195``` 196 197## bundle.getAllBundleInfo<sup>deprecated<sup> 198 199> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead. 200 201 202getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback\<Array\<BundleInfo\>\>): void 203 204Obtains the information of all bundles of the current user. This API uses an asynchronous callback to return the result. 205 206**Required permissions** 207 208ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 209 210**System capability** 211 212SystemCapability.BundleManager.BundleFramework 213 214**Parameters** 215 216| Name | Type | Mandatory| Description | 217| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 218| bundleFlag | BundleFlag | Yes | Type of information that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 219| callback | AsyncCallback<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes | Callback used to return the information of all bundles. | 220 221**Example** 222 223```ts 224let bundleFlag = 0; 225bundle.getAllBundleInfo(bundleFlag, (err, data) => { 226 if (err) { 227 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 228 return; 229 } 230 console.info('Operation successful. Data:' + JSON.stringify(data)); 231 }) 232``` 233 234## bundle.getAllBundleInfo<sup>deprecated<sup> 235 236> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead. 237 238 239getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback\<Array\<BundleInfo\>\>): void 240 241Obtains the information of all bundles of the specified user. This API uses an asynchronous callback to return the result. 242 243**Required permissions** 244 245ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 246 247**System capability** 248 249SystemCapability.BundleManager.BundleFramework 250 251**Parameters** 252 253| Name | Type | Mandatory | Description | 254|------------|-------------------------------------------------------------------|-----|---------------------------------------------------------------------| 255| bundleFlag | BundleFlag | Yes | Type of information that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 256| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. | 257| callback | AsyncCallback<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes | Callback used to return the information of all bundles. | 258| 259 260**Example** 261 262```ts 263let bundleFlag = 0; 264let userId = 100; 265bundle.getAllBundleInfo(bundleFlag, userId, (err, data) => { 266 if (err) { 267 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 268 return; 269 } 270 console.info('Operation successful. Data:' + JSON.stringify(data)); 271 }) 272``` 273 274## bundle.getBundleInfo<sup>deprecated<sup> 275 276> This API is deprecated since API version 9. You are advised to use [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo) instead. 277 278 279getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise\<BundleInfo> 280 281Obtains the bundle information based on a given bundle name. This API uses a promise to return the result. 282 283No permission is required for obtaining the caller's own information. 284 285**Required permissions** 286 287ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 288 289**System capability** 290 291SystemCapability.BundleManager.BundleFramework 292 293**Parameters** 294 295| Name | Type | Mandatory | Description | 296| ----------- | ------------- | ---- |---------------------------------------------------------------------| 297| bundleName | string | Yes | Bundle name. | 298| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 299| options | [BundleOptions](#bundleoptionsdeprecated) | No | Options that contain the user ID. | 300 301**Return value** 302 303| Type | Description | 304| -------------------- | ---------------------------- | 305| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the bundle information.| 306 307**Example** 308 309```ts 310let bundleName = "com.example.myapplication"; 311let bundleFlags = 1; 312let options = { 313 "userId" : 100 314}; 315bundle.getBundleInfo(bundleName, bundleFlags, options) 316.then((data) => { 317 console.info('Operation successful. Data: ' + JSON.stringify(data)); 318}).catch((error) => { 319 console.error('Operation failed. Cause: ' + JSON.stringify(error)); 320}) 321``` 322 323## bundle.getBundleInfo<sup>deprecated<sup> 324 325> This API is deprecated since API version 9. You are advised to use [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo) instead. 326 327getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>): void 328 329Obtains the bundle information based on a given bundle name. This API uses an asynchronous callback to return the result. 330 331No permission is required for obtaining the caller's own information. 332 333**Required permissions** 334 335ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 336 337**System capability** 338 339SystemCapability.BundleManager.BundleFramework 340 341**Parameters** 342 343| Name | Type | Mandatory| Description | 344| ----------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ | 345| bundleName | string | Yes | Bundle name. | 346| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 347| callback | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the bundle information. | 348 349**Example** 350 351```ts 352let bundleName = "com.example.myapplication"; 353let bundleFlags = 1; 354bundle.getBundleInfo(bundleName, bundleFlags, (err, data) => { 355 if (err) { 356 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 357 return; 358 } 359 console.info('Operation successful. Data:' + JSON.stringify(data)); 360}) 361``` 362 363 364## bundle.getBundleInfo<sup>deprecated<sup> 365 366> This API is deprecated since API version 9. You are advised to use [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo) instead. 367 368getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback\<BundleInfo>): void 369 370Obtains the bundle information based on a given bundle name and bundle options. This API uses an asynchronous callback to return the result. 371 372No permission is required for obtaining the caller's own information. 373 374**Required permissions** 375 376ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 377 378**System capability** 379 380SystemCapability.BundleManager.BundleFramework 381 382**Parameters** 383 384| Name | Type | Mandatory| Description | 385| ----------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ | 386| bundleName | string | Yes | Bundle name. | 387| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 388| options | [BundleOptions](#bundleoptionsdeprecated) | Yes | Includes **userId**. | 389| callback | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the bundle information. | 390 391**Example** 392 393```ts 394let bundleName = "com.example.myapplication"; 395let bundleFlags = 1; 396let options = { 397 "userId" : 100 398}; 399bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => { 400 if (err) { 401 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 402 return; 403 } 404 console.info('Operation successful. Data:' + JSON.stringify(data)); 405}) 406``` 407 408 409 410## bundle.getBundleInstaller<sup>deprecated<sup> 411 412> This API is deprecated since API version 9. You are advised to use [installer.getBundleInstaller](js-apis-installer.md#bundleinstallergetbundleinstaller) instead. 413 414getBundleInstaller(): Promise<BundleInstaller>; 415 416Obtains the installation package. This API uses a promise to return the result. 417 418**Required permissions** 419 420ohos.permission.INSTALL_BUNDLE 421 422**System capability** 423 424SystemCapability.BundleManager.BundleFramework 425 426**System API** 427 428This is a system API and cannot be called by third-party applications. 429 430**Return value** 431 432| Type | Description | 433| ------------------------------------------------------------ | -------------------------------------------- | 434| Promise<[BundleInstaller](js-apis-bundle-BundleInstaller.md)> | Promise used to return the installation package.| 435 436**Example** 437 438```ts 439bundle.getBundleInstaller().then((data) => { 440 console.info('getBundleInstaller successfully.'); 441}).catch((error) => { 442 console.error('getBundleInstaller failed.'); 443}); 444``` 445 446## bundle.getBundleInstaller<sup>deprecated<sup> 447 448> This API is deprecated since API version 9. You are advised to use [installer.getBundleInstaller](js-apis-installer.md#bundleinstallergetbundleinstaller) instead. 449 450getBundleInstaller(callback: AsyncCallback<BundleInstaller>): void; 451 452Obtains the installation package. This API uses an asynchronous callback to return the result. 453 454**Required permissions** 455 456ohos.permission.INSTALL_BUNDLE 457 458**System capability** 459 460SystemCapability.BundleManager.BundleFramework 461 462**System API** 463 464This is a system API and cannot be called by third-party applications. 465 466**Parameters** 467 468| Name | Type | Mandatory| Description | 469| -------- | ------------------------------------------------------------ | ---- | ---------------- | 470| callback | AsyncCallback<[BundleInstaller](js-apis-bundle-BundleInstaller.md)> | Yes | Callback used to return the installation package.| 471 472**Example** 473 474```ts 475bundle.getBundleInstaller((err, data) => { 476 if (err.code == 0) { 477 console.error('getBundleInstaller failed.'); 478 } else { 479 console.info('getBundleInstaller successfully'); 480 } 481}); 482``` 483## bundle.cleanBundleCacheFiles<sup>8+</sup> <sup>deprecated<sup> 484 485> This API is deprecated since API version 9. You are advised to use [bundleManager.cleanBundleCacheFiles](js-apis-bundleManager.md#bundlemanagercleanbundlecachefiles) instead. 486 487cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback<void>): void; 488 489Clears the cache data of an application. This API uses an asynchronous callback to return the result. 490 491**Required permissions** 492 493ohos.permission.REMOVE_CACHE_FILES 494 495**System capability** 496 497SystemCapability.BundleManager.BundleFramework 498 499**System API** 500 501This is a system API and cannot be called by third-party applications. 502 503**Parameters** 504 505| Name | Type | Mandatory| Description | 506| ---------- | ------------------- | ---- | ------------------------------------- | 507| bundleName | string | Yes | Bundle name.| 508| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | 509 510**Example** 511 512```ts 513let bundleName = "com.example.myapplication"; 514 515bundle.cleanBundleCacheFiles(bundleName, err => { 516 if (err) { 517 console.error('cleanBundleCacheFiles failed.'); 518 } else { 519 console.info('cleanBundleCacheFiles successfully.'); 520 } 521}); 522``` 523 524## bundle.cleanBundleCacheFiles<sup>8+</sup> <sup>deprecated<sup> 525 526> This API is deprecated since API version 9. You are advised to use [bundleManager.cleanBundleCacheFiles](js-apis-bundleManager.md#bundlemanagercleanbundlecachefiles) instead. 527 528cleanBundleCacheFiles(bundleName: string): Promise<void> 529 530Clears the cache data of an application. This API uses a promise to return the result. 531 532**Required permissions** 533 534ohos.permission.REMOVE_CACHE_FILES 535 536**System capability** 537 538SystemCapability.BundleManager.BundleFramework 539 540**System API** 541 542This is a system API and cannot be called by third-party applications. 543 544**Parameters** 545 546| Name | Type | Mandatory| Description | 547| ---------- | ------ | ---- | ------------------------------------- | 548| bundleName | string | Yes | Bundle name.| 549 550**Return value** 551 552| Type | Description | 553| ------------- | ------------------------------------ | 554| Promise\<void> | Promise that returns no value.| 555 556**Example** 557 558```ts 559let bundleName = "com.example.myapplication"; 560 561bundle.cleanBundleCacheFiles(bundleName).then(()=> { 562 console.info('cleanBundleCacheFiles successfully.'); 563}).catch(err=> { 564 console.error('cleanBundleCacheFiles failed.'); 565}); 566``` 567 568## bundle.setApplicationEnabled<sup>8+</sup> <sup>deprecated<sup> 569 570> This API is deprecated since API version 9. You are advised to use [bundleManager.setApplicationEnabled](js-apis-bundleManager.md#bundlemanagersetapplicationenabled) instead. 571 572setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback<void>): void; 573 574Sets whether to enable an application. This API uses an asynchronous callback to return the result. 575 576**Required permissions** 577 578ohos.permission.CHANGE_ABILITY_ENABLED_STATE 579 580**System capability** 581 582SystemCapability.BundleManager.BundleFramework 583 584**System API** 585 586This is a system API and cannot be called by third-party applications. 587 588**Parameters** 589 590| Name | Type | Mandatory| Description | 591| ---------- | ------------------- | ---- |--------------------------------| 592| bundleName | string | Yes | Bundle name. | 593| isEnable | boolean | Yes | Whether to enable the application. The value **true** means to enable the application, and **false** means the opposite.| 594| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | 595 596**Example** 597 598```ts 599let bundleName = "com.example.myapplication"; 600 601bundle.setApplicationEnabled(bundleName, false, err => { 602 if (err) { 603 console.error('setApplicationEnabled failed.'); 604 } else { 605 console.info('setApplicationEnabled successfully.'); 606 } 607}); 608``` 609 610## bundle.setApplicationEnabled<sup>8+</sup> <sup>deprecated<sup> 611 612> This API is deprecated since API version 9. You are advised to use [bundleManager.setApplicationEnabled](js-apis-bundleManager.md#bundlemanagersetapplicationenabled) instead. 613 614setApplicationEnabled(bundleName: string, isEnable: boolean): Promise<void> 615 616Sets whether to enable an application. This API uses a promise to return the result. 617 618**Required permissions** 619 620ohos.permission.CHANGE_ABILITY_ENABLED_STATE 621 622**System capability** 623 624SystemCapability.BundleManager.BundleFramework 625 626**System API** 627 628This is a system API and cannot be called by third-party applications. 629 630**Parameters** 631 632| Name | Type | Mandatory| Description | 633| ---------- | ------- | ---- | ----------------------------------------------- | 634| bundleName | string | Yes | Bundle name. | 635| isEnable | boolean | Yes | Whether to enable the application. The value **true** means to enable the application, and **false** means the opposite.| 636 637**Return value** 638 639| Type | Description | 640| ------------- | ------------------------------------ | 641| Promise\<void> | Promise that returns no value.| 642 643**Example** 644 645```ts 646let bundleName = "com.example.myapplication"; 647 648bundleManager.setApplicationEnabled(bundleName, false).then(()=> { 649 console.info('setApplicationEnabled successfully.'); 650}).catch(err=> { 651 console.error('setApplicationEnabled failed.'); 652}); 653``` 654 655## bundle.setAbilityEnabled<sup>8+</sup> <sup>deprecated<sup> 656 657> This API is deprecated since API version 9. You are advised to use [bundleManager.setAbilityEnabled](js-apis-bundleManager.md#bundlemanagersetabilityenabled) instead. 658 659setAbilityEnabled(info: AbilityInfo, isEnable: boolean, callback: AsyncCallback<void>): void; 660 661Sets whether to enable an ability. This API uses an asynchronous callback to return the result. 662 663**Required permissions** 664 665ohos.permission.CHANGE_ABILITY_ENABLED_STATE 666 667**System capability** 668 669SystemCapability.BundleManager.BundleFramework 670 671**System API** 672 673This is a system API and cannot be called by third-party applications. 674 675**Parameters** 676 677| Name | Type | Mandatory| Description | 678| -------- | -------------------------------------------- | ---- | ----------------------------------------------- | 679| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes | Ability information. | 680| isEnable | boolean | Yes | Whether to enable the application. The value **true** means to enable the application, and **false** means the opposite.| 681| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | 682 683## bundle.setAbilityEnabled<sup>8+</sup> <sup>deprecated<sup> 684 685> This API is deprecated since API version 9. You are advised to use [bundleManager.setAbilityEnabled](js-apis-bundleManager.md#bundlemanagersetabilityenabled) instead. 686 687setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise<void> 688 689Sets whether to enable an ability. This API uses a promise to return the result. 690 691**Required permissions** 692 693ohos.permission.CHANGE_ABILITY_ENABLED_STATE 694 695**System capability** 696 697SystemCapability.BundleManager.BundleFramework 698 699**System API** 700 701This is a system API and cannot be called by third-party applications. 702 703**Parameters** 704 705| Name | Type | Mandatory| Description | 706| -------- | -------------------------------------------- | ---- | ----------------------------------------------- | 707| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes | Ability information. | 708| isEnable | boolean | Yes | Whether to enable the application. The value **true** means to enable the application, and **false** means the opposite.| 709 710**Return value** 711 712| Type | Description | 713| ------------- | ------------------------------------ | 714| Promise\<void> | Promise that returns no value.| 715 716**Example** 717 718```ts 719let flag = bundle.BundleFlag.GET_ABILITY_INFO_WITH_PERMISSION; 720let userId = 100; 721let want = { 722 bundleName : "com.example.myapplication", 723 abilityName : "com.example.myapplication.MainAbility" 724}; 725 726bundle.getAbilityInfo(want, flag, userId).then((abilityInfo) => { 727 console.info('getAbilityInfo successfully. Data: ' + JSON.stringify(abilityInfo)); 728 729 bundle.setAbilityEnabled(abilityInfo, false).then(data => { 730 console.info('setAbilityEnabled successfully.'); 731 }).catch(err => { 732 console.error('setAbilityEnabled failed:' + JSON.stringify(err)); 733 }) 734}).catch(error => { 735 console.error('getAbilityInfo failed. Cause: ' + JSON.stringify(error)); 736}); 737``` 738## bundle.getPermissionDef<sup>8+</sup> <sup>deprecated<sup> 739 740> This API is deprecated since API version 9. You are advised to use [bundleManager.getPermissionDef](js-apis-bundleManager.md#bundlemanagergetpermissiondef) instead. 741 742getPermissionDef(permissionName: string, callback: AsyncCallback<PermissionDef>): void; 743 744Obtains the permission details by permission name. This API uses an asynchronous callback to return the result. 745 746**Required permissions** 747 748ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 749 750**System capability** 751 752SystemCapability.BundleManager.BundleFramework 753 754**System API** 755 756This is a system API and cannot be called by third-party applications. 757 758**Parameters** 759 760| Name | Type | Mandatory| Description | 761| -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------ | 762| permissionName | string | Yes | Name of the permission. | 763| callback | AsyncCallback<[PermissionDef](js-apis-bundle-PermissionDef.md)> | Yes | Callback used to return the permission details.| 764 765**Example** 766 767```ts 768let permission = "ohos.permission.GET_BUNDLE_INFO"; 769bundleManager.getPermissionDef(permission, (err, data) => { 770 if (err) { 771 console.error('getPermissionDef failed:' + err.message); 772 } else { 773 console.info('getPermissionDef successfully:' + JSON.stringify(data)); 774 } 775}); 776``` 777 778## bundle.getPermissionDef<sup>8+</sup> <sup>deprecated<sup> 779 780> This API is deprecated since API version 9. You are advised to use [bundleManager.getPermissionDef](js-apis-bundleManager.md#bundlemanagergetpermissiondef) instead. 781 782getPermissionDef(permissionName: string): Promise<PermissionDef> 783 784Obtains the permission details by permission name. This API uses a promise to return the result. 785 786**Required permissions** 787 788ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 789 790**System capability** 791 792SystemCapability.BundleManager.BundleFramework 793 794**System API** 795 796This is a system API and cannot be called by third-party applications. 797 798**Parameters** 799 800| Name | Type | Mandatory| Description | 801| -------------- | ------ | ---- | ---------------- | 802| permissionName | string | Yes | Name of the permission.| 803 804**Return value** 805 806| Type | Description | 807| ------------------------------------------------------ | ------------------------------------------------------ | 808| Promise<[PermissionDef](js-apis-bundle-PermissionDef.md)> | Promise used to return the permission details.| 809 810**Example** 811 812```ts 813let permissionName = "ohos.permission.GET_BUNDLE_INFO"; 814bundle.getPermissionDef(permissionName).then((data) => { 815 console.info('getPermissionDef successfully. Data: ' + JSON.stringify(data)); 816}).catch(error => { 817 console.error('getPermissionDef failed. Cause: ' + error.message); 818}); 819``` 820 821## bundle.getAllApplicationInfo<sup>deprecated<sup> 822 823> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo) instead. 824 825getAllApplicationInfo(bundleFlags: number, userId?: number): Promise\<Array\<ApplicationInfo\>\> 826 827Obtains the information about all applications of the specified user. This API uses a promise to return the result. 828 829**Required permissions** 830 831ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 832 833**System capability** 834 835SystemCapability.BundleManager.BundleFramework 836 837**Parameters** 838 839| Name | Type | Mandatory| Description | 840| ----------- | ------ | ---- | ------------------------------------------------------------ | 841| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the application information flags in [BundleFlag](#bundleflagdeprecated).| 842| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. | 843 844**Return value** 845 846| Type | Description | 847| -------------------------------- | ------------------------------- | 848| Promise<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Promise used to return the application information.| 849 850**Example** 851 852```ts 853let bundleFlags = 8; 854let userId = 100; 855bundle.getAllApplicationInfo(bundleFlags, userId) 856.then((data) => { 857 console.info('Operation successful. Data: ' + JSON.stringify(data)); 858}).catch((error) => { 859 console.error('Operation failed. Cause: ' + JSON.stringify(error)); 860}) 861``` 862 863## bundle.getAllApplicationInfo<sup>deprecated<sup> 864 865> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo) instead. 866 867getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<ApplicationInfo\>\>): void 868 869Obtains the information about all applications. This API uses an asynchronous callback to return the result. 870 871**Required permissions** 872 873ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 874 875**System capability** 876 877SystemCapability.BundleManager.BundleFramework 878 879**Parameters** 880 881| Name | Type | Mandatory| Description | 882| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 883| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the application information flags in [BundleFlag](#bundleflagdeprecated).| 884| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. | 885| callback | AsyncCallback<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Yes | Callback used to return the application information. | 886 887**Example** 888 889```ts 890let bundleFlags = bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION; 891let userId = 100; 892bundle.getAllApplicationInfo(bundleFlags, userId, (err, data) => { 893 if (err) { 894 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 895 return; 896 } 897 console.info('Operation successful. Data:' + JSON.stringify(data)); 898}) 899``` 900 901 902## bundle.getAllApplicationInfo<sup>deprecated<sup> 903 904> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo) instead. 905 906getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback<Array\<ApplicationInfo>>) : void; 907 908Obtains the information about all applications of the current user. This API uses an asynchronous callback to return the result. 909 910**Required permissions** 911 912ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 913 914**System capability** 915 916SystemCapability.BundleManager.BundleFramework 917 918**Parameters** 919 920| Name | Type | Mandatory| Description | 921| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 922| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the application information flags in [BundleFlag](#bundleflagdeprecated).| 923| callback | AsyncCallback<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Yes | Callback used to return the application information. | 924 925**Example** 926 927```ts 928let bundleFlags = bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION; 929bundle.getAllApplicationInfo(bundleFlags, (err, data) => { 930 if (err) { 931 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 932 return; 933 } 934 console.info('Operation successful. Data:' + JSON.stringify(data)); 935}) 936``` 937 938## bundle.getBundleArchiveInfo<sup>deprecated<sup> 939 940> This API is deprecated since API version 9. You are advised to use [bundleManager.getBundleArchiveInfo](js-apis-bundleManager.md#bundlemanagergetbundlearchiveinfo) instead. 941 942getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise\<BundleInfo> 943 944Obtains information about the bundles contained in a HAP file. This API uses a promise to return the result. 945 946**System capability** 947 948SystemCapability.BundleManager.BundleFramework 949 950**Parameters** 951 952| Name | Type | Mandatory | Description | 953| ---------- | ------ | ---- | ------------ | 954| hapFilePath | string | Yes | Path where the HAP file is stored. The absolute path of the application and the data directory sandbox path are supported.| 955| bundleFlags | number | Yes | Flags used to specify information contained in the **BundleInfo** object that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 956 957**Return value** 958| Type | Description | 959| ---------------------------------------------------- | ------------------------------------------------------------ | 960| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the information about the bundles.| 961 962**Example** 963 964```ts 965let hapFilePath = "/data/storage/el2/base/test.hap"; 966let bundleFlags = 0; 967bundle.getBundleArchiveInfo(hapFilePath, bundleFlags) 968.then((data) => { 969 console.info('Operation successful. Data: ' + JSON.stringify(data)); 970}).catch((error) => { 971 console.error('Operation failed. Cause: ' + JSON.stringify(error)); 972}) 973``` 974 975## bundle.getBundleArchiveInfo<sup>deprecated<sup> 976 977> This API is deprecated since API version 9. You are advised to use [bundleManager.getBundleArchiveInfo](js-apis-bundleManager.md#bundlemanagergetbundlearchiveinfo) instead. 978 979getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>) : void 980 981Obtains information about the bundles contained in a HAP file. This API uses an asynchronous callback to return the result. 982 983**System capability** 984 985SystemCapability.BundleManager.BundleFramework 986 987**Parameters** 988 989| Name | Type | Mandatory | Description | 990| ---------- | ------ | ---- | ------------ | 991| hapFilePath | string | Yes | Path where the HAP file is stored.. The absolute path of the application and the data directory sandbox path are supported.| 992| bundleFlags | number | Yes | Flags used to specify information contained in the **BundleInfo** object that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 993| callback| AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the information about the bundles.| 994 995**Example** 996 997```ts 998let hapFilePath = "/data/storage/el2/base/test.hap"; 999let bundleFlags = 0; 1000bundle.getBundleArchiveInfo(hapFilePath, bundleFlags, (err, data) => { 1001 if (err) { 1002 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1003 return; 1004 } 1005 console.info('Operation successful. Data:' + JSON.stringify(data)); 1006}) 1007``` 1008 1009 1010## bundle.getAbilityInfo<sup>deprecated<sup> 1011 1012> This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead. 1013 1014getAbilityInfo(bundleName: string, abilityName: string): Promise\<AbilityInfo> 1015 1016Obtains the ability information based on a given bundle name and ability name. This API uses a promise to return the result. 1017 1018No permission is required for obtaining the caller's own information. 1019 1020**Required permissions** 1021 1022ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1023 1024**System capability** 1025 1026SystemCapability.BundleManager.BundleFramework 1027 1028**Parameters** 1029 1030| Name | Type | Mandatory | Description | 1031| ----------- | ------ | ---- |------------| 1032| bundleName | string | Yes | Bundle name.| 1033| abilityName | string | Yes | Ability name.| 1034 1035**Return value** 1036 1037| Type | Description | 1038| --------------------- | --------------------- | 1039| Promise\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Promise used to return the ability information.| 1040 1041**Example** 1042 1043```ts 1044let bundleName = "com.example.myapplication"; 1045let abilityName = "com.example.myapplication.MainAbility"; 1046bundle.getAbilityInfo(bundleName, abilityName) 1047.then((data) => { 1048 console.info('Operation successful. Data: ' + JSON.stringify(data)); 1049}).catch((error) => { 1050 console.error('Operation failed. Cause: ' + JSON.stringify(error)); 1051}) 1052``` 1053 1054## bundle.getAbilityInfo<sup>deprecated<sup> 1055 1056> This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead. 1057 1058getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback\<AbilityInfo>): void; 1059 1060Obtains the ability information based on a given bundle name and ability name. This API uses an asynchronous callback to return the result. 1061 1062No permission is required for obtaining the caller's own information. 1063 1064**Required permissions** 1065 1066ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1067 1068**System capability** 1069 1070SystemCapability.BundleManager.BundleFramework 1071 1072**Parameters** 1073 1074| Name | Type | Mandatory | Description | 1075| ----------- | ------------ | ---- |----------------------------| 1076| bundleName | string | Yes | Bundle name. | 1077| abilityName | string | Yes | Ability name. | 1078| callback | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | Callback used to return the ability information.| 1079 1080**Example** 1081 1082```ts 1083let bundleName = "com.example.myapplication"; 1084let abilityName = "com.example.myapplication.MainAbility"; 1085bundle.getAbilityInfo(bundleName, abilityName, (err, data) => { 1086 if (err) { 1087 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1088 return; 1089 } 1090 console.info('Operation successful. Data:' + JSON.stringify(data)); 1091}) 1092``` 1093 1094## bundle.getAbilityLabel<sup>8+</sup> <sup>deprecated<sup> 1095 1096> This API is deprecated since API version 9. You are advised to use [bundleManager.getAbilityLabel](js-apis-bundleManager.md#bundlemanagergetabilitylabel) instead. 1097 1098getAbilityLabel(bundleName: string, abilityName: string): Promise\<string> 1099 1100Obtains the application name based on a given bundle name and ability name. This API uses a promise to return the result. 1101 1102No permission is required for obtaining the caller's own information. 1103 1104**Required permissions** 1105 1106ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1107 1108**System capability** 1109 1110SystemCapability.BundleManager.BundleFramework 1111 1112**Parameters** 1113 1114| Name | Type | Mandatory| Description | 1115| ----------- | ------ | ---- | ---------------- | 1116| bundleName | string | Yes | Bundle name.| 1117| abilityName | string | Yes | Ability name. | 1118 1119**Return value** 1120 1121| Type | Description | 1122| ---------------- | ------------------ | 1123| Promise\<string> | Promise used to return the application name.| 1124 1125**Example** 1126 1127```ts 1128let bundleName = "com.example.myapplication"; 1129let abilityName = "com.example.myapplication.MainAbility"; 1130bundle.getAbilityLabel(bundleName, abilityName) 1131.then((data) => { 1132 console.info('Operation successful. Data: ' + JSON.stringify(data)); 1133}).catch((error) => { 1134 console.error('Operation failed. Cause: ' + JSON.stringify(error)); 1135}) 1136``` 1137 1138## bundle.getAbilityLabel<sup>8+</sup> <sup>deprecated<sup> 1139 1140> This API is deprecated since API version 9. You are advised to use [bundleManager.getAbilityLabel](js-apis-bundleManager.md#bundlemanagergetabilitylabel) instead. 1141 1142getAbilityLabel(bundleName: string, abilityName: string, callback : AsyncCallback\<string>): void 1143 1144Obtains the application name based on a given bundle name and ability name. This API uses an asynchronous callback to return the result. 1145 1146No permission is required for obtaining the caller's own information. 1147 1148**Required permissions** 1149 1150ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1151 1152**System capability** 1153 1154SystemCapability.BundleManager.BundleFramework 1155 1156**Parameters** 1157 1158| Name | Type | Mandatory| Description | 1159| ----------- | ---------------------- | ---- | ---------------------------------------------- | 1160| bundleName | string | Yes | Bundle name. | 1161| abilityName | string | Yes | Ability name. | 1162| callback | AsyncCallback\<string> | Yes | Callback used to return the application name.| 1163 1164**Example** 1165 1166```ts 1167let bundleName = "com.example.myapplication"; 1168let abilityName = "com.example.myapplication.MainAbility"; 1169bundle.getAbilityLabel(bundleName, abilityName, (err, data) => { 1170 if (err) { 1171 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1172 return; 1173 } 1174 console.info('Operation successful. Data:' + JSON.stringify(data)); 1175}) 1176``` 1177 1178## bundle.isAbilityEnabled<sup>8+</sup> <sup>deprecated<sup> 1179 1180> This API is deprecated since API version 9. You are advised to use [bundleManager.isAbilityEnabled](js-apis-bundleManager.md#bundlemanagerisabilityenabled) instead. 1181 1182isAbilityEnabled(info: AbilityInfo): Promise\<boolean> 1183 1184Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses a promise to return the result. 1185 1186**System capability** 1187 1188SystemCapability.BundleManager.BundleFramework 1189 1190**Parameters** 1191 1192| Name| Type | Mandatory| Description | 1193| ------ | -------------------------------------------- | ---- | ----------------- | 1194| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes | Ability information.| 1195 1196**Return value** 1197 1198| Type | Description | 1199| ----------------- | ------------------------- | 1200| Promise\<boolean> | Promise used to return the result. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.| 1201 1202**Example** 1203 1204```ts 1205let bundleName = "com.example.myapplication"; 1206let abilityName = "com.example.myapplication.MainAbility"; 1207bundle.getAbilityInfo(bundleName, abilityName).then((abilityInfo)=>{ 1208 bundle.isAbilityEnabled(abilityInfo).then((data) => { 1209 console.info('Operation successful. Data: ' + JSON.stringify(data)); 1210 }).catch((error) => { 1211 console.error('Operation failed. Cause: ' + JSON.stringify(error)); 1212 }) 1213}) 1214``` 1215 1216## bundle.isAbilityEnabled<sup>8+</sup> <sup>deprecated<sup> 1217 1218> This API is deprecated since API version 9. You are advised to use [bundleManager.isAbilityEnabled](js-apis-bundleManager.md#bundlemanagerisabilityenabled) instead. 1219 1220isAbilityEnabled(info : AbilityInfo, callback : AsyncCallback\<boolean>): void 1221 1222Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses an asynchronous callback to return the result. 1223 1224**System capability** 1225 1226SystemCapability.BundleManager.BundleFramework 1227 1228**Parameters** 1229 1230| Name | Type | Mandatory| Description | 1231| -------- | -------------------------------------------- | ---- | ----------------------- | 1232| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes | Ability information. | 1233| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.| 1234 1235**Example** 1236 1237```ts 1238let bundleName = "com.example.myapplication"; 1239let abilityName = "com.example.myapplication.MainAbility"; 1240bundle.getAbilityInfo(bundleName, abilityName).then((abilityInfo)=>{ 1241 bundle.isAbilityEnabled(abilityInfo, (err, data) => { 1242 if (err) { 1243 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1244 return; 1245 } 1246 console.info('Operation successful. Data:' + JSON.stringify(data)); 1247 }) 1248}) 1249``` 1250 1251## bundle.isApplicationEnabled<sup>8+</sup> <sup>deprecated<sup> 1252 1253> This API is deprecated since API version 9. You are advised to use [bundleManager.isApplicationEnabled](js-apis-bundleManager.md#bundlemanagerisapplicationenabled) instead. 1254 1255isApplicationEnabled(bundleName: string): Promise\<boolean> 1256 1257Checks whether an application is enabled based on a given bundle name. This API uses a promise to return the result. 1258 1259**System capability** 1260 1261SystemCapability.BundleManager.BundleFramework 1262 1263**Parameters** 1264 1265| Name | Type | Mandatory| Description | 1266| ---------- | ------ | ---- | ------------------------ | 1267| bundleName | string | Yes | Bundle name.| 1268 1269**Return value** 1270 1271| Type | Description | 1272| ----------------- | ------------------------- | 1273| Promise\<boolean> | Promise used to return the result. If the application is enabled, **true** will be returned; otherwise, **false** will be returned.| 1274 1275**Example** 1276 1277```ts 1278let bundleName = "com.example.myapplication"; 1279bundle.isApplicationEnabled(bundleName) 1280.then((data) => { 1281 console.info('Operation successful. Data: ' + JSON.stringify(data)); 1282}).catch((error) => { 1283 console.error('Operation failed. Cause: ' + JSON.stringify(error)); 1284}) 1285``` 1286 1287## bundle.isApplicationEnabled<sup>8+</sup> <sup>deprecated<sup> 1288 1289> This API is deprecated since API version 9. You are advised to use [bundleManager.isApplicationEnabled](js-apis-bundleManager.md#bundlemanagerisapplicationenabled) instead. 1290 1291isApplicationEnabled(bundleName: string, callback : AsyncCallback\<boolean>): void 1292 1293Checks whether an application is enabled based on a given bundle name. This API uses an asynchronous callback to return the result. 1294 1295**System capability** 1296 1297SystemCapability.BundleManager.BundleFramework 1298 1299**Parameters** 1300 1301| Name | Type | Mandatory| Description | 1302| ---------- | ----------------------- | ---- | ------------------------ | 1303| bundleName | string | Yes | Bundle name.| 1304| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. If the application is enabled, **true** will be returned; otherwise, **false** will be returned.| 1305 1306**Example** 1307 1308```ts 1309let bundleName = "com.example.myapplication"; 1310bundle.isApplicationEnabled(bundleName, (err, data) => { 1311 if (err) { 1312 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1313 return; 1314 } 1315 console.info('Operation successful. Data:' + JSON.stringify(data)); 1316}) 1317``` 1318 1319## bundle.queryAbilityByWant<sup>deprecated<sup> 1320 1321> This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead. 1322 1323queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise\<Array\<AbilityInfo\>\> 1324 1325Obtains the ability information based on given Want. This API uses a promise to return the result. 1326 1327No permission is required for obtaining the caller's own information. 1328 1329**Required permissions** 1330 1331ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1332 1333**System capability** 1334 1335SystemCapability.BundleManager.BundleFramework 1336 1337**Parameters** 1338 1339| Name | Type | Mandatory | Description | 1340| ----------- | ------ | ---- | ------------------------------------- | 1341| want | [Want](js-apis-application-want.md) | Yes | Want containing the bundle name | 1342| bundleFlags | number | Yes | Ability information to be returned. For details about the available enumerated values, see the ability information flags in [BundleFlag](#bundleflagdeprecated).| 1343| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. | 1344 1345**Return value** 1346 1347| Type | Description | 1348| ---------------------------- | --------------------- | 1349| Promise<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Promise used to return the ability information.| 1350 1351**Example** 1352 1353```ts 1354let bundleFlags = 0; 1355let userId = 100; 1356let want = { 1357 bundleName : "com.example.myapplication", 1358 abilityName : "com.example.myapplication.MainAbility" 1359}; 1360bundle.queryAbilityByWant(want, bundleFlags, userId) 1361.then((data) => { 1362 console.info('Operation successful. Data: ' + JSON.stringify(data)); 1363}).catch((error) => { 1364 console.error('Operation failed. Cause: ' + JSON.stringify(error)); 1365}) 1366``` 1367 1368 1369 1370## bundle.queryAbilityByWant<sup>deprecated<sup> 1371 1372> This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead. 1373 1374queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<AbilityInfo\>\>): void 1375 1376Obtains the ability information of the specified user based on given Want. This API uses an asynchronous callback to return the result. 1377 1378No permission is required for obtaining the caller's own information. 1379 1380**Required permissions** 1381 1382ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1383 1384**System capability** 1385 1386SystemCapability.BundleManager.BundleFramework 1387 1388**Parameters** 1389 1390| Name | Type | Mandatory| Description | 1391| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 1392| want | [Want](js-apis-application-want.md) | Yes | Want containing the bundle name. | 1393| bundleFlags | number | Yes | Ability information to be returned. For details about the available enumerated values, see the ability information flags in [BundleFlag](#bundleflagdeprecated).| 1394| userId | number | Yes | User ID. The value must be greater than or equal to 0. | 1395| callback | AsyncCallback<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Yes | Callback used to return the ability information. | 1396 1397**Example** 1398 1399```ts 1400let bundleFlags = 0; 1401let userId = 100; 1402let want = { 1403 bundleName : "com.example.myapplication", 1404 abilityName : "com.example.myapplication.MainAbility" 1405}; 1406bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => { 1407 if (err) { 1408 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1409 return; 1410 } 1411 console.info('Operation successful. Data:' + JSON.stringify(data)); 1412}) 1413``` 1414 1415## bundle.queryAbilityByWant<sup>deprecated<sup> 1416 1417> This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead. 1418 1419queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback\<Array\<AbilityInfo\>\>): void; 1420 1421Obtains the ability information based on given Want. This API uses an asynchronous callback to return the result. 1422 1423No permission is required for obtaining the caller's own information. 1424 1425**Required permissions** 1426 1427ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1428 1429**System capability** 1430 1431SystemCapability.BundleManager.BundleFramework 1432 1433**Parameters** 1434 1435| Name | Type | Mandatory| Description | 1436| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 1437| want | [Want](js-apis-application-want.md) | Yes | Want containing the bundle name. | 1438| bundleFlags | number | Yes | Ability information to be returned. For details about the available enumerated values, see the ability information flags in [BundleFlag](#bundleflagdeprecated).| 1439| callback | AsyncCallback<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Yes | Callback used to return the ability information. | 1440 1441**Example** 1442 1443```ts 1444let bundleFlags = 0; 1445let want = { 1446 bundleName : "com.example.myapplication", 1447 abilityName : "com.example.myapplication.MainAbility" 1448}; 1449bundle.queryAbilityByWant(want, bundleFlags, (err, data) => { 1450 if (err) { 1451 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1452 return; 1453 } 1454 console.info('Operation successful. Data:' + JSON.stringify(data)); 1455}) 1456``` 1457 1458 1459 1460## bundle.getLaunchWantForBundle<sup>deprecated<sup> 1461 1462> This API is deprecated since API version 9. You are advised to use [bundleManager.getLaunchWantForBundle](js-apis-bundleManager.md#bundlemanagergetlaunchwantforbundle) instead. 1463 1464getLaunchWantForBundle(bundleName: string): Promise\<Want> 1465 1466Obtains the **Want** object that launches the specified application. This API uses a promise to return the result. 1467 1468**Required permissions** 1469 1470ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1471 1472**System capability** 1473 1474SystemCapability.BundleManager.BundleFramework 1475 1476**Parameters** 1477 1478| Name | Type | Mandatory| Description | 1479| ---------- | ------ | ---- | ------------------------ | 1480| bundleName | string | Yes | Bundle name.| 1481 1482**Return value** 1483| Type | Description | 1484| -------------- | -------------------------------------- | 1485| Promise\<[Want](js-apis-application-want.md)> | Promise used to return the **Want** object.| 1486 1487**Example** 1488 1489```ts 1490let bundleName = "com.example.myapplication"; 1491bundle.getLaunchWantForBundle(bundleName) 1492.then((data) => { 1493 console.info('Operation successful. Data: ' + JSON.stringify(data)); 1494}).catch((error) => { 1495 console.error('Operation failed. Cause: ' + JSON.stringify(error)); 1496}) 1497``` 1498 1499## bundle.getLaunchWantForBundle<sup>deprecated<sup> 1500 1501> This API is deprecated since API version 9. You are advised to use [bundleManager.getLaunchWantForBundle](js-apis-bundleManager.md#bundlemanagergetlaunchwantforbundle) instead. 1502 1503getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void; 1504 1505Obtains the **Want** object that launches the specified application. This API uses an asynchronous callback to return the result. 1506 1507**Required permissions** 1508 1509ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1510 1511**System capability** 1512 1513SystemCapability.BundleManager.BundleFramework 1514 1515**Parameters** 1516 1517| Name | Type | Mandatory| Description | 1518| ---------- | --------------------------------------------------- | ---- | -------------------------------------------------------- | 1519| bundleName | string | Yes | Bundle name. | 1520| callback | AsyncCallback\<[Want](js-apis-application-want.md)> | Yes | Callback used to return the **Want** object.| 1521 1522**Example** 1523 1524```ts 1525let bundleName = "com.example.myapplication"; 1526bundle.getLaunchWantForBundle(bundleName, (err, data) => { 1527 if (err) { 1528 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1529 return; 1530 } 1531 console.info('Operation successful. Data:' + JSON.stringify(data)); 1532}) 1533``` 1534 1535 1536## bundle.getNameForUid<sup>8+</sup> <sup>deprecated<sup> 1537 1538> This API is deprecated since API version 9. You are advised to use [bundleManager.getBundleNameByUid](js-apis-bundleManager.md#bundlemanagergetbundlenamebyuid) instead. 1539 1540getNameForUid(uid: number): Promise\<string> 1541 1542Obtains the bundle name based on a UID. This API uses a promise to return the result. 1543 1544**System capability** 1545 1546SystemCapability.BundleManager.BundleFramework 1547 1548**Parameters** 1549 1550| Name| Type | Mandatory| Description | 1551| ------ | ------ | ---- | ------------- | 1552| uid | number | Yes | UID based on which the bundle name is to obtain.| 1553 1554**Return value** 1555| Type | Description | 1556| ---------------- | --------------------------------- | 1557| Promise\<string> | Promise used to return the bundle name.| 1558 1559**Example** 1560 1561```ts 1562let uid = 20010005; 1563bundle.getNameForUid(uid) 1564.then((data) => { 1565 console.info('Operation successful. Data: ' + JSON.stringify(data)); 1566}).catch((error) => { 1567 console.error('Operation failed. Cause: ' + JSON.stringify(error)); 1568}) 1569``` 1570 1571## bundle.getNameForUid<sup>8+</sup> <sup>deprecated<sup> 1572 1573> This API is deprecated since API version 9. You are advised to use [bundleManager.getBundleNameByUid](js-apis-bundleManager.md#bundlemanagergetbundlenamebyuid) instead. 1574 1575getNameForUid(uid: number, callback: AsyncCallback\<string>) : void 1576 1577Obtains the bundle name based on a UID. This API uses an asynchronous callback to return the result. 1578 1579**System capability** 1580 1581SystemCapability.BundleManager.BundleFramework 1582 1583**Parameters** 1584 1585| Name | Type | Mandatory| Description | 1586| -------- | ---------------------- | ---- | ----------------------------------------------------- | 1587| uid | number | Yes | UID based on which the bundle name is to obtain. | 1588| callback | AsyncCallback\<string> | Yes | Callback used to return the bundle name.| 1589 1590**Example** 1591 1592```ts 1593let uid = 20010005; 1594bundle.getNameForUid(uid, (err, data) => { 1595 if (err) { 1596 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1597 return; 1598 } 1599 console.info('Operation successful. Data:' + JSON.stringify(data)); 1600}) 1601``` 1602 1603 1604## bundle.getAbilityIcon<sup>8+</sup> <sup>deprecated<sup> 1605 1606> This API is deprecated since API version 9. You are advised to use [resourceManager.getMediaContent](js-apis-resource-manager.md#getmediacontent9) instead. 1607 1608getAbilityIcon(bundleName: string, abilityName: string): Promise\<image.PixelMap>; 1609 1610Obtains the [pixel map](js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses a promise to return the result. 1611 1612No permission is required for obtaining the caller's own information. 1613 1614**Required permissions** 1615 1616ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1617 1618**System capability** 1619 1620SystemCapability.BundleManager.BundleFramework 1621 1622**Parameters** 1623 1624| Name | Type | Mandatory| Description | 1625| ----------- | ------ | ---- | ------------------------ | 1626| bundleName | string | Yes | Bundle name.| 1627| abilityName | string | Yes | Ability name. | 1628 1629**Return value** 1630| Type | Description | 1631| --------------------- | ------------------------------------------------------------ | 1632| Promise\<image.PixelMap> | Promise used to return the [pixel map](js-apis-image.md).| 1633 1634**Example** 1635 1636```ts 1637let bundleName = "com.example.myapplication"; 1638let abilityName = "com.example.myapplication.MainAbility"; 1639bundle.getAbilityIcon(bundleName, abilityName) 1640.then((data) => { 1641 console.info('Operation successful. Data: ' + JSON.stringify(data)); 1642}).catch((error) => { 1643 console.error('Operation failed. Cause: ' + JSON.stringify(error)); 1644}) 1645``` 1646 1647## bundle.getAbilityIcon<sup>8+</sup> <sup>deprecated<sup> 1648 1649> This API is deprecated since API version 9. You are advised to use [resourceManager.getMediaContent](js-apis-resource-manager.md#getmediacontent9) instead. 1650 1651getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<image.PixelMap>): void; 1652 1653Obtains the [pixel map](js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses an asynchronous callback to return the result. 1654 1655No permission is required for obtaining the caller's own information. 1656 1657**Required permissions** 1658 1659ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1660 1661 1662**System capability** 1663 1664SystemCapability.BundleManager.BundleFramework 1665 1666**Parameters** 1667 1668| Name | Type | Mandatory | Description | 1669| ----------- | ---------------------------------------- | ---- |-------------------------------------------------| 1670| bundleName | string | Yes | Bundle name. | 1671| abilityName | string | Yes | Ability name. | 1672| callback | AsyncCallback\<image.PixelMap> | Yes | Callback used to return the [pixel map](js-apis-image.md).| 1673 1674**Example** 1675 1676```ts 1677let bundleName = "com.example.myapplication"; 1678let abilityName = "com.example.myapplication.MainAbility"; 1679bundle.getAbilityIcon(bundleName, abilityName, (err, data) => { 1680 if (err) { 1681 console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1682 return; 1683 } 1684 console.info('Operation successful. Data:' + JSON.stringify(data)); 1685}) 1686``` 1687 1688## InstallErrorCode<sup>deprecated<sup> 1689> This API is deprecated since API version 9. You are not advised using it anymore. 1690 1691 **System capability**: SystemCapability.BundleManager.BundleFramework 1692 1693| Name | Value | Description | 1694| ---------------------------------------------------- | ---- | ------------------------------------------------ | 1695| SUCCESS | 0 | Installation succeeded. | 1696| STATUS_INSTALL_FAILURE | 1 | Installation failed. (The application to be installed is not found.) | 1697| STATUS_INSTALL_FAILURE_ABORTED | 2 | Installation aborted. | 1698| STATUS_INSTALL_FAILURE_INVALID | 3 | Invalid installation parameter. | 1699| STATUS_INSTALL_FAILURE_CONFLICT | 4 | Installation conflict. (The basic information of the application to update is inconsistent with that of the existing application.) | 1700| STATUS_INSTALL_FAILURE_STORAGE | 5 | Failed to store the bundle information. | 1701| STATUS_INSTALL_FAILURE_INCOMPATIBLE | 6 | Installation incompatibility. (A downgrade occurs or the signature information is incorrect.)| 1702| STATUS_UNINSTALL_FAILURE | 7 | Uninstallation failed. (The application to be uninstalled is not found.) | 1703| STATUS_UNINSTALL_FAILURE_BLOCKED | 8 | Uninstallation aborted. (This error code is not in use.) | 1704| STATUS_UNINSTALL_FAILURE_ABORTED | 9 | Uninstallation aborted. (Invalid parameters.) | 1705| STATUS_UNINSTALL_FAILURE_CONFLICT | 10 | Uninstallation conflict. (Failed to uninstall a system application or end the application process.)| 1706| STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT | 0x0B | Installation failed. (Download timed out.) | 1707| STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED | 0x0C | Installation failed. (Download failed.) | 1708| STATUS_RECOVER_FAILURE_INVALID<sup>8+</sup> | 0x0D | Failed to restore the pre-installed application. | 1709| STATUS_ABILITY_NOT_FOUND | 0x40 | Ability not found. | 1710| STATUS_BMS_SERVICE_ERROR | 0x41 | BMS service error. | 1711| STATUS_FAILED_NO_SPACE_LEFT<sup>8+</sup> | 0x42 | Insufficient device space. | 1712| STATUS_GRANT_REQUEST_PERMISSIONS_FAILED<sup>8+</sup> | 0x43 | Application authorization failed. | 1713| STATUS_INSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x44 | No installation permission. | 1714| STATUS_UNINSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x45 | No uninstallation permission. | 1715 1716## BundleFlag<sup>deprecated<sup> 1717 1718> This API is deprecated since API version 9. You are advised to use [bundleManager.BundleFlag](js-apis-bundleManager.md#bundleflag) instead. 1719 1720Enumerates the bundle flags, which indicate the type of bundle information to obtain. 1721 1722If an API does not match the flag, the flag is ignored. For example, using **GET_ABILITY_INFO_WITH_PERMISSION** to obtain the application information does not affect the result. 1723 1724Flags can be used together. For example, you can use the combination of **GET_APPLICATION_INFO_WITH_PERMISSION** and **GET_APPLICATION_INFO_WITH_DISABLE** to obtain the result that contains both application permission information and disabled application information. 1725 1726 **System capability**: SystemCapability.BundleManager.BundleFramework 1727 1728| Name | Value | Description | 1729| ----------------------------------------------- | ---------- | ------------------------------- | 1730| GET_BUNDLE_DEFAULT | 0x00000000 | Obtains the default application information. | 1731| GET_BUNDLE_WITH_ABILITIES | 0x00000001 | Obtains the bundle information with the ability information. | 1732| GET_ABILITY_INFO_WITH_PERMISSION | 0x00000002 | Obtains the ability information with the permission information. | 1733| GET_ABILITY_INFO_WITH_APPLICATION | 0x00000004 | Obtains the ability information with the application information. | 1734| GET_APPLICATION_INFO_WITH_PERMISSION | 0x00000008 | Obtains the application information with the permission information. | 1735| GET_BUNDLE_WITH_REQUESTED_PERMISSION | 0x00000010 | Obtains the bundle information with the information about the required permissions. | 1736| GET_ABILITY_INFO_WITH_METADATA<sup>8+</sup> | 0x00000020 | Obtains the ability metadata information. | 1737| GET_APPLICATION_INFO_WITH_METADATA<sup>8+</sup> | 0x00000040 | Obtains the application metadata information. | 1738| GET_ABILITY_INFO_SYSTEMAPP_ONLY<sup>8+</sup> | 0x00000080 | Obtains the ability information of system applications.| 1739| GET_ABILITY_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000100 | Obtains information about disabled abilities. | 1740| GET_APPLICATION_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000200 | Obtains information about disabled applications. | 1741| GET_ALL_APPLICATION_INFO | 0xFFFF0000 | Obtains all application information. | 1742 1743## BundleOptions<sup>deprecated<sup> 1744> This API is deprecated since API version 9. You are not advised using it anymore. 1745 1746Options that contain the user ID. 1747 1748 **System capability**: SystemCapability.BundleManager.BundleFramework 1749 1750| Name | Type | Readable| Writable| Description | 1751| ------ | ------ | ---- | ---- | ----------------------------------------------------- | 1752| userId | number | Yes | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.| 1753 1754## AbilityType<sup>deprecated<sup> 1755 1756> This API is deprecated since API version 9. You are advised to use [bundleManager.AbilityType](js-apis-bundleManager.md#abilitytype) instead. 1757 1758Enumerates the ability types. 1759 1760 **System capability**: SystemCapability.BundleManager.BundleFramework 1761 1762| Name| Value| Description | 1763| ------- | ---- | --------------------------- | 1764| UNKNOWN | None | Unknown ability type. | 1765| PAGE | None | FA developed using the Page template to provide the capability of interacting with users. | 1766| SERVICE | None | PA developed using the Service template to provide the capability of running tasks in the background. | 1767| DATA | None | PA developed using the Data template to provide unified data access for external systems.| 1768 1769## DisplayOrientation<sup>deprecated<sup> 1770 1771> This API is deprecated since API version 9. You are advised to use [bundleManager.DisplayOrientation](js-apis-bundleManager.md#displayorientation) instead. 1772 1773Enumerates display orientations. 1774 1775 **System capability**: SystemCapability.BundleManager.BundleFramework 1776 1777| Name | Value | Description | 1778| ------------- | ---- | ------------------------ | 1779| UNSPECIFIED | None | Unspecified display orientation. | 1780| LANDSCAPE | None | Landscape orientation. | 1781| PORTRAIT | None | Portrait orientation. | 1782| FOLLOW_RECENT | None | Orientation same as that of the nearest ability in the stack.| 1783## LaunchMode<sup>deprecated<sup> 1784 1785> This API is deprecated since API version 9. You are advised to use [bundleManager.LaunchType](js-apis-bundleManager.md#launchtype) instead. 1786 1787Enumerates the ability launch modes. 1788 1789 **System capability**: SystemCapability.BundleManager.BundleFramework 1790 1791| Name | Value | Description | 1792| --------- | ---- | ------------------- | 1793| SINGLETON | 0 | The ability has only one instance.| 1794| STANDARD | 1 | The ability can have multiple instances. | 1795 1796## AbilitySubType<sup>deprecated<sup> 1797> This API is deprecated since API version 9. You are not advised using it anymore. 1798 1799Enumerates the ability subtypes. 1800 1801 **System capability**: SystemCapability.BundleManager.BundleFramework 1802 1803| Name | Value | Description | 1804| ----------- | ---- | ----------------------------- | 1805| UNSPECIFIED | 0 | Undefined ability subtype. | 1806| CA | 1 | Ability that has a UI.| 1807 1808## ColorMode<sup>deprecated<sup> 1809> This API is deprecated since API version 9. You are not advised using it anymore. 1810 1811Enumerates the color modes of applications and widgets. 1812 1813 **System capability**: SystemCapability.BundleManager.BundleFramework 1814 1815| Name | Value | Description | 1816| ---------- | ---- | -------- | 1817| AUTO_MODE | -1 | Automatic mode.| 1818| DARK_MODE | 0 | Dark mode.| 1819| LIGHT_MODE | 1 | Light mode.| 1820 1821 1822## GrantStatus<sup>deprecated<sup> 1823 1824> This API is deprecated since API version 9. You are advised to use [bundleManager.PermissionGrantState](js-apis-bundleManager.md#permissiongrantstate) instead. 1825 1826Enumerates the permission grant states. 1827 1828 **System capability**: SystemCapability.BundleManager.BundleFramework 1829 1830| Name | Value | Description | 1831| ------------------ | ---- | ------------ | 1832| PERMISSION_DENIED | -1 | Permission denied.| 1833| PERMISSION_GRANTED | 0 | Permission granted. | 1834