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
16/**
17 * @file
18 * @kit AbilityKit
19 */
20
21import { AsyncCallback } from './../@ohos.base';
22import bundle from './../@ohos.bundle';
23
24/**
25 * Provides parameters required for installing or uninstalling an application.
26 *
27 * @typedef InstallParam
28 * @syscap SystemCapability.BundleManager.BundleFramework
29 * @systemapi Hide this for inner system use
30 * @since 7
31 * @deprecated since 9
32 * @useinstead ohos.bundle.installer#InstallParam
33 */
34export interface InstallParam {
35  /**
36   * @type { number }
37   * @default Indicates the user id
38   * @syscap SystemCapability.BundleManager.BundleFramework
39   * @systemapi Hide this for inner system use
40   * @since 7
41   * @deprecated since 9
42   * @useinstead ohos.bundle.installer.InstallParam#userId
43   */
44  userId: number;
45
46  /**
47   * @type { number }
48   * @default Indicates the install flag
49   * @syscap SystemCapability.BundleManager.BundleFramework
50   * @systemapi Hide this for inner system use
51   * @since 7
52   * @deprecated since 9
53   * @useinstead ohos.bundle.installer.InstallParam#installFlag
54   */
55  installFlag: number;
56
57  /**
58   * @type { boolean }
59   * @default Indicates whether the param has data
60   * @syscap SystemCapability.BundleManager.BundleFramework
61   * @systemapi Hide this for inner system use
62   * @since 7
63   * @deprecated since 9
64   * @useinstead ohos.bundle.installer.InstallParam#isKeepData
65   */
66  isKeepData: boolean;
67}
68
69/**
70 * Indicates the install or uninstall status
71 *
72 * @typedef InstallStatus
73 * @syscap SystemCapability.BundleManager.BundleFramework
74 * @systemapi Hide this for inner system use
75 * @since 7
76 * @deprecated since 9
77 */
78export interface InstallStatus {
79  /**
80   * @type { bundle.InstallErrorCode }
81   * @default Indicates the install or uninstall error code
82   * @syscap SystemCapability.BundleManager.BundleFramework
83   * @systemapi Hide this for inner system use
84   * @since 7
85   * @deprecated since 9
86   */
87  status: bundle.InstallErrorCode;
88
89  /**
90   * @type { string }
91   * @default Indicates the install or uninstall result string message
92   * @syscap SystemCapability.BundleManager.BundleFramework
93   * @systemapi Hide this for inner system use
94   * @since 7
95   * @deprecated since 9
96   */
97  statusMessage: string;
98}
99
100/**
101 * Offers install, upgrade, and remove bundles on the devices.
102 *
103 * @interface BundleInstaller
104 * @syscap SystemCapability.BundleManager.BundleFramework
105 * @systemapi Hide this for inner system use
106 * @since 7
107 * @deprecated since 9
108 * @useinstead ohos.bundle.installer#BundleInstaller
109 */
110export interface BundleInstaller {
111  /**
112   * Install an application in a HAP.
113   *
114   * @permission ohos.permission.INSTALL_BUNDLE
115   * @param { Array<string> } bundleFilePaths Indicates the path where the bundle of the application is stored. The path should be the
116   *                                   relative path to the data directory of the current application.
117   * @param { InstallParam } param Indicates other parameters required for the installation.
118   * @param { AsyncCallback<InstallStatus> } callback
119   * @syscap SystemCapability.BundleManager.BundleFramework
120   * @systemapi Hide this for inner system use
121   * @since 7
122   * @deprecated since 9
123   * @useinstead ohos.bundle.installer.BundleInstaller#install
124   */
125  install(bundleFilePaths: Array<string>, param: InstallParam, callback: AsyncCallback<InstallStatus>): void;
126
127  /**
128   * Uninstall an application.
129   *
130   * @permission ohos.permission.INSTALL_BUNDLE
131   * @param { string } bundleName Indicates the bundle name of the application to be uninstalled.
132   * @param { InstallParam } param Indicates other parameters required for the uninstall.
133   * @param { AsyncCallback<InstallStatus> } callback
134   * @syscap SystemCapability.BundleManager.BundleFramework
135   * @systemapi Hide this for inner system use
136   * @since 7
137   * @deprecated since 9
138   * @useinstead ohos.bundle.installer.BundleInstaller#uninstall
139   */
140  uninstall(bundleName: string, param: InstallParam, callback: AsyncCallback<InstallStatus>): void;
141
142  /**
143   * recover an application.
144   *
145   * @permission ohos.permission.INSTALL_BUNDLE
146   * @param { string } bundleName Indicates the bundle name of the application to be recovered.
147   * @param { InstallParam } param Indicates other parameters required for the recover.
148   * @param { AsyncCallback<InstallStatus> } callback
149   * @syscap SystemCapability.BundleManager.BundleFramework
150   * @systemapi Hide this for inner system use
151   * @since 8
152   * @deprecated since 9
153   * @useinstead ohos.bundle.installer.BundleInstaller#recover
154   */
155  recover(bundleName: string, param: InstallParam, callback: AsyncCallback<InstallStatus>): void;
156}
157