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