• 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
16/**
17 * @file
18 * @kit AbilityKit
19 */
20
21import { AsyncCallback } from './@ohos.base';
22import { DispatchInfo as _DispatchInfo } from './bundleManager/DispatchInfo';
23/*** if arkts 1.1 */
24import * as _PackInfo from './bundleManager/BundlePackInfo';
25/*** endif */
26/*** if arkts 1.2 */
27import { BundlePackInfo as _BundlePackInfo, PackageConfig as _PackageConfig, PackageSummary as _PackageSummary,
28  BundleConfigInfo as _BundleConfigInfo, ExtensionAbility as _ExtensionAbility, ModuleConfigInfo as _ModuleConfigInfo,
29  ModuleDistroInfo as _ModuleDistroInfo, ModuleAbilityInfo as _ModuleAbilityInfo, AbilityFormInfo as _AbilityFormInfo,
30  Version as _Version, ApiVersion as _ApiVersion } from './bundleManager/BundlePackInfo';
31/*** endif */
32
33/**
34 * Free install bundle manager.
35 *
36 * @namespace freeInstall
37 * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
38 * @systemapi
39 * @since arkts {'1.1':'9', '1.2':'20'}
40 * @arkts 1.1&1.2
41 */
42declare namespace freeInstall {
43  /**
44   * Used to set the enumeration value of upgrading for free installation.
45   *
46   * @enum { number }
47   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
48   * @systemapi
49   * @since arkts {'1.1':'9', '1.2':'20'}
50   * @arkts 1.1&1.2
51   */
52  export enum UpgradeFlag {
53    /**
54     * Indicates module not need to be upgraded
55     *
56     * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
57     * @systemapi
58     * @since arkts {'1.1':'9', '1.2':'20'}
59     * @arkts 1.1&1.2
60     */
61    NOT_UPGRADE = 0,
62    /**
63     * Indicates single module need to be upgraded
64     *
65     * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
66     * @systemapi
67     * @since arkts {'1.1':'9', '1.2':'20'}
68     * @arkts 1.1&1.2
69     */
70    SINGLE_UPGRADE = 1,
71    /**
72     * Indicates relation module need to be upgraded
73     *
74     * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
75     * @systemapi
76     * @since arkts {'1.1':'9', '1.2':'20'}
77     * @arkts 1.1&1.2
78     */
79    RELATION_UPGRADE = 2
80  }
81
82  /**
83   * Used to query the enumeration value of bundlePackInfo.
84   * Multiple value input, such as GET_PACKAGES | GET_BUNDLE_SUMMARY.
85   *
86   * @enum { number }
87   * @syscap SystemCapability.BundleManager.BundleFramework
88   * @systemapi
89   * @since arkts {'1.1':'9', '1.2':'20'}
90   * @arkts 1.1&1.2
91   */
92  export enum BundlePackFlag {
93    /**
94     * Query all package information.
95     *
96     * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
97     * @systemapi
98     * @since arkts {'1.1':'9', '1.2':'20'}
99     * @arkts 1.1&1.2
100     */
101    GET_PACK_INFO_ALL = 0x00000000,
102    /**
103     * Query package information
104     *
105     * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
106     * @systemapi
107     * @since arkts {'1.1':'9', '1.2':'20'}
108     * @arkts 1.1&1.2
109     */
110    GET_PACKAGES = 0x00000001,
111    /**
112     * Query the brief information of the package
113     *
114     * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
115     * @systemapi
116     * @since arkts {'1.1':'9', '1.2':'20'}
117     * @arkts 1.1&1.2
118     */
119    GET_BUNDLE_SUMMARY = 0x00000002,
120    /**
121     * Query the brief information of the module.
122     *
123     * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
124     * @systemapi
125     * @since arkts {'1.1':'9', '1.2':'20'}
126     * @arkts 1.1&1.2
127     */
128    GET_MODULE_SUMMARY = 0x00000004
129  }
130
131  /**
132   * Sets whether to upgrade the module.
133   *
134   * @permission ohos.permission.INSTALL_BUNDLE
135   * @param { string } bundleName - Indicates the bundle name of the application.
136   * @param { string } moduleName - Indicates the module name of the application.
137   * @param { UpgradeFlag } upgradeFlag - Indicates upgradeFlag of the application.
138   * @param { AsyncCallback<void> } callback - The callback of setting module upgrade flag result.
139   * @throws { BusinessError } 201 - Permission denied.
140   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
141   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
142   * @throws { BusinessError } 801 - Capability not supported.
143   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
144   * @throws { BusinessError } 17700002 - The specified module name is not found.
145   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
146   * @systemapi
147   * @since arkts {'1.1':'9', '1.2':'20'}
148   * @arkts 1.1&1.2
149   */
150  function setHapModuleUpgradeFlag(bundleName: string,
151    moduleName: string, upgradeFlag: UpgradeFlag, callback: AsyncCallback<void>): void;
152
153  /**
154   * Sets whether to upgrade the module.
155   *
156   * @permission ohos.permission.INSTALL_BUNDLE
157   * @param { string } bundleName - Indicates the bundle name of the application.
158   * @param { string } moduleName - Indicates the module name of the application.
159   * @param { UpgradeFlag } upgradeFlag - Indicates upgradeFlag of the application.
160   * @returns { Promise<void> } - Return the result of setting module upgrade flag.
161   * @throws { BusinessError } 201 - Permission denied.
162   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
163   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
164   * @throws { BusinessError } 801 - Capability not supported.
165   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
166   * @throws { BusinessError } 17700002 - The specified module name is not found.
167   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
168   * @systemapi
169   * @since arkts {'1.1':'9', '1.2':'20'}
170   * @arkts 1.1&1.2
171   */
172  function setHapModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag): Promise<void>;
173
174  /**
175   * Checks whether a specified module is removable.
176   *
177   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
178   * @param { string } bundleName - Indicates the bundle name of the application.
179   * @param { string } moduleName - Indicates the module name of the application.
180   * @param { AsyncCallback<boolean> } callback - The callback of checking module removable result.
181   *  The result is true if the module is removable, false otherwise.
182   * @throws { BusinessError } 201 - Permission denied.
183   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
184   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
185   * @throws { BusinessError } 801 - Capability not supported.
186   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
187   * @throws { BusinessError } 17700002 - The specified module name is not found.
188   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
189   * @systemapi
190   * @since arkts {'1.1':'9', '1.2':'20'}
191   * @arkts 1.1&1.2
192   */
193  function isHapModuleRemovable(bundleName: string, moduleName: string, callback: AsyncCallback<boolean>): void;
194
195  /**
196   * Checks whether a specified module is removable.
197   *
198   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
199   * @param { string } bundleName - Indicates the bundle name of the application.
200   * @param { string } moduleName - Indicates the module name of the application.
201   * @returns { Promise<boolean> } Returns true if the module is removable; returns false otherwise.
202   * @throws { BusinessError } 201 - Permission denied.
203   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
204   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
205   * @throws { BusinessError } 801 - Capability not supported.
206   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
207   * @throws { BusinessError } 17700002 - The specified module name is not found.
208   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
209   * @systemapi
210   * @since arkts {'1.1':'9', '1.2':'20'}
211   * @arkts 1.1&1.2
212   */
213  function isHapModuleRemovable(bundleName: string, moduleName: string): Promise<boolean>;
214
215  /**
216   * Obtains bundlePackInfo based on bundleName and bundlePackFlags.
217   *
218   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
219   * @param { string } bundleName - Indicates the application bundle name to be queried.
220   * @param { BundlePackFlag } bundlePackFlag - Indicates the application bundle pack flag to be queried.
221   * @param { AsyncCallback<BundlePackInfo> } callback - The callback of getting the BundlePackInfo object result.
222   * @throws { BusinessError } 201 - Permission denied.
223   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
224   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
225   * @throws { BusinessError } 801 - Capability not supported.
226   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
227   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
228   * @systemapi
229   * @since arkts {'1.1':'9', '1.2':'20'}
230   * @arkts 1.1&1.2
231   */
232  function getBundlePackInfo(bundleName: string,
233    bundlePackFlag: BundlePackFlag, callback: AsyncCallback<BundlePackInfo>): void;
234
235  /**
236   * Obtains bundlePackInfo based on bundleName and bundlePackFlags.
237   *
238   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
239   * @param { string } bundleName - Indicates the application bundle name to be queried.
240   * @param { BundlePackFlag } bundlePackFlag - Indicates the application bundle pack flag to be queried.
241   * @returns { Promise<BundlePackInfo> } Returns the BundlePackInfo object.
242   * @throws { BusinessError } 201 - Permission denied.
243   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
244   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
245   * @throws { BusinessError } 801 - Capability not supported.
246   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
247   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
248   * @systemapi
249   * @since arkts {'1.1':'9', '1.2':'20'}
250   * @arkts 1.1&1.2
251   */
252  function getBundlePackInfo(bundleName: string, bundlePackFlag: BundlePackFlag): Promise<BundlePackInfo>;
253
254  /**
255   * Obtains information about the dispatcher version.
256   *
257   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
258   * @param { AsyncCallback<DispatchInfo> } callback - The callback of getting the dispatchInfo object for the current ability result.
259   * @throws { BusinessError } 201 - Permission denied.
260   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
261   * @throws { BusinessError } 801 - Capability not supported.
262   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
263   * @systemapi
264   * @since arkts {'1.1':'9', '1.2':'20'}
265   * @arkts 1.1&1.2
266   */
267  function getDispatchInfo(callback: AsyncCallback<DispatchInfo>): void;
268
269  /**
270   * Obtains information about the dispatcher version.
271   *
272   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
273   * @returns { Promise<DispatchInfo> } Returns the DispatchInfo object for the current ability.
274   * @throws { BusinessError } 201 - Permission denied.
275   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
276   * @throws { BusinessError } 801 - Capability not supported.
277   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
278   * @systemapi
279   * @since arkts {'1.1':'9', '1.2':'20'}
280   * @arkts 1.1&1.2
281   */
282  function getDispatchInfo(): Promise<DispatchInfo>;
283
284  /**
285   * The dispatch info class.
286   *
287   * @typedef { _DispatchInfo }
288   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
289   * @systemapi
290   * @since arkts {'1.1':'9', '1.2':'20'}
291   * @arkts 1.1&1.2
292   */
293  export type DispatchInfo = _DispatchInfo;
294
295  /**
296   * The bundle pack info class.
297   *
298   * @typedef { _PackInfo.BundlePackInfo }
299   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
300   * @systemapi
301   * @since 9
302   */
303  export type BundlePackInfo = _PackInfo.BundlePackInfo;
304
305  /**
306   * The bundle pack info class.
307   *
308   * @typedef { _BundlePackInfo }
309   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
310   * @systemapi
311   * @since 20
312   * @arkts 1.2
313   */
314  export type BundlePackInfo = _BundlePackInfo;
315
316  /**
317   * The package info class.
318   *
319   * @typedef { _PackInfo.PackageConfig }
320   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
321   * @systemapi
322   * @since 9
323   */
324  export type PackageConfig = _PackInfo.PackageConfig;
325
326  /**
327   * The package info class.
328   *
329   * @typedef { _PackageConfig }
330   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
331   * @systemapi
332   * @since 20
333   * @arkts 1.2
334   */
335  export type PackageConfig = _PackageConfig;
336
337  /**
338   * The package summary class.
339   *
340   * @typedef { _PackInfo.PackageSummary }
341   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
342   * @systemapi
343   * @since 9
344   */
345  export type PackageSummary = _PackInfo.PackageSummary;
346
347  /**
348   * The package summary class.
349   *
350   * @typedef { _PackageSummary }
351   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
352   * @systemapi
353   * @since 20
354   * @arkts 1.2
355   */
356  export type PackageSummary = _PackageSummary;
357
358  /**
359   * The bundle summary class.
360   *
361   * @typedef { _PackInfo.BundleConfigInfo }
362   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
363   * @systemapi
364   * @since 9
365   */
366  export type BundleConfigInfo = _PackInfo.BundleConfigInfo;
367
368  /**
369   * The bundle summary class.
370   *
371   * @typedef { _BundleConfigInfo }
372   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
373   * @systemapi
374   * @since 20
375   * @arkts 1.2
376   */
377  export type BundleConfigInfo = _BundleConfigInfo;
378
379  /**
380   * The extension ability forms class.
381   *
382   * @typedef { _PackInfo.ExtensionAbility }
383   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
384   * @systemapi
385   * @since 9
386   */
387  export type ExtensionAbility = _PackInfo.ExtensionAbility;
388
389  /**
390   * The extension ability forms class.
391   *
392   * @typedef { _ExtensionAbility }
393   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
394   * @systemapi
395   * @since 20
396   * @arkts 1.2
397   */
398  export type ExtensionAbility = _ExtensionAbility;
399
400  /**
401   * The module summary of a bundle.
402   *
403   * @typedef { _PackInfo.ModuleConfigInfo }
404   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
405   * @systemapi
406   * @since 9
407   */
408  export type ModuleConfigInfo = _PackInfo.ModuleConfigInfo;
409
410  /**
411   * The module summary of a bundle.
412   *
413   * @typedef { _ModuleConfigInfo }
414   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
415   * @systemapi
416   * @since 20
417   * @arkts 1.2
418   */
419  export type ModuleConfigInfo = _ModuleConfigInfo;
420
421  /**
422   * The bundle info summary class.
423   *
424   * @typedef { _PackInfo.ModuleDistroInfo }
425   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
426   * @systemapi
427   * @since 9
428   */
429  export type ModuleDistroInfo = _PackInfo.ModuleDistroInfo;
430
431  /**
432   * The bundle info summary class.
433   *
434   * @typedef { _ModuleDistroInfo }
435   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
436   * @systemapi
437   * @since 20
438   * @arkts 1.2
439   */
440  export type ModuleDistroInfo = _ModuleDistroInfo;
441
442  /**
443   * The ability info of a module.
444   *
445   * @typedef { _PackInfo.ModuleAbilityInfo }
446   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
447   * @systemapi
448   * @since 9
449   */
450  export type ModuleAbilityInfo = _PackInfo.ModuleAbilityInfo;
451
452  /**
453   * The ability info of a module.
454   *
455   * @typedef { _ModuleAbilityInfo }
456   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
457   * @systemapi
458   * @since 20
459   * @arkts 1.2
460   */
461  export type ModuleAbilityInfo = _ModuleAbilityInfo;
462
463  /**
464   * The form info of an ability.
465   *
466   * @typedef { _PackInfo.AbilityFormInfo }
467   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
468   * @systemapi
469   * @since 9
470   */
471  export type AbilityFormInfo = _PackInfo.AbilityFormInfo;
472
473  /**
474   * The form info of an ability.
475   *
476   * @typedef { _AbilityFormInfo }
477   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
478   * @systemapi
479   * @since 20
480   * @arkts 1.2
481   */
482  export type AbilityFormInfo = _AbilityFormInfo;
483
484  /**
485   * The bundle version class.
486   *
487   * @typedef { _PackInfo.Version }
488   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
489   * @systemapi
490   * @since 9
491   */
492  export type Version = _PackInfo.Version;
493
494  /**
495   * The bundle version class.
496   *
497   * @typedef { _Version }
498   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
499   * @systemapi
500   * @since 20
501   * @arkts 1.2
502   */
503  export type Version = _Version;
504
505  /**
506   * The bundle Api version class.
507   *
508   * @typedef { _PackInfo.ApiVersion }
509   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
510   * @systemapi
511   * @since 9
512   */
513  export type ApiVersion = _PackInfo.ApiVersion;
514
515  /**
516   * The bundle Api version class.
517   *
518   * @typedef { _ApiVersion }
519   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
520   * @systemapi
521   * @since 20
522   * @arkts 1.2
523   */
524  export type ApiVersion = _ApiVersion;
525}
526
527export default freeInstall;
528