js-apis-Bundle.md 108.1 KB
Newer Older
W
wusongqing 已提交
1
# Bundle
W
wusongqing 已提交
2

W
wusongqing 已提交
3
The **Bundle** module provides APIs for querying the information about bundles, applications, abilities, Extension abilities, and application states.
W
wusongqing 已提交
4 5

> **NOTE**
W
wusongqing 已提交
6
> 
W
wusongqing 已提交
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.
W
wusongqing 已提交
8
> API version 9 is a canary version for trial use. The APIs of this version may be unstable.
W
wusongqing 已提交
9 10
## Modules to Import

W
wusongqing 已提交
11
```js
W
wusongqing 已提交
12 13 14 15 16
import bundle from '@ohos.bundle';
```

## Required Permissions

W
wusongqing 已提交
17 18 19
| Required Permissions                                      | Permission Level    | Description              |
| ------------------------------------------ | ------------ | ------------------ |
| ohos.permission.GET_BUNDLE_INFO            | normal       | Permission to query information about a specified application.  |
W
wusongqing 已提交
20
| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED| system_basic | Permission to query information about all applications.|
W
wusongqing 已提交
21
| ohos.permission.INSTALL_BUNDLE             | system_core  | Permission to install or uninstall applications.  |
W
wusongqing 已提交
22
| ohos.permission.MANAGE_DISPOSED_APP_STATUS | system_core  | Permission to set and query the application disposal status.  |
W
wusongqing 已提交
23

W
wusongqing 已提交
24
For details, see "Permission Levels" in [Access Control Overview](../../security/accesstoken-overview.md).
W
wusongqing 已提交
25 26 27

## bundle.getApplicationInfo

W
wusongqing 已提交
28
getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number): Promise\<ApplicationInfo>
W
wusongqing 已提交
29

W
wusongqing 已提交
30
Obtains the application information based on a given bundle name. This API uses a promise to return the result.
W
wusongqing 已提交
31

W
wusongqing 已提交
32
**Required permissions**
W
wusongqing 已提交
33

W
wusongqing 已提交
34 35 36 37 38
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
39 40 41

**Parameters**

42 43 44 45 46
| Name       | Type  | Mandatory| Description                                                        |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| bundleName  | string | Yes  | Bundle name of an application.                                    |
| bundleFlags | number | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the application information flags in [BundleFlag](#bundleflag).|
| 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.       |
W
wusongqing 已提交
47 48 49

**Return value**

W
wusongqing 已提交
50 51
| Type                       | Description                |
| ------------------------- | ------------------ |
W
wusongqing 已提交
52
| Promise\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Promise used to return the application information.|
W
wusongqing 已提交
53 54 55 56

**Example**

```js
W
wusongqing 已提交
57 58 59 60 61 62 63 64
let bundleName = "com.example.myapplication";
let bundleFlags = 0;
let userId = 100;
bundle.getApplicationInfo(bundleName, bundleFlags, userId)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
W
wusongqing 已提交
65 66 67 68 69 70 71
})
```

## bundle.getApplicationInfo

getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback\<ApplicationInfo>): void

W
wusongqing 已提交
72
Obtains the application information of the specified user based on a given bundle name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
73

W
wusongqing 已提交
74
**Required permissions**
W
wusongqing 已提交
75

W
wusongqing 已提交
76 77 78 79 80
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
81 82 83

**Parameters**

84 85 86 87 88 89
| Name       | Type                                                        | Mandatory| Description                                                        |
| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| bundleName  | string                                                       | Yes  | Bundle name of an application.                                    |
| bundleFlags | number                                                       | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the application information flags in [BundleFlag](#bundleflag).|
| 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.       |
| callback    | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes  | Callback used to return the application information.              |
W
wusongqing 已提交
90 91 92 93

**Example**

```js
W
wusongqing 已提交
94 95 96 97 98 99 100 101 102 103
let bundleName = "com.example.myapplication";
let bundleFlags = 0;
let userId = 100;
bundle.getApplicationInfo(bundleName, bundleFlags, userId, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
 })
W
wusongqing 已提交
104 105
```

W
wusongqing 已提交
106 107 108 109
## bundle.getApplicationInfo

getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<ApplicationInfo>): void

W
wusongqing 已提交
110
Obtains the application information based on a given bundle name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
111 112 113 114 115 116 117 118 119 120 121

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

122 123 124 125 126
| Name       | Type                                                        | Mandatory| Description                                                        |
| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| bundleName  | string                                                       | Yes  | Bundle name of an application.                                    |
| bundleFlags | number                                                       | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the application information flags in [BundleFlag](#bundleflag).|
| callback    | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes  | Callback used to return the application information.              |
W
wusongqing 已提交
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141

**Example**

```js
let bundleName = "com.example.myapplication";
let bundleFlags = 0;
bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
 })
```

142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
## bundle.getApplicationInfoSync<sup>9+</sup>

getApplicationInfoSync(bundleName: string, bundleFlags: number, userId: number): ApplicationInfo;

Obtains the application information of the specified user based on a given bundle name. This API returns the result synchronously.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name       | Type  | Mandatory| Description                                                        |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| bundleName  | string | Yes  | Bundle name of an application.                                              |
| bundleFlags | number | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the application information flags in [BundleFlag](#bundleflag).|
| 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.       |

**Return value**

| Type                                                | Description               |
| ---------------------------------------------------- | ------------------- |
| [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | **ApplicationInfo** object.|

**Example**

```js
let bundleName = "com.example.myapplication";
let bundleFlags = 0;
let userId = 100;
var applicationInfo = bundle.getApplicationInfoSync(bundleName, bundleFlags, userId);
console.info('Operation successful. Name:' + applicationInfo.name);
```

## bundle.getApplicationInfoSync<sup>9+</sup>

getApplicationInfoSync(bundleName: string, bundleFlags: number) : ApplicationInfo;

Obtains the application information based on a given bundle name. This API returns the result synchronously.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name       | Type  | Mandatory| Description                                                        |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| bundleName  | string | Yes  | Bundle name of an application.                                              |
| bundleFlags | number | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the application information flags in [BundleFlag](#bundleflag).|

**Return value**

| Type                                                | Description               |
| ---------------------------------------------------- | ------------------- |
| [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | **ApplicationInfo** object.|

**Example**

```js
let bundleName = "com.example.myapplication";
let bundleFlags = 0;
var applicationInfo = bundle.getApplicationInfoSync(bundleName, bundleFlags);
console.info('Operation successful. Name:' + applicationInfo.name);
```

W
wusongqing 已提交
216 217
## bundle.getAllBundleInfo

W
wusongqing 已提交
218
getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise<Array\<BundleInfo>>
W
wusongqing 已提交
219

W
wusongqing 已提交
220
Obtains the information of all available bundles of the specified user in the system. This API uses a promise to return the result.
W
wusongqing 已提交
221

W
wusongqing 已提交
222
**Required permissions**
W
wusongqing 已提交
223

W
wusongqing 已提交
224 225 226 227 228
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
229 230 231

**Parameters**

232 233 234 235
| Name      | Type      | Mandatory| Description                                                        |
| ---------- | ---------- | ---- | ------------------------------------------------------------ |
| bundleFlag | BundleFlag | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflag).|
| 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.       |
W
wusongqing 已提交
236 237 238

**Return value**

W
wusongqing 已提交
239 240
| Type                         | Description                        |
| --------------------------- | -------------------------- |
W
wusongqing 已提交
241
| Promise<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Promise used to return the information of all available bundles.|
W
wusongqing 已提交
242 243 244 245

**Example**

```js
W
wusongqing 已提交
246 247 248 249 250 251 252
let bundleFlag = 0;
let userId = 100;
bundle.getAllBundleInfo(bundleFlag, userId)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
W
wusongqing 已提交
253 254 255 256 257
})
```

## bundle.getAllBundleInfo

W
wusongqing 已提交
258
getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback<Array\<BundleInfo>>): void
W
wusongqing 已提交
259

W
wusongqing 已提交
260
Obtains the information of all available bundles in the system. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
261

W
wusongqing 已提交
262
**Required permissions**
W
wusongqing 已提交
263

W
wusongqing 已提交
264 265 266 267 268
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
269 270 271

**Parameters**

272 273 274 275
| Name      | Type                                                        | Mandatory| Description                                                        |
| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| bundleFlag | BundleFlag                                                   | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflag).|
| callback   | AsyncCallback<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes  | Callback used to return the information of all available bundles.      |
W
wusongqing 已提交
276 277 278 279

**Example**

```js
W
wusongqing 已提交
280 281 282 283 284 285 286 287 288
let bundleFlag = 0;
bundle.getAllBundleInfo(bundleFlag, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
 })
```
W
wusongqing 已提交
289

W
wusongqing 已提交
290 291
## bundle.getAllBundleInfo

W
wusongqing 已提交
292
getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback<Array\<BundleInfo>>): void
W
wusongqing 已提交
293

W
wusongqing 已提交
294
Obtains the information of all available bundles of the specified user in the system. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
295 296 297

**Required permissions**

W
wusongqing 已提交
298 299 300 301 302
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
303 304 305

**Parameters**

306 307 308 309 310
| Name      | Type                                                        | Mandatory| Description                                                        |
| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| bundleFlag | BundleFlag                                                   | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflag).|
| 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.       |
| callback   | AsyncCallback<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes  | Callback used to return the information of all available bundles.      |
W
wusongqing 已提交
311 312 313 314 315 316 317 318 319 320 321 322 323

**Example**

```js
let bundleFlag = 0;
let userId = 100;
bundle.getAllBundleInfo(bundleFlag, userId, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
 })
W
wusongqing 已提交
324 325 326 327
```

## bundle.getBundleInfo

W
wusongqing 已提交
328
getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise\<BundleInfo>
W
wusongqing 已提交
329

W
wusongqing 已提交
330
Obtains the bundle information based on a given bundle name. This API uses a promise to return the result.
W
wusongqing 已提交
331

W
wusongqing 已提交
332
**Required permissions**
W
wusongqing 已提交
333

W
wusongqing 已提交
334 335 336 337 338
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
339 340 341

**Parameters**

W
wusongqing 已提交
342 343
| Name         | Type           | Mandatory  | Description                                     |
| ----------- | ------------- | ---- | --------------------------------------- |
W
wusongqing 已提交
344
| bundleName  | string        | Yes   | Bundle name of an application.                                     |
345
| bundleFlags | number        | Yes   | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflag).|
W
wusongqing 已提交
346
| options     | [BundleOptions](#bundleoptions) | No   | Includes **userId**.                              |
W
wusongqing 已提交
347 348 349

**Return value**

W
wusongqing 已提交
350 351
| Type                  | Description                          |
| -------------------- | ---------------------------- |
W
wusongqing 已提交
352
| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the bundle information.|
W
wusongqing 已提交
353 354 355 356

**Example**

```js
W
wusongqing 已提交
357 358 359
let bundleName = "com.example.myapplication";
let bundleFlags = 1;
let options = {
W
wusongqing 已提交
360
  "userId" : 100
W
wusongqing 已提交
361 362 363 364 365 366
};
bundle.getBundleInfo(bundleName, bundleFlags, options)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
W
wusongqing 已提交
367 368 369 370 371 372 373
})
```

## bundle.getBundleInfo

getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>): void

W
wusongqing 已提交
374
Obtains the bundle information based on a given bundle name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
375

W
wusongqing 已提交
376
**Required permissions**
W
wusongqing 已提交
377

W
wusongqing 已提交
378 379 380 381 382
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
383 384 385

**Parameters**

386 387 388 389 390
| Name       | Type                                                      | Mandatory| Description                                                        |
| ----------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| bundleName  | string                                                     | Yes  | Bundle name of an application.                                                        |
| bundleFlags | number                                                     | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflag).|
| callback    | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes  | Callback used to return the bundle information.                    |
W
wusongqing 已提交
391 392 393 394

**Example**

```js
W
wusongqing 已提交
395 396 397 398 399 400 401 402 403
let bundleName = "com.example.myapplication";
let bundleFlags = 1;
bundle.getBundleInfo(bundleName, bundleFlags, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
W
wusongqing 已提交
404 405 406
```


W
wusongqing 已提交
407 408 409 410
## bundle.getBundleInfo

getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback\<BundleInfo>): void

W
wusongqing 已提交
411
Obtains the bundle information based on a given bundle name and bundle options. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
412 413 414

**Required permissions**

W
wusongqing 已提交
415 416 417 418 419
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
420 421 422

**Parameters**

423 424 425 426 427 428
| Name       | Type                                                      | Mandatory| Description                                                        |
| ----------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| bundleName  | string                                                     | Yes  | Bundle name of an application.                                                        |
| bundleFlags | number                                                     | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflag).|
| options     | [BundleOptions](#bundleoptions)                            | Yes  | Includes **userId**.                                                |
| callback    | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes  | Callback used to return the bundle information.                    |
W
wusongqing 已提交
429 430 431 432 433 434 435

**Example**

```js
let bundleName = "com.example.myapplication";
let bundleFlags = 1;
let options = {
W
wusongqing 已提交
436
  "userId" : 100
W
wusongqing 已提交
437 438 439 440 441 442 443 444 445 446
};
bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```

447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
## bundle.getBundleInfoSync<sup>9+</sup>

getBundleInfoSync(bundleName: string, bundleFlags: number, options: BundleOptions): BundleInfo;

Obtains the bundle information based on a given bundle name and bundle options. This API returns the result synchronously.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name       | Type                           | Mandatory| Description                                                        |
| ----------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| bundleName  | string                          | Yes  | Bundle name of an application.                                              |
| bundleFlags | number                          | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflag).|
| options     | [BundleOptions](#bundleoptions) | Yes  | Options of the bundle.                                              |

**Return value**

| Type                                      | Description          |
| ------------------------------------------ | -------------- |
| [BundleInfo](js-apis-bundle-BundleInfo.md) | **BundleInfo** object.|

**Example**

```js
let bundleName = "com.example.myapplication";
let bundleFlags = 1;
let options = {
  "userId" : 100
};
var bundleInfo = bundle.getBundleInfoSync(bundleName, bundleFlags, options);
console.info('Operation successful. Name:' + bundleInfo.name);
```

## bundle.getBundleInfoSync<sup>9+</sup>

getBundleInfoSync(bundleName: string, bundleFlags: number): BundleInfo;

Obtains the bundle information based on a given bundle name. This API returns the result synchronously.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name       | Type  | Mandatory| Description                                                        |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| bundleName  | string | Yes  | Bundle name of an application.                                              |
| bundleFlags | number | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflag).|

**Return value**

| Type                                      | Description          |
| ------------------------------------------ | -------------- |
| [BundleInfo](js-apis-bundle-BundleInfo.md) | **BundleInfo** object.|

**Example**

```js
let bundleName = "com.example.myapplication";
let bundleFlags = 1;
var bundleInfo = bundle.getBundleInfoSync(bundleName, bundleFlags);
console.info('Operation successful. Name:' + bundleInfo.name);
```

W
wusongqing 已提交
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837
## bundle.getBundleInstaller

getBundleInstaller(): Promise&lt;BundleInstaller&gt;;

Obtains the installation package information. This API uses a promise to return the result.

**Required permissions**

ohos.permission.INSTALL_BUNDLE

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Return value**

| Type                                                        | Description                                        |
| ------------------------------------------------------------ | -------------------------------------------- |
| Promise<[BundleInstaller](js-apis-bundle-BundleInstaller.md)> | Promise used to return the installation package information.|

## bundle.getBundleInstaller

getBundleInstaller(callback: AsyncCallback&lt;BundleInstaller&gt;): void;

Obtains the installation package information. This API uses an asynchronous callback to return the result.

**Required permissions**

ohos.permission.INSTALL_BUNDLE

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name    | Type                                                        | Mandatory| Description            |
| -------- | ------------------------------------------------------------ | ---- | ---------------- |
| callback | AsyncCallback<[BundleInstaller](js-apis-bundle-BundleInstaller.md)> | Yes  | Callback used to return the installation package information.|

## bundle.cleanBundleCacheFiles<sup>8+</sup>

cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback&lt;void&gt;): void;

Clears the cache data of an application. This API uses an asynchronous callback to return the result.

**Required permissions**

ohos.permission.REMOVE_CACHE_FILES

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name      | Type               | Mandatory| Description                                 |
| ---------- | ------------------- | ---- | ------------------------------------- |
| bundleName | string              | Yes  | Bundle name of an application.|
| callback   | AsyncCallback\<void> | Yes  | Callback used to return the result.         |

## bundle.cleanBundleCacheFiles<sup>8+</sup>

cleanBundleCacheFiles(bundleName: string): Promise&lt;void&gt;

Clears the cache data of an application. This API uses a promise to return the result.

**Required permissions**

ohos.permission.REMOVE_CACHE_FILES

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name      | Type  | Mandatory| Description                                 |
| ---------- | ------ | ---- | ------------------------------------- |
| bundleName | string | Yes  | Bundle name of an application.|

**Return value**

| Type         | Description                                |
| ------------- | ------------------------------------ |
| Promise\<void> | Promise that returns no value.|

## bundle.setApplicationEnabled<sup>8+</sup>

setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback&lt;void&gt;): void;

Sets whether to enable an application. This API uses an asynchronous callback to return the result.

**Required permissions**

ohos.permission.CHANGE_ABILITY_ENABLED_STATE

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name      | Type               | Mandatory| Description                                           |
| ---------- | ------------------- | ---- | ----------------------------------------------- |
| bundleName | string              | Yes  | Bundle name of an application.                               |
| isEnable   | boolean             | Yes  | Whether to enable the application. The value **true** means to enable the application, and **false** means the opposite.|
| callback   | AsyncCallback\<void> | Yes  | Callback used to return the result.                   |

## bundle.setApplicationEnabled<sup>8+</sup>

setApplicationEnabled(bundleName: string, isEnable: boolean): Promise&lt;void&gt;

Sets whether to enable an application. This API uses a promise to return the result.

**Required permissions**

ohos.permission.CHANGE_ABILITY_ENABLED_STATE

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name      | Type   | Mandatory| Description                                           |
| ---------- | ------- | ---- | ----------------------------------------------- |
| bundleName | string  | Yes  | Bundle name of an application.                               |
| isEnable   | boolean | Yes  | Whether to enable the application. The value **true** means to enable the application, and **false** means the opposite.|

**Return value**

| Type         | Description                                |
| ------------- | ------------------------------------ |
| Promise\<void> | Promise that returns no value.|

## bundle.setAbilityEnabled<sup>8+</sup>

setAbilityEnabled(info: AbilityInfo, isEnable: boolean, callback: AsyncCallback&lt;void&gt;): void;

Sets whether to enable an ability. This API uses an asynchronous callback to return the result.

**Required permissions**

ohos.permission.CHANGE_ABILITY_ENABLED_STATE

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name    | Type                                        | Mandatory| Description                                           |
| -------- | -------------------------------------------- | ---- | ----------------------------------------------- |
| info     | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes  | Ability information.                                  |
| isEnable | boolean                                      | Yes  | Whether to enable the ability. The value **true** means to enable the ability, and **false** means the opposite.|
| callback | AsyncCallback\<void>                          | Yes  | Callback used to return the result.                   |

## bundle.setAbilityEnabled<sup>8+</sup>

setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise&lt;void&gt;

Sets whether to enable an ability. This API uses a promise to return the result.

**Required permissions**

ohos.permission.CHANGE_ABILITY_ENABLED_STATE

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name    | Type                                        | Mandatory| Description                                           |
| -------- | -------------------------------------------- | ---- | ----------------------------------------------- |
| info     | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes  | Ability information.                                  |
| isEnable | boolean                                      | Yes  | Whether to enable the ability. The value **true** means to enable the ability, and **false** means the opposite.|

**Return value**

| Type         | Description                                |
| ------------- | ------------------------------------ |
| Promise\<void> | Promise that returns no value.|

## bundle.getPermissionDef<sup>8+</sup>

getPermissionDef(permissionName: string, callback: AsyncCallback&lt;PermissionDef&gt;): void;

Obtains the permission details by permission name. This API uses an asynchronous callback to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name          | Type                                                        | Mandatory| Description                                            |
| -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------ |
| permissionName | string                                                       | Yes  | Name of the permission.                                |
| callback       | AsyncCallback<[PermissionDef](js-apis-bundle-PermissionDef)> | Yes  | Callback used to return the permission details.|

## bundle.getPermissionDef<sup>8+</sup>

getPermissionDef(permissionName: string): Promise&lt;PermissionDef&gt;

Obtains the permission details by permission name. This API uses a promise to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name          | Type  | Mandatory| Description            |
| -------------- | ------ | ---- | ---------------- |
| permissionName | string | Yes  | Name of the permission.|

**Return value**

| Type                                                  | Description                                                  |
| ------------------------------------------------------ | ------------------------------------------------------ |
| Promise<[PermissionDef](js-apis-bundle-PermissionDef)> | Promise used to return the permission details.|

## bundle.setModuleUpgradeFlag<sup>9+</sup>

setModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag, callback: AsyncCallback&lt;void&gt;):void;

Sets whether the module needs an upgrade. This API uses an asynchronous callback to return the result.

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name       | Type                       | Mandatory| Description                        |
| ----------- | --------------------------- | ---- | ---------------------------- |
| bundleName  | string                      | Yes  | Bundle name of an application.            |
| moduleName  | string                      | Yes  | Module name of the application.          |
| upgradeFlag | [UpgradeFlag](#upgradeflag) | Yes  | Upgrade flag, which is used only by the internal system.      |
| callback    | AsyncCallback\<void>         | Yes  | Callback used to return the result.|

## bundle.setModuleUpgradeFlag<sup>9+</sup>

setModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag): Promise&lt;void&gt;

Sets whether the module needs an upgrade. This API uses a promise to return the result.

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name       | Type                       | Mandatory| Description                  |
| ----------- | --------------------------- | ---- | ---------------------- |
| bundleName  | string                      | Yes  | Bundle name of an application.      |
| moduleName  | string                      | Yes  | Module name of the application.    |
838
| upgradeFlag | [UpgradeFlag](#upgradeflag) | Yes  | Upgrade flag, which is for internal use only.|
W
wusongqing 已提交
839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865

**Return value**

| Type         | Description                                |
| ------------- | ------------------------------------ |
| Promise\<void> | Promise that returns no value.|

## bundle.isModuleRemovable<sup>9+</sup>

isModuleRemovable(bundleName: string, moduleName: string, callback: AsyncCallback&lt;boolean&gt;): void;

Checks whether a module is removable. This API uses an asynchronous callback to return the result.

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name      | Type                  | Mandatory| Description                                         |
| ---------- | ---------------------- | ---- | --------------------------------------------- |
| bundleName | string                 | Yes  | Bundle name of an application.                             |
| moduleName | string                 | Yes  | Module name of the application.                           |
W
wusongqing 已提交
866
| callback   | AsyncCallback\<boolean> | Yes  | Callback used to return the result. If the module is removable, **true** is returned. Otherwise, **false** is returned.|
W
wusongqing 已提交
867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892

## bundle.isModuleRemovable<sup>9+</sup>

isModuleRemovable(bundleName: string, moduleName: string): Promise&lt;boolean&gt;

Checks whether a module is removable. This API uses a promise to return the result.

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name      | Type  | Mandatory| Description              |
| ---------- | ------ | ---- | ------------------ |
| bundleName | string | Yes  | Bundle name of an application.  |
| moduleName | string | Yes  | Module name of the application.|

**Return value**

| Type            | Description                        |
| ---------------- | ---------------------------- |
W
wusongqing 已提交
893
| Promise\<boolean> | Promise used to return the result. If the module is removable, **true** is returned. Otherwise, **false** is returned.|
W
wusongqing 已提交
894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910

## bundle.getBundlePackInfo<sup>9+</sup>

getBundlePackInfo(bundleName: string, bundlePackFlag : pack.BundlePackFlag, callback: AsyncCallback&lt;pack.BundlePackInfo&gt;): void;

Obtains the bundle package information based on a given bundle name and bundle flags. This API uses an asynchronous callback to return the result.

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

911 912 913 914
| Name          | Type                                                        | Mandatory| Description                                                |
| -------------- | ------------------------------------------------------------ | ---- | ---------------------------------------------------- |
| bundleName     | string                                                       | Yes  | Bundle name of an application.                                    |
| bundlePackFlag | pack.BundlePackFlag            | Yes  | Flags of the bundle package.                              |
W
wusongqing 已提交
915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932
| callback       | AsyncCallback<pack.BundlePackInfo> | Yes  | Callback used to return the bundle package information.|

## bundle.getBundlePackInfo<sup>9+</sup>

getBundlePackInfo(bundleName: string, bundlePackFlag : pack.BundlePackFlag): Promise&lt;pack.BundlePackInfo&gt;;

Obtains the bundle package information based on a given bundle name and bundle flags. This API uses a promise to return the result.

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

933 934 935
| Name          | Type                                             | Mandatory| Description                  |
| -------------- | ------------------------------------------------- | ---- | ---------------------- |
| bundleName     | string                                            | Yes  | Bundle name of an application.      |
W
wusongqing 已提交
936 937 938 939
| bundlePackFlag | pack.BundlePackFlag | Yes  | Flags of the bundle package.|

**Return value**

940 941 942
| Type                         | Description                                            |
| ---------------------------- | ------------------------------------------------------ |
| Promise<pack.BundlePackInfo> | Promise used to return the bundle package information. |
W
wusongqing 已提交
943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982

## bundle.getDispatcherVersion<sup>9+</sup>

getDispatcherVersion(callback: AsyncCallback&lt;DispatchInfo&gt;): void;

Obtains the dispatcher version. This API uses an asynchronous callback to return the result.

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

| Name    | Type                                                  | Mandatory| Description                                                        |
| -------- | ------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback<[DispatchInfo](js-apis-dispatchInfo.md)> | Yes  | Callback used to return the [DispatchInfo](js-apis-dispatchInfo.md).|

## bundle.getDispatcherVersion<sup>9+</sup>

getDispatcherVersion(): Promise&lt;DispatchInfo&gt;;

Obtains the dispatcher version. This API uses a promise to return the result.

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Return value**

| Type                                            | Description                                                        |
| ------------------------------------------------ | ------------------------------------------------------------ |
| Promise<[DispatchInfo](js-apis-dispatchInfo.md)> | Promise used to return the [DispatchInfo](js-apis-dispatchInfo.md).|
W
wusongqing 已提交
983 984 985

## bundle.getAllApplicationInfo

W
wusongqing 已提交
986
getAllApplicationInfo(bundleFlags: number, userId?: number): Promise<Array\<ApplicationInfo>>
W
wusongqing 已提交
987

W
wusongqing 已提交
988
Obtains the information about all applications of the specified user. This API uses a promise to return the result.
W
wusongqing 已提交
989

W
wusongqing 已提交
990
**Required permissions**
W
wusongqing 已提交
991

W
wusongqing 已提交
992 993 994 995 996
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
997 998 999

**Parameters**

1000 1001 1002 1003
| Name       | Type  | Mandatory| Description                                                        |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| bundleFlags | number | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the application information flags in [BundleFlag](#bundleflag).|
| 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.       |
W
wusongqing 已提交
1004 1005 1006

**Return value**

W
wusongqing 已提交
1007 1008
| Type                              | Description                             |
| -------------------------------- | ------------------------------- |
W
wusongqing 已提交
1009
| Promise<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Promise used to return the application information.|
W
wusongqing 已提交
1010 1011 1012 1013

**Example**

```js
W
wusongqing 已提交
1014 1015 1016 1017 1018 1019 1020
let bundleFlags = 8;
let userId = 100;
bundle.getAllApplicationInfo(bundleFlags, userId)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
W
wusongqing 已提交
1021 1022 1023 1024 1025 1026 1027 1028 1029
})
```



## bundle.getAllApplicationInfo

getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback<Array\<ApplicationInfo>>): void

W
wusongqing 已提交
1030
Obtains the information about all applications of the specified user. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1031

W
wusongqing 已提交
1032
**Required permissions**
W
wusongqing 已提交
1033

W
wusongqing 已提交
1034 1035 1036 1037 1038
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1039 1040 1041

**Parameters**

1042 1043 1044 1045 1046
| Name       | Type                                                        | Mandatory| Description                                                        |
| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| bundleFlags | number                                                       | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the application information flags in [BundleFlag](#bundleflag).|
| 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.       |
| callback    | AsyncCallback<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Yes  | Callback used to return the application information.              |
W
wusongqing 已提交
1047 1048 1049 1050

**Example**

```js
W
wusongqing 已提交
1051 1052 1053 1054 1055 1056 1057 1058 1059
let bundleFlags = 8;
let userId = 100;
bundle.getAllApplicationInfo(bundleFlags, userId, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
W
wusongqing 已提交
1060 1061 1062
```


W
wusongqing 已提交
1063 1064
## bundle.getAllApplicationInfo

W
wusongqing 已提交
1065
getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback<Array\<ApplicationInfo>>) : void;
W
wusongqing 已提交
1066

W
wusongqing 已提交
1067
Obtains the information about all applications. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

1079 1080 1081 1082
| Name       | Type                                                        | Mandatory| Description                                                        |
| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| bundleFlags | number                                                       | Yes  | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the application information flags in [BundleFlag](#bundleflag).|
| callback    | AsyncCallback<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Yes  | Callback used to return the application information.              |
W
wusongqing 已提交
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096

**Example**

```js
let bundleFlags = 8;
bundle.getAllApplicationInfo(bundleFlags, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```

W
wusongqing 已提交
1097 1098
## bundle.getBundleArchiveInfo

W
wusongqing 已提交
1099
getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise\<BundleInfo>
W
wusongqing 已提交
1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111

Obtains information about the bundles contained in a HAP file. This API uses a promise to return the result.

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name        | Type    | Mandatory  | Description          |
| ---------- | ------ | ---- | ------------ |
| hapFilePath | string | Yes   | Path where the HAP file is stored. The path should point to the relative directory of the current application's data directory.|
1112
| bundleFlags | number | Yes   | Flags used to specify information contained in the **BundleInfo** object that will be returned. The default value is **0**. For details on the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflag).|
W
wusongqing 已提交
1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133

**Return value**
| Type            | Description                                    |
| -------------- | -------------------------------------- |
| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the information about the bundles.|

**Example**

```js
let hapFilePath = "/data/xxx/test.hap";
let bundleFlags = 0;
bundle.getBundleArchiveInfo(hapFilePath, bundleFlags)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

## bundle.getBundleArchiveInfo

W
wusongqing 已提交
1134
getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>) : void
W
wusongqing 已提交
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146

Obtains information about the bundles contained in a HAP file. This API uses an asynchronous callback to return the result.

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name        | Type    | Mandatory  | Description          |
| ---------- | ------ | ---- | ------------ |
| hapFilePath | string | Yes   | Path where the HAP file is stored. The path should point to the relative directory of the current application's data directory.|
1147
| bundleFlags | number | Yes   | Flags used to specify information contained in the **BundleInfo** object that will be returned. The default value is **0**. For details on the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflag).|
W
wusongqing 已提交
1148
| callback| AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes   | Callback used to return the information about the bundles.|
W
wusongqing 已提交
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164

**Example**

```js
let hapFilePath = "/data/xxx/test.hap";
let bundleFlags = 0;
bundle.getBundleArchiveInfo(hapFilePath, bundleFlags, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```


W
wusongqing 已提交
1165 1166 1167 1168
## bundle.getAbilityInfo

getAbilityInfo(bundleName: string, abilityName: string): Promise\<AbilityInfo>

W
wusongqing 已提交
1169
Obtains the ability information based on a given bundle name and ability name. This API uses a promise to return the result.
W
wusongqing 已提交
1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1181 1182
| Name         | Type    | Mandatory  | Description              |
| ----------- | ------ | ---- | ---------------- |
W
wusongqing 已提交
1183
| bundleName  | string | Yes   | Bundle name of an application.    |
W
wusongqing 已提交
1184
| abilityName | string | Yes   | Ability name.|
W
wusongqing 已提交
1185 1186 1187

**Return value**

W
wusongqing 已提交
1188 1189
| Type                   | Description                   |
| --------------------- | --------------------- |
W
wusongqing 已提交
1190
| Promise\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Promise used to return the ability information.|
W
wusongqing 已提交
1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206

**Example**

```js
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityInfo(bundleName, abilityName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

## bundle.getAbilityInfo

W
wusongqing 已提交
1207
getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback\<AbilityInfo>): void;
W
wusongqing 已提交
1208

W
wusongqing 已提交
1209
Obtains the ability information based on a given bundle name and ability name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1221 1222
| Name        | Type    | Mandatory  | Description           |
| ----------- | ------------ | ---- | ---------------- |
W
wusongqing 已提交
1223
| bundleName  | string | Yes   | Bundle name of an application.    |
W
wusongqing 已提交
1224 1225
| abilityName | string | Yes   | Ability name.|
| callback    | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes   | Callback used to return the ability information.|
W
wusongqing 已提交
1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239

**Example**

```js
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityInfo(bundleName, abilityName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
W
wusongqing 已提交
1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257
## bundle.getAbilityInfo<sup>9+</sup>

getAbilityInfo(bundleName: string, moduleName: string, abilityName: string): Promise\<AbilityInfo>

Obtains the ability information based on a given bundle name, module name, and ability name. This API uses a promise to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name         | Type    | Mandatory  | Description              |
| ----------- | ------ | ---- | ---------------- |
W
wusongqing 已提交
1258
| bundleName  | string | Yes   | Bundle name of an application.    |
W
wusongqing 已提交
1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299
| moduleName  | string | Yes   | Module name of the application.    |
| abilityName | string | Yes   | Ability name.|

**Return value**

| Type                   | Description                   |
| --------------------- | --------------------- |
| Promise\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Promise used to return the ability information.|

**Example**

```js
let bundleName = "com.example.myapplication";
let moduleName = "entry";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityInfo(bundleName, moduleName, abilityName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

## bundle.getAbilityInfo<sup>9+</sup>

getAbilityInfo(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback\<AbilityInfo>): void;

Obtains the ability information based on a given bundle name, module name, and ability name. This API uses an asynchronous callback to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name        | Type    | Mandatory  | Description           |
| ----------- | ------------ | ---- | ---------------- |
W
wusongqing 已提交
1300
| bundleName  | string | Yes   | Bundle name of an application.    |
W
wusongqing 已提交
1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318
| moduleName  | string | Yes   | Module name of the application.    |
| abilityName | string | Yes   | Ability name.|
| callback    | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes   | Callback used to return the ability information.|

**Example**

```js
let bundleName = "com.example.myapplication";
let moduleName = "entry";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityInfo(bundleName, moduleName, abilityName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
W
wusongqing 已提交
1319

W
wusongqing 已提交
1320
## bundle.getAbilityLabel<sup>8+</sup>
W
wusongqing 已提交
1321 1322 1323

getAbilityLabel(bundleName: string, abilityName: string): Promise\<string>

W
wusongqing 已提交
1324
Obtains the application name based on a given bundle name and ability name. This API uses a promise to return the result.
W
wusongqing 已提交
1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1336 1337
| Name         | Type    | Mandatory  | Description              |
| ----------- | ------ | ---- | ---------------- |
W
wusongqing 已提交
1338
| bundleName  | string | Yes   | Bundle name of an application.    |
W
wusongqing 已提交
1339
| abilityName | string | Yes   | Ability name.|
W
wusongqing 已提交
1340 1341 1342

**Return value**

W
wusongqing 已提交
1343 1344
| Type              | Description                |
| ---------------- | ------------------ |
W
wusongqing 已提交
1345
| Promise\<string> | Promise used to return the application name.|
W
wusongqing 已提交
1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359

**Example**

```js
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityLabel(bundleName, abilityName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

W
wusongqing 已提交
1360
## bundle.getAbilityLabel<sup>8+</sup>
W
wusongqing 已提交
1361 1362 1363

getAbilityLabel(bundleName: string, abilityName: string, callback : AsyncCallback\<string>): void

W
wusongqing 已提交
1364
Obtains the application name based on a given bundle name and ability name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1376 1377
| Name         | Type                    | Mandatory  | Description              |
| ----------- | ---------------------- | ---- | ---------------- |
W
wusongqing 已提交
1378
| bundleName  | string                 | Yes   | Bundle name of an application.    |
W
wusongqing 已提交
1379
| abilityName | string                 | Yes   | Ability name.|
W
wusongqing 已提交
1380
| callback    | AsyncCallback\<string> | Yes   | Callback used to return the application name.       |
W
wusongqing 已提交
1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394

**Example**

```js
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityLabel(bundleName, abilityName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
W
wusongqing 已提交
1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412
## bundle.getAbilityLabel<sup>9+</sup>

getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Promise\<string>

Obtains the application name based on a given bundle name, module name, and ability name. This API uses a promise to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name         | Type    | Mandatory  | Description              |
| ----------- | ------ | ---- | ---------------- |
W
wusongqing 已提交
1413
| bundleName  | string | Yes   | Bundle name of an application.    |
W
wusongqing 已提交
1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454
| moduleName  | string | Yes   | Module name of the application.    |
| abilityName | string | Yes   | Ability name.|

**Return value**

| Type              | Description                |
| ---------------- | ------------------ |
| Promise\<string> | Promise used to return the application name.|

**Example**

```js
let bundleName = "com.example.myapplication";
let moduleName = "entry";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityLabel(bundleName, moduleName, abilityName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

## bundle.getAbilityLabel<sup>9+</sup>

getAbilityLabel(bundleName: string, moduleName: string, abilityName: string, callback : AsyncCallback\<string>): void

Obtains the application name based on a given bundle name, module name, and ability name. This API uses an asynchronous callback to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name         | Type                    | Mandatory  | Description              |
| ----------- | ---------------------- | ---- | ---------------- |
W
wusongqing 已提交
1455
| bundleName  | string                 | Yes   | Bundle name of an application.    |
W
wusongqing 已提交
1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473
| moduleName  | string | Yes   | Module name of the application.    |
| abilityName | string                 | Yes   | Ability name.|
| callback    | AsyncCallback\<string> | Yes   | Callback used to return the application name.       |

**Example**

```js
let bundleName = "com.example.myapplication";
let moduleName = "entry";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityLabel(bundleName, moduleName, abilityName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
W
wusongqing 已提交
1474

W
wusongqing 已提交
1475
## bundle.isAbilityEnabled<sup>8+</sup>
W
wusongqing 已提交
1476 1477 1478

isAbilityEnabled(info: AbilityInfo): Promise\<boolean>

W
wusongqing 已提交
1479
Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses a promise to return the result.
W
wusongqing 已提交
1480 1481 1482 1483 1484 1485 1486

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1487 1488
| Name  | Type         | Mandatory  | Description          |
| ---- | ----------- | ---- | ------------ |
W
wusongqing 已提交
1489
| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes   | Ability information.|
W
wusongqing 已提交
1490 1491 1492

**Return value**

W
wusongqing 已提交
1493 1494
| Type               | Description                       |
| ----------------- | ------------------------- |
W
wusongqing 已提交
1495
| Promise\<boolean> | Promise used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
W
wusongqing 已提交
1496 1497 1498 1499

**Example**

```js
W
wusongqing 已提交
1500 1501 1502 1503 1504 1505 1506 1507
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityInfo(bundleName, abilityName).then((abilityInfo)=>{
    bundle.isAbilityEnabled(abilityInfo).then((data) => {
        console.info('Operation successful. Data: ' + JSON.stringify(data));
    }).catch((error) => {
        console.error('Operation failed. Cause: ' + JSON.stringify(error));
    })
W
wusongqing 已提交
1508 1509 1510
})
```

W
wusongqing 已提交
1511
## bundle.isAbilityEnabled<sup>8+</sup>
W
wusongqing 已提交
1512 1513 1514

isAbilityEnabled(info : AbilityInfo, callback : AsyncCallback\<boolean>): void

W
wusongqing 已提交
1515
Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1516 1517 1518 1519 1520 1521 1522

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1523 1524
| Name      | Type                     | Mandatory  | Description             |
| -------- | ----------------------- | ---- | --------------- |
W
wusongqing 已提交
1525 1526
| info     | [AbilityInfo](js-apis-bundle-AbilityInfo.md)             | Yes   | Ability information.   |
| callback | AsyncCallback\<boolean> | Yes   | Callback used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
W
wusongqing 已提交
1527 1528 1529 1530

**Example**

```js
W
wusongqing 已提交
1531 1532 1533 1534
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityInfo(bundleName, abilityName).then((abilityInfo)=>{
    bundle.isAbilityEnabled(abilityInfo, (err, data) => {
W
wusongqing 已提交
1535 1536 1537 1538 1539
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
W
wusongqing 已提交
1540
    })
W
wusongqing 已提交
1541 1542 1543
})
```

W
wusongqing 已提交
1544
## bundle.isApplicationEnabled<sup>8+</sup>
W
wusongqing 已提交
1545 1546 1547

isApplicationEnabled(bundleName: string): Promise\<boolean>

W
wusongqing 已提交
1548
Checks whether an application is enabled based on a given bundle name. This API uses a promise to return the result.
W
wusongqing 已提交
1549 1550 1551 1552 1553 1554 1555

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1556 1557
| Name        | Type    | Mandatory  | Description          |
| ---------- | ------ | ---- | ------------ |
W
wusongqing 已提交
1558
| bundleName | string | Yes   | Bundle name of an application.|
W
wusongqing 已提交
1559 1560 1561

**Return value**

W
wusongqing 已提交
1562 1563
| Type               | Description                       |
| ----------------- | ------------------------- |
W
wusongqing 已提交
1564
| Promise\<boolean> | Promise used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
W
wusongqing 已提交
1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577

**Example**

```js
let bundleName = "com.example.myapplication";
bundle.isApplicationEnabled(bundleName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

W
wusongqing 已提交
1578
## bundle.isApplicationEnabled<sup>8+</sup>
W
wusongqing 已提交
1579 1580 1581

isApplicationEnabled(bundleName: string, callback : AsyncCallback\<boolean>): void

W
wusongqing 已提交
1582
Checks whether an application is enabled based on a given bundle name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1583 1584 1585 1586 1587 1588 1589

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1590 1591
| Name        | Type                     | Mandatory  | Description             |
| ---------- | ----------------------- | ---- | --------------- |
W
wusongqing 已提交
1592
| bundleName | string                  | Yes   | Bundle name of an application.   |
W
wusongqing 已提交
1593
| callback   | AsyncCallback\<boolean> | Yes   | Callback used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
W
wusongqing 已提交
1594 1595 1596 1597

**Example**

```js
W
wusongqing 已提交
1598
let bundleName = "com.example.myapplication";
W
wusongqing 已提交
1599 1600 1601 1602 1603 1604 1605 1606
bundle.isApplicationEnabled(bundleName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
W
wusongqing 已提交
1607 1608 1609 1610 1611

## bundle.queryAbilityByWant

queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise<Array\<AbilityInfo>>

W
wusongqing 已提交
1612
Obtains the ability information based on a given want. This API uses a promise to return the result.
W
wusongqing 已提交
1613

W
wusongqing 已提交
1614
**Required permissions**
W
wusongqing 已提交
1615

W
wusongqing 已提交
1616 1617 1618 1619 1620
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1621 1622 1623

**Parameters**

W
wusongqing 已提交
1624 1625
| Name         | Type    | Mandatory  | Description                                   |
| ----------- | ------ | ---- | ------------------------------------- |
W
wusongqing 已提交
1626
| want        | [Want](js-apis-application-Want.md)   | Yes   | Want that contains the bundle name.                    |
1627
| bundleFlags | number | Yes   | Ability information to be returned. The default value is **0**. For details on the available enumerated values, see the ability information flags in [BundleFlag](#bundleflag).|
W
wusongqing 已提交
1628
| 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.          |
W
wusongqing 已提交
1629 1630 1631

**Return value**

W
wusongqing 已提交
1632 1633
| Type                          | Description                   |
| ---------------------------- | --------------------- |
W
wusongqing 已提交
1634
| Promise<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Promise used to return the ability information.|
W
wusongqing 已提交
1635 1636 1637 1638

**Example**

```js
W
wusongqing 已提交
1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649
let bundleFlags = 0;
let userId = 100;
let want = {
    bundleName : "com.example.myapplication",
    abilityName : "com.example.myapplication.MainAbility"
};
bundle.queryAbilityByWant(want, bundleFlags, userId)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
W
wusongqing 已提交
1650 1651 1652 1653 1654 1655 1656
})
```



## bundle.queryAbilityByWant

W
wusongqing 已提交
1657
queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback<Array\<AbilityInfo>>): void
W
wusongqing 已提交
1658

W
wusongqing 已提交
1659 1660 1661 1662 1663
Obtains the ability information of the specified user based on a given want. This API uses an asynchronous callback to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
W
wusongqing 已提交
1664 1665 1666 1667

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1668 1669 1670

**Parameters**

1671 1672 1673 1674 1675 1676
| Name       | Type                                                        | Mandatory| Description                                                        |
| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| want        | [Want](js-apis-application-Want.md)                          | Yes  | Want that contains the bundle name.                      |
| bundleFlags | number                                                       | Yes  | Ability information to be returned. The default value is **0**. For details on the available enumerated values, see the ability information flags in [BundleFlag](#bundleflag).|
| 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.         |
| callback    | AsyncCallback<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Yes  | Callback used to return the ability information.               |
W
wusongqing 已提交
1677 1678 1679 1680

**Example**

```js
W
wusongqing 已提交
1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693
let bundleFlags = 0;
let userId = 100;
let want = {
    bundleName : "com.example.myapplication",
    abilityName : "com.example.myapplication.MainAbility"
};
bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
W
wusongqing 已提交
1694 1695 1696 1697
```

## bundle.queryAbilityByWant

W
wusongqing 已提交
1698
queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Array\<AbilityInfo>>): void;
W
wusongqing 已提交
1699

W
wusongqing 已提交
1700
Obtains the ability information based on a given want. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1701

W
wusongqing 已提交
1702 1703 1704 1705
**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

W
wusongqing 已提交
1706 1707 1708 1709
**System capability**

SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1710 1711
**Parameters**

1712 1713 1714 1715 1716
| Name       | Type                                                        | Mandatory| Description                                                        |
| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| want        | [Want](js-apis-application-Want.md)                          | Yes  | Want that contains the bundle name.                      |
| bundleFlags | number                                                       | Yes  | Ability information to be returned. The default value is **0**. For details on the available enumerated values, see the ability information flags in [BundleFlag](#bundleflag).|
| callback    | AsyncCallback<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Yes  | Callback used to return the ability information.               |
W
wusongqing 已提交
1717 1718 1719 1720

**Example**

```js
W
wusongqing 已提交
1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731
let bundleFlags = 0;
let want = {
    bundleName : "com.example.myapplication",
    abilityName : "com.example.myapplication.MainAbility"
};
bundle.queryAbilityByWant(want, bundleFlags, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
W
wusongqing 已提交
1732 1733 1734 1735 1736
})
```



W
wusongqing 已提交
1737 1738 1739 1740
## bundle.getLaunchWantForBundle

getLaunchWantForBundle(bundleName: string): Promise\<Want>

W
wusongqing 已提交
1741
Obtains the **Want** object that launches the specified application. This API uses a promise to return the result.
W
wusongqing 已提交
1742

W
wusongqing 已提交
1743 1744
**Required permissions**

W
wusongqing 已提交
1745 1746 1747 1748 1749
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1750 1751 1752

**Parameters**

W
wusongqing 已提交
1753 1754
| Name        | Type    | Mandatory  | Description          |
| ---------- | ------ | ---- | ------------ |
W
wusongqing 已提交
1755
| bundleName | string | Yes   | Bundle name of an application.|
W
wusongqing 已提交
1756 1757

**Return value**
W
wusongqing 已提交
1758 1759
| Type            | Description                                    |
| -------------- | -------------------------------------- |
W
wusongqing 已提交
1760
| Promise\<[Want](js-apis-application-Want.md)> | Promise used to return the **Want** object.|
W
wusongqing 已提交
1761 1762 1763 1764

**Example**

```js
W
wusongqing 已提交
1765 1766 1767 1768 1769 1770 1771
let bundleName = "com.example.myapplication";
bundle.getLaunchWantForBundle(bundleName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
W
wusongqing 已提交
1772 1773
```

W
wusongqing 已提交
1774
## bundle.getLaunchWantForBundle
W
wusongqing 已提交
1775

W
wusongqing 已提交
1776
getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void;
W
wusongqing 已提交
1777

W
wusongqing 已提交
1778
Obtains the **Want** object that launches the specified application. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1779

W
wusongqing 已提交
1780
**Required permissions**
W
wusongqing 已提交
1781

W
wusongqing 已提交
1782 1783 1784 1785 1786
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1787 1788 1789

**Parameters**

W
wusongqing 已提交
1790 1791
| Name        | Type                  | Mandatory  | Description                            |
| ---------- | -------------------- | ---- | ------------------------------ |
W
wusongqing 已提交
1792
| bundleName | string               | Yes   | Bundle name of an application.                  |
W
wusongqing 已提交
1793
| callback   | AsyncCallback\<[Want](js-apis-application-Want.md)> | Yes   | Callback used to return the **Want** object.|
W
wusongqing 已提交
1794 1795 1796 1797

**Example**

```js
W
wusongqing 已提交
1798 1799 1800 1801 1802 1803 1804 1805
let bundleName = "com.example.myapplication";
bundle.getLaunchWantForBundle(bundleName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
W
wusongqing 已提交
1806 1807 1808
```


W
wusongqing 已提交
1809
## bundle.getNameForUid<sup>8+</sup>
W
wusongqing 已提交
1810 1811

getNameForUid(uid: number): Promise\<string>
W
wusongqing 已提交
1812

W
wusongqing 已提交
1813
Obtains the bundle name based on a UID. This API uses a promise to return the result.
W
wusongqing 已提交
1814 1815 1816 1817

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1818 1819 1820

**Parameters**

W
wusongqing 已提交
1821 1822
| Name  | Type    | Mandatory  | Description      |
| ---- | ------ | ---- | -------- |
W
wusongqing 已提交
1823
| uid  | number | Yes   | UID based on which the bundle name is to obtain.|
W
wusongqing 已提交
1824 1825

**Return value**
W
wusongqing 已提交
1826 1827
| Type              | Description                               |
| ---------------- | --------------------------------- |
W
wusongqing 已提交
1828
| Promise\<string> | Promise used to return the bundle name.|
W
wusongqing 已提交
1829 1830 1831 1832

**Example**

```js
W
wusongqing 已提交
1833 1834 1835 1836 1837 1838 1839
let uid = 20010005;
bundle.getNameForUid(uid)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
W
wusongqing 已提交
1840 1841
```

W
wusongqing 已提交
1842
## bundle.getNameForUid<sup>8+</sup>
W
wusongqing 已提交
1843

W
wusongqing 已提交
1844
getNameForUid(uid: number, callback: AsyncCallback\<string>) : void
W
wusongqing 已提交
1845

W
wusongqing 已提交
1846
Obtains the bundle name based on a UID. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1847

W
wusongqing 已提交
1848 1849 1850
**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1851 1852 1853

**Parameters**

W
wusongqing 已提交
1854 1855 1856
| Name      | Type                    | Mandatory  | Description                       |
| -------- | ---------------------- | ---- | ------------------------- |
| uid      | number                 | Yes   | UID based on which the bundle name is to obtain.                 |
W
wusongqing 已提交
1857
| callback | AsyncCallback\<string> | Yes   | Callback used to return the bundle name.|
W
wusongqing 已提交
1858 1859 1860 1861

**Example**

```js
W
wusongqing 已提交
1862 1863 1864 1865 1866 1867 1868 1869
let uid = 20010005;
bundle.getNameForUid(uid, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
W
wusongqing 已提交
1870 1871
```

W
wusongqing 已提交
1872

W
wusongqing 已提交
1873
## bundle.getAbilityIcon<sup>8+</sup>
W
wusongqing 已提交
1874

W
wusongqing 已提交
1875
getAbilityIcon(bundleName: string, abilityName: string): Promise\<image.PixelMap>;
W
wusongqing 已提交
1876

W
wusongqing 已提交
1877
Obtains 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.
W
wusongqing 已提交
1878

W
wusongqing 已提交
1879 1880
**Required permissions**

W
wusongqing 已提交
1881
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
W
wusongqing 已提交
1882 1883 1884 1885 1886

**System capability**

SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1887 1888
**Parameters**

W
wusongqing 已提交
1889 1890 1891 1892
| Name         | Type                                      | Mandatory  | Description                                      |
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName  | string                                   | Yes   | Bundle name based on which the pixel map is to obtain.                         |
| abilityName | string                                   | Yes   | Ability name based on which the pixel map is to obtain.                        |
W
wusongqing 已提交
1893 1894 1895 1896

**Return value**
| Type                 | Description                                                        |
| --------------------- | ------------------------------------------------------------ |
W
wusongqing 已提交
1897
| Promise\<image.PixelMap> | Promise used to return the [pixel map](js-apis-image.md).|
W
wusongqing 已提交
1898 1899 1900 1901

**Example**

```js
W
wusongqing 已提交
1902 1903
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
W
wusongqing 已提交
1904 1905 1906 1907 1908 1909 1910 1911
bundle.getAbilityIcon(bundleName, abilityName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

W
wusongqing 已提交
1912
## bundle.getAbilityIcon<sup>8+</sup>
W
wusongqing 已提交
1913

W
wusongqing 已提交
1914
getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<image.PixelMap>): void;
W
wusongqing 已提交
1915

W
wusongqing 已提交
1916
Obtains 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.
W
wusongqing 已提交
1917

W
wusongqing 已提交
1918 1919
**Required permissions**

W
wusongqing 已提交
1920
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
W
wusongqing 已提交
1921 1922 1923 1924 1925

**System capability**

SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1926 1927
**Parameters**

W
wusongqing 已提交
1928 1929 1930 1931
| Name         | Type                                      | Mandatory  | Description                                      |
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName  | string                                   | Yes   | Bundle name based on which the pixel map is to obtain.                         |
| abilityName | string                                   | Yes   | Ability name based on which the pixel map is to obtain.                        |
W
wusongqing 已提交
1932
| callback   | AsyncCallback\<image.PixelMap> | Yes  | Callback used to return the [pixel map](js-apis-image.md).|
W
wusongqing 已提交
1933 1934 1935 1936

**Example**

```js
W
wusongqing 已提交
1937 1938
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
W
wusongqing 已提交
1939 1940 1941 1942 1943 1944 1945 1946 1947
bundle.getAbilityIcon(bundleName, abilityName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```

W
wusongqing 已提交
1948 1949 1950 1951
## bundle.getAbilityIcon<sup>9+</sup>

getAbilityIcon(bundleName: string, moduleName: string, abilityName: string): Promise\<image.PixelMap>;

W
wusongqing 已提交
1952
Obtains the [pixel map](js-apis-image.md) of the icon corresponding to a given bundle name, module name, and ability name. This API uses a promise to return the result.
W
wusongqing 已提交
1953 1954 1955

**Required permissions**

W
wusongqing 已提交
1956
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
W
wusongqing 已提交
1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name         | Type                                      | Mandatory  | Description                                      |
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName  | string                                   | Yes   | Bundle name based on which the pixel map is to obtain.                         |
| moduleName  | string                                   | Yes   | Module name based on which the pixel map is to obtain.                         |
| abilityName | string                                   | Yes   | Ability name based on which the pixel map is to obtain.                        |

**Return value**
| Type                 | Description                                                        |
| --------------------- | ------------------------------------------------------------ |
W
wusongqing 已提交
1973
| Promise\<image.PixelMap> | Promise used to return the [pixel map](js-apis-image.md).|
W
wusongqing 已提交
1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992

**Example**

```js
let bundleName = "com.example.myapplication";
let moduleName = "entry";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityIcon(bundleName, moduleName, abilityName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

## bundle.getAbilityIcon<sup>9+</sup>

getAbilityIcon(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback\<image.PixelMap>): void;

W
wusongqing 已提交
1993
Obtains the [pixel map](js-apis-image.md) of the icon corresponding to a given bundle name, module name, and ability name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1994 1995 1996

**Required permissions**

W
wusongqing 已提交
1997
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
W
wusongqing 已提交
1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name         | Type                                      | Mandatory  | Description                                      |
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName  | string                                   | Yes   | Bundle name based on which the pixel map is to obtain.                         |
| moduleName  | string                                   | Yes   | Module name based on which the pixel map is to obtain.                         |
| abilityName | string                                   | Yes   | Ability name based on which the pixel map is to obtain.                        |
W
wusongqing 已提交
2010
| callback   | AsyncCallback\<image.PixelMap> | Yes  | Callback used to return the [pixel map](js-apis-image.md).|
W
wusongqing 已提交
2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025

**Example**

```js
let bundleName = "com.example.myapplication";
let moduleName = "entry";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityIcon(bundleName, moduleName, abilityName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
W
wusongqing 已提交
2026

W
wusongqing 已提交
2027
## bundle.queryExtensionAbilityInfos<sup>9+</sup>
W
wusongqing 已提交
2028

W
wusongqing 已提交
2029
queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, userId?: number): Promise<Array\<ExtensionAbilityInfo>>
W
wusongqing 已提交
2030

W
wusongqing 已提交
2031
Obtains the Extension ability information based on a given want. This API uses a promise to return the result.
W
wusongqing 已提交
2032 2033 2034

**Required permissions**

W
wusongqing 已提交
2035
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
W
wusongqing 已提交
2036 2037 2038 2039 2040 2041 2042

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
2043 2044
| Name            | Type    | Mandatory  | Description                                      |
| -------------- | ------ | ---- | ---------------------------------------- |
W
wusongqing 已提交
2045
| want           | [Want](js-apis-application-Want.md)   | Yes   | Want that contains the bundle name.                       |
W
wusongqing 已提交
2046
| extensionType  | number | Yes   | Type of the Extension ability information to obtain. The default value is **0**. For details on the available enumerated values, see [ExtensionAbilityType](#extensionabilitytype9).|
2047
| extensionFlags | number | Yes   | Extension ability information to be returned. The default value is **0**. For details on the available enumerated values, see [ExtensionFlags](#extensionflag9).|
W
wusongqing 已提交
2048
| 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.             |
W
wusongqing 已提交
2049 2050 2051

**Return value**

W
wusongqing 已提交
2052 2053
| Type                                   | Description                            |
| ------------------------------------- | ------------------------------ |
W
wusongqing 已提交
2054
| Promise<Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)>> | Promise used to return the Extension ability information.|
W
wusongqing 已提交
2055 2056 2057 2058

**Example**

```js
W
wusongqing 已提交
2059
let extensionType = 0;
W
wusongqing 已提交
2060 2061 2062 2063 2064 2065
let extensionFlags = 0;
let userId = 100;
let want = {
    bundleName : "com.example.myapplication",
    abilityName : "com.example.myapplication.MainAbility"
};
W
wusongqing 已提交
2066
bundle.queryExtensionAbilityInfos(want, extensionType, extensionFlags, userId)
W
wusongqing 已提交
2067 2068 2069 2070 2071 2072 2073 2074 2075
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```



W
wusongqing 已提交
2076
## bundle.queryExtensionAbilityInfos<sup>9+</sup>
W
wusongqing 已提交
2077

W
wusongqing 已提交
2078
queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, userId: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void
W
wusongqing 已提交
2079

W
wusongqing 已提交
2080
Obtains the Extension ability information of the specified user based on a given want. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
2081

W
wusongqing 已提交
2082 2083
**Required permissions**

W
wusongqing 已提交
2084
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
W
wusongqing 已提交
2085

W
wusongqing 已提交
2086 2087 2088 2089 2090 2091
**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
2092 2093 2094
| Name          | Type                                                        | Mandatory| Description                                                        |
| -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| want           | [Want](js-apis-application-Want.md)                                                        | Yes  | Want that contains the bundle name.                      |
W
wusongqing 已提交
2095
| extensionType  | number                                                       | Yes  | Type of the Extension ability information to obtain. The default value is **0**. For details on the available enumerated values, see [ExtensionAbilityType](#extensionabilitytype9).|
2096
| extensionFlags | number                                                       | Yes  | Extension ability information to be returned. The default value is **0**. For details on the available enumerated values, see [ExtensionFlags](#extensionflag9).|
W
wusongqing 已提交
2097 2098
| 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.         |
| callback       | AsyncCallback<Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)>> | Yes  | Callback used to return the Extension ability information.      |
W
wusongqing 已提交
2099 2100 2101 2102

**Example**

```js
W
wusongqing 已提交
2103
let extensionType = 0;
W
wusongqing 已提交
2104 2105 2106 2107 2108 2109
let extensionFlags = 0;
let userId = 100;
let want = {
    bundleName : "com.example.myapplication",
    abilityName : "com.example.myapplication.MainAbility"
};
W
wusongqing 已提交
2110 2111 2112 2113 2114 2115 2116
const receiver = function onReceive(err, data) {
    var errValue = JSON.stringify(err)
    var dataValue = JSON.stringify(data)
    console.error('Operation failed. Cause: ' + errValue);
    console.error('Operation failed. Cause: ' + dataValue);
}
bundle.queryExtensionAbilityInfos(want, extensionType, extensionFlags, userId, receiver)
W
wusongqing 已提交
2117 2118
```

W
wusongqing 已提交
2119
## bundle.queryExtensionAbilityInfos<sup>9+</sup>
W
wusongqing 已提交
2120

W
wusongqing 已提交
2121
queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void;
W
wusongqing 已提交
2122

W
wusongqing 已提交
2123
Obtains the Extension ability information based on a given want. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
2124

W
wusongqing 已提交
2125 2126
**Required permissions**

W
wusongqing 已提交
2127
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
W
wusongqing 已提交
2128

W
wusongqing 已提交
2129 2130 2131 2132 2133 2134
**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
2135 2136
| Name            | Type                                      | Mandatory  | Description                                      |
| -------------- | ---------------------------------------- | ---- | ---------------------------------------- |
W
wusongqing 已提交
2137
| want           | [Want](js-apis-application-Want.md)                                     | Yes   | Want that contains the bundle name.                     |
W
wusongqing 已提交
2138
| extensionType  | number                                   | Yes   | Type of the Extension ability information to obtain. The default value is **0**. For details on the available enumerated values, see [ExtensionAbilityType](#extensionabilitytype9).|
2139
| extensionFlags | number                                   | Yes   | Extension ability information to be returned. The default value is **0**. For details on the available enumerated values, see [ExtensionFlags](#extensionflag9).|
W
wusongqing 已提交
2140
| callback       | AsyncCallback<Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)>> | Yes   | Callback used to return the Extension ability information.     |
W
wusongqing 已提交
2141 2142 2143 2144

**Example**

```js
W
wusongqing 已提交
2145
let extensionType = 0;
W
wusongqing 已提交
2146 2147 2148 2149 2150
let extensionFlags = 0;
let want = {
    bundleName : "com.example.myapplication",
    abilityName : "com.example.myapplication.MainAbility"
};
W
wusongqing 已提交
2151 2152 2153 2154 2155 2156 2157
const receiver = function onReceive(err, data) {
    var errValue = JSON.stringify(err)
    var dataValue = JSON.stringify(data)
    console.error('Operation failed. Cause: ' + errValue);
    console.error('Operation failed. Cause: ' + dataValue);
}
bundle.queryExtensionAbilityInfos(want, extensionType, extensionFlags, receiver)
W
wusongqing 已提交
2158 2159
```

W
wusongqing 已提交
2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291
## bundle.getProfileByAbility<sup>9+</sup>

getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback\<Array\<string>>): void;

Obtains the JSON string array of the current application's configuration file in the [metadata](js-apis-bundle-Metadata.md) based on a given module name, ability name, and metadata name. This API uses an asynchronous callback to return the result. This API cannot be used to obtain the JSON string array of another application.

**System capability**: SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name            | Type                               | Mandatory  | Description                                      |
| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
| moduleName     | string                               | Yes   | Module to which the configuration file to be obtained belongs.             |
| abilityName    | string                               | Yes   | Ability to which the configuration file to be obtained belongs.            |
| metadataName   | string                               | Yes   | Metadata to which the configuration file to be obtained belongs.           |
| callback       | AsyncCallback\<Array\<string>>        | Yes   | Callback used to return the JSON string array of the configuration file.  |

**Example**

```js
let moduleName = 'entry';
let abilityName = 'MainAbility';
let metadataName = 'ohos.ability.shortcuts';
const caller = function callback(err, data) {
    console.error('Operation errcode is: ' + err);
    console.error('Operation result is: ' + data);
}
bundle.getProfileByAbility(moduleName, abilityName, metadataName, caller)
```

## bundle.getProfileByAbility<sup>9+</sup>

getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise\<Array\<string>>;

Obtains the JSON string array of the current application's configuration file in the [metadata](js-apis-bundle-Metadata.md) based on a given module name, ability name, and metadata name. This API uses a promise to return the result. This API cannot be used to obtain the JSON string array of another application.

**System capability**: SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name            | Type                               | Mandatory  | Description                                      |
| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
| moduleName     | string                               | Yes   | Module to which the configuration file to be obtained belongs.             |
| abilityName    | string                               | Yes   | Ability to which the configuration file to be obtained belongs.            |
| metadataName   | string                               | No   | Metadata to which the configuration file to be obtained belongs.           |

**Return value**

| Type                                   | Description                            |
| ------------------------------------- | ------------------------------ |
| Promise\<Array\<string>> | Promise used to return the JSON string array of the configuration file.|

**Example**

```js
let moduleName = 'entry';
let abilityName = 'MainAbility';
let metadataName = 'ohos.ability.shortcuts';

bundle.getProfileByAbility(moduleName, abilityName, metadataName).then(data=>{
    console.error('Operation result is: ' + data);
}).catch(err=>{
    console.error('Operation errcode is: ' + err);
})
```

## bundle.getProfileByExtensionAbility<sup>9+</sup>

getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback\<Array\<string>>): void;

Obtains the JSON string array of the current application's configuration file in the [metadata](js-apis-bundle-Metadata.md) based on a given module name, Extension ability name, and metadata name. This API uses an asynchronous callback to return the result. This API cannot be used to obtain the JSON string array of another application.

**System capability**: SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name            | Type                               | Mandatory  | Description                                      |
| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
| moduleName     | string                               | Yes   | Module to which the configuration file to be obtained belongs.             |
| extensionAbilityName    | string                               | Yes   | Extension ability to which the configuration file to be obtained belongs.            |
| metadataName   | string                               | Yes   | Metadata to which the configuration file to be obtained belongs.           |
| callback       | AsyncCallback\<Array\<string>>        | Yes   | Callback used to return the JSON string array of the configuration file.  |

**Example**

```js
let moduleName = 'entry';
let extensionAbilityName = 'Form';
let metadataName = 'ohos.extension.form';
const caller = function callback(err, data) {
    console.error('Operation errcode is: ' + err);
    console.error('Operation result is: ' + data);
}
bundle.getProfileByExtensionAbility(moduleName, extensionAbilityName, metadataName, caller)
```

## bundle.getProfileByExtensionAbility<sup>9+</sup>

getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise\<Array\<string>>;

Obtains the JSON string array of the current application's configuration file in the [metadata](js-apis-bundle-Metadata.md) based on a given module name, Extension ability name, and metadata name. This API uses a promise to return the result. This API cannot be used to obtain the JSON string array of another application.

**System capability**: SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name            | Type                               | Mandatory  | Description                                      |
| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
| moduleName     | string                               | Yes   | Module to which the configuration file to be obtained belongs.             |
| extensionAbilityName    | string                               | Yes   | Extension ability to which the configuration file to be obtained belongs.            |
| metadataName   | string                               | No   | Metadata to which the configuration file to be obtained belongs.           |

**Return value**

| Type                                   | Description                            |
| ------------------------------------- | ------------------------------ |
| Promise\<Array\<string>> | Promise used to return the JSON string array of the configuration file.|

**Example**

```js
let moduleName = 'entry';
let extensionAbilityName = 'Form';
let metadataName = 'ohos.extension.form';

bundle.getProfileByExtensionAbility(moduleName, extensionAbilityName, metadataName).then(data=>{
    console.error('Operation result is: ' + data);
}).catch(err=>{
    console.error('Operation errcode is: ' + err);
})
```

W
wusongqing 已提交
2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427
## bundle.setDisposedStatus<sup>9+</sup>

setDisposedStatus(bundleName: string, status: number, callback: AsyncCallback\<void>): void;

Sets the disposal status for an application based on a given bundle name. This API uses an asynchronous callback to return the result.

**Required permissions**: ohos.permission.MANAGE_DISPOSED_APP_STATUS

**System capability**: SystemCapability.BundleManager.BundleFramework

**System API**: This is a system API and cannot be called by third-party applications.

**Parameters**

| Name            | Type                               | Mandatory  | Description                                      |
| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
| bundleName     | string                               | Yes   | Bundle name of an application.             |
| status    | number                               | Yes   | Disposal status to set. This parameter is reserved for the application market. The default value is **0**, indicating that no disposal is performed.            |
| callback       | AsyncCallback\<void>        | Yes   | Callback that returns no value.  |

**Example**

```js
let bundleName = 'com.ohos.camera';
let status = 1;
const caller = function callback(err, data) {
    console.error('Operation err is: ' + err);
    console.error('Operation result is: ' + data);
}
bundle.setDisposedStatus(bundleName, status, caller)
```

## bundle.setDisposedStatus<sup>9+</sup>

setDisposedStatus(bundleName: string, status: number): Promise\<void>;

Sets the disposal status for an application based on a given bundle name. This API uses a promise to return the result.

**Required permissions**: ohos.permission.MANAGE_DISPOSED_APP_STATUS

**System capability**: SystemCapability.BundleManager.BundleFramework

**System API**: This is a system API and cannot be called by third-party applications.

**Parameters**

| Name            | Type                               | Mandatory  | Description                                      |
| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
| bundleName     | string                               | Yes   | Bundle name of an application.             |
| status    | number                               | Yes   | Disposal status to set. This parameter is reserved for the application market. The default value is **0**, indicating that no disposal is performed.            |

**Return value**

| Type                                   | Description                            |
| ------------------------------------- | ------------------------------ |
| Promise\<void> | Promise that returns no value.|

**Example**

```js
let bundleName = 'com.ohos.camera';
let status = 1;

bundle.setDisposedStatus(bundleName, status).then(data=>{
    console.error('Operation result is: ' + data);
}).catch(err=>{
    console.error('Operation err is: ' + err);
})
```

## bundle.getDisposedStatus<sup>9+</sup>

getDisposedStatus(bundleName: string, callback: AsyncCallback\<number>): void;

Obtains the disposal status of an application based on a given bundle name. This API uses an asynchronous callback to return the result.

**Required permissions**: ohos.permission.MANAGE_DISPOSED_APP_STATUS

**System capability**: SystemCapability.BundleManager.BundleFramework

**System API**: This is a system API and cannot be called by third-party applications.

**Parameters**

| Name            | Type                               | Mandatory  | Description                                      |
| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
| bundleName     | string                               | Yes   | Bundle name of an application.             |
| callback       | AsyncCallback\<number>        | Yes   | Callback used to return the disposal status.  |

**Example**

```js
let bundleName = 'com.ohos.camera';
const caller = function callback(err, data) {
    console.error('Operation err is: ' + err);
    console.error('Operation result is: ' + data);
}
bundle.getDisposedStatus(bundleName, caller)
```

## bundle.getDisposedStatus<sup>9+</sup>

getDisposedStatus(bundleName: string): Promise\<number>;

Obtains the disposal status of an application based on a given bundle name. This API uses a promise to return the result.

**Required permissions**: ohos.permission.MANAGE_DISPOSED_APP_STATUS

**System capability**: SystemCapability.BundleManager.BundleFramework

**System API**: This is a system API and cannot be called by third-party applications.

**Parameters**

| Name            | Type                               | Mandatory  | Description                                      |
| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
| bundleName     | string                               | Yes   | Bundle name of an application.             |

**Return value**

| Type                                   | Description                            |
| ------------------------------------- | ------------------------------ |
| Promise\<number> | Promise used to return the disposal status.|

**Example**

```js
let bundleName = 'com.ohos.camera';

bundle.getDisposedStatus(bundleName).then(data=>{
    console.error('Operation result is: ' + data);
}).catch(err=>{
    console.error('Operation err is: ' + err);
})
```

W
wusongqing 已提交
2428
## InstallErrorCode
W
wusongqing 已提交
2429

W
wusongqing 已提交
2430 2431
 **System capability**: SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
2432 2433 2434
| Name                                      | Default Value | Description                       |
| ---------------------------------------- | ---- | ------------------------- |
| SUCCESS                                  | 0    | Installation succeeded.                     |
W
wusongqing 已提交
2435
| STATUS_INSTALL_FAILURE                   | 1    | Installation failed. (The application to be installed is not found.)           |
W
wusongqing 已提交
2436 2437
| STATUS_INSTALL_FAILURE_ABORTED           | 2    | Installation aborted.                     |
| STATUS_INSTALL_FAILURE_INVALID           | 3    | Invalid installation parameter.                   |
W
wusongqing 已提交
2438
| STATUS_INSTALL_FAILURE_CONFLICT          | 4    | Installation conflict. (The basic information of the application to update is inconsistent with that of the existing application.) |
W
wusongqing 已提交
2439
| STATUS_INSTALL_FAILURE_STORAGE           | 5    | Failed to store the bundle information.                  |
W
wusongqing 已提交
2440 2441
| STATUS_INSTALL_FAILURE_INCOMPATIBLE      | 6    | Installation incompatibility. (A downgrade occurs or the signature information is incorrect.) |
| STATUS_UNINSTALL_FAILURE                 | 7    | Uninstallation failed. (The application to be uninstalled is not found.)          |
W
wusongqing 已提交
2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453
| STATUS_UNINSTALL_FAILURE_BLOCKED         | 8    | Uninstallation aborted. (This error code is not in use.)              |
| STATUS_UNINSTALL_FAILURE_ABORTED         | 9    | Uninstallation aborted. (Invalid parameters.)            |
| STATUS_UNINSTALL_FAILURE_CONFLICT        | 10   | Uninstallation conflict. (Failed to uninstall a system application or end the application process.)|
| STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT  | 0x0B | Installation failed. (Download timed out.)              |
| STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED   | 0x0C | Installation failed. (Download failed.)              |
| STATUS_RECOVER_FAILURE_INVALID<sup>8+</sup> | 0x0D | Failed to restore the pre-installed application.                 |
| STATUS_ABILITY_NOT_FOUND                 | 0x40 | Ability not found.               |
| STATUS_BMS_SERVICE_ERROR                 | 0x41 | BMS service error.                  |
| STATUS_FAILED_NO_SPACE_LEFT<sup>8+</sup> | 0x42 | Insufficient device space.                   |
| STATUS_GRANT_REQUEST_PERMISSIONS_FAILED<sup>8+</sup> | 0x43 | Application authorization failed.                   |
| STATUS_INSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x44 | Installation permission denied.                   |
| STATUS_UNINSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x45 | Uninstallation permission denied.                   |
W
wusongqing 已提交
2454 2455 2456

## BundleFlag

W
wusongqing 已提交
2457 2458 2459
Enumerates bundle flags.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
2460

W
wusongqing 已提交
2461 2462 2463 2464 2465 2466 2467 2468 2469
| Name                                      | Default Value       | Description                 |
| ---------------------------------------- | ---------- | ------------------- |
| GET_BUNDLE_DEFAULT                       | 0x00000000 | Obtains the default application information.          |
| GET_BUNDLE_WITH_ABILITIES                | 0x00000001 | Obtains the bundle information with the ability information.  |
| GET_ABILITY_INFO_WITH_PERMISSION         | 0x00000002 | Obtains the ability information with the permission information.   |
| GET_ABILITY_INFO_WITH_APPLICATION        | 0x00000004 | Obtains the ability information with the application information.   |
| GET_APPLICATION_INFO_WITH_PERMISSION     | 0x00000008 | Obtains the application information with the permission information.        |
| GET_BUNDLE_WITH_REQUESTED_PERMISSION     | 0x00000010 | Obtains the bundle information with the information about the required permissions.       |
| GET_ABILITY_INFO_WITH_METADATA<sup>8+</sup> | 0x00000020 | Obtains the ability metadata information.    |
W
wusongqing 已提交
2470
| GET_BUNDLE_WITH_EXTENSION_ABILITY<sup>9+</sup> | 0x00000020 | Obtains the bundle information with the Extension ability information.|
W
wusongqing 已提交
2471
| GET_APPLICATION_INFO_WITH_METADATA<sup>8+</sup> | 0x00000040 | Obtains the application metadata information.         |
W
wusongqing 已提交
2472
| GET_ABILITY_INFO_SYSTEMAPP_ONLY<sup>8+</sup> | 0x00000080 | Obtains the ability information of system applications.|
W
wusongqing 已提交
2473 2474
| GET_ABILITY_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000100 | Obtains information about disabled abilities.  |
| GET_APPLICATION_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000200 | Obtains information about disabled applications.       |
W
wusongqing 已提交
2475
| GET_APPLICATION_INFO_WITH_CERTIFICATE_FINGERPRINT <sup>9+</sup> | 0x00000400 | Obtains the signing certificate fingerprint of the application.       |
W
wusongqing 已提交
2476
| GET_ALL_APPLICATION_INFO                 | 0xFFFF0000 | Obtains all application information.          |
W
wusongqing 已提交
2477
| GET_BUNDLE_WITH_HASH_VALUE<sup>9+</sup> | 0x00000030 | Obtains information about the bundle that contains a hash value.      |
W
wusongqing 已提交
2478 2479 2480 2481 2482

## BundleOptions

Describes the bundle options.

W
wusongqing 已提交
2483 2484
 **System capability**: SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
2485 2486
| Name    | Type    | Readable  | Writable  | Description                          |
| ------ | ------ | ---- | ---- | ---------------------------- |
W
wusongqing 已提交
2487
| 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.|
W
wusongqing 已提交
2488 2489 2490

## AbilityType

W
wusongqing 已提交
2491 2492 2493
Enumerates ability types.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
2494

W
wusongqing 已提交
2495 2496 2497 2498 2499
| Name     | Type  | Description               |
| ------- | ---- | ----------------- |
| UNKNOWN | None   | Unknown ability type.      |
| PAGE    | None   | Ability that has a UI.   |
| SERVICE | None   | Ability that does not have a UI.    |
W
wusongqing 已提交
2500
| DATA    | None   | Ability that is used to provide data access services.|
W
wusongqing 已提交
2501 2502 2503

## DisplayOrientation

W
wusongqing 已提交
2504 2505 2506
Enumerates display orientations.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
2507

W
wusongqing 已提交
2508 2509
| Name           | Type  | Description           |
| ------------- | ---- | ------------- |
W
wusongqing 已提交
2510
| UNSPECIFIED   | None   | Unspecified display orientation.    |
W
wusongqing 已提交
2511 2512
| LANDSCAPE     | None   | Landscape orientation.     |
| PORTRAIT      | None   | Portrait orientation.     |
W
wusongqing 已提交
2513
| FOLLOW_RECENT | None   | Orientation same as that of the nearest ability in the stack.|
W
wusongqing 已提交
2514 2515 2516 2517 2518 2519 2520 2521 2522
| LANDSCAPE_INVERTED<sup>9+</sup> |None   | Reverse landscape orientation.    |
| PORTRAIT_INVERTED<sup>9+</sup> |None   | Reverse portrait orientation.    |
| AUTO_ROTATION<sup>9+</sup> |None   | Orientation determined by the sensor.    |
| AUTO_ROTATION_LANDSCAPE<sup>9+</sup> |None   | Orientation determined by the sensor in the horizontal direction, including landscape and reverse landscape.    |
| AUTO_ROTATION_PORTRAIT<sup>9+</sup> |None   | Orientation determined by the sensor in the vertical direction, including portrait and reverse portrait.    |
| AUTO_ROTATION_RESTRICTED<sup>9+</sup> |None   | Orientation determined by the sensor when the sensor switch is enabled.    |
| AUTO_ROTATION_LANDSCAPE_RESTRICTED<sup>9+</sup> |None   | Orientation determined by the sensor in the horizontal direction, including landscape and reverse landscape, when the sensor switch is enabled.    |
| AUTO_ROTATION_PORTRAIT_RESTRICTED<sup>9+</sup> |None   | Orientation determined by the sensor in the vertical direction, including portrait and reverse portrait, when the sensor switch is enabled.    |
| LOCKED<sup>9+</sup> |None   | Auto rotate disabled.    |
W
wusongqing 已提交
2523 2524
## LaunchMode

W
wusongqing 已提交
2525 2526 2527
Enumerates launch modes.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
2528

W
wusongqing 已提交
2529 2530
| Name       | Type  | Description           |
| --------- | ---- | ------------- |
W
wusongqing 已提交
2531
| SINGLETON | 0    | The ability has only one instance.|
W
wusongqing 已提交
2532
| STANDARD  | 1    | The ability can have multiple instances. |
W
wusongqing 已提交
2533 2534 2535

## AbilitySubType

W
wusongqing 已提交
2536 2537 2538
Enumerates ability subtypes.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
2539

W
wusongqing 已提交
2540 2541 2542
| Name         | Type  | Description                  |
| ----------- | ---- | -------------------- |
| UNSPECIFIED | 0    | Undefined ability subtype.       |
W
wusongqing 已提交
2543
| CA          | 1    | Ability that has a UI.|
W
wusongqing 已提交
2544

W
wusongqing 已提交
2545
## ExtensionAbilityType<sup>9+</sup>
W
wusongqing 已提交
2546

W
wusongqing 已提交
2547
Enumerates Extension ability types.
W
wusongqing 已提交
2548 2549 2550

 **System capability**: SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
2551 2552
| Name                            | Type  | Description                       |
| ------------------------------ | ---- | ------------------------- |
W
wusongqing 已提交
2553
| FORM<sup>9+</sup>              | 0    | Form (widget) included.  |
W
wusongqing 已提交
2554
| WORK_SCHEDULER<sup>9+</sup>    | 1    | Work scheduler included.|
W
wusongqing 已提交
2555 2556 2557
| INPUT_METHOD<sup>9+</sup>      | 2    | Input method included. |
| SERVICE<sup>9+</sup>           | 3    | Service included.  |
| ACCESSIBILITY<sup>9+</sup>     | 4    | Accessibility included. |
W
wusongqing 已提交
2558 2559
| DATA_SHARE<sup>9+</sup>        | 5    | Data sharing included.|
| FILE_SHARE<sup>9+</sup>        | 6    | File sharing included.|
W
wusongqing 已提交
2560 2561
| STATIC_SUBSCRIBER<sup>9+</sup> | 7    | Subscribers included. |
| WALLPAPER<sup>9+</sup>         | 8    | Wallpaper included.  |
W
wusongqing 已提交
2562 2563
| BACKUP<sup>9+</sup> | 9    | Data backup and restore included.|
| WINDOW<sup>9+</sup> | 10 | Window type extension information included.|
W
wusongqing 已提交
2564
| ENTERPRISE_ADMIN<sup>9+</sup>  | 11   | Enterprise administrators included.  |
W
wusongqing 已提交
2565 2566 2567
| THUMBNAIL<sup>9+</sup> | 13 | Thumbnails included.|
| PREVIEW<sup>9+</sup> | 14 | Preview included.|
| UNSPECIFIED<sup>9+</sup>       | 255   | Unspecified type.    |
W
wusongqing 已提交
2568 2569

## ExtensionFlag<sup>9+</sup>
W
wusongqing 已提交
2570

W
wusongqing 已提交
2571
Enumerates Extension flags.
W
wusongqing 已提交
2572 2573 2574

 **System capability**: SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
2575 2576 2577 2578 2579
| Name                                      | Default Value       | Description                            |
| ---------------------------------------- | ---------- | ------------------------------ |
| GET_EXTENSION_INFO_DEFAULT<sup>9+</sup>  | 0x00000000 | Obtains the default Extension ability information.     |
| GET_EXTENSION_INFO_WITH_PERMISSION<sup>9+</sup> | 0x00000002 | Obtains the Extension ability information that carries permission information. |
| GET_EXTENSION_INFO_WITH_APPLICATION<sup>9+</sup> | 0x00000004 | Obtains the Extension ability information that carries application information. |
W
wusongqing 已提交
2580
| GET_EXTENSION_INFO_WITH_METADATA<sup>9+</sup> | 0x00000020 | Obtains the Extension ability information that carries metadata information.|
W
wusongqing 已提交
2581 2582 2583 2584 2585 2586 2587

## ColorMode

Enumerates color modes.

 **System capability**: SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
2588 2589
| Name        | Type  | Description  |
| ---------- | ---- | ---- |
W
wusongqing 已提交
2590 2591 2592
| AUTO_MODE  | -1   | Automatic mode.|
| DARK_MODE  | 0    | Dark mode.|
| LIGHT_MODE | 1    | Light mode.|
W
wusongqing 已提交
2593 2594


W
wusongqing 已提交
2595 2596
## GrantStatus

W
wusongqing 已提交
2597
Enumerates permission grant states.
W
wusongqing 已提交
2598 2599 2600

 **System capability**: SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
2601 2602
| Name                | Type  | Description  |
| ------------------ | ---- | ---- |
W
wusongqing 已提交
2603
| PERMISSION_DENIED  | -1   | Permission denied.|
W
wusongqing 已提交
2604
| PERMISSION_GRANTED | 0    | Permission granted.  |
W
wusongqing 已提交
2605 2606 2607 2608 2609 2610 2611 2612 2613

## SupportWindowMode

Enumerates window modes.

 **System capability**: SystemCapability.BundleManager.BundleFramework

| Name                | Type  | Description  |
| ------------------ | ---- | ---- |
W
wusongqing 已提交
2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630
| FULL_SCREEN<sup>9+</sup> | 0   | Full screen.|
| SPLIT<sup>9+</sup> | 1    | Split-screen.  |
| FLOATING<sup>9+</sup> | 2    | Floating.  |

## UpgradeFlag

Enumerates the upgrade flags, which are for internal use only.

**System API**: This is a system API and cannot be called by third-party applications.

**System capability**: SystemCapability.BundleManager.BundleFramework

| Name                         | Value  | Description            |
| ----------------------------- | ---- | ---------------- |
| NOT_UPGRADE<sup>9+</sup>      | 0    | No module needs an upgrade.    |
| SINGLE_UPGRADE<sup>9+</sup>   | 1    | A single module needs an upgrade.|
| RELATION_UPGRADE<sup>9+</sup> | 2    | The module that has a relationship with the current one needs an upgrade.|