• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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 './../basic';
17import bundle from './../@ohos.bundle';
18
19/**
20 * @name Provides parameters required for installing or uninstalling an application.
21 * @since 7
22 * @syscap SystemCapability.BundleManager.BundleFramework
23 * @permission NA
24 * @systemapi Hide this for inner system use
25 */
26export interface InstallParam {
27  /**
28    * @default Indicates the user id
29    * @since 7
30    * @syscap SystemCapability.BundleManager.BundleFramework
31    */
32  userId: number;
33
34  /**
35    * @default Indicates the install flag
36    * @since 7
37    * @syscap SystemCapability.BundleManager.BundleFramework
38    */
39  installFlag: number;
40
41  /**
42    * @default Indicates whether the param has data
43    * @since 7
44    * @syscap SystemCapability.BundleManager.BundleFramework
45    */
46  isKeepData: boolean;
47}
48
49/**
50 * @name Indicates the install or uninstall status
51 * @since 7
52 * @syscap SystemCapability.BundleManager.BundleFramework
53 * @permission NA
54 * @systemapi Hide this for inner system use
55 */
56export interface InstallStatus {
57
58  /**
59    * @default Indicates the install or uninstall error code
60    * @since 7
61    * @syscap SystemCapability.BundleManager.BundleFramework
62    */
63  status: bundle.InstallErrorCode;
64
65  /**
66    * @default Indicates the install or uninstall result string message
67    * @since 7
68    * @syscap SystemCapability.BundleManager.BundleFramework
69    */
70  statusMessage: string;
71}
72
73/**
74 * @name Offers install, upgrade, and remove bundles on the devices.
75 * @since 7
76 * @syscap SystemCapability.BundleManager.BundleFramework
77 * @permission NA
78 * @systemapi Hide this for inner system use
79 */
80export interface BundleInstaller {
81  /**
82   * Install an application in a HAP.
83   *
84   * @since 7
85   * @syscap SystemCapability.BundleManager.BundleFramework
86   *
87   * @param bundleFilePaths Indicates the path where the bundle of the application is stored. The path should be the
88   *                        relative path to the data directory of the current application.
89   * @param installParam Indicates other parameters required for the installation.
90   * @return InstallStatus
91   * @permission ohos.permission.INSTALL_BUNDLE
92   */
93  install(bundleFilePaths: Array<string>, param: InstallParam, callback: AsyncCallback<InstallStatus>): void;
94
95  /**
96   * Uninstall an application.
97   *
98   * @since 7
99   * @syscap SystemCapability.BundleManager.BundleFramework
100   *
101   * @param bundleName Indicates the bundle name of the application to be uninstalled.
102   * @param installParam Indicates other parameters required for the uninstallation.
103   * @return InstallStatus
104   * @permission ohos.permission.INSTALL_BUNDLE
105   */
106  uninstall(bundleName: string, param: InstallParam, callback: AsyncCallback<InstallStatus>): void;
107
108  /**
109   * recover an application.
110   *
111   * @since 8
112   * @syscap SystemCapability.BundleManager.BundleFramework
113   *
114   * @param bundleName Indicates the bundle name of the application to be recovered.
115   * @param installParam Indicates other parameters required for the recover.
116   * @return InstallStatus
117   * @permission ohos.permission.INSTALL_BUNDLE
118   * @systemapi Hide this for inner system use
119   */
120   recover(bundleName: string, param: InstallParam, callback: AsyncCallback<InstallStatus>): void;
121}