1e41f4b71Sopenharmony_ci# @ohos.app.ability.quickFixManager (quickFixManager)(系统接口)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciquickFixManager模块提供快速修复的能力,快速修复是系统提供给开发者的一种技术手段,支持开发者以远快于(小时级、分钟级)应用升级的方式进行缺陷修复。
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **说明:**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。  
8e41f4b71Sopenharmony_ci> 本模块接口均为系统接口,三方应用不支持调用。
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## 导入模块
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci```ts
13e41f4b71Sopenharmony_ciimport { quickFixManager } from '@kit.AbilityKit';
14e41f4b71Sopenharmony_ci```
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci## HapModuleQuickFixInfo
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_cihap级别的快速修复信息。
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci**系统API**: 此接口为系统接口,三方应用不支持调用。
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci| 名称        | 类型                 | 只读 | 必填 | 说明                                                         |
25e41f4b71Sopenharmony_ci| ----------- | -------------------- | ---- | ---- | ------------------------------------------------------------ |
26e41f4b71Sopenharmony_ci| moduleName    | string               | 是 |  是   | HAP的名称。                               |
27e41f4b71Sopenharmony_ci| originHapHash    | string            | 是 | 是   | 指示hap的哈希值。                               |
28e41f4b71Sopenharmony_ci| quickFixFilePath    | string         | 是 | 是   | 指示快速修复文件的安装路径。                               |
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci## ApplicationQuickFixInfo
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci应用级别的快速修复信息。
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci**系统API**: 此接口为系统接口,三方应用不支持调用。
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci| 名称        | 类型                 | 只读 | 必填 | 说明                                                         |
39e41f4b71Sopenharmony_ci| ----------- | -------------------- | ---- | ---- | ------------------------------------------------------------ |
40e41f4b71Sopenharmony_ci| bundleName    | string               | 是 | 是   | 应用Bundle名称。                       |
41e41f4b71Sopenharmony_ci| bundleVersionCode    | number        | 是 | 是   | 应用的版本号。                               |
42e41f4b71Sopenharmony_ci| bundleVersionName    | string        | 是 | 是   | 应用版本号的文字描述。                               |
43e41f4b71Sopenharmony_ci| quickFixVersionCode    | number      | 是 | 是   | 快速修复补丁包的版本号。                               |
44e41f4b71Sopenharmony_ci| quickFixVersionName    | string      | 是 | 是   | 快速修复补丁包版本号的文字描述。                               |
45e41f4b71Sopenharmony_ci| hapModuleQuickFixInfo    | Array\<[HapModuleQuickFixInfo](#hapmodulequickfixinfo)>   | 是 | 是   | hap级别的快速修复信息。     |
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci## quickFixManager.applyQuickFix
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ciapplyQuickFix(hapModuleQuickFixFiles: Array\<string>, callback: AsyncCallback\<void>): void;
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci快速修复的补丁安装接口。使用callback异步回调。
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci**需要权限**: ohos.permission.INSTALL_BUNDLE
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci**系统API**: 此接口为系统接口,三方应用不支持调用。
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci**参数:**
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci  | 参数名 | 类型 | 必填 | 说明 |
62e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
63e41f4b71Sopenharmony_ci  | hapModuleQuickFixFiles | Array\<string> | 是 | 快速修复补丁文件(补丁文件需包含有效的文件路径)。 |
64e41f4b71Sopenharmony_ci  | callback | AsyncCallback\<void> | 是 | 回调函数。当快速修复的补丁安装成功,err为undefined,否则为错误对象。 |
65e41f4b71Sopenharmony_ci
66e41f4b71Sopenharmony_ci**错误码**:
67e41f4b71Sopenharmony_ci
68e41f4b71Sopenharmony_ci在打补丁过程中发生的错误,其错误码及错误信息通过公共事件[COMMON_EVENT_QUICK_FIX_APPLY_RESULT](../apis-basic-services-kit/common_event/commonEvent-definitions.md#common_event_quick_fix_apply_result9)的参数返回给应用开发者。
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci以下错误码详细介绍请参考[通用错误码](../errorcode-universal.md)和[元能力子系统错误码](errorcode-ability.md)。
71e41f4b71Sopenharmony_ci
72e41f4b71Sopenharmony_ci| 错误码ID | 错误信息 |
73e41f4b71Sopenharmony_ci| ------- | -------- |
74e41f4b71Sopenharmony_ci| 201      | Permission denied. |
75e41f4b71Sopenharmony_ci| 202      | Not system application. |
76e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
77e41f4b71Sopenharmony_ci| 18500002 | The specified quick fix is invalid. It may not exist or inaccessible. |
78e41f4b71Sopenharmony_ci| 18500008 | Internal error. |
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ci> 说明:调用applyQuickFix接口时,补丁文件所在路径为应用沙箱路径。沙箱路径的获取参考[获取应用的沙箱路径](js-apis-bundle-BundleInstaller-sys.md#获取应用的沙箱路径),映射到设备上的路径为/proc/&lt;应用进程Id&gt;/root/沙箱路径。
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci**示例:**
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ci```ts
85e41f4b71Sopenharmony_ciimport { quickFixManager } from '@kit.AbilityKit';
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_citry {
88e41f4b71Sopenharmony_ci  let hapModuleQuickFixFiles = ['/data/storage/el2/base/entry.hqf'];
89e41f4b71Sopenharmony_ci  quickFixManager.applyQuickFix(hapModuleQuickFixFiles, (error) => {
90e41f4b71Sopenharmony_ci    if (error) {
91e41f4b71Sopenharmony_ci      console.error( `applyQuickFix failed with error: ${error}`);
92e41f4b71Sopenharmony_ci    } else {
93e41f4b71Sopenharmony_ci      console.info( 'applyQuickFix success');
94e41f4b71Sopenharmony_ci    }
95e41f4b71Sopenharmony_ci  });
96e41f4b71Sopenharmony_ci} catch (paramError) {
97e41f4b71Sopenharmony_ci  console.error(`error.code: ${paramError.code}, error.message: ${paramError.message}`);
98e41f4b71Sopenharmony_ci}
99e41f4b71Sopenharmony_ci```
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci## quickFixManager.applyQuickFix
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ciapplyQuickFix(hapModuleQuickFixFiles: Array\<string>): Promise\<void>;
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_ci快速修复的补丁安装接口。使用Promise异步回调。
106e41f4b71Sopenharmony_ci
107e41f4b71Sopenharmony_ci**需要权限**: ohos.permission.INSTALL_BUNDLE
108e41f4b71Sopenharmony_ci
109e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
110e41f4b71Sopenharmony_ci
111e41f4b71Sopenharmony_ci**系统API**: 此接口为系统接口,三方应用不支持调用。
112e41f4b71Sopenharmony_ci
113e41f4b71Sopenharmony_ci**参数:**
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ci  | 参数名 | 类型 | 必填 | 说明 |
116e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
117e41f4b71Sopenharmony_ci  | hapModuleQuickFixFiles | Array\<string> | 是 | 快速修复补丁文件(补丁文件需包含有效的文件路径)。 |
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ci**返回值:**
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_ci  | 类型 | 说明 |
122e41f4b71Sopenharmony_ci  | -------- | -------- |
123e41f4b71Sopenharmony_ci  | Promise\<void> | Promise对象。无返回结果的Promise对象。 |
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_ci**错误码**:
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ci在打补丁过程中发生的错误,其错误码及错误信息通过公共事件[COMMON_EVENT_QUICK_FIX_APPLY_RESULT](../apis-basic-services-kit/common_event/commonEvent-definitions.md#common_event_quick_fix_apply_result9)的参数返回给应用开发者。
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ci以下错误码详细介绍请参考[通用错误码](../errorcode-universal.md)和[元能力子系统错误码](errorcode-ability.md)。
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ci| 错误码ID | 错误信息 |
132e41f4b71Sopenharmony_ci| ------- | -------- |
133e41f4b71Sopenharmony_ci| 201      | Permission denied. |
134e41f4b71Sopenharmony_ci| 202      | Not system application. |
135e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
136e41f4b71Sopenharmony_ci| 18500002 | The specified quick fix is invalid. It may not exist or inaccessible. |
137e41f4b71Sopenharmony_ci| 18500008 | Internal error. |
138e41f4b71Sopenharmony_ci
139e41f4b71Sopenharmony_ci**示例:**
140e41f4b71Sopenharmony_ci
141e41f4b71Sopenharmony_ci```ts
142e41f4b71Sopenharmony_ciimport { quickFixManager } from '@kit.AbilityKit';
143e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
144e41f4b71Sopenharmony_ci
145e41f4b71Sopenharmony_cilet hapModuleQuickFixFiles = ['/data/storage/el2/base/entry.hqf'];
146e41f4b71Sopenharmony_ci
147e41f4b71Sopenharmony_citry {
148e41f4b71Sopenharmony_ci  quickFixManager.applyQuickFix(hapModuleQuickFixFiles).then(() => {
149e41f4b71Sopenharmony_ci    console.info('applyQuickFix success');
150e41f4b71Sopenharmony_ci  }).catch((error: BusinessError) => {
151e41f4b71Sopenharmony_ci    console.error(`applyQuickFix err: ${error}`);
152e41f4b71Sopenharmony_ci  });
153e41f4b71Sopenharmony_ci} catch (paramError) {
154e41f4b71Sopenharmony_ci  console.error(`error: ${(paramError as BusinessError).code}, ${(paramError as BusinessError).message}`);
155e41f4b71Sopenharmony_ci}
156e41f4b71Sopenharmony_ci```
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ci## quickFixManager.getApplicationQuickFixInfo
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_cigetApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback\<ApplicationQuickFixInfo>): void;
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ci获取应用的快速修复信息。使用callback异步回调。
163e41f4b71Sopenharmony_ci
164e41f4b71Sopenharmony_ci**需要权限**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ci**系统API**: 此接口为系统接口,三方应用不支持调用。
169e41f4b71Sopenharmony_ci
170e41f4b71Sopenharmony_ci**参数:**
171e41f4b71Sopenharmony_ci
172e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 |
173e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |
174e41f4b71Sopenharmony_ci| bundleName | string | 是 |应用Bundle名称。  |
175e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[ApplicationQuickFixInfo](#applicationquickfixinfo)> | 是 | 回调函数。返回应用的快速修复信息。 |
176e41f4b71Sopenharmony_ci
177e41f4b71Sopenharmony_ci**错误码**:
178e41f4b71Sopenharmony_ci
179e41f4b71Sopenharmony_ci以下错误码详细介绍请参考[通用错误码](../errorcode-universal.md)和[元能力子系统错误码](errorcode-ability.md)。
180e41f4b71Sopenharmony_ci
181e41f4b71Sopenharmony_ci| 错误码ID | 错误信息 |
182e41f4b71Sopenharmony_ci| ------- | -------- |
183e41f4b71Sopenharmony_ci| 201      | Permission denied. |
184e41f4b71Sopenharmony_ci| 202      | Not system application. |
185e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
186e41f4b71Sopenharmony_ci| 18500001 | The bundle does not exist or no patch has been applied. |
187e41f4b71Sopenharmony_ci| 18500008 | Internal error. |
188e41f4b71Sopenharmony_ci
189e41f4b71Sopenharmony_ci**示例:**
190e41f4b71Sopenharmony_ci
191e41f4b71Sopenharmony_ci```ts
192e41f4b71Sopenharmony_ciimport { quickFixManager } from '@kit.AbilityKit';
193e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
194e41f4b71Sopenharmony_ci
195e41f4b71Sopenharmony_citry {
196e41f4b71Sopenharmony_ci  let bundleName = 'bundleName';
197e41f4b71Sopenharmony_ci  quickFixManager.getApplicationQuickFixInfo(bundleName, (error, data) => {
198e41f4b71Sopenharmony_ci    if (error) {
199e41f4b71Sopenharmony_ci      console.error(`getApplicationQuickFixInfo error: ${error}`);
200e41f4b71Sopenharmony_ci    } else {
201e41f4b71Sopenharmony_ci      console.info(`getApplicationQuickFixInfo success: ${data}`);
202e41f4b71Sopenharmony_ci    }
203e41f4b71Sopenharmony_ci  });
204e41f4b71Sopenharmony_ci} catch (paramError) {
205e41f4b71Sopenharmony_ci  console.error(`error: ${(paramError as BusinessError).code}, ${(paramError as BusinessError).message}`);
206e41f4b71Sopenharmony_ci}
207e41f4b71Sopenharmony_ci```
208e41f4b71Sopenharmony_ci
209e41f4b71Sopenharmony_ci## quickFixManager.getApplicationQuickFixInfo
210e41f4b71Sopenharmony_ci
211e41f4b71Sopenharmony_cigetApplicationQuickFixInfo(bundleName: string): Promise\<ApplicationQuickFixInfo>;
212e41f4b71Sopenharmony_ci
213e41f4b71Sopenharmony_ci获取应用的快速修复信息。使用Promise异步回调。
214e41f4b71Sopenharmony_ci
215e41f4b71Sopenharmony_ci**需要权限**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
216e41f4b71Sopenharmony_ci
217e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
218e41f4b71Sopenharmony_ci
219e41f4b71Sopenharmony_ci**系统API**: 此接口为系统接口,三方应用不支持调用。
220e41f4b71Sopenharmony_ci
221e41f4b71Sopenharmony_ci**参数:**
222e41f4b71Sopenharmony_ci
223e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 |
224e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |
225e41f4b71Sopenharmony_ci| bundleName | string | 是 | 应用Bundle名称。 |
226e41f4b71Sopenharmony_ci
227e41f4b71Sopenharmony_ci**返回值:**
228e41f4b71Sopenharmony_ci
229e41f4b71Sopenharmony_ci  | 类型 | 说明 |
230e41f4b71Sopenharmony_ci  | -------- | -------- |
231e41f4b71Sopenharmony_ci  | Promise\<[ApplicationQuickFixInfo](#applicationquickfixinfo)> | Promise对象。返回应用的快速修复信息。 |
232e41f4b71Sopenharmony_ci
233e41f4b71Sopenharmony_ci**错误码**:
234e41f4b71Sopenharmony_ci
235e41f4b71Sopenharmony_ci以下错误码详细介绍请参考[通用错误码](../errorcode-universal.md)和[元能力子系统错误码](errorcode-ability.md)。
236e41f4b71Sopenharmony_ci
237e41f4b71Sopenharmony_ci| 错误码ID | 错误信息 |
238e41f4b71Sopenharmony_ci| ------- | -------- |
239e41f4b71Sopenharmony_ci| 201      | Permission denied. |
240e41f4b71Sopenharmony_ci| 202      | Not system application. |
241e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
242e41f4b71Sopenharmony_ci| 18500001 | The bundle does not exist or no patch has been applied. |
243e41f4b71Sopenharmony_ci| 18500008 | Internal error. |
244e41f4b71Sopenharmony_ci
245e41f4b71Sopenharmony_ci**示例:**
246e41f4b71Sopenharmony_ci
247e41f4b71Sopenharmony_ci```ts
248e41f4b71Sopenharmony_ciimport { quickFixManager } from '@kit.AbilityKit';
249e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
250e41f4b71Sopenharmony_ci
251e41f4b71Sopenharmony_citry {
252e41f4b71Sopenharmony_ci  let bundleName = 'bundleName';
253e41f4b71Sopenharmony_ci  quickFixManager.getApplicationQuickFixInfo(bundleName).then((data) => {
254e41f4b71Sopenharmony_ci    console.info(`getApplicationQuickFixInfo success: ${data}`);
255e41f4b71Sopenharmony_ci  }).catch((error: BusinessError) => {
256e41f4b71Sopenharmony_ci    console.error(`getApplicationQuickFixInfo err: ${error}`);
257e41f4b71Sopenharmony_ci  });
258e41f4b71Sopenharmony_ci} catch (paramError) {
259e41f4b71Sopenharmony_ci  console.error(`error: ${(paramError as BusinessError).code}, ${(paramError as BusinessError).message}`);
260e41f4b71Sopenharmony_ci}
261e41f4b71Sopenharmony_ci```
262e41f4b71Sopenharmony_ci
263e41f4b71Sopenharmony_ci## quickFixManager.revokeQuickFix<sup>10+<sup>
264e41f4b71Sopenharmony_ci
265e41f4b71Sopenharmony_cirevokeQuickFix(bundleName: string, callback: AsyncCallback\<void>): void;
266e41f4b71Sopenharmony_ci
267e41f4b71Sopenharmony_ci撤销快速修复的接口,使用callback方式返回结果。
268e41f4b71Sopenharmony_ci
269e41f4b71Sopenharmony_ci**需要权限**:ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.INSTALL_BUNDLE
270e41f4b71Sopenharmony_ci
271e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
272e41f4b71Sopenharmony_ci
273e41f4b71Sopenharmony_ci**系统API**:此接口为系统接口,三方应用不支持调用。
274e41f4b71Sopenharmony_ci
275e41f4b71Sopenharmony_ci**参数:**
276e41f4b71Sopenharmony_ci
277e41f4b71Sopenharmony_ci  | 参数名 | 类型 | 必填 | 说明 |
278e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
279e41f4b71Sopenharmony_ci  | bundleName | string | 是 | 需要撤销补丁的应用Bundle名称。 |
280e41f4b71Sopenharmony_ci  | callback | AsyncCallback\<void> | 是 | 回调函数。当撤销快速修复成功时,err为undefined,否则为错误对象。 |
281e41f4b71Sopenharmony_ci
282e41f4b71Sopenharmony_ci**错误码**:
283e41f4b71Sopenharmony_ci
284e41f4b71Sopenharmony_ci以下错误码详细介绍请参考[通用错误码](../errorcode-universal.md)和[元能力子系统错误码](errorcode-ability.md)。
285e41f4b71Sopenharmony_ci
286e41f4b71Sopenharmony_ci| 错误码ID | 错误信息 |
287e41f4b71Sopenharmony_ci| ------- | -------- |
288e41f4b71Sopenharmony_ci| 201      | Permission denied. |
289e41f4b71Sopenharmony_ci| 202      | Not system application. |
290e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
291e41f4b71Sopenharmony_ci| 18500001 | The bundle does not exist or no patch has been applied. |
292e41f4b71Sopenharmony_ci| 18500009 | The application has an ongoing quick fix task. |
293e41f4b71Sopenharmony_ci
294e41f4b71Sopenharmony_ci在撤销补丁过程中发生的错误,其错误码及错误信息通过公共事件[COMMON_EVENT_QUICK_FIX_REVOKE_RESULT](../apis-basic-services-kit/common_event/commonEventManager-definitions.md#common_event_quick_fix_revoke_result10)的参数返回给应用开发者。
295e41f4b71Sopenharmony_ci
296e41f4b71Sopenharmony_ci**示例:**
297e41f4b71Sopenharmony_ci
298e41f4b71Sopenharmony_ci```ts
299e41f4b71Sopenharmony_ciimport { quickFixManager } from '@kit.AbilityKit';
300e41f4b71Sopenharmony_ci
301e41f4b71Sopenharmony_cilet bundleName = "com.example.myapplication";
302e41f4b71Sopenharmony_ci
303e41f4b71Sopenharmony_ciquickFixManager.revokeQuickFix(bundleName, (err) => {
304e41f4b71Sopenharmony_ci  console.info("revokeQuickFix " + bundleName + " " + JSON.stringify(err));
305e41f4b71Sopenharmony_ci});
306e41f4b71Sopenharmony_ci```
307e41f4b71Sopenharmony_ci
308e41f4b71Sopenharmony_ci## quickFixManager.revokeQuickFix<sup>10+<sup>
309e41f4b71Sopenharmony_ci
310e41f4b71Sopenharmony_cirevokeQuickFix(bundleName: string): Promise\<void>;
311e41f4b71Sopenharmony_ci
312e41f4b71Sopenharmony_ci撤销快速修复的接口。使用Promise异步回调。
313e41f4b71Sopenharmony_ci
314e41f4b71Sopenharmony_ci**需要权限**:ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.INSTALL_BUNDLE
315e41f4b71Sopenharmony_ci
316e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
317e41f4b71Sopenharmony_ci
318e41f4b71Sopenharmony_ci**系统API**:此接口为系统接口,三方应用不支持调用。
319e41f4b71Sopenharmony_ci
320e41f4b71Sopenharmony_ci**参数:**
321e41f4b71Sopenharmony_ci
322e41f4b71Sopenharmony_ci  | 参数名 | 类型 | 必填 | 说明 |
323e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- |
324e41f4b71Sopenharmony_ci  | bundleName | string | 是 | 需要撤销补丁的应用Bundle名称。 |
325e41f4b71Sopenharmony_ci
326e41f4b71Sopenharmony_ci**返回值:**
327e41f4b71Sopenharmony_ci
328e41f4b71Sopenharmony_ci  | 类型 | 说明 |
329e41f4b71Sopenharmony_ci  | -------- | -------- |
330e41f4b71Sopenharmony_ci  | Promise\<void> | Promise对象。无返回结果的Promise对象。 |
331e41f4b71Sopenharmony_ci
332e41f4b71Sopenharmony_ci**错误码**:
333e41f4b71Sopenharmony_ci
334e41f4b71Sopenharmony_ci以下错误码详细介绍请参考[通用错误码](../errorcode-universal.md)和[元能力子系统错误码](errorcode-ability.md)。
335e41f4b71Sopenharmony_ci
336e41f4b71Sopenharmony_ci| 错误码ID | 错误信息 |
337e41f4b71Sopenharmony_ci| ------- | -------- |
338e41f4b71Sopenharmony_ci| 201      | Permission denied. |
339e41f4b71Sopenharmony_ci| 202      | Not system application. |
340e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
341e41f4b71Sopenharmony_ci| 18500001 | The bundle does not exist or no patch has been applied. |
342e41f4b71Sopenharmony_ci| 18500009 | The application has an ongoing quick fix task. |
343e41f4b71Sopenharmony_ci
344e41f4b71Sopenharmony_ci在撤销补丁过程中发生的错误,其错误码及错误信息通过公共事件[COMMON_EVENT_QUICK_FIX_REVOKE_RESULT](../apis-basic-services-kit/common_event/commonEventManager-definitions.md#common_event_quick_fix_revoke_result10)的参数返回给应用开发者。这部分错误码及错误信息如下:
345e41f4b71Sopenharmony_ci
346e41f4b71Sopenharmony_ci**示例:**
347e41f4b71Sopenharmony_ci
348e41f4b71Sopenharmony_ci```ts
349e41f4b71Sopenharmony_ciimport { quickFixManager } from '@kit.AbilityKit';
350e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
351e41f4b71Sopenharmony_ci
352e41f4b71Sopenharmony_cilet bundleName = "com.example.myapplication";
353e41f4b71Sopenharmony_ci
354e41f4b71Sopenharmony_ciquickFixManager.revokeQuickFix(bundleName).then(() => {
355e41f4b71Sopenharmony_ci  console.info("revokeQuickFix " + bundleName +" ok");
356e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => {
357e41f4b71Sopenharmony_ci  console.info("revokeQuickFix " + bundleName +" failed, error code is ", JSON.stringify((err)));
358e41f4b71Sopenharmony_ci});
359e41f4b71Sopenharmony_ci```