• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Bundle
2
3> **NOTE**
4>
5> 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.
6> API version 9 is a canary version for trial use. The APIs of this version may be unstable.
7## Modules to Import
8
9```
10import bundle from '@ohos.bundle';
11```
12
13## System Capability
14
15SystemCapability.BundleManager.BundleFramework
16
17## Required Permissions
18
19| Required Permissions                                      | Permission Level    | Description              |
20| ------------------------------------------ | ------------ | ------------------ |
21| ohos.permission.GET_BUNDLE_INFO            | normal       | Permission to query information about the current application.  |
22| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED| system_basic | Permission to query information about all applications.|
23| ohos.permission.INSTALL_BUNDLE             | system_core  | Permission to install or uninstall applications.  |
24
25## bundle.getApplicationInfo
26
27getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number): Promise\<ApplicationInfo>
28
29Obtains the application information based on a given bundle name. This API uses a promise to return the result.
30
31**Required permissions**
32
33ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
34
35**System capability**
36
37SystemCapability.BundleManager.BundleFramework
38
39**Parameters**
40
41| Name         | Type    | Mandatory  | Description                                     |
42| ----------- | ------ | ---- | --------------------------------------- |
43| bundleName  | string | Yes   | Bundle name of an application.                           |
44| 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.|
45| 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.           |
46
47**Return value**
48
49| Type                       | Description                |
50| ------------------------- | ------------------ |
51| Promise\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Promise used to return the application information.|
52
53**Example**
54
55```js
56let bundleName = "com.example.myapplication";
57let bundleFlags = 0;
58let userId = 100;
59bundle.getApplicationInfo(bundleName, bundleFlags, userId)
60.then((data) => {
61    console.info('Operation successful. Data: ' + JSON.stringify(data));
62}).catch((error) => {
63    console.error('Operation failed. Cause: ' + JSON.stringify(error));
64})
65```
66
67
68
69## bundle.getApplicationInfo
70
71getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback\<ApplicationInfo>): void
72
73Obtains the application information of the specified user based on a given bundle name. This API uses an asynchronous callback to return the result.
74
75**Required permissions**
76
77ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
78
79**System capability**
80
81SystemCapability.BundleManager.BundleFramework
82
83**Parameters**
84
85| Name         | Type                             | Mandatory  | Description                                     |
86| ----------- | ------------------------------- | ---- | --------------------------------------- |
87| bundleName  | string                          | Yes   | Bundle name of an application.                           |
88| 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.|
89| 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.           |
90| callback    | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes   | Callback used to return the application information.                |
91
92**Example**
93
94```js
95let bundleName = "com.example.myapplication";
96let bundleFlags = 0;
97let userId = 100;
98bundle.getApplicationInfo(bundleName, bundleFlags, userId, (err, data) => {
99    if (err) {
100        console.error('Operation failed. Cause: ' + JSON.stringify(err));
101        return;
102    }
103    console.info('Operation successful. Data:' + JSON.stringify(data));
104 })
105```
106
107
108## bundle.getApplicationInfo
109
110getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<ApplicationInfo>): void
111
112Obtains the application information based on a given bundle name. This API uses an asynchronous callback to return the result.
113
114**Required permissions**
115
116ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
117
118**System capability**
119
120SystemCapability.BundleManager.BundleFramework
121
122**Parameters**
123
124| Name         | Type                             | Mandatory  | Description                                     |
125| ----------- | ------------------------------- | ---- | --------------------------------------- |
126| bundleName  | string                          | Yes   | Bundle name of an application.                           |
127| 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.|
128| callback    | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes   | Callback used to return the application information.                |
129
130**Example**
131
132```js
133let bundleName = "com.example.myapplication";
134let bundleFlags = 0;
135bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => {
136    if (err) {
137        console.error('Operation failed. Cause: ' + JSON.stringify(err));
138        return;
139    }
140    console.info('Operation successful. Data:' + JSON.stringify(data));
141 })
142```
143
144
145## bundle.getAllBundleInfo
146
147getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise<Array\<BundleInfo>>
148
149Obtains the information of all available bundles of the specified user in the system. This API uses a promise to return the result.
150
151**Required permissions**
152
153ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
154
155**System capability**
156
157SystemCapability.BundleManager.BundleFramework
158
159**Parameters**
160
161| Name        | Type        | Mandatory  | Description                                     |
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.|
164| 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.           |
165
166**Return value**
167
168| Type                         | Description                        |
169| --------------------------- | -------------------------- |
170| Promise<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Promise used to return the information of all available bundles.|
171
172**Example**
173
174```js
175let bundleFlag = 0;
176let userId = 100;
177bundle.getAllBundleInfo(bundleFlag, userId)
178.then((data) => {
179    console.info('Operation successful. Data: ' + JSON.stringify(data));
180}).catch((error) => {
181    console.error('Operation failed. Cause: ' + JSON.stringify(error));
182})
183```
184
185
186
187## bundle.getAllBundleInfo
188
189getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback<Array\<BundleInfo>>): void
190
191Obtains the information of all available bundles in the system. This API uses an asynchronous callback to return the result.
192
193**Required permissions**
194
195ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
196
197**System capability**
198
199SystemCapability.BundleManager.BundleFramework
200
201**Parameters**
202
203| Name        | Type                               | Mandatory  | Description                                     |
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.|
206| callback   | AsyncCallback<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes   | Callback used to return the information of all available bundles.       |
207
208**Example**
209
210```js
211let bundleFlag = 0;
212bundle.getAllBundleInfo(bundleFlag, (err, data) => {
213    if (err) {
214        console.error('Operation failed. Cause: ' + JSON.stringify(err));
215        return;
216    }
217    console.info('Operation successful. Data:' + JSON.stringify(data));
218 })
219```
220
221
222## bundle.getAllBundleInfo
223
224getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback<Array\<BundleInfo>>): void
225
226Obtains the information of all available bundles of the specified user in the system. This API uses an asynchronous callback to return the result.
227
228**Required permissions**
229
230ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
231
232**System capability**
233
234SystemCapability.BundleManager.BundleFramework
235
236**Parameters**
237
238| Name        | Type                               | Mandatory  | Description                                     |
239| ---------- | --------------------------------- | ---- | --------------------------------------- |
240| 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.|
241| 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.           |
242| callback   | AsyncCallback<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes   | Callback used to return the information of all available bundles.       |
243
244**Example**
245
246```js
247let bundleFlag = 0;
248let userId = 100;
249bundle.getAllBundleInfo(bundleFlag, userId, (err, data) => {
250    if (err) {
251        console.error('Operation failed. Cause: ' + JSON.stringify(err));
252        return;
253    }
254    console.info('Operation successful. Data:' + JSON.stringify(data));
255 })
256```
257
258
259
260## bundle.getBundleInfo
261
262getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise\<BundleInfo>
263
264Obtains the bundle information based on a given bundle name. This API uses a promise to return the result.
265
266**Required permissions**
267
268ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
269
270**System capability**
271
272SystemCapability.BundleManager.BundleFramework
273
274**Parameters**
275
276| Name         | Type           | Mandatory  | Description                                     |
277| ----------- | ------------- | ---- | --------------------------------------- |
278| bundleName  | string        | Yes   | Bundle name of an application.                                     |
279| 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.|
280| options     | [BundleOptions](#bundleoptions) | No   | Includes **userId**.                              |
281
282**Return value**
283
284| Type                  | Description                          |
285| -------------------- | ---------------------------- |
286| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the bundle information.|
287
288**Example**
289
290```js
291let bundleName = "com.example.myapplication";
292let bundleFlags = 1;
293let options = {
294  "userId" : 100
295};
296bundle.getBundleInfo(bundleName, bundleFlags, options)
297.then((data) => {
298    console.info('Operation successful. Data: ' + JSON.stringify(data));
299}).catch((error) => {
300    console.error('Operation failed. Cause: ' + JSON.stringify(error));
301})
302```
303
304
305
306## bundle.getBundleInfo
307
308getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>): void
309
310Obtains the bundle information based on a given bundle name. This API uses an asynchronous callback to return the result.
311
312**Required permissions**
313
314ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
315
316**System capability**
317
318SystemCapability.BundleManager.BundleFramework
319
320**Parameters**
321
322| Name         | Type                        | Mandatory  | Description                                     |
323| ----------- | -------------------------- | ---- | --------------------------------------- |
324| bundleName  | string                     | Yes   | Bundle name of an application.                                     |
325| 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.|
326| callback    | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes   | Callback used to return the bundle information.                   |
327
328**Example**
329
330```js
331let bundleName = "com.example.myapplication";
332let bundleFlags = 1;
333bundle.getBundleInfo(bundleName, bundleFlags, (err, data) => {
334    if (err) {
335        console.error('Operation failed. Cause: ' + JSON.stringify(err));
336        return;
337    }
338    console.info('Operation successful. Data:' + JSON.stringify(data));
339})
340```
341
342
343## bundle.getBundleInfo
344
345getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback\<BundleInfo>): void
346
347Obtains the bundle information based on a given bundle name and bundle options. This API uses an asynchronous callback to return the result.
348
349**Required permissions**
350
351ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
352
353**System capability**
354
355SystemCapability.BundleManager.BundleFramework
356
357**Parameters**
358
359| Name         | Type                        | Mandatory  | Description                                     |
360| ----------- | -------------------------- | ---- | --------------------------------------- |
361| bundleName  | string                     | Yes   | Bundle name of an application.                                     |
362| 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.|
363| options     | [BundleOptions](#bundleoptions)              | Yes   | Includes **userId**.                              |
364| callback    | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes   | Callback used to return the bundle information.                   |
365
366**Example**
367
368```js
369let bundleName = "com.example.myapplication";
370let bundleFlags = 1;
371let options = {
372  "userId" : 100
373};
374bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => {
375    if (err) {
376        console.error('Operation failed. Cause: ' + JSON.stringify(err));
377        return;
378    }
379    console.info('Operation successful. Data:' + JSON.stringify(data));
380})
381```
382
383
384## bundle.getAllApplicationInfo
385
386getAllApplicationInfo(bundleFlags: number, userId?: number): Promise<Array\<ApplicationInfo>>
387
388Obtains the information about all applications of the specified user. This API uses a promise to return the result.
389
390**Required permissions**
391
392ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
393
394**System capability**
395
396SystemCapability.BundleManager.BundleFramework
397
398**Parameters**
399
400| Name         | Type    | Mandatory  | Description                                     |
401| ----------- | ------ | ---- | --------------------------------------- |
402| 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.|
403| 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.           |
404
405**Return value**
406
407| Type                              | Description                             |
408| -------------------------------- | ------------------------------- |
409| Promise<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Promise used to return the application information.|
410
411**Example**
412
413```js
414let bundleFlags = 8;
415let userId = 100;
416bundle.getAllApplicationInfo(bundleFlags, userId)
417.then((data) => {
418    console.info('Operation successful. Data: ' + JSON.stringify(data));
419}).catch((error) => {
420    console.error('Operation failed. Cause: ' + JSON.stringify(error));
421})
422```
423
424
425
426## bundle.getAllApplicationInfo
427
428getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback<Array\<ApplicationInfo>>): void
429
430Obtains the information about all applications of the specified user. This API uses an asynchronous callback to return the result.
431
432**Required permissions**
433
434ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
435
436**System capability**
437
438SystemCapability.BundleManager.BundleFramework
439
440**Parameters**
441
442| Name         | Type                                    | Mandatory  | Description                                     |
443| ----------- | -------------------------------------- | ---- | --------------------------------------- |
444| 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.|
445| 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.           |
446| callback    | AsyncCallback<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Yes   | Callback used to return the application information.                |
447
448**Example**
449
450```js
451let bundleFlags = 8;
452let userId = 100;
453bundle.getAllApplicationInfo(bundleFlags, userId, (err, data) => {
454    if (err) {
455        console.error('Operation failed. Cause: ' + JSON.stringify(err));
456        return;
457    }
458    console.info('Operation successful. Data:' + JSON.stringify(data));
459})
460```
461
462
463## bundle.getAllApplicationInfo
464
465getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback<Array\<ApplicationInfo>>) : void;
466
467Obtains the information about all applications. This API uses an asynchronous callback to return the result.
468
469**Required permissions**
470
471ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
472
473**System capability**
474
475SystemCapability.BundleManager.BundleFramework
476
477**Parameters**
478
479| Name         | Type                                    | Mandatory  | Description                                     |
480| ----------- | -------------------------------------- | ---- | --------------------------------------- |
481| 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.|
482| callback    | AsyncCallback<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Yes   | Callback used to return the application information.                |
483
484**Example**
485
486```js
487let bundleFlags = 8;
488bundle.getAllApplicationInfo(bundleFlags, (err, data) => {
489    if (err) {
490        console.error('Operation failed. Cause: ' + JSON.stringify(err));
491        return;
492    }
493    console.info('Operation successful. Data:' + JSON.stringify(data));
494})
495```
496
497## bundle.getBundleArchiveInfo
498
499getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise\<BundleInfo>
500
501Obtains information about the bundles contained in a HAP file. This API uses a promise to return the result.
502
503**System capability**
504
505SystemCapability.BundleManager.BundleFramework
506
507**Parameters**
508
509| Name        | Type    | Mandatory  | Description          |
510| ---------- | ------ | ---- | ------------ |
511| hapFilePath | string | Yes   | Path where the HAP file is stored. The path should point to the relative directory of the current application's data directory.|
512| bundleFlags | number | Yes   | Flags used to specify information contained in the **BundleInfo** object that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
513
514**Return value**
515| Type            | Description                                    |
516| -------------- | -------------------------------------- |
517| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the information about the bundles.|
518
519**Example**
520
521```js
522let hapFilePath = "/data/xxx/test.hap";
523let bundleFlags = 0;
524bundle.getBundleArchiveInfo(hapFilePath, bundleFlags)
525.then((data) => {
526    console.info('Operation successful. Data: ' + JSON.stringify(data));
527}).catch((error) => {
528    console.error('Operation failed. Cause: ' + JSON.stringify(error));
529})
530```
531
532## bundle.getBundleArchiveInfo
533
534getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>) : void
535
536Obtains information about the bundles contained in a HAP file. This API uses an asynchronous callback to return the result.
537
538**System capability**
539
540SystemCapability.BundleManager.BundleFramework
541
542**Parameters**
543
544| Name        | Type    | Mandatory  | Description          |
545| ---------- | ------ | ---- | ------------ |
546| hapFilePath | string | Yes   | Path where the HAP file is stored. The path should point to the relative directory of the current application's data directory.|
547| bundleFlags | number | Yes   | Flags used to specify information contained in the **BundleInfo** object that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
548| callback| AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes   | Callback used to return the information about the bundles.|
549
550**Example**
551
552```js
553let hapFilePath = "/data/xxx/test.hap";
554let bundleFlags = 0;
555bundle.getBundleArchiveInfo(hapFilePath, bundleFlags, (err, data) => {
556    if (err) {
557        console.error('Operation failed. Cause: ' + JSON.stringify(err));
558        return;
559    }
560    console.info('Operation successful. Data:' + JSON.stringify(data));
561})
562```
563
564## bundle.getAbilityInfo
565
566getAbilityInfo(bundleName: string, abilityName: string): Promise\<AbilityInfo>
567
568Obtains the ability information based on a given bundle name and ability name. This API uses a promise to return the result.
569
570**Required permissions**
571
572ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
573
574**System capability**
575
576SystemCapability.BundleManager.BundleFramework
577
578**Parameters**
579
580| Name         | Type    | Mandatory  | Description              |
581| ----------- | ------ | ---- | ---------------- |
582| bundleName  | string | Yes   | Bundle name of an application.    |
583| abilityName | string | Yes   | Ability name.|
584
585**Return value**
586
587| Type                   | Description                   |
588| --------------------- | --------------------- |
589| Promise\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Promise used to return the ability information.|
590
591**Example**
592
593```js
594let bundleName = "com.example.myapplication";
595let abilityName = "com.example.myapplication.MainAbility";
596bundle.getAbilityInfo(bundleName, abilityName)
597.then((data) => {
598    console.info('Operation successful. Data: ' + JSON.stringify(data));
599}).catch((error) => {
600    console.error('Operation failed. Cause: ' + JSON.stringify(error));
601})
602```
603
604## bundle.getAbilityInfo
605
606getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback\<AbilityInfo>): void;
607
608Obtains the ability information based on a given bundle name and ability name. This API uses an asynchronous callback to return the result.
609
610**Required permissions**
611
612ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
613
614**System capability**
615
616SystemCapability.BundleManager.BundleFramework
617
618**Parameters**
619
620| Name        | Type    | Mandatory  | Description           |
621| ----------- | ------------ | ---- | ---------------- |
622| bundleName  | string | Yes   | Bundle name of an application.    |
623| abilityName | string | Yes   | Ability name.|
624| callback    | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes   | Callback used to return the ability information.|
625
626**Example**
627
628```js
629let bundleName = "com.example.myapplication";
630let abilityName = "com.example.myapplication.MainAbility";
631bundle.getAbilityInfo(bundleName, abilityName, (err, data) => {
632    if (err) {
633        console.error('Operation failed. Cause: ' + JSON.stringify(err));
634        return;
635    }
636    console.info('Operation successful. Data:' + JSON.stringify(data));
637})
638```
639
640## bundle.getAbilityLabel<sup>8+</sup>
641
642getAbilityLabel(bundleName: string, abilityName: string): Promise\<string>
643
644Obtains the application name based on a given bundle name and ability name. This API uses a promise to return the result.
645
646**Required permissions**
647
648ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
649
650**System capability**
651
652SystemCapability.BundleManager.BundleFramework
653
654**Parameters**
655
656| Name         | Type    | Mandatory  | Description              |
657| ----------- | ------ | ---- | ---------------- |
658| bundleName  | string | Yes   | Bundle name of an application.    |
659| abilityName | string | Yes   | Ability name.|
660
661**Return value**
662
663| Type              | Description                |
664| ---------------- | ------------------ |
665| Promise\<string> | Promise used to return the application name.|
666
667**Example**
668
669```js
670let bundleName = "com.example.myapplication";
671let abilityName = "com.example.myapplication.MainAbility";
672bundle.getAbilityLabel(bundleName, abilityName)
673.then((data) => {
674    console.info('Operation successful. Data: ' + JSON.stringify(data));
675}).catch((error) => {
676    console.error('Operation failed. Cause: ' + JSON.stringify(error));
677})
678```
679
680## bundle.getAbilityLabel<sup>8+</sup>
681
682getAbilityLabel(bundleName: string, abilityName: string, callback : AsyncCallback\<string>): void
683
684Obtains the application name based on a given bundle name and ability name. This API uses an asynchronous callback to return the result.
685
686**Required permissions**
687
688ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
689
690**System capability**
691
692SystemCapability.BundleManager.BundleFramework
693
694**Parameters**
695
696| Name         | Type                    | Mandatory  | Description              |
697| ----------- | ---------------------- | ---- | ---------------- |
698| bundleName  | string                 | Yes   | Bundle name of an application.    |
699| abilityName | string                 | Yes   | Ability name.|
700| callback    | AsyncCallback\<string> | Yes   | Callback used to return the application name.       |
701
702**Example**
703
704```js
705let bundleName = "com.example.myapplication";
706let abilityName = "com.example.myapplication.MainAbility";
707bundle.getAbilityLabel(bundleName, abilityName, (err, data) => {
708    if (err) {
709        console.error('Operation failed. Cause: ' + JSON.stringify(err));
710        return;
711    }
712    console.info('Operation successful. Data:' + JSON.stringify(data));
713})
714```
715
716## bundle.isAbilityEnabled<sup>8+</sup>
717
718isAbilityEnabled(info: AbilityInfo): Promise\<boolean>
719
720Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses a promise to return the result.
721
722**System capability**
723
724SystemCapability.BundleManager.BundleFramework
725
726**Parameters**
727
728| Name  | Type         | Mandatory  | Description          |
729| ---- | ----------- | ---- | ------------ |
730| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes   | Ability information.|
731
732**Return value**
733
734| Type               | Description                       |
735| ----------------- | ------------------------- |
736| 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.|
737
738**Example**
739
740```js
741let Info = {
742    bundleName : "com.example.myapplication",
743    name : "com.example.myapplication.MainAbility"
744};
745bundle.isAbilityEnabled(Info)
746.then((data) => {
747    console.info('Operation successful. Data: ' + JSON.stringify(data));
748}).catch((error) => {
749    console.error('Operation failed. Cause: ' + JSON.stringify(error));
750})
751```
752
753## bundle.isAbilityEnabled<sup>8+</sup>
754
755isAbilityEnabled(info : AbilityInfo, callback : AsyncCallback\<boolean>): void
756
757Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses an asynchronous callback to return the result.
758
759**System capability**
760
761SystemCapability.BundleManager.BundleFramework
762
763**Parameters**
764
765| Name      | Type                     | Mandatory  | Description             |
766| -------- | ----------------------- | ---- | --------------- |
767| info     | [AbilityInfo](js-apis-bundle-AbilityInfo.md)             | Yes   | Ability information.   |
768| 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.|
769
770**Example**
771
772```js
773let Info = {
774    bundleName : "com.example.myapplication",
775    name : "com.example.myapplication.MainAbility"
776};
777bundle.isAbilityEnabled(Info, (err, data) => {
778    if (err) {
779        console.error('Operation failed. Cause: ' + JSON.stringify(err));
780        return;
781    }
782    console.info('Operation successful. Data:' + JSON.stringify(data));
783})
784```
785
786## bundle.isApplicationEnabled<sup>8+</sup>
787
788isApplicationEnabled(bundleName: string): Promise\<boolean>
789
790Checks whether an application is enabled based on a given bundle name. This API uses a promise to return the result.
791
792**System capability**
793
794SystemCapability.BundleManager.BundleFramework
795
796**Parameters**
797
798| Name        | Type    | Mandatory  | Description          |
799| ---------- | ------ | ---- | ------------ |
800| bundleName | string | Yes   | Bundle name of an application.|
801
802**Return value**
803
804| Type               | Description                       |
805| ----------------- | ------------------------- |
806| 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.|
807
808**Example**
809
810```js
811let bundleName = "com.example.myapplication";
812bundle.isApplicationEnabled(bundleName)
813.then((data) => {
814    console.info('Operation successful. Data: ' + JSON.stringify(data));
815}).catch((error) => {
816    console.error('Operation failed. Cause: ' + JSON.stringify(error));
817})
818```
819
820## bundle.isApplicationEnabled<sup>8+</sup>
821
822isApplicationEnabled(bundleName: string, callback : AsyncCallback\<boolean>): void
823
824Checks whether an application is enabled based on a given bundle name. This API uses an asynchronous callback to return the result.
825
826**System capability**
827
828SystemCapability.BundleManager.BundleFramework
829
830**Parameters**
831
832| Name        | Type                     | Mandatory  | Description             |
833| ---------- | ----------------------- | ---- | --------------- |
834| bundleName | string                  | Yes   | Bundle name of an application.   |
835| 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.|
836
837**Example**
838
839```js
840let bundleName = "com.example.myapplication";
841bundle.isApplicationEnabled(bundleName, (err, data) => {
842    if (err) {
843        console.error('Operation failed. Cause: ' + JSON.stringify(err));
844        return;
845    }
846    console.info('Operation successful. Data:' + JSON.stringify(data));
847})
848```
849
850## bundle.queryAbilityByWant
851
852queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise<Array\<AbilityInfo>>
853
854Obtains the ability information based on a given want. This API uses a promise to return the result.
855
856**Required permissions**
857
858ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
859
860**System capability**
861
862SystemCapability.BundleManager.BundleFramework
863
864**Parameters**
865
866| Name         | Type    | Mandatory  | Description                                   |
867| ----------- | ------ | ---- | ------------------------------------- |
868| want        | [Want](js-apis-application-Want.md)   | Yes   | Want that contains the bundle name.                    |
869| bundleFlags | number | Yes   | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
870| 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.          |
871
872**Return value**
873
874| Type                          | Description                   |
875| ---------------------------- | --------------------- |
876| Promise<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Promise used to return the ability information.|
877
878**Example**
879
880```js
881let bundleFlags = 0;
882let userId = 100;
883let want = {
884    bundleName : "com.example.myapplication",
885    abilityName : "com.example.myapplication.MainAbility"
886};
887bundle.queryAbilityByWant(want, bundleFlags, userId)
888.then((data) => {
889    console.info('Operation successful. Data: ' + JSON.stringify(data));
890}).catch((error) => {
891    console.error('Operation failed. Cause: ' + JSON.stringify(error));
892})
893```
894
895
896
897## bundle.queryAbilityByWant
898
899queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback<Array\<AbilityInfo>>): void
900
901Obtains the ability information of the specified user based on a given want. This API uses an asynchronous callback to return the result.
902
903**Required permissions**
904
905ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
906
907**System capability**
908
909SystemCapability.BundleManager.BundleFramework
910
911**Parameters**
912
913| Name         | Type                                | Mandatory  | Description                                   |
914| ----------- | ---------------------------------- | ---- | ------------------------------------- |
915| want        | [Want](js-apis-application-Want.md)                               | Yes   | Want that contains the bundle name.                  |
916| bundleFlags | number                             | Yes   | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
917| 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.          |
918| callback    | AsyncCallback<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Yes   | Callback used to return the ability information.           |
919
920**Example**
921
922```js
923let bundleFlags = 0;
924let userId = 100;
925let want = {
926    bundleName : "com.example.myapplication",
927    abilityName : "com.example.myapplication.MainAbility"
928};
929bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => {
930    if (err) {
931        console.error('Operation failed. Cause: ' + JSON.stringify(err));
932        return;
933    }
934    console.info('Operation successful. Data:' + JSON.stringify(data));
935})
936```
937
938## bundle.queryAbilityByWant
939
940queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Array\<AbilityInfo>>): void;
941
942Obtains the ability information based on a given want. This API uses an asynchronous callback to return the result.
943
944**Required permissions**
945
946ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
947
948**System capability**
949
950SystemCapability.BundleManager.BundleFramework
951
952**Parameters**
953
954| Name         | Type                                | Mandatory  | Description                                   |
955| ----------- | ---------------------------------- | ---- | ------------------------------------- |
956| want        | [Want](js-apis-application-Want.md)                               | Yes   | Want that contains the bundle name.                  |
957| bundleFlags | number                             | Yes   | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
958| callback    | AsyncCallback<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Yes   | Callback used to return the ability information.           |
959
960**Example**
961
962```js
963let bundleFlags = 0;
964let want = {
965    bundleName : "com.example.myapplication",
966    abilityName : "com.example.myapplication.MainAbility"
967};
968bundle.queryAbilityByWant(want, bundleFlags, (err, data) => {
969    if (err) {
970        console.error('Operation failed. Cause: ' + JSON.stringify(err));
971        return;
972    }
973    console.info('Operation successful. Data:' + JSON.stringify(data));
974})
975```
976
977
978
979## bundle.getLaunchWantForBundle
980
981getLaunchWantForBundle(bundleName: string): Promise\<Want>
982
983Obtains the **Want** object that launches the specified application. This API uses a promise to return the result.
984
985**Required permissions**
986
987ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
988
989**System capability**
990
991SystemCapability.BundleManager.BundleFramework
992
993**Parameters**
994
995| Name        | Type    | Mandatory  | Description          |
996| ---------- | ------ | ---- | ------------ |
997| bundleName | string | Yes   | Bundle name of an application.|
998
999**Return value**
1000| Type            | Description                                    |
1001| -------------- | -------------------------------------- |
1002| Promise\<[Want](js-apis-application-Want.md)> | Promise used to return the **Want** object.|
1003
1004**Example**
1005
1006```js
1007let bundleName = "com.example.myapplication";
1008bundle.getLaunchWantForBundle(bundleName)
1009.then((data) => {
1010    console.info('Operation successful. Data: ' + JSON.stringify(data));
1011}).catch((error) => {
1012    console.error('Operation failed. Cause: ' + JSON.stringify(error));
1013})
1014```
1015
1016## bundle.getLaunchWantForBundle
1017
1018getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void;
1019
1020Obtains the **Want** object that launches the specified application. This API uses an asynchronous callback to return the result.
1021
1022**Required permissions**
1023
1024ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
1025
1026**System capability**
1027
1028SystemCapability.BundleManager.BundleFramework
1029
1030**Parameters**
1031
1032| Name        | Type                  | Mandatory  | Description                            |
1033| ---------- | -------------------- | ---- | ------------------------------ |
1034| bundleName | string               | Yes   | Bundle name of an application.                  |
1035| callback   | AsyncCallback\<[Want](js-apis-application-Want.md)> | Yes   | Callback used to return the **Want** object.|
1036
1037**Example**
1038
1039```js
1040let bundleName = "com.example.myapplication";
1041bundle.getLaunchWantForBundle(bundleName, (err, data) => {
1042    if (err) {
1043        console.error('Operation failed. Cause: ' + JSON.stringify(err));
1044        return;
1045    }
1046    console.info('Operation successful. Data:' + JSON.stringify(data));
1047})
1048```
1049
1050
1051## bundle.getNameForUid<sup>8+</sup>
1052
1053getNameForUid(uid: number): Promise\<string>
1054
1055Obtains the bundle name based on a UID. This API uses a promise to return the result.
1056
1057**System capability**
1058
1059SystemCapability.BundleManager.BundleFramework
1060
1061**Parameters**
1062
1063| Name  | Type    | Mandatory  | Description      |
1064| ---- | ------ | ---- | -------- |
1065| uid  | number | Yes   | UID based on which the bundle name is to obtain.|
1066
1067**Return value**
1068| Type              | Description                               |
1069| ---------------- | --------------------------------- |
1070| Promise\<string> | Promise used to return the bundle name.|
1071
1072**Example**
1073
1074```js
1075let uid = 20010005;
1076bundle.getNameForUid(uid)
1077.then((data) => {
1078    console.info('Operation successful. Data: ' + JSON.stringify(data));
1079}).catch((error) => {
1080    console.error('Operation failed. Cause: ' + JSON.stringify(error));
1081})
1082```
1083
1084## bundle.getNameForUid<sup>8+</sup>
1085
1086getNameForUid(uid: number, callback: AsyncCallback\<string>) : void
1087
1088Obtains the bundle name based on a UID. This API uses an asynchronous callback to return the result.
1089
1090**System capability**
1091
1092SystemCapability.BundleManager.BundleFramework
1093
1094**Parameters**
1095
1096| Name      | Type                    | Mandatory  | Description                       |
1097| -------- | ---------------------- | ---- | ------------------------- |
1098| uid      | number                 | Yes   | UID based on which the bundle name is to obtain.                 |
1099| callback | AsyncCallback\<string> | Yes   | Callback used to return the bundle name.|
1100
1101**Example**
1102
1103```js
1104let uid = 20010005;
1105bundle.getNameForUid(uid, (err, data) => {
1106    if (err) {
1107        console.error('Operation failed. Cause: ' + JSON.stringify(err));
1108        return;
1109    }
1110    console.info('Operation successful. Data:' + JSON.stringify(data));
1111})
1112```
1113
1114
1115## bundle.getAbilityIcon<sup>8+</sup>
1116
1117getAbilityIcon(bundleName: string, abilityName: string): Promise\<image.PixelMap>;
1118
1119Obtains the [pixel map](js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses a promise to return the result.
1120
1121**Required permissions**
1122
1123ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
1124
1125**System capability**
1126
1127SystemCapability.BundleManager.BundleFramework
1128
1129**Parameters**
1130
1131| Name         | Type                                      | Mandatory  | Description                                      |
1132| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
1133| bundleName  | string                                   | Yes   | Bundle name based on which the pixel map is to obtain.                         |
1134| abilityName | string                                   | Yes   | Ability name based on which the pixel map is to obtain.                        |
1135
1136**Return value**
1137| Type                 | Description                                                        |
1138| --------------------- | ------------------------------------------------------------ |
1139| Promise\<image.PixelMap> | Promise used to return the [pixel map](js-apis-image.md).|
1140
1141**Example**
1142
1143```js
1144let bundleName = "com.example.myapplication";
1145let abilityName = "com.example.myapplication.MainAbility";
1146bundle.getAbilityIcon(bundleName, abilityName)
1147.then((data) => {
1148    console.info('Operation successful. Data: ' + JSON.stringify(data));
1149}).catch((error) => {
1150    console.error('Operation failed. Cause: ' + JSON.stringify(error));
1151})
1152```
1153
1154## bundle.getAbilityIcon<sup>8+</sup>
1155
1156getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<image.PixelMap>): void;
1157
1158Obtains the [pixel map](js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses an asynchronous callback to return the result.
1159
1160**Required permissions**
1161
1162ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
1163
1164**System capability**
1165
1166SystemCapability.BundleManager.BundleFramework
1167
1168**Parameters**
1169
1170| Name         | Type                                      | Mandatory  | Description                                      |
1171| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
1172| bundleName  | string                                   | Yes   | Bundle name based on which the pixel map is to obtain.                         |
1173| abilityName | string                                   | Yes   | Ability name based on which the pixel map is to obtain.                        |
1174| callback   | AsyncCallback\<image.PixelMap> | Yes  | Callback used to return the [pixel map](js-apis-image.md).|
1175
1176**Example**
1177
1178```js
1179let bundleName = "com.example.myapplication";
1180let abilityName = "com.example.myapplication.MainAbility";
1181bundle.getAbilityIcon(bundleName, abilityName, (err, data) => {
1182    if (err) {
1183        console.error('Operation failed. Cause: ' + JSON.stringify(err));
1184        return;
1185    }
1186    console.info('Operation successful. Data:' + JSON.stringify(data));
1187})
1188```
1189
1190## InstallErrorCode
1191
1192 **System capability**: SystemCapability.BundleManager.BundleFramework
1193
1194| Name                                      | Default Value | Description                       |
1195| ---------------------------------------- | ---- | ------------------------- |
1196| SUCCESS                                  | 0    | Installation succeeded.                     |
1197| STATUS_INSTALL_FAILURE                   | 1    | Installation failed. (The application to be installed is not found.)           |
1198| STATUS_INSTALL_FAILURE_ABORTED           | 2    | Installation aborted.                     |
1199| STATUS_INSTALL_FAILURE_INVALID           | 3    | Invalid installation parameter.                   |
1200| STATUS_INSTALL_FAILURE_CONFLICT          | 4    | Installation conflict. (The basic information of the application to update is inconsistent with that of the existing application.) |
1201| STATUS_INSTALL_FAILURE_STORAGE           | 5    | Failed to store the bundle information.                  |
1202| STATUS_INSTALL_FAILURE_INCOMPATIBLE      | 6    | Installation incompatibility. (A downgrade occurs or the signature information is incorrect.) |
1203| STATUS_UNINSTALL_FAILURE                 | 7    | Uninstallation failed. (The application to be uninstalled is not found.)          |
1204| STATUS_UNINSTALL_FAILURE_BLOCKED         | 8    | Uninstallation aborted. (This error code is not in use.)              |
1205| STATUS_UNINSTALL_FAILURE_ABORTED         | 9    | Uninstallation aborted. (Invalid parameters.)            |
1206| STATUS_UNINSTALL_FAILURE_CONFLICT        | 10   | Uninstallation conflict. (Failed to uninstall a system application or end the application process.)|
1207| STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT  | 0x0B | Installation failed. (Download timed out.)              |
1208| STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED   | 0x0C | Installation failed. (Download failed.)              |
1209| STATUS_RECOVER_FAILURE_INVALID<sup>8+</sup> | 0x0D | Failed to restore the pre-installed application.                 |
1210| STATUS_ABILITY_NOT_FOUND                 | 0x40 | Ability not found.               |
1211| STATUS_BMS_SERVICE_ERROR                 | 0x41 | BMS service error.                  |
1212| STATUS_FAILED_NO_SPACE_LEFT<sup>8+</sup> | 0x42 | Insufficient device space.                   |
1213| STATUS_GRANT_REQUEST_PERMISSIONS_FAILED<sup>8+</sup> | 0x43 | Application authorization failed.                   |
1214| STATUS_INSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x44 | Installation permission denied.                   |
1215| STATUS_UNINSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x45 | Uninstallation permission denied.                   |
1216
1217## BundleFlag
1218
1219Enumerates bundle flags.
1220
1221 **System capability**: SystemCapability.BundleManager.BundleFramework
1222
1223| Name                                      | Default Value       | Description                 |
1224| ---------------------------------------- | ---------- | ------------------- |
1225| GET_BUNDLE_DEFAULT                       | 0x00000000 | Obtains the default application information.          |
1226| GET_BUNDLE_WITH_ABILITIES                | 0x00000001 | Obtains the bundle information with the ability information.  |
1227| GET_ABILITY_INFO_WITH_PERMISSION         | 0x00000002 | Obtains the ability information with the permission information.   |
1228| GET_ABILITY_INFO_WITH_APPLICATION        | 0x00000004 | Obtains the ability information with the application information.   |
1229| GET_APPLICATION_INFO_WITH_PERMISSION     | 0x00000008 | Obtains the application information with the permission information.        |
1230| GET_BUNDLE_WITH_REQUESTED_PERMISSION     | 0x00000010 | Obtains the bundle information with the information about the required permissions.       |
1231| GET_ABILITY_INFO_WITH_METADATA<sup>8+</sup> | 0x00000020 | Obtains the ability metadata information.    |
1232| GET_BUNDLE_WITH_EXTENSION_ABILITY<sup>9+</sup> | 0x00000020 | Obtains the bundle information with the Extension ability information.|
1233| GET_APPLICATION_INFO_WITH_METADATA<sup>8+</sup> | 0x00000040 | Obtains the application metadata information.         |
1234| GET_ABILITY_INFO_SYSTEMAPP_ONLY<sup>8+</sup> | 0x00000080 | Obtains the ability information of system applications.|
1235| GET_ABILITY_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000100 | Obtains information about disabled abilities.  |
1236| GET_APPLICATION_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000200 | Obtains information about disabled applications.       |
1237| GET_ALL_APPLICATION_INFO                 | 0xFFFF0000 | Obtains all application information.          |
1238
1239## BundleOptions
1240
1241Describes the bundle options.
1242
1243 **System capability**: SystemCapability.BundleManager.BundleFramework
1244
1245| Name    | Type    | Readable  | Writable  | Description                          |
1246| ------ | ------ | ---- | ---- | ---------------------------- |
1247| 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.|
1248
1249
1250## AbilityType
1251
1252Enumerates ability types.
1253
1254 **System capability**: SystemCapability.BundleManager.BundleFramework
1255
1256| Name     | Type  | Description               |
1257| ------- | ---- | ----------------- |
1258| UNKNOWN | None   | Unknown ability type.      |
1259| PAGE    | None   | Ability that has a UI.   |
1260| SERVICE | None   | Ability that does not have a UI.    |
1261| DATA    | None   | Ability that is used to provide data access services.|
1262
1263## DisplayOrientation
1264
1265Enumerates display orientations.
1266
1267 **System capability**: SystemCapability.BundleManager.BundleFramework
1268
1269| Name           | Type  | Description           |
1270| ------------- | ---- | ------------- |
1271| UNSPECIFIED   | None   | Unspecified display orientation.    |
1272| LANDSCAPE     | None   | Landscape orientation.     |
1273| PORTRAIT      | None   | Portrait orientation.     |
1274| FOLLOW_RECENT | None   | Orientation same as that of the nearest ability in the stack.|
1275
1276## LaunchMode
1277
1278Enumerates launch modes.
1279
1280 **System capability**: SystemCapability.BundleManager.BundleFramework
1281
1282| Name       | Type  | Description           |
1283| --------- | ---- | ------------- |
1284| SINGLETON | 0    | The ability has only one instance.|
1285| STANDARD  | 1    | The ability can have multiple instances. |
1286
1287## AbilitySubType
1288
1289Enumerates ability subtypes.
1290
1291 **System capability**: SystemCapability.BundleManager.BundleFramework
1292
1293| Name         | Type  | Description                  |
1294| ----------- | ---- | -------------------- |
1295| UNSPECIFIED | 0    | Undefined ability subtype.       |
1296| CA          | 1    | Ability that has a UI.|
1297
1298## ExtensionAbilityType<sup>9+</sup>
1299
1300Enumerates Extension ability types.
1301
1302 **System capability**: SystemCapability.BundleManager.BundleFramework
1303
1304| Name                            | Type  | Description                       |
1305| ------------------------------ | ---- | ------------------------- |
1306| FORM<sup>9+</sup>              | 0    | Form (widget) included.  |
1307| WORK_SCHEDULER<sup>9+</sup>    | 1    | Work scheduler included.|
1308| INPUT_METHOD<sup>9+</sup>      | 2    | Input method included. |
1309| SERVICE<sup>9+</sup>           | 3    | Service included.  |
1310| ACCESSIBILITY<sup>9+</sup>     | 4    | Accessibility included. |
1311| DATA_SHARE<sup>9+</sup>        | 5    | Data sharing included.|
1312| FILE_SHARE<sup>9+</sup>        | 6    | File sharing included.|
1313| STATIC_SUBSCRIBER<sup>9+</sup> | 7    | Subscribers included. |
1314| WALLPAPER<sup>9+</sup>         | 8    | Wallpaper included.  |
1315| UNSPECIFIED<sup>9+</sup>       | 9   | Unspecified type.    |
1316
1317## ExtensionFlag<sup>9+</sup>
1318
1319Enumerates Extension flags.
1320
1321 **System capability**: SystemCapability.BundleManager.BundleFramework
1322
1323| Name                                      | Default Value       | Description                            |
1324| ---------------------------------------- | ---------- | ------------------------------ |
1325| GET_EXTENSION_INFO_DEFAULT<sup>9+</sup>  | 0x00000000 | Obtains the default Extension ability information.     |
1326| GET_EXTENSION_INFO_WITH_PERMISSION<sup>9+</sup> | 0x00000002 | Obtains the Extension ability information that carries permission information. |
1327| GET_EXTENSION_INFO_WITH_APPLICATION<sup>9+</sup> | 0x00000004 | Obtains the Extension ability information that carries application information. |
1328| GET_EXTENSION_INFO_WITH_METADATA<sup>9+</sup> | 0x00000020 | Obtains the Extension ability information that carries metadata information.|
1329
1330## ColorMode
1331
1332Enumerates color modes.
1333
1334 **System capability**: SystemCapability.BundleManager.BundleFramework
1335
1336| Name        | Type  | Description  |
1337| ---------- | ---- | ---- |
1338| AUTO_MODE  | -1   | Automatic mode.|
1339| DARK_MODE  | 0    | Dark mode.|
1340| LIGHT_MODE | 1    | Light mode.|
1341
1342## GrantStatus
1343
1344Enumerates permission grant states.
1345
1346 **System capability**: SystemCapability.BundleManager.BundleFramework
1347
1348| Name                | Type  | Description  |
1349| ------------------ | ---- | ---- |
1350| PERMISSION_DENIED  | -1   | Permission denied.|
1351| PERMISSION_GRANTED | 0    | Permission granted.  |
1352
1353