• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { AsyncCallback } from './@ohos.base';
17
18/**
19 * Support install, upgrade, remove and recover bundles on the devices.
20 *
21 * @namespace installer
22 * @syscap SystemCapability.BundleManager.BundleFramework.Core
23 * @systemapi
24 * @since 9
25 */
26declare namespace installer {
27  /**
28   * Obtains the interface used to install bundle.
29   *
30   * @param { AsyncCallback<BundleInstaller> } callback - The callback of BundleInstaller object.
31   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
32   * @throws { BusinessError } 401 - Input parameters check failed.
33   * @syscap SystemCapability.BundleManager.BundleFramework.Core
34   * @systemapi
35   * @since 9
36   */
37  function getBundleInstaller(callback: AsyncCallback<BundleInstaller>): void;
38
39  /**
40   * Obtains the interface used to install bundle.
41   *
42   * @returns { Promise<BundleInstaller> } BundleInstaller object.
43   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
44   * @syscap SystemCapability.BundleManager.BundleFramework.Core
45   * @systemapi
46   * @since 9
47   */
48  function getBundleInstaller(): Promise<BundleInstaller>;
49
50  /**
51   * Obtains the interface used to install bundle.
52   *
53   * @returns { BundleInstaller } BundleInstaller object.
54   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
55   * @syscap SystemCapability.BundleManager.BundleFramework.Core
56   * @systemapi
57   * @since 10
58   */
59  function getBundleInstallerSync(): BundleInstaller;
60
61  /**
62   * Bundle installer interface, include install uninstall recover.
63   *
64   * @interface BundleInstaller
65   * @syscap SystemCapability.BundleManager.BundleFramework.Core
66   * @systemapi
67   * @since 9
68   */
69  interface BundleInstaller {
70    /**
71     * Install haps for an application.
72     *
73     * @permission ohos.permission.INSTALL_BUNDLE
74     * @param { Array<string> } hapFilePaths - Indicates the path where the hap of the application is stored.
75     * @param { InstallParam } installParam - Indicates other parameters required for the installation.
76     * @param { AsyncCallback<void> } callback - The callback of installing haps result.
77     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE'.
78     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
79     * @throws { BusinessError } 401 - Input parameters check failed.
80     * @throws { BusinessError } 17700004 - The specified user ID is not found.
81     * @throws { BusinessError } 17700010 - Failed to install the HAP because the HAP fails to be parsed.
82     * @throws { BusinessError } 17700011 - Failed to install the HAP because the HAP signature fails to be verified.
83     * @throws { BusinessError } 17700012 - Failed to install the HAP because the HAP path is invalid or the HAP is too large.
84     * @throws { BusinessError } 17700015 - Failed to install the HAPs because they have different configuration information.
85     * @throws { BusinessError } 17700016 - Failed to install the HAP because of insufficient system disk space.
86     * @throws { BusinessError } 17700017 - Failed to install the HAP since the version of the HAP to install is too early.
87     * @throws { BusinessError } 17700018 - Failed to install because the dependent module does not exist.
88     * @throws { BusinessError } 17700031 - Failed to install the HAP because the overlay check of the HAP is failed.
89     * @throws { BusinessError } 17700036 - Failed to install the HSP because lacks appropriate permissions.
90     * @throws { BusinessError } 17700039 - Failed to install because disallow install a shared bundle by hapFilePaths.
91     * @throws { BusinessError } 17700041 - Failed to install because enterprise device management disallow install.
92     * @throws { BusinessError } 17700042 - Failed to install the HAP because of incorrect URI in the data proxy.
93     * @throws { BusinessError } 17700043 - Failed to install the HAP because of low APL in the non-system data proxy
94     *  (required APL: system_basic or system_core).
95     * @throws { BusinessError } 17700044 - Failed to install the HAP because the isolationMode configured is not supported.
96     * @throws { BusinessError } 17700047 - Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode.
97     * @syscap SystemCapability.BundleManager.BundleFramework.Core
98     * @systemapi
99     * @since 9
100     */
101    /**
102     * Install HAPs for an application.
103     * To install a non-enterprise application, you must have the permission ohos.permission.INSTALL_BUNDLE.
104     * To install an enterprise application, you must have the permission ohos.permission.INSTALL_ENTERPRISE_BUNDLE.
105     * To install an enterprise administrator application, you must have the permission ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE.
106     * To install an enterprise normal application, you must have the permission ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE.
107     *
108     * @permission ohos.permission.INSTALL_BUNDLE or ohos.permission.INSTALL_ENTERPRISE_BUNDLE or ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE or ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE
109     * @param { Array<string> } hapFilePaths - Indicates the path where the HAP of the application is stored.
110     * @param { InstallParam } installParam - Indicates other parameters required for the installation.
111     * @param { AsyncCallback<void> } callback - The callback of installing HAPs result.
112     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE' or 'ohos.permission.INSTALL_ENTERPRISE_BUNDLE' or
113     * 'ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE' or 'ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE'.
114     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
115     * @throws { BusinessError } 401 - Input parameters check failed.
116     * @throws { BusinessError } 17700004 - The specified user ID is not found.
117     * @throws { BusinessError } 17700010 - Failed to install the HAP because the HAP fails to be parsed.
118     * @throws { BusinessError } 17700011 - Failed to install the HAP because the HAP signature fails to be verified.
119     * @throws { BusinessError } 17700012 - Failed to install the HAP because the HAP path is invalid or the HAP is too large.
120     * @throws { BusinessError } 17700015 - Failed to install the HAPs because they have different configuration information.
121     * @throws { BusinessError } 17700016 - Failed to install the HAP because of insufficient system disk space.
122     * @throws { BusinessError } 17700017 - Failed to install the HAP since the version of the HAP to install is too early.
123     * @throws { BusinessError } 17700018 - Failed to install because the dependent module does not exist.
124     * @throws { BusinessError } 17700031 - Failed to install the HAP because the overlay check of the HAP is failed.
125     * @throws { BusinessError } 17700036 - Failed to install the HSP because lacks appropriate permissions.
126     * @throws { BusinessError } 17700039 - Failed to install because disallow install a shared bundle by hapFilePaths.
127     * @throws { BusinessError } 17700041 - Failed to install because enterprise device management disallow install.
128     * @throws { BusinessError } 17700042 - Failed to install the HAP because of incorrect URI in the data proxy.
129     * @throws { BusinessError } 17700043 - Failed to install the HAP because of low APL in the non-system data proxy
130     *  (required APL: system_basic or system_core).
131     * @throws { BusinessError } 17700044 - Failed to install the HAP because the isolationMode configured is not supported.
132     * @throws { BusinessError } 17700047 - Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode.
133     * @throws { BusinessError } 17700048 - Failed to install the HAP because the code signature verification is failed.
134     * @throws { BusinessError } 17700050 - Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device.
135     * @syscap SystemCapability.BundleManager.BundleFramework.Core
136     * @systemapi
137     * @since 10
138     */
139    install(hapFilePaths: Array<string>, installParam: InstallParam, callback: AsyncCallback<void>): void;
140
141    /**
142     * Install haps for an application.
143     *
144     * @permission ohos.permission.INSTALL_BUNDLE
145     * @param { Array<string> } hapFilePaths - Indicates the path where the hap of the application is stored.
146     * @param { AsyncCallback<void> } callback - The callback of installing haps result.
147     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE'.
148     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
149     * @throws { BusinessError } 401 - Input parameters check failed.
150     * @throws { BusinessError } 17700010 - Failed to install the HAP because the HAP fails to be parsed.
151     * @throws { BusinessError } 17700011 - Failed to install the HAP because the HAP signature fails to be verified.
152     * @throws { BusinessError } 17700012 - Failed to install the HAP because the HAP path is invalid or the HAP is too large.
153     * @throws { BusinessError } 17700015 - Failed to install the HAPs because they have different configuration information.
154     * @throws { BusinessError } 17700016 - Failed to install the HAP because of insufficient system disk space.
155     * @throws { BusinessError } 17700017 - Failed to install the HAP since the version of the HAP to install is too early.
156     * @throws { BusinessError } 17700018 - Failed to install because the dependent module does not exist.
157     * @throws { BusinessError } 17700031 - Failed to install the HAP because the overlay check of the HAP is failed.
158     * @throws { BusinessError } 17700036 - Failed to install the HSP because lacks appropriate permissions.
159     * @throws { BusinessError } 17700039 - Failed to install because disallow install a shared bundle by hapFilePaths.
160     * @throws { BusinessError } 17700041 - Failed to install because enterprise device management disallow install.
161     * @throws { BusinessError } 17700042 - Failed to install the HAP because of incorrect URI in the data proxy.
162     * @throws { BusinessError } 17700043 - Failed to install the HAP because of low APL in the non-system data proxy
163     *  (required APL: system_basic or system_core).
164     * @throws { BusinessError } 17700044 - Failed to install the HAP because the isolationMode configured is not supported.
165     * @throws { BusinessError } 17700047 - Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode.
166     * @syscap SystemCapability.BundleManager.BundleFramework.Core
167     * @systemapi
168     * @since 9
169     */
170    /**
171     * Install HAPs for an application.
172     * To install a non-enterprise application, you must have the permission ohos.permission.INSTALL_BUNDLE.
173     * To install an enterprise application, you must have the permission ohos.permission.INSTALL_ENTERPRISE_BUNDLE.
174     * To install an enterprise administrator application, you must have the permission ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE.
175     * To install an enterprise normal application, you must have the permission ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE.
176     *
177     * @permission ohos.permission.INSTALL_BUNDLE or ohos.permission.INSTALL_ENTERPRISE_BUNDLE or ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE or ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE
178     * @param { Array<string> } hapFilePaths - Indicates the path where the HAP of the application is stored.
179     * @param { AsyncCallback<void> } callback - The callback of installing HAPs result.
180     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE' or 'ohos.permission.INSTALL_ENTERPRISE_BUNDLE' or
181     * 'ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE' or 'ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE'.
182     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
183     * @throws { BusinessError } 401 - Input parameters check failed.
184     * @throws { BusinessError } 17700010 - Failed to install the HAP because the HAP fails to be parsed.
185     * @throws { BusinessError } 17700011 - Failed to install the HAP because the HAP signature fails to be verified.
186     * @throws { BusinessError } 17700012 - Failed to install the HAP because the HAP path is invalid or the HAP is too large.
187     * @throws { BusinessError } 17700015 - Failed to install the HAPs because they have different configuration information.
188     * @throws { BusinessError } 17700016 - Failed to install the HAP because of insufficient system disk space.
189     * @throws { BusinessError } 17700017 - Failed to install the HAP since the version of the HAP to install is too early.
190     * @throws { BusinessError } 17700018 - Failed to install because the dependent module does not exist.
191     * @throws { BusinessError } 17700031 - Failed to install the HAP because the overlay check of the HAP is failed.
192     * @throws { BusinessError } 17700036 - Failed to install the HSP because lacks appropriate permissions.
193     * @throws { BusinessError } 17700039 - Failed to install because disallow install a shared bundle by hapFilePaths.
194     * @throws { BusinessError } 17700041 - Failed to install because enterprise device management disallow install.
195     * @throws { BusinessError } 17700042 - Failed to install the HAP because of incorrect URI in the data proxy.
196     * @throws { BusinessError } 17700043 - Failed to install the HAP because of low APL in the non-system data proxy
197     *  (required APL: system_basic or system_core).
198     * @throws { BusinessError } 17700044 - Failed to install the HAP because the isolationMode configured is not supported.
199     * @throws { BusinessError } 17700047 - Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode.
200     * @throws { BusinessError } 17700048 - Failed to install the HAP because the code signature verification is failed.
201     * @throws { BusinessError } 17700050 - Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device.
202     * @syscap SystemCapability.BundleManager.BundleFramework.Core
203     * @systemapi
204     * @since 10
205     */
206    install(hapFilePaths: Array<string>, callback: AsyncCallback<void>): void;
207
208    /**
209     * Install haps for an application.
210     *
211     * @permission ohos.permission.INSTALL_BUNDLE
212     * @param { Array<string> } hapFilePaths - Indicates the path where the hap of the application is stored.
213     * @param { InstallParam } installParam - Indicates other parameters required for the installation.
214     * @returns { Promise<void> }
215     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE'.
216     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
217     * @throws { BusinessError } 401 - Input parameters check failed.
218     * @throws { BusinessError } 17700004 - The specified user ID is not found.
219     * @throws { BusinessError } 17700010 - Failed to install the HAP because the HAP fails to be parsed.
220     * @throws { BusinessError } 17700011 - Failed to install the HAP because the HAP signature fails to be verified.
221     * @throws { BusinessError } 17700012 - Failed to install the HAP because the HAP path is invalid or the HAP is too large.
222     * @throws { BusinessError } 17700015 - Failed to install the HAPs because they have different configuration information.
223     * @throws { BusinessError } 17700016 - Failed to install the HAP because of insufficient system disk space.
224     * @throws { BusinessError } 17700017 - Failed to install the HAP since the version of the HAP to install is too early.
225     * @throws { BusinessError } 17700018 - Failed to install because the dependent module does not exist.
226     * @throws { BusinessError } 17700031 - Failed to install the HAP because the overlay check of the HAP is failed.
227     * @throws { BusinessError } 17700036 - Failed to install the HSP because lacks appropriate permissions.
228     * @throws { BusinessError } 17700039 - Failed to install because disallow install a shared bundle by hapFilePaths.
229     * @throws { BusinessError } 17700041 - Failed to install because enterprise device management disallow install.
230     * @throws { BusinessError } 17700042 - Failed to install the HAP because of incorrect URI in the data proxy.
231     * @throws { BusinessError } 17700043 - Failed to install the HAP because of low APL in the non-system data proxy
232     *  (required APL: system_basic or system_core).
233     * @throws { BusinessError } 17700044 - Failed to install the HAP because the isolationMode configured is not supported.
234     * @throws { BusinessError } 17700047 - Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode.
235     * @syscap SystemCapability.BundleManager.BundleFramework.Core
236     * @systemapi
237     * @since 9
238     */
239    /**
240     * Install haps for an application.
241     * To install a non-enterprise application, you must have the permission ohos.permission.INSTALL_BUNDLE.
242     * To install an enterprise application, you must have the permission ohos.permission.INSTALL_ENTERPRISE_BUNDLE.
243     * To install an enterprise administrator application, you must have the permission ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE.
244     * To install an enterprise normal application, you must have the permission ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE.
245     *
246     * @permission ohos.permission.INSTALL_BUNDLE or ohos.permission.INSTALL_ENTERPRISE_BUNDLE or ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE or ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE
247     * @param { Array<string> } hapFilePaths - Indicates the path where the HAP of the application is stored.
248     * @param { InstallParam } installParam - Indicates other parameters required for the installation.
249     * @returns { Promise<void> }
250     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE' or 'ohos.permission.INSTALL_ENTERPRISE_BUNDLE' or
251     * 'ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE' or 'ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE'.
252     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
253     * @throws { BusinessError } 401 - Input parameters check failed.
254     * @throws { BusinessError } 17700004 - The specified user ID is not found.
255     * @throws { BusinessError } 17700010 - Failed to install the HAP because the HAP fails to be parsed.
256     * @throws { BusinessError } 17700011 - Failed to install the HAP because the HAP signature fails to be verified.
257     * @throws { BusinessError } 17700012 - Failed to install the HAP because the HAP path is invalid or the HAP is too large.
258     * @throws { BusinessError } 17700015 - Failed to install the HAPs because they have different configuration information.
259     * @throws { BusinessError } 17700016 - Failed to install the HAP because of insufficient system disk space.
260     * @throws { BusinessError } 17700017 - Failed to install the HAP since the version of the HAP to install is too early.
261     * @throws { BusinessError } 17700018 - Failed to install because the dependent module does not exist.
262     * @throws { BusinessError } 17700031 - Failed to install the HAP because the overlay check of the HAP is failed.
263     * @throws { BusinessError } 17700036 - Failed to install the HSP because lacks appropriate permissions.
264     * @throws { BusinessError } 17700039 - Failed to install because disallow install a shared bundle by hapFilePaths.
265     * @throws { BusinessError } 17700041 - Failed to install because enterprise device management disallow install.
266     * @throws { BusinessError } 17700042 - Failed to install the HAP because of incorrect URI in the data proxy.
267     * @throws { BusinessError } 17700043 - Failed to install the HAP because of low APL in the non-system data proxy
268     *  (required APL: system_basic or system_core).
269     * @throws { BusinessError } 17700044 - Failed to install the HAP because the isolationMode configured is not supported.
270     * @throws { BusinessError } 17700047 - Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode.
271     * @throws { BusinessError } 17700048 - Failed to install the HAP because the code signature verification is failed.
272     * @throws { BusinessError } 17700050 - Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device.
273     * @syscap SystemCapability.BundleManager.BundleFramework.Core
274     * @systemapi
275     * @since 10
276     */
277    install(hapFilePaths: Array<string>, installParam?: InstallParam): Promise<void>;
278
279    /**
280     * Uninstall an application.
281     *
282     * @permission ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
283     * @param { string } bundleName - Indicates the bundle name of the application to be uninstalled.
284     * @param { InstallParam } installParam - Indicates other parameters required for the uninstall.
285     * @param { AsyncCallback<void> } callback - The callback of uninstalling application result.
286     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE' or 'ohos.permission.UNINSTALL_BUNDLE'.
287     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
288     * @throws { BusinessError } 401 - Input parameters check failed.
289     * @throws { BusinessError } 17700001 - The specified bundle name is not found.
290     * @throws { BusinessError } 17700004 - The specified user ID is not found.
291     * @throws { BusinessError } 17700020 - The specified bundle is pre-installed bundle which cannot be uninstalled.
292     * @throws { BusinessError } 17700040 - The specified bundle is a shared bundle which cannot be uninstalled.
293     * @throws { BusinessError } 17700045 - Failed to uninstall because enterprise device management disallow uninstall.
294     * @syscap SystemCapability.BundleManager.BundleFramework.Core
295     * @systemapi
296     * @since 9
297     */
298    uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallback<void>): void;
299
300    /**
301     * Uninstall an application.
302     *
303     * @permission ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
304     * @param { string } bundleName - Indicates the bundle name of the application to be uninstalled.
305     * @param { AsyncCallback<void> } callback - The callback of uninstalling application result.
306     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE' or 'ohos.permission.UNINSTALL_BUNDLE'.
307     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
308     * @throws { BusinessError } 401 - Input parameters check failed.
309     * @throws { BusinessError } 17700001 - The specified bundle name is not found.
310     * @throws { BusinessError } 17700020 - The specified bundle is pre-installed bundle which cannot be uninstalled.
311     * @throws { BusinessError } 17700040 - The specified bundle is a shared bundle which cannot be uninstalled.
312     * @throws { BusinessError } 17700045 - Failed to uninstall because enterprise device management disallow uninstall.
313     * @syscap SystemCapability.BundleManager.BundleFramework.Core
314     * @systemapi
315     * @since 9
316     */
317    uninstall(bundleName: string, callback: AsyncCallback<void>): void;
318
319    /**
320     * Uninstall an application.
321     *
322     * @permission ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
323     * @param { string } bundleName - Indicates the bundle name of the application to be uninstalled.
324     * @param { InstallParam } installParam - Indicates other parameters required for the uninstall.
325     * @returns { Promise<void> }
326     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE' or 'ohos.permission.UNINSTALL_BUNDLE'.
327     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
328     * @throws { BusinessError } 401 - Input parameters check failed.
329     * @throws { BusinessError } 17700001 - The specified bundle name is not found.
330     * @throws { BusinessError } 17700004 - The specified user ID is not found.
331     * @throws { BusinessError } 17700020 - The specified bundle is pre-installed bundle which cannot be uninstalled.
332     * @throws { BusinessError } 17700040 - The specified bundle is a shared bundle which cannot be uninstalled.
333     * @throws { BusinessError } 17700045 - Failed to uninstall because enterprise device management disallow uninstall.
334     * @syscap SystemCapability.BundleManager.BundleFramework.Core
335     * @systemapi
336     * @since 9
337     */
338    uninstall(bundleName: string, installParam?: InstallParam): Promise<void>;
339
340    /**
341     * Recover an application.
342     *
343     * @permission ohos.permission.INSTALL_BUNDLE or ohos.permission.RECOVER_BUNDLE
344     * @param { string } bundleName - Indicates the bundle name of the application to be recovered.
345     * @param { InstallParam } installParam - Indicates other parameters required for the recover.
346     * @param { AsyncCallback<void> } callback - The callback of recovering application result.
347     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE' or 'ohos.permission.RECOVER_BUNDLE'.
348     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
349     * @throws { BusinessError } 401 - Input parameters check failed.
350     * @throws { BusinessError } 17700001 - The specified bundle name is not found.
351     * @throws { BusinessError } 17700004 - The specified user ID is not found.
352     * @syscap SystemCapability.BundleManager.BundleFramework.Core
353     * @systemapi
354     * @since 9
355     */
356    recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback<void>): void;
357
358    /**
359     * Recover an application.
360     *
361     * @permission ohos.permission.INSTALL_BUNDLE or ohos.permission.RECOVER_BUNDLE
362     * @param { string } bundleName - Indicates the bundle name of the application to be recovered.
363     * @param { AsyncCallback<void> } callback - The callback of recovering application result.
364     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE' or 'ohos.permission.RECOVER_BUNDLE'.
365     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
366     * @throws { BusinessError } 401 - Input parameters check failed.
367     * @throws { BusinessError } 17700001 - The specified bundle name is not found.
368     * @syscap SystemCapability.BundleManager.BundleFramework.Core
369     * @systemapi
370     * @since 9
371     */
372    recover(bundleName: string, callback: AsyncCallback<void>): void;
373
374    /**
375     * Recover an application.
376     *
377     * @permission ohos.permission.INSTALL_BUNDLE or ohos.permission.RECOVER_BUNDLE
378     * @param { string } bundleName - Indicates the bundle name of the application to be recovered.
379     * @param { InstallParam } installParam - Indicates other parameters required for the recover.
380     * @returns { Promise<void> }
381     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE' or 'ohos.permission.RECOVER_BUNDLE'.
382     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
383     * @throws { BusinessError } 401 - Input parameters check failed.
384     * @throws { BusinessError } 17700001 - The specified bundle name is not found.
385     * @throws { BusinessError } 17700004 - The specified user ID is not found.
386     * @syscap SystemCapability.BundleManager.BundleFramework.Core
387     * @systemapi
388     * @since 9
389     */
390    recover(bundleName: string, installParam?: InstallParam): Promise<void>;
391
392    /**
393     * Uninstall a shared bundle.
394     *
395     * @permission ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
396     * @param { UninstallParam } uninstallParam - Indicates parameters required for the uninstall.
397     * @param { AsyncCallback<void> } callback - The callback of uninstalling shared bundle result.
398     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE' or 'ohos.permission.UNINSTALL_BUNDLE'.
399     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
400     * @throws { BusinessError } 401 - Input parameters check failed.
401     * @throws { BusinessError } 17700020 - The specified bundle is pre-installed bundle which cannot be uninstalled.
402     * @throws { BusinessError } 17700037 - The version of shared bundle is dependent on other applications.
403     * @throws { BusinessError } 17700038 - The specified shared bundle does not exist.
404     * @syscap SystemCapability.BundleManager.BundleFramework.Core
405     * @systemapi
406     * @since 10
407     */
408    uninstall(uninstallParam: UninstallParam, callback: AsyncCallback<void>): void;
409
410    /**
411     * Uninstall a shared bundle.
412     *
413     * @permission ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
414     * @param { UninstallParam } uninstallParam - Indicates parameters required for the uninstall.
415     * @returns { Promise<void> }
416     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE' or 'ohos.permission.UNINSTALL_BUNDLE'.
417     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
418     * @throws { BusinessError } 401 - Input parameters check failed.
419     * @throws { BusinessError } 17700020 - The specified bundle is pre-installed bundle which cannot be uninstalled.
420     * @throws { BusinessError } 17700037 - The version of shared bundle is dependent on other applications.
421     * @throws { BusinessError } 17700038 - The specified shared bundle does not exist.
422     * @syscap SystemCapability.BundleManager.BundleFramework.Core
423     * @systemapi
424     * @since 10
425     */
426    uninstall(uninstallParam: UninstallParam): Promise<void>;
427
428    /**
429     * Updates this enterprise application.
430     *
431     * @permission ohos.permission.INSTALL_SELF_BUNDLE
432     * @param { Array<string> } hapFilePaths - Indicates the path where the HAP of the application is stored.
433     * @param { InstallParam } installParam - Indicates other parameters required for the installation.
434     * @param { AsyncCallback<void> } callback - Indicates the callback used to return the HAP installation result.
435     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_SELF_BUNDLE'.
436     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
437     * @throws { BusinessError } 401 - Input parameters check failed.
438     * @throws { BusinessError } 17700004 - The specified user ID is not found.
439     * @throws { BusinessError } 17700010 - Failed to install the HAP because the HAP fails to be parsed.
440     * @throws { BusinessError } 17700011 - Failed to install the HAP because the HAP signature fails to be verified.
441     * @throws { BusinessError } 17700012 - Failed to install the HAP because the HAP path is invalid or the HAP is too large.
442     * @throws { BusinessError } 17700015 - Failed to install the HAPs because they have different configuration information.
443     * @throws { BusinessError } 17700016 - Failed to install the HAP because of insufficient system disk space.
444     * @throws { BusinessError } 17700017 - Failed to install the HAP since the version of the HAP to install is too early.
445     * @throws { BusinessError } 17700018 - Failed to install because the dependent module does not exist.
446     * @throws { BusinessError } 17700039 - Failed to install because disallow install a shared bundle by hapFilePaths.
447     * @throws { BusinessError } 17700041 - Failed to install because enterprise device management disallow install.
448     * @throws { BusinessError } 17700042 - Failed to install the HAP because of incorrect URI in the data proxy.
449     * @throws { BusinessError } 17700043 - Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core).
450     * @throws { BusinessError } 17700044 - Failed to install the HAP because the isolationMode configured is not supported.
451     * @throws { BusinessError } 17700047 - Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode.
452     * @throws { BusinessError } 17700048 - Failed to install the HAP because the code signature verification is failed.
453     * @throws { BusinessError } 17700049 - Failed to install the HAP because the bundleName is different from the bundleName of the caller application.
454     * @throws { BusinessError } 17700050 - Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device.
455     * @throws { BusinessError } 17700051 - Failed to install the HAP because the distribution type of caller application is not enterprise_mdm.
456     * @syscap SystemCapability.BundleManager.BundleFramework.Core
457     * @systemapi
458     * @since 10
459     */
460    updateBundleForSelf(hapFilePaths: Array<string>, installParam: InstallParam, callback: AsyncCallback<void>): void;
461
462    /**
463     * Updates this enterprise application.
464     *
465     * @permission ohos.permission.INSTALL_SELF_BUNDLE
466     * @param { Array<string> } hapFilePaths - Indicates the path where the HAP of the application is stored.
467     * @param { AsyncCallback<void> } callback - Indicates the callback used to return the HAP installation result.
468     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_SELF_BUNDLE'.
469     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
470     * @throws { BusinessError } 401 - Input parameters check failed.
471     * @throws { BusinessError } 17700010 - Failed to install the HAP because the HAP fails to be parsed.
472     * @throws { BusinessError } 17700011 - Failed to install the HAP because the HAP signature fails to be verified.
473     * @throws { BusinessError } 17700012 - Failed to install the HAP because the HAP path is invalid or the HAP is too large.
474     * @throws { BusinessError } 17700015 - Failed to install the HAPs because they have different configuration information.
475     * @throws { BusinessError } 17700016 - Failed to install the HAP because of insufficient system disk space.
476     * @throws { BusinessError } 17700017 - Failed to install the HAP since the version of the HAP to install is too early.
477     * @throws { BusinessError } 17700018 - Failed to install because the dependent module does not exist.
478     * @throws { BusinessError } 17700039 - Failed to install because disallow install a shared bundle by hapFilePaths.
479     * @throws { BusinessError } 17700041 - Failed to install because enterprise device management disallow install.
480     * @throws { BusinessError } 17700042 - Failed to install the HAP because of incorrect URI in the data proxy.
481     * @throws { BusinessError } 17700043 - Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core).
482     * @throws { BusinessError } 17700044 - Failed to install the HAP because the isolationMode configured is not supported.
483     * @throws { BusinessError } 17700047 - Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode.
484     * @throws { BusinessError } 17700048 - Failed to install the HAP because the code signature verification is failed.
485     * @throws { BusinessError } 17700049 - Failed to install the HAP because the bundleName is different from the bundleName of the caller application.
486     * @throws { BusinessError } 17700050 - Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device.
487     * @throws { BusinessError } 17700051 - Failed to install the HAP because the distribution type of caller application is not enterprise_mdm.
488     * @syscap SystemCapability.BundleManager.BundleFramework.Core
489     * @systemapi
490     * @since 10
491     */
492    updateBundleForSelf(hapFilePaths: Array<string>, callback: AsyncCallback<void>): void;
493
494    /**
495     * Updates this enterprise application.
496     *
497     * @permission ohos.permission.INSTALL_SELF_BUNDLE
498     * @param { Array<string> } hapFilePaths - Indicates the path where the HAP of the application is stored.
499     * @param { InstallParam } installParam - Indicates other parameters required for the installation.
500     * @returns { Promise<void> }
501     * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_SELF_BUNDLE'.
502     * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
503     * @throws { BusinessError } 401 - Input parameters check failed.
504     * @throws { BusinessError } 17700004 - The specified user ID is not found.
505     * @throws { BusinessError } 17700010 - Failed to install the HAP because the HAP fails to be parsed.
506     * @throws { BusinessError } 17700011 - Failed to install the HAP because the HAP signature fails to be verified.
507     * @throws { BusinessError } 17700012 - Failed to install the HAP because the HAP path is invalid or the HAP is too large.
508     * @throws { BusinessError } 17700015 - Failed to install the HAPs because they have different configuration information.
509     * @throws { BusinessError } 17700016 - Failed to install the HAP because of insufficient system disk space.
510     * @throws { BusinessError } 17700017 - Failed to install the HAP since the version of the HAP to install is too early.
511     * @throws { BusinessError } 17700018 - Failed to install because the dependent module does not exist.
512     * @throws { BusinessError } 17700039 - Failed to install because disallow install a shared bundle by hapFilePaths.
513     * @throws { BusinessError } 17700041 - Failed to install because enterprise device management disallow install.
514     * @throws { BusinessError } 17700042 - Failed to install the HAP because of incorrect URI in the data proxy.
515     * @throws { BusinessError } 17700043 - Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core).
516     * @throws { BusinessError } 17700044 - Failed to install the HAP because the isolationMode configured is not supported.
517     * @throws { BusinessError } 17700047 - Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode.
518     * @throws { BusinessError } 17700048 - Failed to install the HAP because the code signature verification is failed.
519     * @throws { BusinessError } 17700049 - Failed to install the HAP because the bundleName is different from the bundleName of the caller application.
520     * @throws { BusinessError } 17700050 - Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device.
521     * @throws { BusinessError } 17700051 - Failed to install the HAP because the distribution type of caller application is not enterprise_mdm.
522     * @syscap SystemCapability.BundleManager.BundleFramework.Core
523     * @systemapi
524     * @since 10
525     */
526    updateBundleForSelf(hapFilePaths: Array<string>, installParam?: InstallParam): Promise<void>;
527  }
528
529  /**
530   * Provides parameters required for hashParam.
531   *
532   * @typedef HashParam
533   * @syscap SystemCapability.BundleManager.BundleFramework.Core
534   * @systemapi
535   * @since 9
536   */
537  export interface HashParam {
538    /**
539     * Indicates the moduleName
540     *
541     * @syscap SystemCapability.BundleManager.BundleFramework.Core
542     * @systemapi
543     * @since 9
544     */
545    moduleName: string;
546
547    /**
548     * Indicates the hash value
549     *
550     * @syscap SystemCapability.BundleManager.BundleFramework.Core
551     * @systemapi
552     * @since 9
553     */
554    hashValue: string;
555  }
556
557  /**
558   * Provides parameters required for VerifyCodeParam.
559   *
560   * @typedef VerifyCodeParam
561   * @syscap SystemCapability.BundleManager.BundleFramework.Core
562   * @systemapi
563   * @since 10
564   */
565  export interface VerifyCodeParam {
566    /**
567     * Indicates the moduleName which hopes to be processed with code signature.
568     *
569     * @type { string }
570     * @syscap SystemCapability.BundleManager.BundleFramework.Core
571     * @systemapi
572     * @since 10
573     */
574    moduleName: string;
575
576    /**
577     * Indicates the path where the code signature file of the corresponding HAP is stored.
578     *
579     * @type { string }
580     * @syscap SystemCapability.BundleManager.BundleFramework.Core
581     * @systemapi
582     * @since 10
583     */
584    signatureFilePath: string;
585  }
586
587  /**
588   * Provides parameters required for installing or uninstalling an application.
589   *
590   * @typedef InstallParam
591   * @syscap SystemCapability.BundleManager.BundleFramework.Core
592   * @systemapi
593   * @since 9
594   */
595  export interface InstallParam {
596    /**
597     * Indicates the user id
598     *
599     * @syscap SystemCapability.BundleManager.BundleFramework.Core
600     * @systemapi
601     * @since 9
602     */
603    userId?: number;
604
605    /**
606     * Indicates the installation type. The value 0x00 means normal installation, 0x01 means overwrite installation, and 0x10 means installation-free.
607     *
608     * @syscap SystemCapability.BundleManager.BundleFramework.Core
609     * @systemapi
610     * @since 9
611     */
612    installFlag?: number;
613
614    /**
615     * Indicates whether the param has data
616     *
617     * @syscap SystemCapability.BundleManager.BundleFramework.Core
618     * @systemapi
619     * @since 9
620     */
621    isKeepData?: boolean;
622
623    /**
624     * Indicates the hash params
625     *
626     * @syscap SystemCapability.BundleManager.BundleFramework.Core
627     * @systemapi
628     * @since 9
629     */
630    hashParams?: Array<HashParam>;
631
632    /**
633     * Indicates the deadline of the crowdtesting bundle
634     *
635     * @syscap SystemCapability.BundleManager.BundleFramework.Core
636     * @systemapi
637     * @since 9
638     */
639    crowdtestDeadline?: number;
640
641    /**
642     * Indicates the shared bundle dir paths.
643     *
644     * @syscap SystemCapability.BundleManager.BundleFramework.Core
645     * @systemapi
646     * @since 10
647     */
648    sharedBundleDirPaths?: Array<String>;
649
650    /**
651     * Indicates the distribution type specified during bundle installation.
652     *
653     * @syscap SystemCapability.BundleManager.BundleFramework.Core
654     * @systemapi
655     * @since 10
656     */
657    specifiedDistributionType?: string;
658
659    /**
660     * Indicates the additional information during bundle installation.
661     *
662     * @syscap SystemCapability.BundleManager.BundleFramework.Core
663     * @systemapi
664     * @since 10
665     */
666    additionalInfo?: string;
667
668    /**
669     * Indicates the verification code param.
670     *
671     * @type { ?Array<VerifyCodeParam> }
672     * @syscap SystemCapability.BundleManager.BundleFramework.Core
673     * @systemapi
674     * @since 10
675     */
676    verifyCodeParams?: Array<VerifyCodeParam>;
677  }
678
679  /**
680   * Provides parameters required for uninstalling shared bundle.
681   *
682   * @typedef UninstallParam
683   * @syscap SystemCapability.BundleManager.BundleFramework.Core
684   * @systemapi
685   * @since 10
686   */
687  export interface UninstallParam {
688    /**
689     * Indicates the shared bundle name
690     *
691     * @syscap SystemCapability.BundleManager.BundleFramework.Core
692     * @systemapi
693     * @since 10
694     */
695    bundleName: string;
696
697    /**
698     * Indicates the shared version code. If default, indicates that all version sharing bundles are uninstalled
699     *
700     * @syscap SystemCapability.BundleManager.BundleFramework.Core
701     * @systemapi
702     * @since 10
703     */
704    versionCode?: number;
705  }
706}
707
708export default installer;
709