IssueNo:#I5UJZM

Description:add freeinstall api
Sig:SIG_ApplicaitonFramework
Feature or Bugfix:Bugfix
Binary Source:No
Signed-off-by: wangtiantian <wangtiantian19@huawei.com>
This commit is contained in:
wangtiantian 2022-10-09 09:40:48 +08:00
parent f212e1f15e
commit 04336959c0
3 changed files with 775 additions and 0 deletions

313
api/@ohos.bundle.freeInstall.d.ts vendored Normal file
View File

@ -0,0 +1,313 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AsyncCallback } from './basic';
import { DispatchInfo as _DispatchInfo } from './bundleManager/dispatchInfo';
import * as _PackInfo from './bundleManager/packInfo'
/**
* Free install bundle manager.
* @namespace freeInstall
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
declare namespace freeInstall {
/**
* Used to set the enumeration value of upgrading for free installation.
* @enum {number}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export enum UpgradeFlag {
/**
* Indicates module not need to be upgraded
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
NOT_UPGRADE = 0,
/**
* Indicates single module need to be upgraded
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
SINGLE_UPGRADE = 1,
/**
* Indicates relation module need to be upgraded
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
RELATION_UPGRADE = 2,
}
/**
* Used to query the enumeration value of bundlePackInfo.
* @enum {number}
* @syscap SystemCapability.BundleManager.BundleFramework
* @systemapi
* @since 9
*/
export enum BundlePackFlag {
/**
* Query all package information.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
GET_PACK_INFO_ALL = 0x00000000,
/**
* Query package information
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
GET_PACKAGES = 0x00000001,
/**
* Query the brief information of the package
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
GET_BUNDLE_SUMMARY = 0x00000002,
/**
* Query the brief information of the module.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
GET_MODULE_SUMMARY = 0x00000004,
}
/**
* Sets wether to upgrade the module.
* @permission ohos.permission.INSTALL_BUNDLE
* @param { string } bundleName - Indicates the bundle name of the application.
* @param { string } moduleName - Indicates the module name of the application.
* @param { UpgradeFlag } upgradeFlag - Indicates upgradeFlag of the application.
* @param { AsyncCallback<void> } callback - The callback of setting module upgrade flag result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 17700001 - The specified bundle name is not found.
* @throws { BusinessError } 17700002 - The specified module name is not found.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
function setHapModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag, callback: AsyncCallback<void>) : void;
/**
* Sets wether to upgrade the module.
* @permission ohos.permission.INSTALL_BUNDLE
* @param { string } bundleName - Indicates the bundle name of the application.
* @param { string } moduleName - Indicates the module name of the application.
* @param { UpgradeFlag } upgradeFlag - Indicates upgradeFlag of the application.
* @returns { Promise<void> } - Return the result of setting module upgrade flag.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 17700001 - The specified bundle name is not found.
* @throws { BusinessError } 17700002 - The specified module name is not found.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
function setHapModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag): Promise<void>;
/**
* Checks whether a specified module is removable.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { string } bundleName - Indicates the bundle name of the application.
* @param { string } moduleName - Indicates the module name of the application.
* @param { AsyncCallback<boolean> } callback - The callback of checking module removable result.The result is true if the module is removable, false otherwise.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 17700001 - The specified bundle name is not found.
* @throws { BusinessError } 17700002 - The specified module name is not found.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
function isHapModuleRemovable(bundleName: string, moduleName: string, callback: AsyncCallback<boolean>): void;
/**
* Checks whether a specified module is removable.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { string } bundleName - Indicates the bundle name of the application.
* @param { string } moduleName - Indicates the module name of the application.
* @returns {Promise<void>} Returns true if the module is removable; returns false otherwise.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 17700001 - The specified bundle name is not found.
* @throws { BusinessError } 17700002 - The specified module name is not found.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
function isHapModuleRemovable(bundleName: string, moduleName: string): Promise<boolean>;
/**
* Obtains bundlePackInfo based on bundleName and bundleFlags.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { string } bundleName - Indicates the application bundle name to be queried.
* @param { BundlePackFlag } bundlePackFlag - Indicates the application bundle pack flag to be queried.
* @param { AsyncCallback<BundlePackInfo> } callback - The callback of getting the BundlePackInfo object result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 17700001 - The specified bundle name is not found.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
function getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag, callback: AsyncCallback<BundlePackInfo>): void;
/**
* Obtains bundlePackInfo based on bundleName and bundleFlags.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { string } bundleName - Indicates the application bundle name to be queried.
* @param { BundlePackFlag } bundlePackFlag - Indicates the application bundle pack flag to be queried.
* @returns {Promise<BundlePackInfo>} Returns the BundlePackInfo object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 17700001 - The specified bundle name is not found.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
function getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag): Promise<BundlePackInfo>;
/**
* Obtains information about the dispatcher version.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { AsyncCallback<DispatchInfo> } callback - The callback of getting the dispatchInfo object for the current ability result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
function getDispatchInfo(callback: AsyncCallback<DispatchInfo>): void;
/**
* Obtains information about the dispatcher version.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @returns { Promise<DispatchInfo> } Returns the DispatchInfo object for the current ability.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
function getDispatchInfo(): Promise<DispatchInfo>;
/**
* The dispatch info class.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export type DispatchInfo = _DispatchInfo;
/**
* The bundle pack info class.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export type BundlePackInfo = _PackInfo.BundlePackInfo;
/**
* The package info class.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export type PackageConfig = _PackInfo.PackageConfig;
/**
* The package summary class.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export type PackageSummary = _PackInfo.PackageSummary;
/**
* The bundle summary class.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export type BundleConfigInfo = _PackInfo.BundleConfigInfo;
/**
* The extension ability forms class.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export type ExtensionAbility = _PackInfo.ExtensionAbility;
/**
* The module summary of a bundle.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export type ModuleConfigInfo = _PackInfo.ModuleConfigInfo;
/**
* The bundle info summary class.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export type ModuleDistroInfo = _PackInfo.ModuleDistroInfo;
/**
* The ability info of a module.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export type ModuleAbilityInfo = _PackInfo.ModuleAbilityInfo;
/**
* The form info of an ability.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export type AbilityFormInfo = _PackInfo.AbilityFormInfo;
/**
* The bundle version class.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export type Version = _PackInfo.Version;
/**
* The bundle Api version class.
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export type ApiVersion = _PackInfo.ApiVersion;
}
export default freeInstall;

37
api/bundleManager/dispatchInfo.d.ts vendored Normal file
View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Dispatch info related to free install
* @typedef DispatchInfo
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export interface DispatchInfo {
/**
* Indicates the dispatchInfo version
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly version: string;
/**
* Indicates the free install interface version
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly dispatchAPIVersion: string;
}

425
api/bundleManager/packInfo.d.ts vendored Normal file
View File

@ -0,0 +1,425 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* The bundle pack info class.
* @typedef BundlePackInfo
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export interface BundlePackInfo {
/**
* This contains package information in pack.info
* @type {PackageConfig}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly packages: Array<PackageConfig>;
/**
* This contains bundle summary information in pack.info
* @type {PackageSummary}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly summary: PackageSummary;
}
/**
* PackageConfig: the package info class.
* @typedef PackageConfig
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export interface PackageConfig {
/**
* Indicates the device types of this package
* @type {Array<string>}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly deviceTypes: Array<string>;
/**
* Indicates the name of this package
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly name: string;
/**
* Indicates the module type of this package
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly moduleType: string;
/**
* Indicates whether this package is delivery and install
* @type {boolean}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly deliveryWithInstall: boolean;
}
/**
* PackageSummary: the package summary class.
* @typedef PackageSummary
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export interface PackageSummary {
/**
* Indicates the bundle config info of this package
* @type {BundleConfigInfo}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly app: BundleConfigInfo;
/**
* Indicates the modules config info of this package
* @type {Array<ModuleConfigInfo>}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly modules: Array<ModuleConfigInfo>;
}
/**
* BundleConfigInfo: the bundle summary class.
* @typedef BundleConfigInfo
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export interface BundleConfigInfo {
/**
* Indicates the name of this bundle
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly bundleName: string;
/**
* Indicates the bundle version
* @type {Version}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly version: Version;
}
/**
* ExtensionAbility: the extension ability forms class.
* @typedef ExtensionAbility
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export interface ExtensionAbility {
/**
* Indicates the name of this extension ability
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly name: string;
/**
* Indicates the ability forms info
* @type {Array<AbilityFormInfo>}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly forms: Array<AbilityFormInfo>;
}
/**
* ModuleConfigInfo: the module summary of a bundle.
* @typedef ModuleConfigInfo
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export interface ModuleConfigInfo {
/**
* Indicates the name of main ability
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly mainAbility: string;
/**
* Indicates the api version
* @type {ApiVersion}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly apiVersion: ApiVersion;
/**
* Indicates the devices type
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly deviceTypes: Array<string>;
/**
* Indicates the module distro info
* @type {ModuleDistroInfo}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly distro: ModuleDistroInfo;
/**
* Indicates the abilities info of this module
* @type {Array<ModuleAbilityInfo>}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly abilities: Array<ModuleAbilityInfo>;
/**
* Indicates extension abilities info of this module
* @type {Array<ExtensionAbility>}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly extensionAbilities: Array<ExtensionAbility>;
}
/**
* ModuleDistroInfo: the bundle info summary class.
* @typedef ModuleDistroInfo
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export interface ModuleDistroInfo {
/**
* Indicates whether this package is delivered with install
* @type {boolean}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly deliveryWithInstall: boolean;
/**
* Indicates whether this package is free install
* @type {boolean}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly installationFree: boolean;
/**
* Indicates the module name
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly moduleName: string;
/**
* Indicates the module type
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly moduleType: string;
}
/**
* ModuleAbilityInfo: the ability info of a module.
* @typedef ModuleAbilityInfo
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export interface ModuleAbilityInfo {
/**
* Indicates the name of this module ability
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly name: string;
/**
* Indicates the label of this module ability
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly label: string;
/**
* Indicates whether this ability is visible
* @type {boolean}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly visible: boolean;
/**
* Indicates the ability forms info
* @type {Array<AbilityFormInfo>}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly forms: Array<AbilityFormInfo>;
}
/**
* AbilityFormInfo: the form info of an ability.
* @typedef AbilityFormInfo
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export interface AbilityFormInfo {
/**
* Indicates the name of this ability
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly name: string;
/**
* Indicates the type of this ability
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly type: string;
/**
* Indicates whether this form is enabled update
* @type {boolean}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly updateEnabled: boolean;
/**
* Indicates the scheduled update time
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly scheduledUpdateTime: string;
/**
* Indicates the update duration
* @type {number}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly updateDuration: number;
/**
* Indicates the ability support dimensions
* @type {Array<string>}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly supportDimensions: Array<string>;
/**
* Indicates the ability default dimension
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly defaultDimension: string;
}
/**
* Version: the bundle version class.
* @typedef Version
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export interface Version {
/**
* Indicates the min compatible code of this version
* @type {number}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly minCompatibleVersionCode: number;
/**
* Indicates the name of this version
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly name: string;
/**
* Indicates the code of this version
* @type {number}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly code: number;
}
/**
* ApiVersion: the bundle Api version class.
* @typedef ApiVersion
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @systemapi
* @since 9
*/
export interface ApiVersion {
/**
* Indicates the release type of the api
* @type {string}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly releaseType: string;
/**
* Indicates the compatible version code of the api
* @type {number}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly compatible: number;
/**
* Indicates the target version code of the api
* @type {number}
* @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
* @since 9
*/
readonly target: number;
}