161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"), 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit AbilityKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport { AsyncCallback } from './@ohos.base'; 2261847f8eSopenharmony_ci 2361847f8eSopenharmony_ci/** 2461847f8eSopenharmony_ci * Interface of quickFixManager. 2561847f8eSopenharmony_ci * 2661847f8eSopenharmony_ci * @namespace quickFixManager 2761847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 2861847f8eSopenharmony_ci * @systemapi 2961847f8eSopenharmony_ci * @since 9 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_cideclare namespace quickFixManager { 3261847f8eSopenharmony_ci /** 3361847f8eSopenharmony_ci * Quick fix info of hap module. 3461847f8eSopenharmony_ci * 3561847f8eSopenharmony_ci * @typedef HapModuleQuickFixInfo 3661847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 3761847f8eSopenharmony_ci * @systemapi 3861847f8eSopenharmony_ci * @since 9 3961847f8eSopenharmony_ci */ 4061847f8eSopenharmony_ci export interface HapModuleQuickFixInfo { 4161847f8eSopenharmony_ci /** 4261847f8eSopenharmony_ci * Indicates hap module name. 4361847f8eSopenharmony_ci * 4461847f8eSopenharmony_ci * @type { string } 4561847f8eSopenharmony_ci * @readonly 4661847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 4761847f8eSopenharmony_ci * @systemapi 4861847f8eSopenharmony_ci * @since 9 4961847f8eSopenharmony_ci */ 5061847f8eSopenharmony_ci readonly moduleName: string; 5161847f8eSopenharmony_ci 5261847f8eSopenharmony_ci /** 5361847f8eSopenharmony_ci * Indicates hash value of a hap. 5461847f8eSopenharmony_ci * 5561847f8eSopenharmony_ci * @type { string } 5661847f8eSopenharmony_ci * @readonly 5761847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 5861847f8eSopenharmony_ci * @systemapi 5961847f8eSopenharmony_ci * @since 9 6061847f8eSopenharmony_ci */ 6161847f8eSopenharmony_ci readonly originHapHash: string; 6261847f8eSopenharmony_ci 6361847f8eSopenharmony_ci /** 6461847f8eSopenharmony_ci * Indicates installed path of quick fix file. 6561847f8eSopenharmony_ci * 6661847f8eSopenharmony_ci * @type { string } 6761847f8eSopenharmony_ci * @readonly 6861847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 6961847f8eSopenharmony_ci * @systemapi 7061847f8eSopenharmony_ci * @since 9 7161847f8eSopenharmony_ci */ 7261847f8eSopenharmony_ci readonly quickFixFilePath: string; 7361847f8eSopenharmony_ci } 7461847f8eSopenharmony_ci 7561847f8eSopenharmony_ci /** 7661847f8eSopenharmony_ci * Quick fix info of application. 7761847f8eSopenharmony_ci * 7861847f8eSopenharmony_ci * @typedef ApplicationQuickFixInfo 7961847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 8061847f8eSopenharmony_ci * @systemapi 8161847f8eSopenharmony_ci * @since 9 8261847f8eSopenharmony_ci */ 8361847f8eSopenharmony_ci export interface ApplicationQuickFixInfo { 8461847f8eSopenharmony_ci /** 8561847f8eSopenharmony_ci * Bundle name. 8661847f8eSopenharmony_ci * 8761847f8eSopenharmony_ci * @type { string } 8861847f8eSopenharmony_ci * @readonly 8961847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 9061847f8eSopenharmony_ci * @systemapi 9161847f8eSopenharmony_ci * @since 9 9261847f8eSopenharmony_ci */ 9361847f8eSopenharmony_ci readonly bundleName: string; 9461847f8eSopenharmony_ci 9561847f8eSopenharmony_ci /** 9661847f8eSopenharmony_ci * The version number of the bundle. 9761847f8eSopenharmony_ci * 9861847f8eSopenharmony_ci * @type { number } 9961847f8eSopenharmony_ci * @readonly 10061847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 10161847f8eSopenharmony_ci * @systemapi 10261847f8eSopenharmony_ci * @since 9 10361847f8eSopenharmony_ci */ 10461847f8eSopenharmony_ci readonly bundleVersionCode: number; 10561847f8eSopenharmony_ci 10661847f8eSopenharmony_ci /** 10761847f8eSopenharmony_ci * The version name of the bundle. 10861847f8eSopenharmony_ci * 10961847f8eSopenharmony_ci * @type { string } 11061847f8eSopenharmony_ci * @readonly 11161847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 11261847f8eSopenharmony_ci * @systemapi 11361847f8eSopenharmony_ci * @since 9 11461847f8eSopenharmony_ci */ 11561847f8eSopenharmony_ci readonly bundleVersionName: string; 11661847f8eSopenharmony_ci 11761847f8eSopenharmony_ci /** 11861847f8eSopenharmony_ci * The version number of the quick fix. 11961847f8eSopenharmony_ci * 12061847f8eSopenharmony_ci * @type { number } 12161847f8eSopenharmony_ci * @readonly 12261847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 12361847f8eSopenharmony_ci * @systemapi 12461847f8eSopenharmony_ci * @since 9 12561847f8eSopenharmony_ci */ 12661847f8eSopenharmony_ci readonly quickFixVersionCode: number; 12761847f8eSopenharmony_ci 12861847f8eSopenharmony_ci /** 12961847f8eSopenharmony_ci * The version name of the quick fix. 13061847f8eSopenharmony_ci * 13161847f8eSopenharmony_ci * @type { string } 13261847f8eSopenharmony_ci * @readonly 13361847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 13461847f8eSopenharmony_ci * @systemapi 13561847f8eSopenharmony_ci * @since 9 13661847f8eSopenharmony_ci */ 13761847f8eSopenharmony_ci readonly quickFixVersionName: string; 13861847f8eSopenharmony_ci 13961847f8eSopenharmony_ci /** 14061847f8eSopenharmony_ci * Hap module quick fix info. 14161847f8eSopenharmony_ci * 14261847f8eSopenharmony_ci * @type { Array<HapModuleQuickFixInfo> } 14361847f8eSopenharmony_ci * @readonly 14461847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 14561847f8eSopenharmony_ci * @systemapi 14661847f8eSopenharmony_ci * @since 9 14761847f8eSopenharmony_ci */ 14861847f8eSopenharmony_ci readonly hapModuleQuickFixInfo: Array<HapModuleQuickFixInfo>; 14961847f8eSopenharmony_ci } 15061847f8eSopenharmony_ci 15161847f8eSopenharmony_ci /** 15261847f8eSopenharmony_ci * Apply quick fix files. 15361847f8eSopenharmony_ci * 15461847f8eSopenharmony_ci * @permission ohos.permission.INSTALL_BUNDLE 15561847f8eSopenharmony_ci * @param { Array<string> } hapModuleQuickFixFiles - Quick fix files need to apply, this value should include file 15661847f8eSopenharmony_ci * path and file name. 15761847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of applyQuickFix. 15861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 15961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 16061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 16161847f8eSopenharmony_ci * 2. Incorrect parameter types. 16261847f8eSopenharmony_ci * @throws { BusinessError } 18500002 - The specified quick fix is invalid. It may not exist or inaccessible. 16361847f8eSopenharmony_ci * @throws { BusinessError } 18500008 - Internal error. 16461847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 16561847f8eSopenharmony_ci * @systemapi 16661847f8eSopenharmony_ci * @since 9 16761847f8eSopenharmony_ci */ 16861847f8eSopenharmony_ci function applyQuickFix(hapModuleQuickFixFiles: Array<string>, callback: AsyncCallback<void>): void; 16961847f8eSopenharmony_ci 17061847f8eSopenharmony_ci /** 17161847f8eSopenharmony_ci * Apply quick fix files. 17261847f8eSopenharmony_ci * 17361847f8eSopenharmony_ci * @permission ohos.permission.INSTALL_BUNDLE 17461847f8eSopenharmony_ci * @param { Array<string> } hapModuleQuickFixFiles - Quick fix files need to apply, this value should include file 17561847f8eSopenharmony_ci * path and file name. 17661847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 17761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 17861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 17961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 18061847f8eSopenharmony_ci * 2. Incorrect parameter types. 18161847f8eSopenharmony_ci * @throws { BusinessError } 18500002 - The specified quick fix is invalid. It may not exist or inaccessible. 18261847f8eSopenharmony_ci * @throws { BusinessError } 18500008 - Internal error. 18361847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 18461847f8eSopenharmony_ci * @systemapi 18561847f8eSopenharmony_ci * @since 9 18661847f8eSopenharmony_ci */ 18761847f8eSopenharmony_ci function applyQuickFix(hapModuleQuickFixFiles: Array<string>): Promise<void>; 18861847f8eSopenharmony_ci 18961847f8eSopenharmony_ci /** 19061847f8eSopenharmony_ci * Revoke quick fix by bundle name. 19161847f8eSopenharmony_ci * 19261847f8eSopenharmony_ci * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED and ohos.permission.INSTALL_BUNDLE 19361847f8eSopenharmony_ci * @param { string } bundleName - Bundle name wish to revoke quick fix. 19461847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of revokeQuickFix. 19561847f8eSopenharmony_ci * @throws { BusinessError } 201 - The application does not have permission to call the interface. 19661847f8eSopenharmony_ci * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 19761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 19861847f8eSopenharmony_ci * 2. Incorrect parameter types. 19961847f8eSopenharmony_ci * @throws { BusinessError } 18500001 - The bundle does not exist or no patch has been applied. 20061847f8eSopenharmony_ci * @throws { BusinessError } 18500009 - The application has an ongoing quick fix task. 20161847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 20261847f8eSopenharmony_ci * @systemapi 20361847f8eSopenharmony_ci * @since 10 20461847f8eSopenharmony_ci */ 20561847f8eSopenharmony_ci function revokeQuickFix(bundleName: string, callback: AsyncCallback<void>): void; 20661847f8eSopenharmony_ci 20761847f8eSopenharmony_ci /** 20861847f8eSopenharmony_ci * Revoke quick fix by bundle name. 20961847f8eSopenharmony_ci * 21061847f8eSopenharmony_ci * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED and ohos.permission.INSTALL_BUNDLE 21161847f8eSopenharmony_ci * @param { string } bundleName - Bundle name wish to revoke quick fix. 21261847f8eSopenharmony_ci * @returns { Promise<void> } 21361847f8eSopenharmony_ci * @throws { BusinessError } 201 - The application does not have permission to call the interface. 21461847f8eSopenharmony_ci * @throws { BusinessError } 202 - The application is not system-app, can not use system-api. 21561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 21661847f8eSopenharmony_ci * 2. Incorrect parameter types. 21761847f8eSopenharmony_ci * @throws { BusinessError } 18500001 - The bundle does not exist or no patch has been applied. 21861847f8eSopenharmony_ci * @throws { BusinessError } 18500009 - The application has an ongoing quick fix task. 21961847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 22061847f8eSopenharmony_ci * @systemapi 22161847f8eSopenharmony_ci * @since 10 22261847f8eSopenharmony_ci */ 22361847f8eSopenharmony_ci function revokeQuickFix(bundleName: string): Promise<void>; 22461847f8eSopenharmony_ci 22561847f8eSopenharmony_ci /** 22661847f8eSopenharmony_ci * Get application quick fix info by bundle name. 22761847f8eSopenharmony_ci * 22861847f8eSopenharmony_ci * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 22961847f8eSopenharmony_ci * @param { string } bundleName - Bundle name wish to query. 23061847f8eSopenharmony_ci * @param { AsyncCallback<ApplicationQuickFixInfo> } callback - The callback is used to return the ApplicationQuickFixInfo. 23161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 23261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 23361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 23461847f8eSopenharmony_ci * 2. Incorrect parameter types. 23561847f8eSopenharmony_ci * @throws { BusinessError } 18500001 - The bundle does not exist or no patch has been applied. 23661847f8eSopenharmony_ci * @throws { BusinessError } 18500008 - Internal error. 23761847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 23861847f8eSopenharmony_ci * @systemapi 23961847f8eSopenharmony_ci * @since 9 24061847f8eSopenharmony_ci */ 24161847f8eSopenharmony_ci function getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback<ApplicationQuickFixInfo>): void; 24261847f8eSopenharmony_ci 24361847f8eSopenharmony_ci /** 24461847f8eSopenharmony_ci * Get application quick fix info by bundle name. 24561847f8eSopenharmony_ci * 24661847f8eSopenharmony_ci * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 24761847f8eSopenharmony_ci * @param { string } bundleName - Bundle name wish to query. 24861847f8eSopenharmony_ci * @returns { Promise<ApplicationQuickFixInfo> } Returns the ApplicationQuickFixInfo. 24961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 25061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 25161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 25261847f8eSopenharmony_ci * 2. Incorrect parameter types. 25361847f8eSopenharmony_ci * @throws { BusinessError } 18500001 - The bundle does not exist or no patch has been applied. 25461847f8eSopenharmony_ci * @throws { BusinessError } 18500008 - Internal error. 25561847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix 25661847f8eSopenharmony_ci * @systemapi 25761847f8eSopenharmony_ci * @since 9 25861847f8eSopenharmony_ci */ 25961847f8eSopenharmony_ci function getApplicationQuickFixInfo(bundleName: string): Promise<ApplicationQuickFixInfo>; 26061847f8eSopenharmony_ci} 26161847f8eSopenharmony_ci 26261847f8eSopenharmony_ciexport default quickFixManager; 263