• 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 "./basic";
17
18/**
19 * Interface of quickFixManager.
20 * @namespace quickFixManager
21 * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
22 * @systemapi
23 * @since 9
24 */
25declare namespace quickFixManager {
26    /**
27     * Quick fix info of hap module.
28     * @typedef HapModuleQuickFixInfo
29     * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
30     * @systemapi
31     * @since 9
32     */
33    export interface HapModuleQuickFixInfo {
34        /**
35         * Indicates hap module name.
36         * @type { string }
37         * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
38         * @systemapi
39         * @since 9
40         */
41        readonly moduleName: string;
42
43        /**
44         * Indicates hash value of a hap.
45         * @type { string }
46         * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
47         * @systemapi
48         * @since 9
49         */
50        readonly originHapHash: string;
51
52        /**
53         * Indicates installed path of quick fix file.
54         * @type { string }
55         * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
56         * @systemapi
57         * @since 9
58         */
59        readonly quickFixFilePath: string;
60    }
61
62    /**
63     * Quick fix info of application.
64     * @typedef ApplicationQuickFixInfo
65     * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
66     * @systemapi
67     * @since 9
68     */
69    export interface ApplicationQuickFixInfo {
70        /**
71         * Bundle name.
72         * @type { string }
73         * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
74         * @systemapi
75         * @since 9
76         */
77        readonly bundleName: string;
78
79        /**
80         * The version number of the bundle.
81         * @type { number }
82         * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
83         * @systemapi
84         * @since 9
85         */
86        readonly bundleVersionCode: number;
87
88        /**
89         * The version name of the bundle.
90         * @type { string }
91         * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
92         * @systemapi
93         * @since 9
94         */
95        readonly bundleVersionName: string;
96
97        /**
98         * The version number of the quick fix.
99         * @type { number }
100         * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
101         * @systemapi
102         * @since 9
103         */
104        readonly quickFixVersionCode: number;
105
106        /**
107         * The version name of the quick fix.
108         * @type { string }
109         * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
110         * @systemapi
111         * @since 9
112         */
113        readonly quickFixVersionName: string;
114
115        /**
116         * Hap module quick fix info.
117         * @type { Array<HapModuleQuickFixInfo> }
118         * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
119         * @systemapi
120         * @since 9
121         */
122        readonly hapModuleQuickFixInfo: Array<HapModuleQuickFixInfo>;
123    }
124
125    /**
126     * Apply quick fix files.
127     * @permission ohos.permission.INSTALL_BUNDLE
128     * @param { Array<string> } hapModuleQuickFixFiles - Quick fix files need to apply, this value should include file
129     *                                                   path and file name.
130     * @param { AsyncCallback<void> } callback - The callback of applyQuickFix.
131     * @throws { BusinessError } 201 - Permission denied.
132     * @throws { BusinessError } 202 - Not system application.
133     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
134     * @throws { BusinessError } 18500002 - The specified quick fix is invalid. It may not exist or inaccessible.
135     * @throws { BusinessError } 18500008 - Internal error.
136     * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
137     * @systemapi
138     * @since 9
139     */
140    function applyQuickFix(hapModuleQuickFixFiles: Array<string>, callback: AsyncCallback<void>): void;
141
142    /**
143     * Apply quick fix files.
144     * @permission ohos.permission.INSTALL_BUNDLE
145     * @param { Array<string> } hapModuleQuickFixFiles - Quick fix files need to apply, this value should include file
146     *                                                   path and file name.
147     * @returns { Promise<void> } The promise returned by the function.
148     * @throws { BusinessError } 201 - Permission denied.
149     * @throws { BusinessError } 202 - Not system application.
150     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
151     * @throws { BusinessError } 18500002 - The specified quick fix is invalid. It may not exist or inaccessible.
152     * @throws { BusinessError } 18500008 - Internal error.
153     * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
154     * @systemapi
155     * @since 9
156     */
157    function applyQuickFix(hapModuleQuickFixFiles: Array<string>): Promise<void>;
158
159    /**
160     * Get application quick fix info by bundle name.
161     * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
162     * @param { string } bundleName - Bundle name wish to query.
163     * @param { AsyncCallback<ApplicationQuickFixInfo> } callback - The callback is used to return the ApplicationQuickFixInfo.
164     * @throws { BusinessError } 201 - Permission denied.
165     * @throws { BusinessError } 202 - Not system application.
166     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
167     * @throws { BusinessError } 18500001 - The specified bundleName is invalid.
168     * @throws { BusinessError } 18500008 - Internal error.
169     * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
170     * @systemapi
171     * @since 9
172     */
173    function getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback<ApplicationQuickFixInfo>): void;
174
175    /**
176     * Get application quick fix info by bundle name.
177     * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
178     * @param { string } bundleName - Bundle name wish to query.
179     * @returns { Promise<ApplicationQuickFixInfo> } Returns the ApplicationQuickFixInfo.
180     * @throws { BusinessError } 201 - Permission denied.
181     * @throws { BusinessError } 202 - Not system application.
182     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
183     * @throws { BusinessError } 18500001 - The specified bundleName is invalid.
184     * @throws { BusinessError } 18500008 - Internal error.
185     * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
186     * @systemapi
187     * @since 9
188     */
189    function getApplicationQuickFixInfo(bundleName: string): Promise<ApplicationQuickFixInfo>;
190}
191
192export default quickFixManager;