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