js-apis-Bundle.md 72.2 KB
Newer Older
W
wusongqing 已提交
1 2
# Bundle Module (JavaScript SDK APIs)

W
wusongqing 已提交
3 4 5
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> 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 已提交
6 7 8 9 10 11 12 13 14 15 16 17
## Modules to Import

```
import bundle from '@ohos.bundle';
```

## System Capabilities

SystemCapability.BundleManager.BundleFramework

## Required Permissions

W
wusongqing 已提交
18 19 20
|  Required Permissions| Permission Level| Description|
|-------| --------- | ---- |
| ohos.permission.GET_BUNDLE_INFO | normal | Permission to query information about the current application.|
W
wusongqing 已提交
21
| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED| system_basic | Permission to query information about all applications.|
W
wusongqing 已提交
22
| ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall applications.|
W
wusongqing 已提交
23 24 25

## bundle.getApplicationInfo

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

W
wusongqing 已提交
28
Obtains the application information based on a given bundle name. This method uses a promise to return the result.
W
wusongqing 已提交
29

W
wusongqing 已提交
30
**Required permissions**
W
wusongqing 已提交
31

W
wusongqing 已提交
32 33 34 35 36
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
37 38 39

**Parameters**

W
wusongqing 已提交
40
| Name       | Type  | Mandatory| Description                                                        |
W
wusongqing 已提交
41
| ----------- | ------ | ---- | ------------------------------------------------------------ |
W
wusongqing 已提交
42 43
| bundleName  | string | Yes  | Bundle name of the application.                                    |
| bundleFlags | number | Yes  | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
W
wusongqing 已提交
44
| 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 已提交
45 46 47

**Return value**

W
wusongqing 已提交
48
| Type     | Description|
W
wusongqing 已提交
49 50 51 52 53 54
| ----------- | -------- |
| Promise\<ApplicationInfo> | Promise used to return the application information.|

**Example**

```js
W
wusongqing 已提交
55 56 57 58 59 60 61 62
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 已提交
63 64 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 based on a given bundle name. This method 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**

W
wusongqing 已提交
84
| Name       | Type                           | Mandatory| Description                                                        |
W
wusongqing 已提交
85
| ----------- | ------------------------------- | ---- | ------------------------------------------------------------ |
W
wusongqing 已提交
86 87 88 89
| bundleName  | string                          | Yes  | Bundle name of the application.                                    |
| bundleFlags | number                          | Yes  | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| 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> | 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 106
```


W
wusongqing 已提交
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
## bundle.getApplicationInfo

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

Obtains the application information based on a given bundle name. This method 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                                                        |
| ----------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| bundleName  | string                          | Yes  | Bundle name of the application.                                    |
| bundleFlags | number                          | Yes  | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback    | AsyncCallback\<ApplicationInfo> | Yes  | Callback used to return the application information.              |

**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));
 })
```

W
wusongqing 已提交
143 144 145

## bundle.getAllBundleInfo

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

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

W
wusongqing 已提交
150
**Required permissions**
W
wusongqing 已提交
151

W
wusongqing 已提交
152 153 154 155 156
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
157 158 159

**Parameters**

W
wusongqing 已提交
160
| Name      | Type      | Mandatory| Description                                                       |
W
wusongqing 已提交
161
| ---------- | ---------- | ---- | ----------------------------------------------------------- |
W
wusongqing 已提交
162 163
| bundleFlag | BundleFlag | Yes  | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| 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 已提交
164 165 166

**Return value**

W
wusongqing 已提交
167
| Type                       | Description                               |
W
wusongqing 已提交
168 169 170 171 172 173
| --------------------------- | ----------------------------------- |
| Promise<Array\<BundleInfo>> | Promise used to return the information of all available bundles.|

**Example**

```js
W
wusongqing 已提交
174 175 176 177 178 179 180
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 已提交
181 182 183 184 185 186 187 188 189
})
```



## bundle.getAllBundleInfo

getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback<Array\<BundleInfo>>): void

W
wusongqing 已提交
190
Obtains the information of all available bundles in the system. This method uses an asynchronous callback to return the result.
W
wusongqing 已提交
191

W
wusongqing 已提交
192
**Required permissions**
W
wusongqing 已提交
193

W
wusongqing 已提交
194 195 196 197 198
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
199 200 201

**Parameters**

W
wusongqing 已提交
202
| Name      | Type                             | Mandatory| Description                                                        |
W
wusongqing 已提交
203
| ---------- | --------------------------------- | ---- | ------------------------------------------------------------ |
W
wusongqing 已提交
204 205
| bundleFlag | BundleFlag                        | Yes  | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback   | AsyncCallback<Array\<BundleInfo>> | Yes  | Callback used to return the information of all available bundles.      |
W
wusongqing 已提交
206 207 208 209

**Example**

```js
W
wusongqing 已提交
210 211 212 213 214 215 216 217 218
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 已提交
219

W
wusongqing 已提交
220 221 222 223 224

## bundle.getAllBundleInfo

getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback<Array\<BundleInfo>>): void

W
wusongqing 已提交
225
Obtains the information of all available bundles in the system. This method uses an asynchronous callback to return the result.
W
wusongqing 已提交
226 227 228

**Required permissions**

W
wusongqing 已提交
229 230 231 232 233
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254

**Parameters**

| Name      | Type                             | Mandatory| Description                                                        |
| ---------- | --------------------------------- | ---- | ------------------------------------------------------------ |
| bundleFlag | BundleFlag                        | Yes  | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| 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>> | Yes  | Callback used to return the information of all available bundles.      |

**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 已提交
255 256 257 258 259 260
```



## bundle.getBundleInfo

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

W
wusongqing 已提交
263
Obtains the bundle information based on a given bundle name. This method uses a promise to return the result.
W
wusongqing 已提交
264

W
wusongqing 已提交
265
**Required permissions**
W
wusongqing 已提交
266

W
wusongqing 已提交
267 268 269 270 271
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
272 273 274

**Parameters**

W
wusongqing 已提交
275
| Name       | Type  | Mandatory| Description                                                        |
W
wusongqing 已提交
276
| ----------- | ------ | ---- | ------------------------------------------------------------ |
W
wusongqing 已提交
277 278
| bundleName  | string | Yes  | Bundle name.                                                        |
| bundleFlags | number | Yes  | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
W
wusongqing 已提交
279
| options     | BundleOptions              | No  | Includes **userId**.                                   |
W
wusongqing 已提交
280 281 282

**Return value**

W
wusongqing 已提交
283
| Type                | Description                                      |
W
wusongqing 已提交
284 285 286 287 288 289
| -------------------- | ------------------------------------------ |
| Promise\<BundleInfo> | Promise used to return the bundle information.|

**Example**

```js
W
wusongqing 已提交
290 291 292
let bundleName = "com.example.myapplication";
let bundleFlags = 1;
let options = {
W
wusongqing 已提交
293
  "userId" : 100
W
wusongqing 已提交
294 295 296 297 298 299
};
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 已提交
300 301 302 303 304 305 306 307 308
})
```



## bundle.getBundleInfo

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

W
wusongqing 已提交
309
Obtains the bundle information based on a given bundle name. This method uses an asynchronous callback to return the result.
W
wusongqing 已提交
310

W
wusongqing 已提交
311
**Required permissions**
W
wusongqing 已提交
312

W
wusongqing 已提交
313 314 315 316 317
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
318 319 320

**Parameters**

W
wusongqing 已提交
321
| Name       | Type                      | Mandatory| Description                                                        |
W
wusongqing 已提交
322
| ----------- | -------------------------- | ---- | ------------------------------------------------------------ |
W
wusongqing 已提交
323 324 325
| bundleName  | string                     | Yes  | Bundle name.                                                        |
| bundleFlags | number                     | Yes  | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback    | AsyncCallback\<BundleInfo> | Yes  | Callback used to return the bundle information.                    |
W
wusongqing 已提交
326 327 328 329

**Example**

```js
W
wusongqing 已提交
330 331 332 333 334 335 336 337 338
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 已提交
339 340 341
```


W
wusongqing 已提交
342 343 344 345
## bundle.getBundleInfo

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

W
wusongqing 已提交
346
Obtains the bundle information based on a given bundle name. This method uses an asynchronous callback to return the result.
W
wusongqing 已提交
347 348 349

**Required permissions**

W
wusongqing 已提交
350 351 352 353 354
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
355 356 357 358 359 360 361

**Parameters**

| Name       | Type                      | Mandatory| Description                                                        |
| ----------- | -------------------------- | ---- | ------------------------------------------------------------ |
| bundleName  | string                     | Yes  | Bundle name.                                                        |
| bundleFlags | number                     | Yes  | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
W
wusongqing 已提交
362
| options     | BundleOptions              | Yes  | Includes **userId**.                                   |
W
wusongqing 已提交
363 364 365 366 367 368 369 370
| callback    | AsyncCallback\<BundleInfo> | Yes  | Callback used to return the bundle information.                    |

**Example**

```js
let bundleName = "com.example.myapplication";
let bundleFlags = 1;
let options = {
W
wusongqing 已提交
371
  "userId" : 100
W
wusongqing 已提交
372 373 374 375 376 377 378 379 380 381
};
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));
})
```

W
wusongqing 已提交
382 383 384

## bundle.getAllApplicationInfo

W
wusongqing 已提交
385
getAllApplicationInfo(bundleFlags: number, userId?: number): Promise<Array\<ApplicationInfo>>
W
wusongqing 已提交
386 387 388

Obtains the information about all applications of the specified user. This method uses a promise to return the result.

W
wusongqing 已提交
389
**Required permissions**
W
wusongqing 已提交
390

W
wusongqing 已提交
391 392 393 394 395
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
396 397 398

**Parameters**

W
wusongqing 已提交
399
| Name       | Type  | Mandatory| Description                                                  |
W
wusongqing 已提交
400
| ----------- | ------ | ---- | ------------------------------------------------------ |
W
wusongqing 已提交
401
| bundleFlags | number | Yes  | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
W
wusongqing 已提交
402
| 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 已提交
403 404 405

**Return value**

W
wusongqing 已提交
406
| Type                            | Description                                            |
W
wusongqing 已提交
407 408 409 410 411 412
| -------------------------------- | ------------------------------------------------ |
| Promise<Array\<ApplicationInfo>> | Promise used to return the application information.|

**Example**

```js
W
wusongqing 已提交
413 414 415 416 417 418 419
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 已提交
420 421 422 423 424 425 426 427 428
})
```



## bundle.getAllApplicationInfo

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

W
wusongqing 已提交
429
Obtains the information about all applications of the specified user. This method uses an asynchronous callback to return the result.
W
wusongqing 已提交
430

W
wusongqing 已提交
431
**Required permissions**
W
wusongqing 已提交
432

W
wusongqing 已提交
433 434 435 436 437
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
438 439 440

**Parameters**

W
wusongqing 已提交
441
| Name       | Type                                  | Mandatory| Description                                                  |
W
wusongqing 已提交
442
| ----------- | -------------------------------------- | ---- | ------------------------------------------------------ |
W
wusongqing 已提交
443
| bundleFlags | number                                 | Yes  | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
W
wusongqing 已提交
444
| 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 已提交
445
| callback    | AsyncCallback<Array\<ApplicationInfo>> | Yes  | Callback used to return the application information.        |
W
wusongqing 已提交
446 447 448 449

**Example**

```js
W
wusongqing 已提交
450 451 452 453 454 455 456 457 458
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 已提交
459 460 461
```


W
wusongqing 已提交
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 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
## bundle.getAllApplicationInfo

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

Obtains the information about all applications. This method uses an asynchronous callback to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name       | Type                                  | Mandatory| Description                                                  |
| ----------- | -------------------------------------- | ---- | ------------------------------------------------------ |
| bundleFlags | number                                 | Yes  | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback    | AsyncCallback<Array\<ApplicationInfo>> | Yes  | Callback used to return the application information.        |

**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));
})
```

## bundle.getAbilityInfo

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

Obtains the ability information based on a given want. This method 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                                                      |
| ----------- | ------ | ---- | -------------------------------------------------------- |
| bundleName  | string  | Yes  | Bundle name of the application. |
| abilityName | string  |  Yes | Name of the ability.|

**Return value**

| Type                        | Description                        |
| ---------------------------- | ---------------------------- |
| Promise\<AbilityInfo> | Promise used to return the ability information.|

**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

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

Obtains the ability information based on a given want. This method 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                                                       |
| ----------- | ------ | ---- | --------------------------------------------------------- |
| bundleName  | string  | Yes  | Bundle name of the application. |
| abilityName | string  |  Yes | Name of the ability.|
| callback    | AsyncCallback\<AbilityInfo> | Yes| Callback used to return the ability information.|

**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 已提交
573
## bundle.getAbilityLabel<sup>8+</sup>
W
wusongqing 已提交
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

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

Obtains the application name based on a given want. This method 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                                                      |
| ----------- | ------ | ---- | -------------------------------------------------------- |
| bundleName  | string  | Yes  | Bundle name of the application. |
| abilityName | string  |  Yes | Name of the ability.|

**Return value**

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

**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 已提交
613
## bundle.getAbilityLabel<sup>8+</sup>
W
wusongqing 已提交
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

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

Obtains the application name based on a given want. This method 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                                                       |
| ----------- | ------ | ---- | --------------------------------------------------------- |
| bundleName  | string  | Yes  | Bundle name of the application. |
| abilityName | string  |  Yes | Name of the ability.|
| callback | AsyncCallback\<string> | Yes| Callback used to return the application name.|

**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 已提交
649
## bundle.isAbilityEnabled<sup>8+</sup>
W
wusongqing 已提交
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

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

Checks whether an ability is enabled based on a given want. This method uses a promise to return the result.

**Required permissions**

None

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name       | Type  | Mandatory| Description                     |
| ----------- | ------ | ---- | ------------             |
| info       | AbilityInfo  | Yes  | Ability information.   |

**Return value**

| Type                        | Description                    |
| ---------------------------- | ------------------------|
| 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.|

**Example**

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

W
wusongqing 已提交
690
## bundle.isAbilityEnabled<sup>8+</sup>
W
wusongqing 已提交
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

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

Checks whether an ability is enabled based on a given want. This method uses an asynchronous callback to return the result.

**Required permissions**

None

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name       | Type  | Mandatory| Description                                                       |
| ----------- | ------ | ---- | --------------------------------------------------------- |
| info  | AbilityInfo  | 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.|

**Example**

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

W
wusongqing 已提交
727
## bundle.isApplicationEnabled<sup>8+</sup>
W
wusongqing 已提交
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

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

Checks whether an application is enabled based on a given want. This method uses a promise to return the result.

**Required permissions**

None

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

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

**Return value**

| Type                        | Description                    |
| ---------------------------- | ------------------------|
| Promise\<boolean> | Promise used to return whether the application is enabled. If the application is enabled, **true** will be returned; otherwise, **false** will be returned.|

**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 已提交
765
## bundle.isApplicationEnabled<sup>8+</sup>
W
wusongqing 已提交
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

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

Checks whether an application is enabled based on a given want. This method uses an asynchronous callback to return the result.

**Required permissions**

None

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name       | Type  | Mandatory| Description                                                       |
| ----------- | ------ | ---- | --------------------------------------------------------- |
| bundleName  | string | Yes  | Bundle name of the application.  |
| callback |  AsyncCallback\<boolean> | Yes| Callback used to return whether the application is enabled. If the application is enabled, **true** will be returned; otherwise, **false** will be returned.|

**Example**

```js
let bundleName : "com.example.myapplication";
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 已提交
798 799 800 801 802

## bundle.queryAbilityByWant

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

W
wusongqing 已提交
803
Obtains the ability information based on a given want. This method uses a promise to return the result.
W
wusongqing 已提交
804

W
wusongqing 已提交
805
**Required permissions**
W
wusongqing 已提交
806

W
wusongqing 已提交
807 808 809 810 811
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
812 813 814

**Parameters**

W
wusongqing 已提交
815
| Name       | Type  | Mandatory| Description                                                        |
W
wusongqing 已提交
816
| ----------- | ------ | ---- | ------------------------------------------------------------ |
W
wusongqing 已提交
817 818 819
| want        | Want   | Yes  | Want that contains the bundle name.                          |
| bundleFlags | number | Yes  | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| 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 已提交
820 821 822

**Return value**

W
wusongqing 已提交
823
| Type                        | Description                        |
W
wusongqing 已提交
824 825 826 827 828 829
| ---------------------------- | ---------------------------- |
| Promise\<Array\<AbilityInfo>>| Promise used to return the ability information.|

**Example**

```js
W
wusongqing 已提交
830 831 832 833 834 835 836 837 838 839 840
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 已提交
841 842 843 844 845 846 847 848 849
})
```



## bundle.queryAbilityByWant

queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<AbilityInfo>>): void

W
wusongqing 已提交
850 851 852 853 854
Obtains the ability information based on a given want. This method uses an asynchronous callback to return the result.

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
855 856 857

**Parameters**

W
wusongqing 已提交
858
| Name       | Type                              | Mandatory| Description                                                        |
W
wusongqing 已提交
859
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
W
wusongqing 已提交
860 861 862 863
| want        | Want                               | Yes  | Want that contains the bundle name.                      |
| bundleFlags | number                             | Yes  | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| 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>> | Yes  | Callback used to return the ability information.               |
W
wusongqing 已提交
864 865 866 867

**Example**

```js
W
wusongqing 已提交
868 869 870 871 872 873 874 875 876 877 878 879 880
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 已提交
881 882 883 884
```

## bundle.queryAbilityByWant

W
wusongqing 已提交
885
queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Array\<AbilityInfo>>): void
W
wusongqing 已提交
886 887 888

Obtains the ability information based on a given want. This method uses an asynchronous callback to return the result.

W
wusongqing 已提交
889 890 891 892
**System capability**

SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
893 894
**Parameters**

W
wusongqing 已提交
895
| Name       | Type                              | Mandatory| Description                                                        |
W
wusongqing 已提交
896
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
W
wusongqing 已提交
897 898 899
| want        | Want                               | Yes  | Want that contains the bundle name.                      |
| bundleFlags | number                             | Yes  | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback    | AsyncCallback<Array\<AbilityInfo>> | Yes  | Callback used to return the ability information.               |
W
wusongqing 已提交
900 901 902 903

**Example**

```js
W
wusongqing 已提交
904 905 906 907 908 909 910 911 912 913 914
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 已提交
915 916 917 918 919
})
```

## bundle.getBundleInstaller

W
wusongqing 已提交
920
getBundleInstaller(): Promise\<BundleInstaller>
W
wusongqing 已提交
921

W
wusongqing 已提交
922
Obtains the bundle installer. This method uses a promise to return the result.
W
wusongqing 已提交
923

W
wusongqing 已提交
924 925 926 927
**Required permissions**

ohos.permission.INSTALL_BUNDLE

W
wusongqing 已提交
928 929 930 931
**System capability**

SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
932 933
**Return value**

W
wusongqing 已提交
934
| Type                    | Description                                               |
W
wusongqing 已提交
935
| ------------------------ | --------------------------------------------------- |
W
wusongqing 已提交
936
| Promise\<BundleInstaller> | Promise used to return the bundle installer.|
W
wusongqing 已提交
937 938 939 940

**Example**

```js
W
wusongqing 已提交
941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957
let bundleFilePaths = ['/data/test.hap'];
let param = {
    userId : 100,
    installFlag : 1,
    isKeepData : false
};
bundle.getBundleInstaller()
.then((installerObject) => {
    console.info('Operation successful. ');
    installerObject.install(bundleFilePaths, param)
    .then((data) => {
        console.info('Operation successful. Data:' + JSON.stringify(data));
    }).catch((error) => {
        console.error('Operation failed. Cause: ' + JSON.stringify(error));
    })
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
W
wusongqing 已提交
958 959 960 961 962
})
```

## bundle.getBundleInstaller

W
wusongqing 已提交
963
getBundleInstaller(callback: AsyncCallback\<BundleInstaller>): void;
W
wusongqing 已提交
964

W
wusongqing 已提交
965
Obtains the bundle installer. This method uses an asynchronous callback to return the result.
W
wusongqing 已提交
966

W
wusongqing 已提交
967 968 969 970
**Required permissions**

ohos.permission.INSTALL_BUNDLE

W
wusongqing 已提交
971 972 973 974
**System capability**

SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
975 976
**Parameters**

W
wusongqing 已提交
977
| Name    | Type                          | Mandatory| Description                                             |
W
wusongqing 已提交
978
| -------- | ------------------------------ | ---- | ------------------------------------------------- |
W
wusongqing 已提交
979
| callback | AsyncCallback\<BundleInstaller> | Yes  | Callback used to return the bundle installer.|
W
wusongqing 已提交
980 981 982 983

**Example**

```js
W
wusongqing 已提交
984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000
let bundleFilePaths = ['/data/test.hap'];
let param = {
    userId : 100,
    installFlag : 1,
    isKeepData : false
};
bundle.getBundleInstaller((err, installerObject) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
    }
    console.info('Operation successful. Data:' + JSON.stringify(installerObject));
    installerObject.install(bundleFilePaths, param, (err, data) => {
        if (err) {
            console.error('Operation failed. Cause: ' + JSON.stringify(err));
        }
        console.info('Operation successful. Data:' + JSON.stringify(data));
    })
W
wusongqing 已提交
1001 1002 1003 1004
})
```


W
wusongqing 已提交
1005 1006 1007 1008
## bundle.getLaunchWantForBundle

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

W
wusongqing 已提交
1009
Obtains the **Want** object that launches the specified application. This method uses a promise to return the result.
W
wusongqing 已提交
1010

W
wusongqing 已提交
1011 1012
**Required permissions**

W
wusongqing 已提交
1013 1014 1015 1016 1017
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1018 1019 1020

**Parameters**

W
wusongqing 已提交
1021
| Name      | Type  | Mandatory| Description    |
W
wusongqing 已提交
1022
| ---------- | ------ | ---- | -------- |
W
wusongqing 已提交
1023
| bundleName | string | Yes  | Bundle name of the application.|
W
wusongqing 已提交
1024 1025

**Return value**
W
wusongqing 已提交
1026 1027 1028
| Type                 | Description                                                        |
| --------------------- | ------------------------------------------------------------ |
| Promise\<Want> | Promise used to return the **Want** object.|
W
wusongqing 已提交
1029 1030 1031 1032

**Example**

```js
W
wusongqing 已提交
1033 1034 1035 1036 1037 1038 1039
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 已提交
1040 1041
```

W
wusongqing 已提交
1042
## bundle.getLaunchWantForBundle
W
wusongqing 已提交
1043

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

W
wusongqing 已提交
1046
Obtains the **Want** object that launches the specified application. This method uses an asynchronous callback to return the result.
W
wusongqing 已提交
1047

W
wusongqing 已提交
1048
**Required permissions**
W
wusongqing 已提交
1049

W
wusongqing 已提交
1050 1051 1052 1053 1054
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1055 1056 1057

**Parameters**

W
wusongqing 已提交
1058 1059 1060 1061
| Name      | Type  | Mandatory| Description    |
| ---------- | ------ | ---- | -------- |
| bundleName | string | Yes  | Bundle name of the application.|
| callback   | AsyncCallback\<Want> | Yes  | Callback used to return the **Want** object.|
W
wusongqing 已提交
1062 1063 1064 1065

**Example**

```js
W
wusongqing 已提交
1066 1067 1068 1069 1070 1071 1072 1073
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 已提交
1074 1075 1076
```


W
wusongqing 已提交
1077
## bundle.getNameForUid<sup>8+</sup>
W
wusongqing 已提交
1078 1079

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

W
wusongqing 已提交
1081 1082 1083 1084 1085
Obtains the bundle name based on a UID. This method uses a promise to return the result.

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1086 1087 1088

**Parameters**

W
wusongqing 已提交
1089
| Name      | Type  | Mandatory| Description    |
W
wusongqing 已提交
1090
| ---------- | ------ | ---- | -------- |
W
wusongqing 已提交
1091
| uid | number | Yes  | UID based on which the bundle name is to obtain.|
W
wusongqing 已提交
1092 1093

**Return value**
W
wusongqing 已提交
1094
| Type                 | Description                                                        |
W
wusongqing 已提交
1095
| --------------------- | ------------------------------------------------------------ |
W
wusongqing 已提交
1096
| Promise\<string> | Promise used to return the bundle name.|
W
wusongqing 已提交
1097 1098 1099 1100

**Example**

```js
W
wusongqing 已提交
1101 1102 1103 1104 1105 1106 1107
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 已提交
1108 1109
```

W
wusongqing 已提交
1110
## bundle.getNameForUid<sup>8+</sup>
W
wusongqing 已提交
1111

W
wusongqing 已提交
1112 1113 1114
getNameForUid(uid: number, callback: AsyncCallback\<string>): void;

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

W
wusongqing 已提交
1116 1117 1118
**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1119 1120 1121

**Parameters**

W
wusongqing 已提交
1122 1123 1124 1125
| Name      | Type  | Mandatory| Description    |
| ---------- | ------ | ---- | -------- |
| uid | number | Yes  | UID based on which the bundle name is to obtain.|
| callback   | AsyncCallback\<string> | Yes  | Callback used to return the bundle name.|
W
wusongqing 已提交
1126 1127 1128 1129

**Example**

```js
W
wusongqing 已提交
1130 1131 1132 1133 1134 1135 1136 1137
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 已提交
1138 1139
```

W
wusongqing 已提交
1140

W
wusongqing 已提交
1141
## bundle.getAbilityIcon<sup>8+</sup>
W
wusongqing 已提交
1142

W
wusongqing 已提交
1143
getAbilityIcon(bundleName: string, abilityName: string): Promise\<[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)>;
W
wusongqing 已提交
1144 1145 1146

Obtains the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md) of the corresponding icon based on a given bundle name and ability name. This method uses a promise to return the result.

W
wusongqing 已提交
1147 1148 1149 1150 1151 1152 1153 1154
**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179
**Parameters**

| 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.|

**Return value**
| Type                 | Description                                                        |
| --------------------- | ------------------------------------------------------------ |
| Promise\<[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)> | Promise used to return the <[PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md)>.|

**Example**

```js
let bundleName = com.example.myapplication;
let abilityName = com.example.myapplication.MainAbility;
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 已提交
1180
## bundle.getAbilityIcon<sup>8+</sup>
W
wusongqing 已提交
1181

W
wusongqing 已提交
1182
getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)>): void;
W
wusongqing 已提交
1183 1184 1185

Obtains the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md) of the corresponding icon based on a given bundle name and ability name. This method uses an asynchronous callback to return the result.

W
wusongqing 已提交
1186 1187 1188 1189 1190 1191 1192 1193
**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216
**Parameters**

| 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.|
| callback   | AsyncCallback\<[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)> | Yes  | Callback used to return the <[PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md)>.|

**Example**

```js
let bundleName = com.example.myapplication;
let abilityName = com.example.myapplication.MainAbility;
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 已提交
1217
## bundle.queryExtensionAbilityInfosByWant<sup>9+</sup>
W
wusongqing 已提交
1218

W
wusongqing 已提交
1219
queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId?: number): Promise<Array\<ExtensionAbilityInfo>>
W
wusongqing 已提交
1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263

Obtains the extension ability information based on a given want. This method uses a promise to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name       | Type  | Mandatory| Description                                                        |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| want        | Want   | Yes  | Want that contains the bundle name.                          |
| extensionFlags | number | Yes  | Extension ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| 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.         |

**Return value**

| Type                        | Description                        |
| ---------------------------- | ---------------------------- |
| Promise<Array\<ExtensionAbilityInfo>> | Promise used to return the extension ability information.|

**Example**

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



W
wusongqing 已提交
1264
## bundle.queryExtensionAbilityInfosByWant<sup>9+</sup>
W
wusongqing 已提交
1265

W
wusongqing 已提交
1266
queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void
W
wusongqing 已提交
1267 1268 1269

Obtains the extension ability information based on a given want. This method uses an asynchronous callback to return the result.

W
wusongqing 已提交
1270 1271 1272 1273
**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

W
wusongqing 已提交
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 1300 1301 1302 1303 1304
**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name       | Type                              | Mandatory| Description                                                        |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
| want        | Want                               | Yes  | Want that contains the bundle name.                      |
| extensionFlags | number                             | Yes  | Extension ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| 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>> | Yes  | Callback used to return the extension ability information.               |

**Example**

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

W
wusongqing 已提交
1305
## bundle.queryExtensionAbilityInfosByWant<sup>9+</sup>
W
wusongqing 已提交
1306

W
wusongqing 已提交
1307
queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void;
W
wusongqing 已提交
1308 1309 1310

Obtains the extension ability information based on a given want. This method uses an asynchronous callback to return the result.

W
wusongqing 已提交
1311 1312 1313 1314
**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

W
wusongqing 已提交
1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343
**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name       | Type                              | Mandatory| Description                                                        |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
| want        | Want                               | Yes  | Want that contains the bundle name.                      |
| extensionFlags | number                             | Yes  | Extension ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback    | AsyncCallback<Array\<ExtensionAbilityInfo>> | Yes  | Callback used to return the extension ability information.               |

**Example**

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

W
wusongqing 已提交
1344 1345
## ElementName

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

W
wusongqing 已提交
1348
| Name       | Readable/Writable| Type  | Mandatory| Description                                                        |
W
wusongqing 已提交
1349
| ----------- | -------- | ------ | ---- | ------------------------------------------------------------ |
W
wusongqing 已提交
1350 1351 1352 1353 1354
| deviceId    | Read-only    | string | No  | ID of the device that runs the ability.                               |
| bundleName  | Read-only    | string | Yes  | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
| abilityName | Read-only    | string | Yes  | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
| uri | Read-only    | string | No  | Resource ID.|
| shortName | Read-only    | string | No  | Short name of the **ElementName**.|
W
wusongqing 已提交
1355

W
wusongqing 已提交
1356
## InstallErrorCode
W
wusongqing 已提交
1357

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

W
wusongqing 已提交
1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381
| Name              | Default Value| Description  |
| ------ | ------ | ------ |
| SUCCESS | 0 | Installation succeeded.|
| STATUS_INSTALL_FAILURE | 1 | Installation failed. (The application to be installed does not exist.)|
| STATUS_INSTALL_FAILURE_ABORTED | 2 | Installation aborted.|
| STATUS_INSTALL_FAILURE_INVALID | 3 | Invalid installation parameter.|
| STATUS_INSTALL_FAILURE_CONFLICT | 4 | Installation conflict. (The basic information about the application to upgrade is inconsistent with that of the existing application.)|
| STATUS_INSTALL_FAILURE_STORAGE | 5 | Failed to store the bundle information.|
| STATUS_INSTALL_FAILURE_INCOMPATIBLE | 6 | Installation incompatible. (A downgrade occurs or the signature information is incorrect.)|
| STATUS_UNINSTALL_FAILURE | 7 | Uninstallation failed. (The application to be uninstalled does not exist.)|
| 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 已提交
1382 1383 1384

## BundleFlag

W
wusongqing 已提交
1385 1386 1387
Enumerates bundle flags.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1388 1389 1390 1391 1392 1393 1394 1395 1396

| 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.|
W
wusongqing 已提交
1397 1398 1399 1400 1401 1402
| GET_ABILITY_INFO_WITH_METADATA<sup>8+</sup> | 0x00000020 | Obtains the ability metadata information.|
| GET_BUNDLE_WITH_EXTENSION_ABILITY<sup>9+</sup> | 0x00000020 | Obtains the bundle information with the extension ability information.|
| GET_APPLICATION_INFO_WITH_METADATA<sup>8+</sup> | 0x00000040 | Obtains the application metadata information.|
| GET_ABILITY_INFO_SYSTEMAPP_ONLY<sup>8+</sup> | 0x00000080 | Obtains the ability information with information about system applications.|
| 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 已提交
1403 1404 1405 1406 1407 1408
| GET_ALL_APPLICATION_INFO | 0xFFFF0000 | Obtains all application information.|

## BundleOptions

Describes the bundle options.

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

W
wusongqing 已提交
1411 1412 1413 1414 1415 1416 1417 1418
| Name              | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| 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.|

## BundleInfo

Describes the application bundle information.

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

W
wusongqing 已提交
1421 1422 1423 1424 1425 1426
| Name              | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| name                     | string                     | Yes  | No  | Bundle name.                              |
| type                     | string                     | Yes  | No  | Bundle type.                                |
| appId                    | string                     | Yes  | No  | ID of the application to which the bundle belongs.                      |
| uid                      | number                     | Yes  | No  | UID of the application to which the bundle belongs.                     |
W
wusongqing 已提交
1427 1428
| installTime              | number                     | Yes  | No  | Time when the HAP file was installed.                             |
| updateTime               | number                     | Yes  | No  | Time when the HAP file was updated.                             |
W
wusongqing 已提交
1429
| appInfo                  | ApplicationInfo        | Yes  | No  | Application configuration information.                        |
W
wusongqing 已提交
1430 1431 1432
| abilityInfos              | Array\<AbilityInfo>         | Yes  | No  | Ability configuration information.                         |
| reqPermissions           | Array\<string>              | Yes  | No  | Array of the permissions to request from the system.          |
| reqPermissionDetails     | Array\<ReqPermissionDetail> | Yes  | No  | Detailed information of the permissions to request from the system.|
W
wusongqing 已提交
1433 1434 1435 1436 1437 1438
| vendor                   | string                     | Yes  | No  | Vendor of the bundle.                            |
| versionCode              | number                     | Yes  | No  | Version number of the bundle.                            |
| versionName              | string                     | Yes  | No  | Version description of the bundle.                  |
| compatibleVersion        | number                     | Yes  | No  | Earliest SDK version required for running the bundle.           |
| targetVersion            | number                     | Yes  | No  | Latest SDK version required for running the bundle.             |
| isCompressNativeLibs     | boolean                    | Yes  | No  | Whether to compress the native library of the bundle. The default value is **true**.        |
W
wusongqing 已提交
1439
| hapModuleInfos            | Array\<HapModuleInfo>       | Yes  | No  | Module configuration information.                            |
W
wusongqing 已提交
1440 1441 1442 1443 1444
| entryModuleName          | string                     | Yes  | No  | Name of the entry module.                           |
| cpuAbi                   | string                     | Yes  | No  | cpuAbi information of the bundle.                        |
| isSilentInstallation     | string                     | Yes  | No  | Whether to install the bundle in silent mode.                          |
| minCompatibleVersionCode | number                     | Yes  | No  | Earliest version compatible with the bundle in the distributed scenario.        |
| entryInstallationFree | boolean | Yes| No| Whether installation-free is supported for the entry.|
W
wusongqing 已提交
1445 1446
| reqPermissionStates<sup>8+</sup> | Array\<number> | Yes| No| Permission grant state.|
| extensionAbilityInfo<sup>9+</sup> | Array\<ExtensionAbilityInfo> | Yes| No|   Extended information of the ability.|
W
wusongqing 已提交
1447 1448 1449 1450 1451

## ApplicationInfo

Describes the application information.

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

W
wusongqing 已提交
1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464
| Name              | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| name             | string        | Yes  | No  | Application name.                            |
| description      | string        | Yes  | No  | Application description.                            |
| descriptionId    | number        | Yes  | No  | Application description ID.                          |
| systemApp        | boolean       | Yes  | No  | Whether the application is a system application. The default value is **false**.       |
| enabled          | boolean       | Yes  | No  | Whether the application is enabled. The default value is **true**.      |
| label            | string        | Yes  | No  | Application label.                            |
| labelId          | string        | Yes  | No  | Application label ID.                          |
| icon             | string        | Yes  | No  | Application icon.                            |
| iconId           | string        | Yes  | No  | Application icon ID.                          |
W
wusongqing 已提交
1465
| process          | string        | Yes  | No  | Process in which the application runs. If this parameter is not set, the bundle name is used by default.|
W
wusongqing 已提交
1466
| supportedModes   | number        | Yes  | No  | Running modes supported by the application.                    |
W
wusongqing 已提交
1467 1468 1469
| moduleSourceDirs | Array\<string> | Yes  | No  | Relative paths for storing application resources.              |
| permissions      | Array\<string> | Yes  | No  | Permissions required for accessing the application.                    |
| moduleInfos | Array\<ModuleInfo> | Yes  | No  | Application module information.                        |
W
wusongqing 已提交
1470
| entryDir         | string        | Yes  | No  | Path for storing application files.                    |
W
wusongqing 已提交
1471
| customizeData    | Map<string, Array\<CustomizeData>> | Yes  | Yes  | Custom data of the application.                      |
W
wusongqing 已提交
1472 1473 1474 1475 1476 1477 1478
| codePath<sup>8+</sup> | string | Yes| No| Installation directory of the application.|
| metaData<sup>8+</sup> | Map<string, Array\<CustomizeData>> | Yes| No| Custom metadata of the application.|
| metaData<sup>9+</sup> | Map<string, Array\<Metadata>> | Yes| No| Metadata of the application.|
| removable<sup>8+</sup> | boolean | Yes| No| Whether the application is removable.|
| accessTokenId<sup>8+</sup> | number | Yes| No| Access token ID of the application.|
| uid<sup>8+</sup> | number | Yes| No| UID of the application.|
| entityType<sup>9+</sup> | string | Yes| No| Entity type of the application.|
W
wusongqing 已提交
1479 1480 1481

## ModuleInfo

W
wusongqing 已提交
1482 1483 1484
Describes the module information of the application.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1485 1486 1487 1488 1489 1490 1491 1492 1493 1494

| Name              | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| moduleName      | string | Yes  | No  | Module name.|
| moduleSourceDir | string | Yes  | No  | Installation directory.|

## CustomizeData

Describes the custom metadata.

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

W
wusongqing 已提交
1497 1498 1499 1500
| Name | Type  | Readable| Writable| Description            |
| ----- | ------ | ---- | ---- | ---------------- |
| name  | string | Yes  | Yes  | Custom metadata name.|
| value | string | Yes  | Yes  | Custom metadata value.  |
W
wusongqing 已提交
1501
| extra<sup>8+</sup> | string | Yes  | Yes  | Custom resources.      |
W
wusongqing 已提交
1502 1503 1504 1505 1506 1507


## HapModuleInfo

Describes the HAP module information.

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

W
wusongqing 已提交
1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520
| Name              | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| name             | string        | Yes  | No  | Module name.          |
| description      | string        | Yes  | No  | Module description.      |
| descriptionId    | number        | Yes  | No  | Module description ID.        |
| icon             | string        | Yes  | No  | Module icon.          |
| label            | string        | Yes  | No  | Module label.          |
| labelId          | number        | Yes  | No  | Module label ID.        |
| iconId           | number        | Yes  | No  | Module icon ID.        |
| backgroundImg    | string        | Yes  | No  | Module background image.      |
| supportedModes   | number        | Yes  | No  | Modes supported by the module.    |
W
wusongqing 已提交
1521 1522 1523
| reqCapabilities  | Array\<string> | Yes  | No  | Capabilities required for module running.|
| deviceTypes      | Array\<string> | Yes  | No  | An array of supported device types.|
| abilityInfo      | Array\<AbilityInfo> | Yes  | No  | Ability information.       |
W
wusongqing 已提交
1524 1525 1526
| moduleName       | string        | Yes  | No  | Module name.            |
| mainAbilityName  | string        | Yes  | No  | Name of the entry ability.   |
| installationFree | boolean       | Yes  | No  | Whether installation-free is supported.    |
W
wusongqing 已提交
1527 1528 1529
| mainElementName<sup>8+</sup> | string | Yes| No| Information about the entry ability.|
| extensionAbilityInfo<sup>9+</sup> | Array\<ExtensionAbilityInfo> | Yes| No| Extension ability information.|
| metadata<sup>9+</sup> | Array\<Metadata> | Yes| No| Metadata of the ability.|
W
wusongqing 已提交
1530 1531 1532 1533 1534

## ReqPermissionDetail

Describes the detailed information of the permissions to request from the system.

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

W
wusongqing 已提交
1537 1538 1539 1540 1541 1542 1543 1544 1545 1546
| Name              | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| name      | string    | Yes  | Yes  | Name of the permission to request.  |
| reason    | string    | Yes  | Yes  | Reason for requesting the permission.  |
| usedScene | UsedScene | Yes| Yes| Application scenario and timing for using the permission.|

## UsedScene

Describes the application scenario and timing for using the permission.

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

W
wusongqing 已提交
1549 1550
| Name              | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
W
wusongqing 已提交
1551
| abilities | Array\<string> | Yes  | Yes  | Abilities that use the permission.|
W
wusongqing 已提交
1552 1553 1554 1555 1556
| when      | string        | Yes  | Yes  | Time when the permission is used.         |


## AbilityInfo

W
wusongqing 已提交
1557 1558 1559
Describes the ability information.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571

| Name              | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
| bundleName         | string                                                       | Yes  | No  | Application bundle name.                                 |
| name               | string                                                       | Yes  | No  | Ability name.                              |
| label              | string                                                       | Yes  | No  | Ability name visible to users.                  |
| description        | string                                                       | Yes  | No  | Ability description.                            |
| icon               | string                                                       | Yes  | No  | Index of the ability icon resource file.                |
| descriptionId      | number                                                       | Yes  | No  | Ability description ID.                          |
| iconId             | number                                                       | Yes  | No  | Ability icon ID.                          |
| moduleName         | string                                                       | Yes  | No  | Name of the HAP file to which the ability belongs.                 |
| process            | string                                                       | Yes  | No  | Process in which this ability runs. If this parameter is not set, the bundle name is used by default.|
W
wusongqing 已提交
1572
| targetAbility      | string                                                       | Yes  | No  | Target ability that the ability alias points to.             |
W
wusongqing 已提交
1573 1574 1575 1576 1577 1578
| backgroundModes    | number                                                       | Yes  | No  | Background service mode of the ability.                       |
| isVisible          | boolean                                                      | Yes  | No  | Whether the ability can be called by other applications.        |
| formEnabled        | boolean                                                      | Yes  | No  | Whether the ability provides the service widget capability.              |
| type               | AbilityType | Yes  | No  | Ability type.                              |
| orientation        | DisplayOrientation | Yes  | No  | Ability display orientation.                        |
| launchMode         | LaunchMode | Yes  | No  | Ability launch mode.                        |
W
wusongqing 已提交
1579 1580 1581
| permissions        | Array\<string>                                                | Yes  | No  | Permissions required for other applications to call the ability.|
| deviceTypes        | Array\<string>                                                | Yes  | No  | Device types supported by the ability.                    |
| deviceCapabilities | Array\<string>                                                | Yes  | No  | Device capabilities required for the ability.                    |
W
wusongqing 已提交
1582 1583 1584 1585 1586 1587
| readPermission     | string                                                       | Yes  | No  | Permission required for reading the ability data.                |
| writePermission    | string                                                       | Yes  | No  | Permission required for writing data to the ability.                |
| applicationInfo    | ApplicationInfo | Yes  | No  | Application configuration information.                       |
| uri                | string                                                       | Yes  | No  | URI of the ability.       |
| labelId            | number                                                       | Yes  | No  | Ability label ID.                          |
| subType            | AbilitySubType | Yes  | No  | Subtype of the template that can be used by the ability.          |
W
wusongqing 已提交
1588 1589 1590
| metaData<sup>8+</sup> | Array\<CustomizeData> | Yes| No| Custom information of the ability.|
| metaData<sup>9+</sup> | Array\<Metadata> | Yes| No| Metadata of the ability.|
| enabled<sup>8+</sup> | boolean | Yes| No| Whether the ability is enabled.|
W
wusongqing 已提交
1591 1592 1593

## AbilityType

W
wusongqing 已提交
1594 1595 1596
Enumerates ability types.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1597 1598 1599 1600 1601 1602 1603 1604 1605 1606

| Name   | Type| Description                       |
| ------- | ---- | --------------------------- |
| UNKNOWN | None  | Unknown ability type.            |
| PAGE    | None  | Ability that has a UI.        |
| SERVICE | None  | Ability that does not have a UI.          |
| DATA    | None  | Ability that is used to provide data access services.|

## DisplayOrientation

W
wusongqing 已提交
1607 1608 1609
Enumerates display orientations.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1610 1611 1612 1613 1614 1615 1616 1617 1618 1619

| Name         | Type| Description                    |
| ------------- | ---- | ------------------------ |
| UNSPECIFIED   | None  | The system automatically determines the display orientation.        |
| LANDSCAPE     | None  | Landscape orientation.          |
| PORTRAIT      | None  | Portrait orientation.          |
| FOLLOW_RECENT | None  | The page ability orientation is the same as that of the nearest ability in the stack.|

## LaunchMode

W
wusongqing 已提交
1620 1621 1622
Enumerates launch modes.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1623 1624 1625

| Name       | Type| Description               |
| ----------- | ---- | ------------------- |
W
wusongqing 已提交
1626
| SINGLETON  | 0    | The ability has only one instance.|
W
wusongqing 已提交
1627 1628 1629 1630
| STANDARD    | 1    | The ability can have multiple instances.  |

## AbilitySubType

W
wusongqing 已提交
1631 1632 1633
Enumerates ability subtypes.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1634 1635 1636 1637 1638

| Name       | Type| Description                         |
| ----------- | ---- | ----------------------------- |
| UNSPECIFIED | 0    | Undefined ability subtype.          |
| CA          | 1    | Ability that has a UI.|
W
wusongqing 已提交
1639 1640


W
wusongqing 已提交
1641
## ExtensionAbilityType<sup>9+</sup>
W
wusongqing 已提交
1642 1643 1644 1645 1646 1647 1648

Enumerates extension ability types.

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

| Name                 | Type| Description                         |
| -------------------- | ---- | ----------------------------- |
W
wusongqing 已提交
1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660
| FORM<sup>9+</sup>    | 0    | Form included.    |
| WORK_SCHEDULER<sup>9+</sup>    | 1    | Work scheduler included.|
| INPUT_METHOD<sup>9+</sup>         | 2    | Input method included.  |
| SERVICE<sup>9+</sup>    | 3    | Service included.    |
| ACCESSIBILITY<sup>9+</sup>    | 4    | Accessibility included.  |
| DATA_SHARE<sup>9+</sup>      | 5    | Data sharing included.|
| FILE_SHARE<sup>9+</sup>    | 6    | File sharing included.|
| STATIC_SUBSCRIBER<sup>9+</sup>  | 7    | Subscribers included.  |
| WALLPAPER<sup>9+</sup>    | 8    | Wallpaper included.    |
| UNSPECIFIED<sup>9+</sup>     | 9    | Unspecified type.    |

## ExtensionFlag<sup>9+</sup>
W
wusongqing 已提交
1661 1662 1663 1664 1665 1666 1667

Enumerates extension flags.

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

| Name              | Default Value| Description  |
| ------ | ------ | ------ |
W
wusongqing 已提交
1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684
| 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.|
| GET_EXTENSION_INFO_WITH_METADATA<sup>9+</sup> | 0x00000020 | Obtains the extension ability information that carries metadata information.|


## ColorMode

Enumerates color modes.

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

| Name       | Type| Description               |
| ----------- | ---- | ------------------- |
| AUTO_MODE  | -1    | Automatic mode.|
| DARK_MODE    | 0    | Dark mode.  |
| LIGHT_MODE    | 1    | Light mode.  |
W
wusongqing 已提交
1685 1686


W
wusongqing 已提交
1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699
## GrantStatus

Enumerates permission grant statuses.

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

| Name       | Type| Description               |
| ----------- | ---- | ------------------- |
| PERMISSION_DENIED  | -1    | Permission denied.|
| PERMISSION_GRANTED    | 0    | Permission granted.  |


## ExtensionAbilityInfo<sup>9+</sup>
W
wusongqing 已提交
1700 1701 1702 1703 1704 1705 1706

Describes the extension ability information.

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

| Name              | Type| Readable| Writable| Description|
| ------ | ------ | ------ | ------ | ------ |
W
wusongqing 已提交
1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723
| bundleName<sup>9+</sup>     | string                                                       | Yes  | No  | Application bundle name.                                 |
| moduleName<sup>9+</sup>     | string                                                       | Yes  | No  | Name of the HAP file to which the extension ability belongs.                 |
| name<sup>9+</sup>       | string                                                       | Yes  | No  | Name of the extension ability.                              |
| labelId<sup>9+</sup>    | number                                                       | Yes  | No  | Label ID of the extension ability.                          |
| descriptionId<sup>9+</sup>   | number                                                       | Yes  | No  | Description ID of the extension ability.                          |
| iconId<sup>9+</sup>    | number                                                       | Yes  | No  | Icon ID of the extension ability.                          |
| isVisible<sup>9+</sup>    | boolean                                                      | Yes  | No  | Whether the extension ability can be called by other applications.        |
| extensionAbilityType<sup>9+</sup>      | bundle.ExtensionAbilityType | Yes  | No  | Type of the extension ability.                              |
| permissions<sup>9+</sup>     | Array\<string>                                                | Yes  | No  | Permissions required for other applications to call the extension ability.|
| applicationInfo<sup>9+</sup>   | ApplicationInfo | Yes  | No  | Application configuration information.                       |
| metaData<sup>9+</sup> | Array\<Metadata> | Yes| No| Metadata of the extension ability.|
| enabled<sup>9+</sup> | boolean | Yes| No| Whether the extension ability is enabled.|
| readPermission<sup>9+</sup>   | string                                                       | Yes  | No  | Permission required for reading the extension ability data.                |
| writePermission<sup>9+</sup>   | string                                                       | Yes  | No  | Permission required for writing data to the extension ability.                |


## Metadata<sup>9+</sup>
W
wusongqing 已提交
1724 1725 1726 1727 1728 1729 1730

Describes the metadata information.

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

| Name | Type  | Readable| Writable| Description            |
| ----- | ------ | ---- | ---- | ---------------- |
W
wusongqing 已提交
1731 1732 1733
| name<sup>9+</sup>  | string | Yes  | Yes  | Metadata name.|
| value<sup>9+</sup> | string | Yes  | Yes  | Metadata value.  |
| resource<sup>9+</sup> | string | Yes  | Yes  | Metadata resource.      |