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