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