• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.bundle.installer (installer)
2
3The **bundle.installer** module provides APIs for you to install, uninstall, and recover bundles on devices.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8
9## Modules to Import
10
11```js
12import installer from '@ohos.bundle.installer';
13```
14
15## Required Permissions
16
17| Permission                          | APL   | Description            |
18| ------------------------------ | ----------- | ---------------- |
19| ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall other applications except enterprise applications, including enterprise InHouse, mobile device management (MDM), and Normal applications.|
20| ohos.permission.INSTALL_ENTERPRISE_BUNDLE | system_core | Permission to install enterprise InHouse applications.|
21| ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE | system_core | Permission to install enterprise MDM applications.|
22| ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE | system_core | Permission to install enterprise Normal applications.|
23| ohos.permission.UNINSTALL_BUNDLE | system_core | Allows an application to uninstall applications.|
24| ohos.permission.RECOVER_BUNDLE | system_core | Allows an application to restore pre-installed applications.|
25| ohos.permission.INSTALL_SELF_BUNDLE | system_core | Allows automatic updates of the enterprise MDM applications on enterprise devices.|
26
27
28For details, see [Permission APL](../../security/AccessToken/app-permission-mgmt-overview.md#permission-apl).
29
30## BundleInstaller.getBundleInstaller
31
32getBundleInstaller(callback: AsyncCallback\<BundleInstaller>): void
33
34Obtains a **BundleInstaller** object. This API uses an asynchronous callback to return the result.
35
36**System API**: This is a system API.
37
38**System capability**: SystemCapability.BundleManager.BundleFramework.Core
39
40**Parameters**
41
42| Name  | Type                                                        | Mandatory| Description                                                        |
43| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
44| callback | AsyncCallback\<BundleInstaller> | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the **BundleInstaller** object obtained; otherwise, **err** is an error object.|
45
46**Example**
47
48```ts
49import installer from '@ohos.bundle.installer';
50import { BusinessError } from '@ohos.base';
51
52try {
53    installer.getBundleInstaller((err: BusinessError, data: installer.BundleInstaller) => {
54        if (err) {
55            console.error('getBundleInstaller failed:' + err.message);
56        } else {
57            console.info('getBundleInstaller successfully');
58        }
59    });
60} catch (error) {
61    let message = (error as BusinessError).message;
62    console.error('getBundleInstaller failed:' + message);
63}
64```
65
66## BundleInstaller.getBundleInstaller
67
68getBundleInstaller(): Promise\<BundleInstaller>
69
70Obtains a **BundleInstaller** object. This API uses an asynchronous callback to return the result.
71
72**System API**: This is a system API.
73
74**System capability**: SystemCapability.BundleManager.BundleFramework.Core
75
76**Return value**
77| Type                                                        | Description                                |
78| ------------------------------------------------------------ | ------------------------------------ |
79| Promise\<BundleInstaller> | Promise used to return the **BundleInstaller** object obtained.|
80
81**Example**
82
83```ts
84import installer from '@ohos.bundle.installer';
85import { BusinessError } from '@ohos.base';
86
87try {
88    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
89        console.info('getBundleInstaller successfully.');
90    }).catch((error: BusinessError) => {
91        console.error('getBundleInstaller failed. Cause: ' + error.message);
92    });
93} catch (error) {
94    let message = (error as BusinessError).message;
95    console.error('getBundleInstaller failed. Cause: ' + message);
96}
97```
98
99## BundleInstaller.getBundleInstallerSync<sup>10+</sup>
100
101getBundleInstallerSync(): BundleInstaller
102
103Obtains a **BundleInstaller** object. This API is a synchronous API.
104
105**System API**: This is a system API.
106
107**System capability**: SystemCapability.BundleManager.BundleFramework.Core
108
109**Return value**
110| Type                                                        | Description                                |
111| ------------------------------------------------------------ | ------------------------------------ |
112| BundleInstaller | **BundleInstaller** object.|
113
114**Example**
115
116```ts
117import installer from '@ohos.bundle.installer';
118import { BusinessError } from '@ohos.base';
119
120try {
121    installer.getBundleInstallerSync();
122    console.info('getBundleInstallerSync successfully.');
123} catch (error) {
124    let message = (error as BusinessError).message;
125    console.error('getBundleInstallerSync failed. Cause: ' + message);
126}
127```
128
129## BundleInstaller.install
130install(hapFilePaths: Array&lt;string&gt;, installParam: InstallParam, callback: AsyncCallback&lt;void&gt;): void
131
132Installs a bundle. This API uses an asynchronous callback to return the result.
133
134**System API**: This is a system API.
135
136**Required permissions**: ohos.permission.INSTALL_BUNDLE, ohos.permission.INSTALL_ENTERPRISE_BUNDLE<sup>10+</sup>, ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE<sup>10+</sup>, or ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE<sup>10+</sup>
137> **NOTE**
138>
139> From API version 10, this API can be called with the permission **ohos.permission.INSTALL_ENTERPRISE_BUNDLE**, **ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE**, or **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE**.
140>
141> To install an enterprise application, you must have the **ohos.permission.INSTALL_ENTERPRISE_BUNDLE** permission.
142>
143> To install an enterprise Normal application, you must have the **ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE** or **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE** permission.
144>
145> To install an enterprise MDM application, you must have the **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE** permission.
146>
147> To install a common application, you must have the **ohos.permission.INSTALL_BUNDLE** permission.
148
149**System capability**: SystemCapability.BundleManager.BundleFramework.Core
150
151**Parameters**
152
153| Name          | Type                                                | Mandatory| Description                                                        |
154| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
155| hapFilePaths | Array&lt;string&gt;                                  | Yes  | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.|
156| installParam           | [InstallParam](#installparam)                        | Yes  | Parameters required for the installation.                                    |
157| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
158
159**Error codes**
160
161For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
162
163| ID| Error Message                                                    |
164| -------- | ------------------------------------------------------------ |
165| 17700004 | The specified user ID is not found.                          |
166| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
167| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
168| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
169| 17700015 | Failed to install the HAPs because they have different configuration information. |
170| 17700016 | Failed to install the HAP because of insufficient system disk space. |
171| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
172| 17700018 | Failed to install because the dependent module does not exist. |
173| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. |
174| 17700036 | Failed to install the HSP because lacks appropriate permissions. |
175| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
176| 17700041 | Failed to install because enterprise device management disallow install. |
177| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
178| 17700043 | Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core). |
179| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
180| 17700047 | Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode. |
181| 17700048 | Failed to install the HAP because the code signature verification is failed. |
182| 17700050 | Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device. |
183| 17700052 | Failed to install the HAP because debug bundle cannot be installed under non-developer mode. |
184| 17700054 | Failed to install the HAP because the HAP requests wrong permissions.|
185
186**Example**
187
188```ts
189import installer from '@ohos.bundle.installer';
190import { BusinessError } from '@ohos.base';
191
192let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
193let installParam: installer.InstallParam = {
194    userId: 100,
195    isKeepData: false,
196    installFlag: 1,
197};
198
199try {
200    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
201        data.install(hapFilePaths, installParam, (err: BusinessError) => {
202            if (err) {
203                console.error('install failed:' + err.message);
204            } else {
205                console.info('install successfully.');
206            }
207        });
208    }).catch((error: BusinessError) => {
209        console.error('getBundleInstaller failed. Cause: ' + error.message);
210    });
211} catch (error) {
212    let message = (error as BusinessError).message;
213    console.error('getBundleInstaller failed. Cause: ' + message);
214}
215```
216## BundleInstaller.install
217install(hapFilePaths: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void
218
219Installs a bundle. This API uses an asynchronous callback to return the result.
220
221**System API**: This is a system API.
222
223**Required permissions**: ohos.permission.INSTALL_BUNDLE, ohos.permission.INSTALL_ENTERPRISE_BUNDLE<sup>10+</sup>, ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE<sup>10+</sup>, or ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE<sup>10+</sup>
224> **NOTE**
225>
226> From API version 10, this API can be called with the permission **ohos.permission.INSTALL_ENTERPRISE_BUNDLE**, **ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE**, or **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE**.
227>
228> To install an enterprise application, you must have the **ohos.permission.INSTALL_ENTERPRISE_BUNDLE** permission.
229>
230> To install an enterprise Normal application, you must have the **ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE** or **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE** permission.
231>
232> To install an enterprise MDM application, you must have the **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE** permission.
233>
234> To install a common application, you must have the **ohos.permission.INSTALL_BUNDLE** permission.
235
236**System capability**: SystemCapability.BundleManager.BundleFramework.Core
237
238**Parameters**
239
240| Name          | Type                                                | Mandatory| Description                                                        |
241| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
242| hapFilePaths | Array&lt;string&gt;                                  | Yes  | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.|
243| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
244
245**Error codes**
246
247For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
248
249| ID| Error Message                                                    |
250| -------- | ------------------------------------------------------------ |
251| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
252| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
253| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
254| 17700015 | Failed to install the HAPs because they have different configuration information. |
255| 17700016 | Failed to install the HAP because of insufficient system disk space. |
256| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
257| 17700018 | Failed to install because the dependent module does not exist. |
258| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. |
259| 17700036 | Failed to install the HSP because lacks appropriate permissions. |
260| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
261| 17700041 | Failed to install because enterprise device management disallow install. |
262| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
263| 17700043 | Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core). |
264| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
265| 17700047 | Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode. |
266| 17700048 | Failed to install the HAP because the code signature verification is failed. |
267| 17700050 | Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device. |
268| 17700052 | Failed to install the HAP because debug bundle cannot be installed under non-developer mode. |
269| 17700054 | Failed to install the HAP because the HAP requests wrong permissions.|
270
271**Example**
272
273```ts
274import installer from '@ohos.bundle.installer';
275import { BusinessError } from '@ohos.base';
276
277let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
278
279try {
280    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
281        data.install(hapFilePaths, (err: BusinessError) => {
282            if (err) {
283                console.error('install failed:' + err.message);
284            } else {
285                console.info('install successfully.');
286            }
287        });
288    }).catch((error: BusinessError) => {
289        console.error('getBundleInstaller failed. Cause: ' + error.message);
290    });
291} catch (error) {
292    let message = (error as BusinessError).message;
293    console.error('getBundleInstaller failed. Cause: ' + message);
294}
295```
296
297## BundleInstaller.install
298
299install(hapFilePaths: Array\<string\>, installParam?: InstallParam) : Promise\<void\>
300
301Installs a bundle. This API uses a promise to return the result.
302
303**System API**: This is a system API.
304
305**Required permissions**: ohos.permission.INSTALL_BUNDLE, ohos.permission.INSTALL_ENTERPRISE_BUNDLE<sup>10+</sup>, ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE<sup>10+</sup>, or ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE<sup>10+</sup>
306> **NOTE**
307>
308> From API version 10, this API can be called with the permission **ohos.permission.INSTALL_ENTERPRISE_BUNDLE**, **ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE**, or **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE**.
309>
310> To install an enterprise application, you must have the **ohos.permission.INSTALL_ENTERPRISE_BUNDLE** permission.
311>
312> To install an enterprise Normal application, you must have the **ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE** or **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE** permission.
313>
314> To install an enterprise MDM application, you must have the **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE** permission.
315>
316> To install a common application, you must have the **ohos.permission.INSTALL_BUNDLE** permission.
317
318**System capability**: SystemCapability.BundleManager.BundleFramework.Core
319
320**Parameters**
321
322| Name      | Type                         | Mandatory| Description                                                        |
323| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
324| hapFilePaths | Array\<string\>               | Yes  | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.|
325| installParam | [InstallParam](#installparam) | No  | Parameters required for the installation. For details about their default values, see [InstallParam](#installparam).                                    |
326
327**Return value**
328
329| Type           | Description                                  |
330| --------------- | -------------------------------------- |
331| Promise\<void\> | Promise that returns no value.|
332
333**Error codes**
334
335For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
336
337| ID| Error Message                                                    |
338| -------- | ------------------------------------------------------------ |
339| 17700004 | The specified user ID is not found.                          |
340| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
341| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
342| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
343| 17700015 | Failed to install the HAPs because they have different configuration information. |
344| 17700016 | Failed to install the HAP because of insufficient system disk space. |
345| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
346| 17700018 | Failed to install because the dependent module does not exist. |
347| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. |
348| 17700036 | Failed to install the HSP because lacks appropriate permissions. |
349| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
350| 17700041 | Failed to install because enterprise device management disallow install. |
351| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
352| 17700043 | Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core). |
353| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
354| 17700047 | Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode. |
355| 17700048 | Failed to install the HAP because the code signature verification is failed. |
356| 17700050 | Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device. |
357| 17700052 | Failed to install the HAP because debug bundle cannot be installed under non-developer mode. |
358| 17700054 | Failed to install the HAP because the HAP requests wrong permissions.|
359
360**Example**
361
362```ts
363import installer from '@ohos.bundle.installer';
364import { BusinessError } from '@ohos.base';
365
366let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
367let installParam: installer.InstallParam = {
368    userId: 100,
369    isKeepData: false,
370    installFlag: 1,
371};
372
373try {
374    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
375        data.install(hapFilePaths, installParam)
376            .then((data: void) => {
377                console.info('install successfully: ' + JSON.stringify(data));
378        }).catch((error: BusinessError) => {
379            console.error('install failed:' + error.message);
380        });
381    }).catch((error: BusinessError) => {
382        console.error('getBundleInstaller failed. Cause: ' + error.message);
383    });
384} catch (error) {
385    let message = (error as BusinessError).message;
386    console.error('getBundleInstaller failed. Cause: ' + message);
387}
388```
389
390## BundleInstaller.uninstall
391
392uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallback&lt;void&gt;): void
393
394Uninstalls a bundle. This API uses an asynchronous callback to return the result.
395
396**System API**: This is a system API.
397
398**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
399
400**System capability**: SystemCapability.BundleManager.BundleFramework.Core
401
402**Parameters**
403
404| Name     | Type                                                | Mandatory| Description                                          |
405| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
406| bundleName | string                                               | Yes  | Name of the target bundle.                                          |
407| installParam      | [InstallParam](#installparam)                        | Yes  | Parameters required for the uninstall.                      |
408| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
409
410**Error codes**
411
412For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
413
414| ID| Error Message                                                    |
415| -------- | ------------------------------------------------------------ |
416| 17700001 | The specified bundle name is not found. |
417| 17700004 | The specified user ID is not found. |
418| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
419| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. |
420| 17700045 | Failed to uninstall because enterprise device management disallow uninstall. |
421
422**Example**
423
424```ts
425import installer from '@ohos.bundle.installer';
426import { BusinessError } from '@ohos.base';
427
428let bundleName = 'com.ohos.demo';
429let installParam: installer.InstallParam = {
430    userId: 100,
431    isKeepData: false,
432    installFlag: 1
433};
434
435try {
436    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
437        data.uninstall(bundleName, installParam, (err: BusinessError) => {
438            if (err) {
439                console.error('uninstall failed:' + err.message);
440            } else {
441                console.info('uninstall successfully.');
442            }
443        });
444    }).catch((error: BusinessError) => {
445        console.error('getBundleInstaller failed. Cause: ' + error.message);
446    });
447} catch (error) {
448    let message = (error as BusinessError).message;
449    console.error('getBundleInstaller failed. Cause: ' + message);
450}
451```
452
453## BundleInstaller.uninstall
454
455uninstall(bundleName: string, callback: AsyncCallback&lt;void&gt;): void
456
457Uninstalls a bundle. This API uses an asynchronous callback to return the result.
458
459**System API**: This is a system API.
460
461**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
462
463**System capability**: SystemCapability.BundleManager.BundleFramework.Core
464
465**Parameters**
466
467| Name     | Type                                                | Mandatory| Description                                          |
468| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
469| bundleName | string                                               | Yes  | Name of the target bundle.                                          |
470| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
471
472**Error codes**
473
474For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
475
476| ID| Error Message                                                    |
477| -------- | ------------------------------------------------------------ |
478| 17700001 | The specified bundle name is not found. |
479| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
480| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. |
481| 17700045 | Failed to uninstall because enterprise device management disallow uninstall. |
482
483**Example**
484
485```ts
486import installer from '@ohos.bundle.installer';
487import { BusinessError } from '@ohos.base';
488
489let bundleName = 'com.ohos.demo';
490
491try {
492    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
493        data.uninstall(bundleName, (err: BusinessError) => {
494            if (err) {
495                console.error('uninstall failed:' + err.message);
496            } else {
497                console.info('uninstall successfully.');
498            }
499        });
500    }).catch((error: BusinessError) => {
501        console.error('getBundleInstaller failed. Cause: ' + error.message);
502    });
503} catch (error) {
504    let message = (error as BusinessError).message;
505    console.error('getBundleInstaller failed. Cause: ' + message);
506}
507```
508## BundleInstaller.uninstall
509
510uninstall(bundleName: string, installParam?: InstallParam) : Promise\<void\>
511
512Uninstalls a bundle. This API uses a promise to return the result.
513
514**System API**: This is a system API.
515
516**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
517
518**System capability**: SystemCapability.BundleManager.BundleFramework.Core
519
520**Parameters**
521
522| Name      | Type                         | Mandatory| Description                                                        |
523| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
524| bundleName | string                          | Yes  | Name of the target bundle.                                          |
525| installParam | [InstallParam](#installparam) | No  | Parameters required for the uninstall. For details about their default values, see [InstallParam](#installparam).                                    |
526
527**Return value**
528
529| Type           | Description                                  |
530| --------------- | -------------------------------------- |
531| Promise\<void\> | Promise that returns no value.|
532
533**Error codes**
534
535For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
536
537| ID| Error Message                                                    |
538| -------- | ------------------------------------------------------------ |
539| 17700001 | The specified bundle name is not found. |
540| 17700004 | The specified user ID is not found. |
541| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
542| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. |
543| 17700045 | Failed to uninstall because enterprise device management disallow uninstall. |
544
545**Example**
546```ts
547import installer from '@ohos.bundle.installer';
548import { BusinessError } from '@ohos.base';
549
550let bundleName = 'com.ohos.demo';
551let installParam: installer.InstallParam = {
552    userId: 100,
553    isKeepData: false,
554    installFlag: 1,
555};
556
557try {
558    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
559        data.uninstall(bundleName, installParam)
560            .then((data: void) => {
561                console.info('uninstall successfully: ' + JSON.stringify(data));
562        }).catch((error: BusinessError) => {
563            console.error('uninstall failed:' + error.message);
564        });
565    }).catch((error: BusinessError) => {
566        console.error('getBundleInstaller failed. Cause: ' + error.message);
567    });
568} catch (error) {
569    let message = (error as BusinessError).message;
570    console.error('getBundleInstaller failed. Cause: ' + message);
571}
572```
573
574## BundleInstaller.recover
575
576recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback&lt;void&gt;): void
577
578Rolls back a bundle to the initial installation state. This API uses an asynchronous callback to return the result.
579
580**System API**: This is a system API.
581
582**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.RECOVER_BUNDLE
583
584**System capability**: SystemCapability.BundleManager.BundleFramework.Core
585
586**Parameters**
587
588| Name     | Type                                                | Mandatory| Description                                          |
589| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
590| bundleName | string                                               | Yes  | Name of the target bundle.                                          |
591| installParam      | [InstallParam](#installparam)                        | Yes  | Parameters required for the recovery.                      |
592| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
593
594**Error codes**
595
596For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
597
598| ID| Error Message                           |
599| -------- | ----------------------------------- |
600| 17700001 | The specified bundle name is not found. |
601| 17700004 | The specified user ID is not found. |
602
603**Example**
604
605```ts
606import installer from '@ohos.bundle.installer';
607import { BusinessError } from '@ohos.base';
608
609let bundleName = 'com.ohos.demo';
610let installParam: installer.InstallParam = {
611    userId: 100,
612    isKeepData: false,
613    installFlag: 1
614};
615
616try {
617    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
618        data.recover(bundleName, installParam, (err: BusinessError) => {
619            if (err) {
620                console.error('recover failed:' + err.message);
621            } else {
622                console.info('recover successfully.');
623            }
624        });
625    }).catch((error: BusinessError) => {
626        console.error('getBundleInstaller failed. Cause: ' + error.message);
627    });
628} catch (error) {
629    let message = (error as BusinessError).message;
630    console.error('getBundleInstaller failed. Cause: ' + message);
631}
632```
633
634
635## BundleInstaller.recover
636
637recover(bundleName: string, callback: AsyncCallback&lt;void&gt;): void
638
639Rolls back a bundle to the initial installation state. This API uses an asynchronous callback to return the result.
640
641**System API**: This is a system API.
642
643**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.RECOVER_BUNDLE
644
645**System capability**: SystemCapability.BundleManager.BundleFramework.Core
646
647**Parameters**
648
649| Name     | Type                                                | Mandatory| Description                                          |
650| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
651| bundleName | string                                               | Yes  | Name of the target bundle.                              |
652| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
653
654**Error codes**
655
656For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
657
658| ID| Error Message                           |
659| -------- | ----------------------------------- |
660| 17700001 | The specified bundle name is not found. |
661
662**Example**
663
664```ts
665import installer from '@ohos.bundle.installer';
666import { BusinessError } from '@ohos.base';
667
668let bundleName = 'com.ohos.demo';
669
670try {
671    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
672        data.recover(bundleName, (err: BusinessError) => {
673            if (err) {
674                console.error('recover failed:' + err.message);
675            } else {
676                console.info('recover successfully.');
677            }
678        });
679    }).catch((error: BusinessError) => {
680        console.error('getBundleInstaller failed. Cause: ' + error.message);
681    });
682} catch (error) {
683    let message = (error as BusinessError).message;
684    console.error('getBundleInstaller failed. Cause: ' + message);
685}
686```
687
688## BundleInstaller.recover
689
690recover(bundleName: string, installParam?: InstallParam) : Promise\<void\>
691
692Rolls back a bundle to the initial installation state. This API uses a promise to return the result.
693
694**System API**: This is a system API.
695
696**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.RECOVER_BUNDLE
697
698**System capability**: SystemCapability.BundleManager.BundleFramework.Core
699
700**Parameters**
701
702| Name      | Type                         | Mandatory| Description                                                        |
703| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
704| bundleName | string                          | Yes  | Name of the target bundle.                                          |
705| installParam | [InstallParam](#installparam) | No  | Parameters required for the recovery. For details about their default values, see [InstallParam](#installparam).                                    |
706
707**Return value**
708
709| Type           | Description                                  |
710| --------------- | -------------------------------------- |
711| Promise\<void\> | Promise that returns no value.|
712
713**Error codes**
714
715For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
716
717| ID| Error Message                           |
718| -------- | ----------------------------------- |
719| 17700001 | The specified bundle name is not found. |
720| 17700004 | The specified user ID is not found. |
721
722**Example**
723```ts
724import installer from '@ohos.bundle.installer';
725import { BusinessError } from '@ohos.base';
726
727let bundleName = 'com.ohos.demo';
728let installParam: installer.InstallParam = {
729    userId: 100,
730    isKeepData: false,
731    installFlag: 1,
732};
733
734try {
735    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
736        data.recover(bundleName, installParam)
737            .then((data: void) => {
738                console.info('recover successfully: ' + JSON.stringify(data));
739        }).catch((error: BusinessError) => {
740            console.error('recover failed:' + error.message);
741        });
742    }).catch((error: BusinessError) => {
743        console.error('getBundleInstaller failed. Cause: ' + error.message);
744    });
745} catch (error) {
746    let message = (error as BusinessError).message;
747    console.error('getBundleInstaller failed. Cause: ' + message);
748}
749```
750
751## BundleInstaller.uninstall<sup>10+</sup>
752
753uninstall(uninstallParam: UninstallParam, callback : AsyncCallback\<void>) : void
754
755Uninstalls a shared bundle. This API uses an asynchronous callback to return the result.
756
757**System API**: This is a system API.
758
759**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
760
761**System capability**: SystemCapability.BundleManager.BundleFramework.Core
762
763**Parameters**
764
765| Name        | Type                               | Mandatory| Description                                                    |
766| -------------- | ----------------------------------- | ---- | -------------------------------------------------------- |
767| uninstallParam | [UninstallParam](#uninstallparam10) | Yes  | Parameters required for the uninstall.                            |
768| callback       | AsyncCallback&lt;void&gt;           | Yes  | Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
769
770**Error codes**
771
772For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
773
774| ID| Error Message                                                    |
775| -------- | ------------------------------------------------------------ |
776| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
777| 17700037 | The version of shared bundle is dependent on other applications. |
778| 17700038 | The specified shared bundle does not exist.                  |
779
780**Example**
781
782```ts
783import installer from '@ohos.bundle.installer';
784import { BusinessError } from '@ohos.base';
785
786let uninstallParam: installer.UninstallParam = {
787    bundleName: "com.ohos.demo",
788};
789
790try {
791    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
792        data.uninstall(uninstallParam, (err: BusinessError) => {
793            if (err) {
794                console.error('uninstall failed:' + err.message);
795            } else {
796                console.info('uninstall successfully.');
797            }
798        });
799    }).catch((error: BusinessError) => {
800        console.error('getBundleInstaller failed. Cause: ' + error.message);
801    });
802} catch (error) {
803    let message = (error as BusinessError).message;
804    console.error('getBundleInstaller failed. Cause: ' + message);
805}
806```
807
808## BundleInstaller.uninstall<sup>10+</sup>
809
810uninstall(uninstallParam: UninstallParam) : Promise\<void>
811
812Uninstalls a shared bundle. This API uses a promise to return the result.
813
814**System API**: This is a system API.
815
816**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
817
818**System capability**: SystemCapability.BundleManager.BundleFramework.Core
819
820**Parameters**
821
822| Name        | Type                               | Mandatory| Description                        |
823| -------------- | ----------------------------------- | ---- | ---------------------------- |
824| uninstallParam | [UninstallParam](#uninstallparam10) | Yes  | Parameters required for the uninstall.|
825
826**Return value**
827
828| Type         | Description                                  |
829| ------------- | -------------------------------------- |
830| Promise\<void\> | Promise that returns no value.|
831
832**Error codes**
833
834For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
835
836| ID| Error Message                                                    |
837| -------- | ------------------------------------------------------------ |
838| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
839| 17700037 | The version of shared bundle is dependent on other applications. |
840| 17700038 | The specified shared bundle does not exist.                  |
841
842**Example**
843
844```ts
845import installer from '@ohos.bundle.installer';
846import { BusinessError } from '@ohos.base';
847
848let uninstallParam: installer.UninstallParam = {
849    bundleName: "com.ohos.demo",
850};
851
852try {
853    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
854        data.uninstall(uninstallParam, (err: BusinessError) => {
855            if (err) {
856                console.error('uninstall failed:' + err.message);
857            } else {
858                console.info('uninstall successfully.');
859            }
860        });
861    }).catch((error: BusinessError) => {
862        console.error('getBundleInstaller failed. Cause: ' + error.message);
863    });
864} catch (error) {
865    let message = (error as BusinessError).message;
866    console.error('getBundleInstaller failed. Cause: ' + message);
867}
868```
869
870## BundleInstaller.updateBundleForSelf<sup>10+</sup>
871
872updateBundleForSelf(hapFilePaths: Array\<string\>, installParam: InstallParam, callback: AsyncCallback\<void\>): void
873
874Updates the current bundle. This API uses an asynchronous callback to return the result. It can be called only by enterprise MDM applications on enterprise devices, and the HAPs in **hapFilePaths** must belong to the current application.
875
876**System API**: This is a system API.
877
878**Required permissions**: ohos.permission.INSTALL_SELF_BUNDLE
879
880**System capability**: SystemCapability.BundleManager.BundleFramework.Core
881
882**Parameters**
883
884| Name          | Type                                                | Mandatory| Description                                                        |
885| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
886| hapFilePaths | Array&lt;string&gt;                                  | Yes  | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.|
887| installParam           | [InstallParam](#installparam)                        | Yes  | Parameters required for the installation.                                    |
888| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
889
890**Error codes**
891
892For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
893
894| ID| Error Message                                                    |
895| -------- | ------------------------------------------------------------ |
896| 17700004 | The specified user ID is not found.                          |
897| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
898| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
899| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
900| 17700015 | Failed to install the HAPs because they have different configuration information. |
901| 17700016 | Failed to install the HAP because of insufficient system disk space. |
902| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
903| 17700018 | Failed to install because the dependent module does not exist. |
904| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
905| 17700041 | Failed to install because enterprise device management disallow install. |
906| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
907| 17700043 | Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core). |
908| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
909| 17700047 | Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode. |
910| 17700048 | Failed to install the HAP because the code signature verification is failed. |
911| 17700049 | Failed to install the HAP because the bundleName is different from the bundleName of the caller application. |
912| 17700050 | Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device. |
913| 17700051 | Failed to install the HAP because the distribution type of caller application is not enterprise_mdm. |
914
915**Example**
916
917```ts
918import installer from '@ohos.bundle.installer';
919import { BusinessError } from '@ohos.base';
920
921let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
922let installParam: installer.InstallParam = {
923    userId: 100,
924    isKeepData: false,
925    installFlag: 1,
926};
927
928try {
929    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
930        data.updateBundleForSelf(hapFilePaths, installParam, (err: BusinessError) => {
931            if (err) {
932                console.error('updateBundleForSelf failed:' + err.message);
933            } else {
934                console.info('updateBundleForSelf successfully.');
935            }
936        });
937    }).catch((error: BusinessError) => {
938        console.error('getBundleInstaller failed. Cause: ' + error.message);
939    });
940} catch (error) {
941    let message = (error as BusinessError).message;
942    console.error('getBundleInstaller failed. Cause: ' + message);
943}
944```
945
946## BundleInstaller.updateBundleForSelf<sup>10+</sup>
947
948updateBundleForSelf(hapFilePaths: Array\<string\>, callback: AsyncCallback\<void\>): void
949
950Updates the current bundle. This API uses an asynchronous callback to return the result. It can be called only by enterprise MDM applications on enterprise devices, and the HAPs in **hapFilePaths** must belong to the current application.
951
952**System API**: This is a system API.
953
954**Required permissions**: ohos.permission.INSTALL_SELF_BUNDLE
955
956**System capability**: SystemCapability.BundleManager.BundleFramework.Core
957
958**Parameters**
959
960| Name          | Type                                                | Mandatory| Description                                                        |
961| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
962| hapFilePaths | Array&lt;string&gt;                                  | Yes  | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.|
963| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
964
965**Error codes**
966
967For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
968
969| ID| Error Message                                                    |
970| -------- | ------------------------------------------------------------ |
971| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
972| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
973| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
974| 17700015 | Failed to install the HAPs because they have different configuration information. |
975| 17700016 | Failed to install the HAP because of insufficient system disk space. |
976| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
977| 17700018 | Failed to install because the dependent module does not exist. |
978| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
979| 17700041 | Failed to install because enterprise device management disallow install. |
980| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
981| 17700043 | Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core). |
982| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
983| 17700047 | Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode. |
984| 17700048 | Failed to install the HAP because the code signature verification is failed. |
985| 17700049 | Failed to install the HAP because the bundleName is different from the bundleName of the caller application. |
986| 17700050 | Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device. |
987| 17700051 | Failed to install the HAP because the distribution type of caller application is not enterprise_mdm. |
988
989**Example**
990
991```ts
992import installer from '@ohos.bundle.installer';
993import { BusinessError } from '@ohos.base';
994
995let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
996
997try {
998    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
999        data.updateBundleForSelf(hapFilePaths, (err: BusinessError) => {
1000            if (err) {
1001                console.error('updateBundleForSelf failed:' + err.message);
1002            } else {
1003                console.info('updateBundleForSelf successfully.');
1004            }
1005        });
1006    }).catch((error: BusinessError) => {
1007        console.error('getBundleInstaller failed. Cause: ' + error.message);
1008    });
1009} catch (error) {
1010    let message = (error as BusinessError).message;
1011    console.error('getBundleInstaller failed. Cause: ' + message);
1012}
1013```
1014
1015## BundleInstaller.updateBundleForSelf<sup>10+</sup>
1016
1017updateBundleForSelf(hapFilePaths: Array\<string\>, installParam?: InstallParam): Promise\<void\>
1018
1019Updates the current bundle. This API uses a promise to return the result. It can be called only by enterprise MDM applications on enterprise devices, and the HAPs in **hapFilePaths** must belong to the current application.
1020
1021**System API**: This is a system API.
1022
1023**Required permissions**: ohos.permission.INSTALL_SELF_BUNDLE
1024
1025**System capability**: SystemCapability.BundleManager.BundleFramework.Core
1026
1027**Parameters**
1028
1029| Name          | Type                                                | Mandatory| Description                                                        |
1030| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
1031| hapFilePaths | Array&lt;string&gt;                                  | Yes  | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.|
1032| installParam | [InstallParam](#installparam) | No  | Parameters required for the installation. For details about their default values, see [InstallParam](#installparam).                                    |
1033
1034**Return value**
1035
1036| Type         | Description                                  |
1037| ------------- | -------------------------------------- |
1038| Promise\<void\> | Promise that returns no value.|
1039
1040**Error codes**
1041
1042For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
1043
1044| ID| Error Message                                                    |
1045| -------- | ------------------------------------------------------------ |
1046| 17700004 | The specified user ID is not found.                          |
1047| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
1048| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
1049| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
1050| 17700015 | Failed to install the HAPs because they have different configuration information. |
1051| 17700016 | Failed to install the HAP because of insufficient system disk space. |
1052| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
1053| 17700018 | Failed to install because the dependent module does not exist. |
1054| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
1055| 17700041 | Failed to install because enterprise device management disallow install. |
1056| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
1057| 17700043 | Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core). |
1058| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
1059| 17700047 | Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode. |
1060| 17700048 | Failed to install the HAP because the code signature verification is failed. |
1061| 17700049 | Failed to install the HAP because the bundleName is different from the bundleName of the caller application. |
1062| 17700050 | Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device. |
1063| 17700051 | Failed to install the HAP because the distribution type of caller application is not enterprise_mdm. |
1064
1065**Example**
1066
1067```ts
1068import installer from '@ohos.bundle.installer';
1069import { BusinessError } from '@ohos.base';
1070
1071let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
1072let installParam: installer.InstallParam = {
1073    userId: 100,
1074    isKeepData: false,
1075    installFlag: 1,
1076};
1077
1078try {
1079    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
1080        data.updateBundleForSelf(hapFilePaths, installParam)
1081            .then((data: void) => {
1082                console.info('updateBundleForSelf successfully: ' + JSON.stringify(data));
1083        }).catch((error: BusinessError) => {
1084            console.error('updateBundleForSelf failed:' + error.message);
1085        });
1086    }).catch((error: BusinessError) => {
1087        console.error('getBundleInstaller failed. Cause: ' + error.message);
1088    });
1089} catch (error) {
1090    let message = (error as BusinessError).message;
1091    console.error('getBundleInstaller failed. Cause: ' + message);
1092}
1093```
1094
1095## HashParam
1096
1097Defines the hash parameters for bundle installation and uninstall.
1098
1099 **System capability**: SystemCapability.BundleManager.BundleFramework.Core
1100
1101 **System API**: This is a system API.
1102
1103| Name    | Type  | Mandatory| Description            |
1104| ---------- | ------ | ---------------- | ---------------- |
1105| moduleName | string | Yes| Module name of the bundle.|
1106| hashValue  | string | Yes| Hash value.          |
1107
1108## InstallParam
1109
1110Defines the parameters that need to be specified for bundle installation, uninstall, or recovering.
1111
1112 **System capability**: SystemCapability.BundleManager.BundleFramework.Core
1113
1114 **System API**: This is a system API.
1115
1116| Name                       | Type                          | Mandatory                        | Description              |
1117| ------------------------------ | ------------------------------ | ------------------ | ------------------ |
1118| 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. You can call [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId) to obtain the user ID of the current process.|
1119| installFlag                    | number                         | No                       | Installation flag. The value **0x00** means initial installation, **0x01** means overwrite installation, and **0x10** means installation-free. The default value is **0x00**.|
1120| isKeepData                     | boolean                        | No                      | Whether to retain the data directory during bundle uninstall. The default value is **false**.|
1121| hashParams        | Array<[HashParam](#hashparam)> | No| Hash parameters. By default, no value is passed.        |
1122| crowdtestDeadline| number                         | No                       | End date of crowdtesting. The default value is **-1**, indicating that no end date is specified for crowdtesting.|
1123| sharedBundleDirPaths<sup>10+</sup> | Array\<String> | No|Paths of the shared bundle files. By default, no value is passed.|
1124| specifiedDistributionType<sup>10+</sup> | string | No|Distribution type specified during application installation. By default, no value is passed. The maximum length is 128 bytes. This field is usually specified by the application market of the operating system operator.|
1125| additionalInfo<sup>10+</sup> | string | No|Additional information during application installation (usually an enterprise application). By default, no value is passed. The maximum length is 3,000 bytes. This field is usually specified by the application market of the operating system operator.|
1126| verifyCodeParams<sup>deprecated<sup> | Array<[VerifyCodeParam](#verifycodeparamdeprecated)> | No| Information about the code signature file. The default value is null.        |
1127| pgoParams<sup>11+</sup> | Array<[PGOParam](#pgoparam11)> | No| Parameters of the Profile-guided Optimization (PGO) configuration file. The default value is null.        |
1128
1129## UninstallParam<sup>10+</sup>
1130
1131Defines the parameters required for the uninstall of a shared bundle.
1132
1133 **System capability**: SystemCapability.BundleManager.BundleFramework.Core
1134
1135 **System API**: This is a system API.
1136
1137| Name       | Type  | Mandatory| Description                                                        |
1138| ----------- | ------ | ---- | ------------------------------------------------------------ |
1139| bundleName  | string | Yes  | Name of the shared bundle.                                                |
1140| versionCode | number | No  | Version number of the shared bundle. By default, no value is passed, and all shared bundles of the specified name are uninstalled.|
1141
1142## VerifyCodeParam<sup>deprecated<sup>
1143
1144> Since API version 11, the code signature file of an application is integrated into the installation package, rather than being specified by using this field.
1145
1146Defines the information about the code signature file.
1147
1148 **System capability**: SystemCapability.BundleManager.BundleFramework.Core
1149
1150 **System API**: This is a system API.
1151
1152| Name    | Type  | Mandatory| Description            |
1153| ---------- | ------ | ---------------- | ---------------- |
1154| moduleName | string | Yes| Module name of the bundle.|
1155| signatureFilePath  | string | Yes| Path of the code signature file.          |
1156
1157## PGOParam<sup>11+</sup>
1158
1159Defines the parameters of the PGO configuration file.
1160
1161 **System capability**: SystemCapability.BundleManager.BundleFramework.Core
1162
1163 **System API**: This is a system API.
1164
1165| Name    | Type  | Mandatory| Description            |
1166| ---------- | ------ | ---------------- | ---------------- |
1167| moduleName | string | Yes| Module name of the bundle.|
1168| pgoFilePath  | string | Yes| Path of the PGO configuration file.          |
1169