js-apis-Bundle.md 71.1 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 API 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 41 42 43 44
| 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.|
| 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 49
| Type                       | Description                |
| ------------------------- | ------------------ |
W
wusongqing 已提交
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 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**

W
wusongqing 已提交
84 85 86 87 88 89
| 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.|
| 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
## bundle.getApplicationInfo

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

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

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
123 124 125 126 127
| 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.                |
W
wusongqing 已提交
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142

**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 API 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 161 162 163
| 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     | 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 168
| Type                         | Description                        |
| --------------------------- | -------------------------- |
W
wusongqing 已提交
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 API 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 203 204 205
| 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.|
| 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 API 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

**Parameters**

W
wusongqing 已提交
237 238 239 240 241
| 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.       |
W
wusongqing 已提交
242 243 244 245 246 247 248 249 250 251 252 253 254

**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 API 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 276 277 278 279
| 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.|
| options     | BundleOptions | No   | Includes **userId**.                              |
W
wusongqing 已提交
280 281 282

**Return value**

W
wusongqing 已提交
283 284
| Type                  | Description                          |
| -------------------- | ---------------------------- |
W
wusongqing 已提交
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 API 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 322 323 324 325
| 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.|
| 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 API 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

**Parameters**

W
wusongqing 已提交
358 359 360 361 362 363
| 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.|
| options     | BundleOptions              | Yes   | Includes **userId**.                              |
| callback    | AsyncCallback\<BundleInfo> | Yes   | Callback used to return the bundle information.                   |
W
wusongqing 已提交
364 365 366 367 368 369 370

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

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

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 400 401 402
| 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.|
| 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 407
| Type                              | Description                             |
| -------------------------------- | ------------------------------- |
W
wusongqing 已提交
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 API 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 442 443 444 445
| 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.|
| 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>> | 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
## bundle.getAllApplicationInfo

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

W
wusongqing 已提交
466
Obtains the information about all applications of the specified user. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
467 468 469 470 471 472 473 474 475 476 477

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
478 479 480 481
| 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.                |
W
wusongqing 已提交
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499

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

W
wusongqing 已提交
500
Obtains the ability information based on a given bundle name and ability name. This API uses a promise to return the result.
W
wusongqing 已提交
501 502 503 504 505 506 507 508 509 510 511

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
512 513 514 515
| Name         | Type    | Mandatory  | Description              |
| ----------- | ------ | ---- | ---------------- |
| bundleName  | string | Yes   | Bundle name of the application.    |
| abilityName | string | Yes   | Ability name.|
W
wusongqing 已提交
516 517 518

**Return value**

W
wusongqing 已提交
519 520
| Type                   | Description                   |
| --------------------- | --------------------- |
W
wusongqing 已提交
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537
| 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

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

W
wusongqing 已提交
540
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 已提交
541 542 543 544 545 546 547 548 549 550 551

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
552 553 554 555 556
| Name        | Type    | Mandatory  | Description           |
| ----------- | ------------ | ---- | ---------------- |
| bundleName  | string | Yes   | Bundle name of the application.    |
| abilityName | string | Yes   | Ability name.|
| callback    | AsyncCallback\<AbilityInfo> | Yes   | Callback used to return the ability information.|
W
wusongqing 已提交
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571

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

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

W
wusongqing 已提交
576
Obtains the application name based on a given bundle name and ability name. This API uses a promise to return the result.
W
wusongqing 已提交
577 578 579 580 581 582 583 584 585 586 587

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
588 589 590 591
| Name         | Type    | Mandatory  | Description              |
| ----------- | ------ | ---- | ---------------- |
| bundleName  | string | Yes   | Bundle name of the application.    |
| abilityName | string | Yes   | Ability name.|
W
wusongqing 已提交
592 593 594

**Return value**

W
wusongqing 已提交
595 596
| Type              | Description                |
| ---------------- | ------------------ |
W
wusongqing 已提交
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611
| 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 已提交
612
## bundle.getAbilityLabel<sup>8+</sup>
W
wusongqing 已提交
613 614 615

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

W
wusongqing 已提交
616
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 已提交
617 618 619 620 621 622 623 624 625 626 627

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
628 629 630 631 632
| Name         | Type                    | Mandatory  | Description              |
| ----------- | ---------------------- | ---- | ---------------- |
| bundleName  | string                 | Yes   | Bundle name of the application.    |
| abilityName | string                 | Yes   | Ability name.|
| callback    | AsyncCallback\<string> | Yes   | Callback used to return the application name.       |
W
wusongqing 已提交
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647

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

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

W
wusongqing 已提交
652
Checks whether an ability is enabled based on a given want. This API uses a promise to return the result.
W
wusongqing 已提交
653 654 655 656 657 658 659 660 661 662 663

**Required permissions**

None

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
664 665 666
| Name  | Type         | Mandatory  | Description          |
| ---- | ----------- | ---- | ------------ |
| info | AbilityInfo | Yes   | Ability information.|
W
wusongqing 已提交
667 668 669

**Return value**

W
wusongqing 已提交
670 671
| Type               | Description                       |
| ----------------- | ------------------------- |
W
wusongqing 已提交
672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688
| 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 已提交
689
## bundle.isAbilityEnabled<sup>8+</sup>
W
wusongqing 已提交
690 691 692

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

W
wusongqing 已提交
693
Checks whether an ability is enabled based on a given want. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
694 695 696 697 698 699 700 701 702 703 704

**Required permissions**

None

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
705 706 707 708
| 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.|
W
wusongqing 已提交
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725

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

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

W
wusongqing 已提交
730
Checks whether an application is enabled based on a given want. This API uses a promise to return the result.
W
wusongqing 已提交
731 732 733 734 735 736 737 738 739 740 741

**Required permissions**

None

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
742 743 744
| Name        | Type    | Mandatory  | Description          |
| ---------- | ------ | ---- | ------------ |
| bundleName | string | Yes   | Bundle name of the application.|
W
wusongqing 已提交
745 746 747

**Return value**

W
wusongqing 已提交
748 749 750
| 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.|
W
wusongqing 已提交
751 752 753 754 755 756 757 758 759 760 761 762 763

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

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

W
wusongqing 已提交
768
Checks whether an application is enabled based on a given want. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
769 770 771 772 773 774 775 776 777 778 779

**Required permissions**

None

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
780 781 782 783
| Name        | Type                     | Mandatory  | Description             |
| ---------- | ----------------------- | ---- | --------------- |
| bundleName | string                  | Yes   | Bundle name of the application.   |
| 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 已提交
784 785 786 787

**Example**

```js
W
wusongqing 已提交
788
let bundleName = "com.example.myapplication";
W
wusongqing 已提交
789 790 791 792 793 794 795 796
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 已提交
797 798 799 800 801

## bundle.queryAbilityByWant

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

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

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

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

**System capability**

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

**Parameters**

W
wusongqing 已提交
814 815 816 817 818
| Name         | Type    | Mandatory  | Description                                   |
| ----------- | ------ | ---- | ------------------------------------- |
| 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 已提交
819 820 821

**Return value**

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

**Example**

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



## bundle.queryAbilityByWant

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

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

**System capability**

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

**Parameters**

W
wusongqing 已提交
857 858 859 860 861 862
| Name         | Type                                | Mandatory  | Description                                   |
| ----------- | ---------------------------------- | ---- | ------------------------------------- |
| 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 已提交
863 864 865 866

**Example**

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

## bundle.queryAbilityByWant

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

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

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

SystemCapability.BundleManager.BundleFramework

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

W
wusongqing 已提交
894 895 896 897 898
| Name         | Type                                | Mandatory  | Description                                   |
| ----------- | ---------------------------------- | ---- | ------------------------------------- |
| 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 已提交
899 900 901 902

**Example**

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



W
wusongqing 已提交
919 920 921 922
## bundle.getLaunchWantForBundle

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

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

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

W
wusongqing 已提交
927 928 929 930 931
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
932 933 934

**Parameters**

W
wusongqing 已提交
935 936 937
| Name        | Type    | Mandatory  | Description          |
| ---------- | ------ | ---- | ------------ |
| bundleName | string | Yes   | Bundle name of the application.|
W
wusongqing 已提交
938 939

**Return value**
W
wusongqing 已提交
940 941
| Type            | Description                                    |
| -------------- | -------------------------------------- |
W
wusongqing 已提交
942
| Promise\<Want> | Promise used to return the **Want** object.|
W
wusongqing 已提交
943 944 945 946

**Example**

```js
W
wusongqing 已提交
947 948 949 950 951 952 953
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 已提交
954 955
```

W
wusongqing 已提交
956
## bundle.getLaunchWantForBundle
W
wusongqing 已提交
957

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

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

W
wusongqing 已提交
962
**Required permissions**
W
wusongqing 已提交
963

W
wusongqing 已提交
964 965 966 967 968
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
969 970 971

**Parameters**

W
wusongqing 已提交
972 973 974 975
| 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 已提交
976 977 978 979

**Example**

```js
W
wusongqing 已提交
980 981 982 983 984 985 986 987
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 已提交
988 989 990
```


W
wusongqing 已提交
991
## bundle.getNameForUid<sup>8+</sup>
W
wusongqing 已提交
992 993

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

W
wusongqing 已提交
995
Obtains the bundle name based on a UID. This API uses a promise to return the result.
W
wusongqing 已提交
996 997 998 999

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1000 1001 1002

**Parameters**

W
wusongqing 已提交
1003 1004 1005
| Name  | Type    | Mandatory  | Description      |
| ---- | ------ | ---- | -------- |
| uid  | number | Yes   | UID based on which the bundle name is to obtain.|
W
wusongqing 已提交
1006 1007

**Return value**
W
wusongqing 已提交
1008 1009
| Type              | Description                               |
| ---------------- | --------------------------------- |
W
wusongqing 已提交
1010
| Promise\<string> | Promise used to return the bundle name.|
W
wusongqing 已提交
1011 1012 1013 1014

**Example**

```js
W
wusongqing 已提交
1015 1016 1017 1018 1019 1020 1021
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 已提交
1022 1023
```

W
wusongqing 已提交
1024
## bundle.getNameForUid<sup>8+</sup>
W
wusongqing 已提交
1025

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

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

W
wusongqing 已提交
1030 1031 1032
**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1033 1034 1035

**Parameters**

W
wusongqing 已提交
1036 1037 1038 1039
| 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 已提交
1040 1041 1042 1043

**Example**

```js
W
wusongqing 已提交
1044 1045 1046 1047 1048 1049 1050 1051
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 已提交
1052 1053
```

W
wusongqing 已提交
1054

W
wusongqing 已提交
1055
## bundle.getAbilityIcon<sup>8+</sup>
W
wusongqing 已提交
1056

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

W
wusongqing 已提交
1059
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 API uses a promise to return the result.
W
wusongqing 已提交
1060

W
wusongqing 已提交
1061 1062 1063 1064 1065 1066 1067 1068
**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1069 1070
**Parameters**

W
wusongqing 已提交
1071 1072 1073 1074
| 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 已提交
1075 1076 1077 1078

**Return value**
| Type                 | Description                                                        |
| --------------------- | ------------------------------------------------------------ |
W
wusongqing 已提交
1079
| Promise\<image.PixelMap> | Promise used to return the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md)>.|
W
wusongqing 已提交
1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093

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

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

W
wusongqing 已提交
1098
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 API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1099

W
wusongqing 已提交
1100 1101 1102 1103 1104 1105 1106 1107
**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1108 1109
**Parameters**

W
wusongqing 已提交
1110 1111 1112 1113 1114
| 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\<image.PixelMap> | Yes  | Callback used to return the [PixelMap](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-image.md)>.|
W
wusongqing 已提交
1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130

**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 已提交
1131
## bundle.queryExtensionAbilityInfosByWant<sup>9+</sup>
W
wusongqing 已提交
1132

W
wusongqing 已提交
1133
queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId?: number): Promise<Array\<ExtensionAbilityInfo>>
W
wusongqing 已提交
1134

W
wusongqing 已提交
1135
Obtains the Extension ability information based on a given want. This API uses a promise to return the result.
W
wusongqing 已提交
1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1147 1148 1149 1150 1151
| 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.             |
W
wusongqing 已提交
1152 1153 1154

**Return value**

W
wusongqing 已提交
1155 1156 1157
| Type                                   | Description                            |
| ------------------------------------- | ------------------------------ |
| Promise<Array\<ExtensionAbilityInfo>> | Promise used to return the Extension ability information.|
W
wusongqing 已提交
1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177

**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 已提交
1178
## bundle.queryExtensionAbilityInfosByWant<sup>9+</sup>
W
wusongqing 已提交
1179

W
wusongqing 已提交
1180
queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void
W
wusongqing 已提交
1181

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

W
wusongqing 已提交
1184 1185 1186 1187
**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

W
wusongqing 已提交
1188 1189 1190 1191 1192 1193
**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1194 1195 1196 1197 1198 1199
| 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.     |
W
wusongqing 已提交
1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218

**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 已提交
1219
## bundle.queryExtensionAbilityInfosByWant<sup>9+</sup>
W
wusongqing 已提交
1220

W
wusongqing 已提交
1221
queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void;
W
wusongqing 已提交
1222

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

W
wusongqing 已提交
1225 1226 1227 1228
**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

W
wusongqing 已提交
1229 1230 1231 1232 1233 1234
**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1235 1236 1237 1238 1239
| 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.     |
W
wusongqing 已提交
1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257

**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 已提交
1258 1259
## ElementName

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

W
wusongqing 已提交
1262 1263 1264 1265 1266 1267 1268
| Name         | Readable/Writable| Type    | Mandatory  | Description                                      |
| ----------- | ---- | ------ | ---- | ---------------------------------------- |
| 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 已提交
1269

W
wusongqing 已提交
1270
## InstallErrorCode
W
wusongqing 已提交
1271

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

W
wusongqing 已提交
1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295
| 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 已提交
1296 1297 1298

## BundleFlag

W
wusongqing 已提交
1299 1300 1301
Enumerates bundle flags.

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

W
wusongqing 已提交
1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313
| 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.    |
| 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.         |
W
wusongqing 已提交
1314
| GET_ABILITY_INFO_SYSTEMAPP_ONLY<sup>8+</sup> | 0x00000080 | Obtains the ability information with information about system applications.|
W
wusongqing 已提交
1315 1316 1317
| 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.       |
| GET_ALL_APPLICATION_INFO                 | 0xFFFF0000 | Obtains all application information.          |
W
wusongqing 已提交
1318 1319 1320 1321 1322

## BundleOptions

Describes the bundle options.

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

W
wusongqing 已提交
1325 1326 1327
| 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.|
W
wusongqing 已提交
1328 1329 1330 1331 1332

## BundleInfo

Describes the application bundle information.

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

W
wusongqing 已提交
1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360
| 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.         |
| installTime                       | number                       | Yes   | No   | Time when the HAP file was installed.             |
| updateTime                        | number                       | Yes   | No   | Time when the HAP file was updated.             |
| appInfo                           | ApplicationInfo              | Yes   | No   | Application configuration information.            |
| 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.|
| 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**.  |
| hapModuleInfos                    | Array\<HapModuleInfo>        | Yes   | No   | Module configuration information.              |
| 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.         |
| 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 已提交
1361 1362 1363 1364 1365

## ApplicationInfo

Describes the application information.

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

W
wusongqing 已提交
1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391
| 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.            |
| process                    | string                             | Yes   | No   | Process in which the application runs. If this parameter is not set, the bundle name is used by default.|
| supportedModes             | number                             | Yes   | No   | Running modes supported by the application.          |
| 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.            |
| entryDir                   | string                             | Yes   | No   | Path for storing application files.          |
| 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 已提交
1392 1393 1394

## ModuleInfo

W
wusongqing 已提交
1395 1396 1397
Describes the module information of the application.

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

W
wusongqing 已提交
1399 1400 1401 1402
| Name             | Type    | Readable  | Writable  | Description  |
| --------------- | ------ | ---- | ---- | ---- |
| moduleName      | string | Yes   | No   | Module name.|
| moduleSourceDir | string | Yes   | No   | Installation directory.|
W
wusongqing 已提交
1403 1404 1405 1406 1407

## CustomizeData

Describes the custom metadata.

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

W
wusongqing 已提交
1410 1411 1412 1413 1414
| Name                | Type    | Readable  | Writable  | Description      |
| ------------------ | ------ | ---- | ---- | -------- |
| name               | string | Yes   | Yes   | Custom metadata name.|
| value              | string | Yes   | Yes   | Custom metadata value. |
| extra<sup>8+</sup> | string | Yes   | Yes   | Custom resources.   |
W
wusongqing 已提交
1415 1416 1417 1418 1419 1420


## HapModuleInfo

Describes the HAP module information.

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

W
wusongqing 已提交
1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442
| 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.           |
| 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.         |
| moduleName                        | string                       | Yes   | No   | Module name.               |
| mainAbilityName                   | string                       | Yes   | No   | Name of the entry ability.       |
| installationFree                  | boolean                      | Yes   | No   | Whether installation-free is supported.           |
| mainElementName<sup>9+</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 已提交
1443 1444 1445 1446 1447

## ReqPermissionDetail

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

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

W
wusongqing 已提交
1450 1451 1452 1453 1454
| 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.|
W
wusongqing 已提交
1455 1456 1457 1458 1459

## UsedScene

Describes the application scenario and timing for using the permission.

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

W
wusongqing 已提交
1462 1463 1464 1465
| Name       | Type            | Readable  | Writable  | Description              |
| --------- | -------------- | ---- | ---- | ---------------- |
| abilities | Array\<string> | Yes   | Yes   | Abilities that use the permission.|
| when      | string         | Yes   | Yes   | Time when the permission is used.        |
W
wusongqing 已提交
1466 1467 1468 1469


## AbilityInfo

W
wusongqing 已提交
1470 1471 1472
Describes the ability information.

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

W
wusongqing 已提交
1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503
| 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.|
| targetAbility         | string                | Yes   | No   | Target ability that the ability alias points to.   |
| 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.            |
| 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.          |
| 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.     |
| 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 已提交
1504 1505 1506

## AbilityType

W
wusongqing 已提交
1507 1508 1509
Enumerates ability types.

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

W
wusongqing 已提交
1511 1512 1513 1514 1515 1516
| 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.|
W
wusongqing 已提交
1517 1518 1519

## DisplayOrientation

W
wusongqing 已提交
1520 1521 1522
Enumerates display orientations.

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

W
wusongqing 已提交
1524 1525 1526 1527 1528 1529
| 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.|
W
wusongqing 已提交
1530 1531 1532

## LaunchMode

W
wusongqing 已提交
1533 1534 1535
Enumerates launch modes.

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

W
wusongqing 已提交
1537 1538 1539 1540
| Name       | Type  | Description           |
| --------- | ---- | ------------- |
| SINGLETON | 0    | The ability has only one instance.|
| STANDARD  | 1    | The ability can have multiple instances. |
W
wusongqing 已提交
1541 1542 1543

## AbilitySubType

W
wusongqing 已提交
1544 1545 1546
Enumerates ability subtypes.

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

W
wusongqing 已提交
1548 1549 1550
| Name         | Type  | Description                  |
| ----------- | ---- | -------------------- |
| UNSPECIFIED | 0    | Undefined ability subtype.       |
W
wusongqing 已提交
1551
| CA          | 1    | Ability that has a UI.|
W
wusongqing 已提交
1552 1553


W
wusongqing 已提交
1554
## ExtensionAbilityType<sup>9+</sup>
W
wusongqing 已提交
1555

W
wusongqing 已提交
1556
Enumerates Extension ability types.
W
wusongqing 已提交
1557 1558 1559

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

W
wusongqing 已提交
1560 1561 1562
| Name                            | Type  | Description                       |
| ------------------------------ | ---- | ------------------------- |
| FORM<sup>9+</sup>              | 0    | Form included.  |
W
wusongqing 已提交
1563
| WORK_SCHEDULER<sup>9+</sup>    | 1    | Work scheduler included.|
W
wusongqing 已提交
1564 1565 1566 1567 1568 1569 1570 1571
| 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.    |
W
wusongqing 已提交
1572 1573

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

W
wusongqing 已提交
1575
Enumerates Extension flags.
W
wusongqing 已提交
1576 1577 1578

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

W
wusongqing 已提交
1579 1580 1581 1582 1583 1584
| 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. |
| GET_EXTENSION_INFO_WITH_METADATA<sup>9+</sup> | 0x00000020 | Obtains the Extension ability information that carries metadata information.|
W
wusongqing 已提交
1585 1586 1587 1588 1589 1590 1591 1592


## ColorMode

Enumerates color modes.

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

W
wusongqing 已提交
1593 1594 1595 1596 1597
| Name        | Type  | Description  |
| ---------- | ---- | ---- |
| AUTO_MODE  | -1   | Automatic mode.|
| DARK_MODE  | 0    | Dark mode.|
| LIGHT_MODE | 1    | Light mode.|
W
wusongqing 已提交
1598 1599


W
wusongqing 已提交
1600 1601 1602 1603 1604 1605
## GrantStatus

Enumerates permission grant statuses.

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

W
wusongqing 已提交
1606 1607 1608 1609
| Name                | Type  | Description  |
| ------------------ | ---- | ---- |
| PERMISSION_DENIED  | -1   | Permission denied.|
| PERMISSION_GRANTED | 0    | Permission granted.  |
W
wusongqing 已提交
1610 1611 1612


## ExtensionAbilityInfo<sup>9+</sup>
W
wusongqing 已提交
1613

W
wusongqing 已提交
1614
Describes the Extension ability information.
W
wusongqing 已提交
1615 1616 1617

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

W
wusongqing 已提交
1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633
| Name                               | Type                         | Readable  | Writable  | Description                               |
| --------------------------------- | --------------------------- | ---- | ---- | --------------------------------- |
| 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.        |
W
wusongqing 已提交
1634 1635 1636


## Metadata<sup>9+</sup>
W
wusongqing 已提交
1637 1638 1639 1640 1641

Describes the metadata information.

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

W
wusongqing 已提交
1642 1643 1644 1645 1646
| Name                   | Type    | Readable  | Writable  | Description   |
| --------------------- | ------ | ---- | ---- | ----- |
| 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.|