diff --git a/api/@ohos.bundle.appControl.d.ts b/api/@ohos.bundle.appControl.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3502aaa1c386910a5873e9020957032794fc0a7d --- /dev/null +++ b/api/@ohos.bundle.appControl.d.ts @@ -0,0 +1,102 @@ +/* + * 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 Want from './@ohos.application.want'; + +/** + * Used for application interception control + * @namespace appControl + * @syscap SystemCapability.BundleManager.BundleFramework.AppControl + * @systemapi + * @since 9 + */ +declare namespace appControl { + /** + * Set the disposed status of a specified bundle. + * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS + * @param { string } appId - Indicates the bundle name of the application. + * @param { Want } disposedWant - Indicates the disposed want. + * @param { AsyncCallback } callback - The callback of setting the disposed status of a specified bundle. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.AppControl + * @systemapi + * @since 9 + */ + function setDisposedStatus(appId: string, disposedWant: Want, callback: AsyncCallback): void; + + /** + * Set the disposed status of a specified bundle. + * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS + * @param { string } appId - Indicates the bundle name of the application. + * @param { Want } disposedWant - Indicates the disposed want. + * @returns { Promise } The result of setting the disposed status of a specified bundle. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.AppControl + * @systemapi + * @since 9 + */ + function setDisposedStatus(appId: string, disposedWant: Want): Promise; + + /** + * Obtains the disposed status of a specified bundle. + * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS + * @param { string } appId - Indicates the bundle name of the application. + * @param { AsyncCallback } callback - The callback of getting the disposed status of a specified bundle. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.AppControl + * @systemapi + * @since 9 + */ + function getDisposedStatus(appId: string, callback: AsyncCallback): void; + + /** + * Obtains the disposed status of a specified bundle. + * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS + * @param { string } appId - Indicates the bundle name of the application. + * @returns { Promise } Returns the disposed status of a specified bundle. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.AppControl + * @systemapi + * @since 9 + */ + function getDisposedStatus(appId: string): Promise; + + /** + * Delete the disposed status of a specified bundle. + * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS + * @param { string } appId - Indicates the bundle name of the application. + * @param { AsyncCallback } callback - the callback of deleting the disposed status of a specified bundle. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.AppControl + * @systemapi + * @since 9 + */ + function deleteDisposedStatus(appId: string, callback: AsyncCallback): void; + + /** + * Delete the disposed status of a specified bundle. + * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS + * @param { string } appId - Indicates the bundle name of the application. + * @returns { Promise } Returns the result of deleting the disposed status of a specified bundle.. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.AppControl + * @systemapi + * @since 9 + */ + function deleteDisposedStatus(appId: string): Promise; +} + +export default appControl; diff --git a/api/@ohos.bundle.bundleManager.d.ts b/api/@ohos.bundle.bundleManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1314e58486ee08e5792a8b1fbe475b2c1b6de129 --- /dev/null +++ b/api/@ohos.bundle.bundleManager.d.ts @@ -0,0 +1,877 @@ +/* + * 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 { ApplicationInfo as _ApplicationInfo } from './bundleManager/applicationInfo'; +import { Metadata as _Metadata } from './bundleManager/metadata'; +import { HapModuleInfo as _HapModuleInfo } from './bundleManager/hapModuleInfo'; +import { AbilityInfo as _AbilityInfo } from './bundleManager/abilityInfo'; +import { ExtensionAbilityInfo as _ExtensionAbilityInfo, ExtensionAbilityType as _ExtensionAbilityType } from './bundleManager/extensionAbilityInfo'; +import { PermissionDef as _PermissionDef } from './bundleManager/PermissionDef'; +import { ElementName as _ElementName } from './bundleManager/elementName'; +import Want from './@ohos.application.want'; +import image from './@ohos.multimedia.image'; +import * as _BundleInfo from './bundleManager/bundleInfo'; + +/** + * This module is used to obtain package information of various applications installed on the current device. + * @namespace bundleManager + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +declare namespace bundleManager { + /** + * Used to query the enumeration value of bundleInfo. Multiple values can be passed in the form of or. + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + enum BundleFlag { + /** + * Used to obtain the default bundleInfo. The obtained bundleInfo does not contain information of + * signatureInfo, applicationInfo, hapModuleInfo, ability, extensionAbility and permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_DEFAULT = 0x00000000, + /** + * Used to obtain the bundleInfo containing applicationInfo. The obtained bundleInfo does not + * contain the information of signatureInfo, hapModuleInfo, ability, extensionAbility and permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_APPLICATION = 0x00000001, + /** + * Used to obtain the bundleInfo containing hapModuleInfo. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, ability, extensionAbility and permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_HAP_MODULE = 0x00000002, + /** + * Used to obtain the bundleInfo containing ability. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, extensionAbility and permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_ABILITY = 0x00000004, + /** + * Used to obtain the bundleInfo containing extensionAbility. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, ability and permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY = 0x00000008, + /** + * Used to obtain the bundleInfo containing permission. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, hapModuleInfo, extensionAbility and ability. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION = 0x00000010, + /** + * Used to obtain the metadata contained in applicationInfo, moduleInfo and abilityInfo. It can't be used alone, it needs to be used + * with GET_BUNDLE_INFO_WITH_APPLICATION, GET_BUNDLE_INFO_WITH_HAP_MODULE, GET_BUNDLE_INFO_WITH_ABILITIES, + * GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_METADATA = 0x00000020, + /** + * Used to obtain the default bundleInfo containing disabled application and ability. The obtained bundleInfo does not contain information of + * signatureInfo, applicationInfo, hapModuleInfo, ability, extensionAbility and permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_DISABLE = 0x00000040, + /** + * Used to obtain the bundleInfo containing signatureInfo. The obtained bundleInfo does not + * contain the information of applicationInfo, hapModuleInfo, extensionAbility, ability and permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_SIGNATURE_INFO = 0x00000080, + } + + /** + * Used to query the enumeration value of applicationInfo. Multiple values can be passed in the form of or. + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + enum ApplicationFlag { + /** + * Used to obtain the default applicationInfo. The obtained applicationInfo does not contain the information of + * permission and metadata. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_APPLICATION_INFO_DEFAULT = 0x00000000, + /** + * Used to obtain the applicationInfo containing permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_APPLICATION_INFO_WITH_PERMISSION = 0x00000001, + /** + * Used to obtain the applicationInfo containing metadata. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_APPLICATION_INFO_WITH_METADATA = 0x00000002, + /** + * Used to obtain the applicationInfo containing disabled application. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_APPLICATION_INFO_WITH_DISABLE = 0x00000004, + /** + * Used to obtain all applicationInfo in current device. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_ALL_APPLICATION_INFO = 0xFFFF0000, + } + + /** + * Used to query the enumeration value of abilityInfo. Multiple values can be passed in the form of or. + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + enum AbilityFlag { + /** + * Used to obtain the default abilityInfo. The obtained abilityInfo does not contain the information of + * permission, metadata and disabled abilityInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_ABILITY_INFO_DEFAULT = 0x00000000, + /** + * Used to obtain the abilityInfo containing disabled abilityInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_ABILITY_INFO_WITH_PERMISSION = 0x00000001, + /** + * Used to obtain the abilityInfo containing applicationInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_ABILITY_INFO_WITH_APPLICATION = 0x00000002, + /** + * Used to obtain the abilityInfo containing metadata. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_ABILITY_INFO_WITH_METADATA = 0x00000004, + /** + * Used to obtain the abilityInfo containing disabled abilityInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_ABILITY_INFO_WITH_DISABLE = 0x00000008, + /** + * Used to obtain the abilityInfo only for system app. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_ABILITY_INFO_ONLY_SYSTEM_APP = 0x00000010, + } + + /** + * Used to query the enumeration value of ExtensionAbilityInfo. Multiple values can be passed in the form of or. + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + enum ExtensionAbilityFlag { + /** + * Used to obtain the default extensionAbilityInfo. The obtained extensionAbilityInfo does not contain the information of + * permission, metadata and disabled abilityInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_EXTENSION_ABILITY_INFO_DEFAULT = 0x00000000, + /** + * Used to obtain the extensionAbilityInfo containing permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_EXTENSION_ABILITY_INFO_WITH_PERMISSION = 0x00000001, + /** + * Used to obtain the extensionAbilityInfo containing applicationInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_EXTENSION_ABILITY_INFO_WITH_APPLICATION = 0x00000002, + /** + * Used to obtain the extensionAbilityInfo containing metadata. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_EXTENSION_ABILITY_INFO_WITH_METADATA = 0x00000004, + } + + /** + * Obtains own bundleInfo. + * @param { number } bundleFlags - Indicates BundleFlag, the value in bundleFlag can be used in or. + * @returns { Promise } The result of getting the bundle info. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + function getBundleInfoForSelf(bundleFlags: number): Promise; + + /** + * Obtains own bundleInfo. + * @param { number } bundleFlags - Indicates BundleFlag, the value in bundleFlag can be used in or. + * @param { AsyncCallback } callback - The callback of getting bundle info result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + function getBundleInfoForSelf(bundleFlags: number, callback: AsyncCallback): void; + + /** + * Obtains bundleInfo based on bundleName, bundleFlags and options. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } bundleFlags - Indicates BundleFlag, the value in bundleFlag can be used in or. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @param { AsyncCallback } callback - The callback of getting bundle info result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback): void; + function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback): void; + + /** + * Obtains bundleInfo based on bundleName, bundleFlags and options. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } bundleFlags - Indicates BundleFlag, the value in bundleFlag can be used in or. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @returns { Promise } The result of getting the bundle info. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleInfo(bundleName: string, bundleFlags: number, userId?: number): Promise; + + /** + * Obtains application info based on a given bundle name. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } appFlags - Indicates ApplicationFlag, the value in ApplicationFlag can be used in or. + * @param { number } userId Indicates the user ID or do not pass user ID. + * @param { AsyncCallback } callback - The callback of getting application info result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getApplicationInfo(bundleName: string, appFlags: number, userId: number, callback: AsyncCallback): void; + function getApplicationInfo(bundleName: string, appFlags: number, callback: AsyncCallback): void; + + /** + * Obtains application info based on a given bundle name. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } appFlags - Indicates ApplicationFlag, the value in ApplicationFlag can be used in or. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @returns { Promise } The result of getting the application info. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getApplicationInfo(bundleName: string, appFlags: number, userId?: number): Promise; + + /** + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo that will be returned. + * @param { number } userId - Indicates the user id. + * @param { AsyncCallback } callback - The callback of getting a list of BundleInfo objects. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getAllBundleInfo(bundleFlags: number, userId: number, callback: AsyncCallback>): void; + function getAllBundleInfo(bundleFlags: number, callback: AsyncCallback>): void; + + /** + * Obtains BundleInfo of all bundles available in the system. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo that will be returned. + * @param { number } userId - Indicates the user id. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @return { Promise> } Returns a list of BundleInfo objects. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getAllBundleInfo(bundleFlags: number, userId?: number): Promise>; + + /** + * Obtains information about all installed applications of a specified user. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } appFlags - Indicates the flag used to specify information contained in the ApplicationInfo objects that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @param { AsyncCallback } callback - The callback of getting a list of ApplicationInfo objects. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getAllApplicationInfo(appFlags: number, userId: number, callback: AsyncCallback>): void; + function getAllApplicationInfo(appFlags: number, callback: AsyncCallback>): void; + + /** + * Obtains information about all installed applications of a specified user. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } appFlags - Indicates the flag used to specify information contained in the ApplicationInfo objects that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @returns { Promise> } Returns a list of ApplicationInfo objects. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getAllApplicationInfo(appFlags: number, userId?: number): Promise>; + + /** + * Query the AbilityInfo by the given Want. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { Want } want - Indicates the Want containing the application bundle name to be queried. + * @param { number } abilityFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that will be returned. + * @param { number } userId - userId Indicates the user ID. + * @param { AsyncCallback } callback - The callback of querying ability info result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function queryAbilityInfo(want: Want, abilityFlags: number, userId: number, callback: AsyncCallback>): void; + function queryAbilityInfo(want: Want, abilityFlags: number, callback: AsyncCallback>): void; + + /** + * Query the AbilityInfo by the given Want. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { Want } want - Indicates the Want containing the application bundle name to be queried. + * @param { number } abilityFlags Indicates the flag used to specify information contained in the AbilityInfo objects that will be returned. + * @param { number } userId - userId Indicates the user ID. + * @returns { Promise> } Returns a list of AbilityInfo objects. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function queryAbilityInfo(want: Want, abilityFlags: number, userId?: number): Promise>; + + /** + * Query extension info of by utilizing a Want. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { Want } want - Indicates the Want containing the application bundle name to be queried. + * @param { ExtensionAbilityType } extensionAbilityType - Indicates ExtensionAbilityType. + * @param { number } extensionAbilityFlags - Indicates the flag used to specify information contained in the ExtensionInfo objects that will be returned. + * @param { number } userId - Indicates the user ID. + * @param { AsyncCallback } callback - The callback of querying extension ability info result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function queryExtensionAbilityInfo(want: Want, extensionAbilityType: ExtensionAbilityType, extensionAbilityFlags: number, userId: number, callback: AsyncCallback>): void; + function queryExtensionAbilityInfo(want: Want, extensionAbilityType: ExtensionAbilityType, extensionAbilityFlags: number, callback: AsyncCallback>): void; + + /** + * Query the ExtensionAbilityInfo by the given Want. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { Want } want - Indicates the Want containing the application bundle name to be queried. + * @param { ExtensionAbilityType } extensionAbilityType - Indicates ExtensionAbilityType.. + * @param { number } extensionAbilityFlags - Indicates the flag used to specify information contained in the ExtensionAbilityInfo objects that will be returned. + * @param { number } userId - userId Indicates the user ID. + * @returns { Promise> } Returns a list of ExtensionAbilityInfo objects. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function queryExtensionAbilityInfo(want: Want, extensionAbilityType: ExtensionAbilityType, extensionAbilityFlags: number, userId?: number): Promise>; + + /** + * Obtains bundle name by the given uid. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { number } uid - Indicates the UID of an application. + * @param { AsyncCallback } callback - The callback of getting bundle name. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleNameByUid(uid: number, callback: AsyncCallback): void + + /** + * Obtains bundle name by the given uid. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { number } uid - Indicates the UID of an application. + * @returns { Promise } Returns the bundle name. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleNameByUid(uid: number): Promise; + + /** + * Obtains information about an application bundle contained in an ohos Ability Package (HAP). + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path to the data directory of the current application. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo object to be returned. + * @param { AsyncCallback } callback - The callback of getting bundle archive info result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback): void + + /** + * Obtains information about an application bundle contained in an ohos Ability Package (HAP). + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path to the data directory of the current application. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo object to be returned. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @return { Promise } Returns the BundleInfo object. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number): Promise; + + /** + * Obtains the Want for starting the main ability of an application based on the + * given bundle name. The main ability of an application is the ability that has the + * #ACTION_HOME and #ENTITY_HOME Want filters set in the application's config.json or module.json file. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @param { AsyncCallback } callback - The callback for starting the application's main ability. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getLaunchWantForBundle(bundleName: string, userId: number, callback: AsyncCallback): void; + function getLaunchWantForBundle(bundleName: string, callback: AsyncCallback): void; + + /** + * Obtains the Want for starting the main ability of an application based on the + * given bundle name. The main ability of an application is the ability that has the + * #ACTION_HOME and #ENTITY_HOME Want filters set in the application's config.json or module.json file. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @returns { Promise } the Want for starting the application's main ability. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getLaunchWantForBundle(bundleName: string, userId?: number): Promise; + + /** + * Clears cache data of a specified application. + * @permission ohos.permission.REMOVE_CACHE_FILES + * @param { string } bundleName - Indicates the bundle name of the application whose cache data is to be cleaned. + * @param { AsyncCallback } callback - The callback of cleaning bundle cache files result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback): void; + + /** + * Clears cache data of a specified application. + * @permission ohos.permission.REMOVE_CACHE_FILES + * @param { string } bundleName - Indicates the bundle name of the application whose cache data is to be cleaned. + * @returns { Promise } Clean bundle cache files result + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function cleanBundleCacheFiles(bundleName: string): Promise; + + /** + * Sets whether to enable a specified application. + * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { boolean } isEnabled - The value true means to enable it, and the value false means to disable it. + * @param { AsyncCallback } callback - The callback of setting app enabled result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback): void; + + /** + * Sets whether to enable a specified application. + * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { boolean } isEnabled - The value true means to enable it, and the value false means to disable it. + * @returns { Promise } set app enabled result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function setApplicationEnabled(bundleName: string, isEnable: boolean): Promise; + + /** + * Sets whether to enable a specified ability. + * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE + * @param {AbilityInfo} abilityInfo - Indicates information about the ability to set. + * @param { boolean } isEnabled - The value true means to enable it, and the value false means to disable it. + * @param { AsyncCallback } callback - The callback of setting ability enabled result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function setAbilityEnabled(info: AbilityInfo, isEnable: boolean, callback: AsyncCallback): void; + + /** + * Sets whether to enable a specified ability. + * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE + * @param {AbilityInfo} abilityInfo - Indicates information about the ability to set. + * @param { boolean } isEnabled - The value true means to enable it, and the value false means to disable it. + * @returns { Promise } set ability enabled result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise; + + /** + * Checks whether a specified application is enabled. + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { AsyncCallback } callback - The callback of checking application enabled result. The result is true if enabled, false otherwise. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function isApplicationEnabled(bundleName: string, callback: AsyncCallback): void; + + /** + * Checks whether a specified application is enabled. + * @param { string } bundleName - Indicates the bundle name of the application. + * @returns { Promise } Returns true if the application is enabled; returns false otherwise. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function isApplicationEnabled(bundleName: string): Promise; + + /** + * Checks whether a specified ability is enabled. + * @param {AbilityInfo} info - Indicates information about the ability to check. + * @param { AsyncCallback } callback - The callback of checking ability enabled result. The result is true if enabled, false otherwise. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback): void; + + /** + * Checks whether a specified ability is enabled. + * @param {AbilityInfo} info - Indicates information about the ability to check. + * @returns { Promise } Returns true if the ability is enabled; returns false otherwise. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function isAbilityEnabled(info: AbilityInfo): Promise; + + /** + * Get the permission details by permission name. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } permissionName - Indicates permission name. + * @param { AsyncCallback } callback - The callback of get permissionDef object result. + * @returns Returns permissionDef object. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getPermissionDef(permissionName: string, callback: AsyncCallback): void; + + /** + * Get the permission details by permission name. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } permissionName - Indicates permission name. + * @returns { Promise } Returns permissionDef object. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getPermissionDef(permissionName: string): Promise; + + /** + * Obtains the label of a specified ability. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. + * @param { string } moduleName Indicates the module name. + * @param { string } abilityName - Indicates the ability name. + * @param { AsyncCallback } callback - The callback of getting ability label result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Resource + * @systemapi + * @since 9 + */ + function getAbilityLabel(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback): void; + + /** + * Obtains the label of a specified ability. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. + * @param { string } moduleName Indicates the module name. + * @param { string } abilityName - Indicates the ability name. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @return { Promise } Returns the label representing the label of the specified ability. + * @syscap SystemCapability.BundleManager.BundleFramework.Resource + * @systemapi + * @since 9 + */ + function getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Promise; + + /** + * Obtains the icon of a specified ability. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param bundleName Indicates the bundle name of the application to which the ability belongs. + * @param moduleName Indicates the module name. + * @param abilityName Indicates the ability name. + * @param { AsyncCallback } callback - The callback of getting ability icon result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Resource + * @systemapi + * @since 9 + */ + function getAbilityIcon(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback): void; + + /** + * Obtains the icon of a specified ability. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName Indicates the bundle name of the application to which the ability belongs. + * @param { string } moduleName Indicates the module name. + * @param { string } abilityName Indicates the ability name. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @return { Promise } Returns the PixelMap object representing the icon of the specified ability. + * @syscap SystemCapability.BundleManager.BundleFramework.Resource + * @systemapi + * @since 9 + */ + function getAbilityIcon(bundleName: string, moduleName: string, abilityName: string): Promise; + + /** + * Obtains the profile designated by metadata name, abilityName and moduleName from the current application. + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } abilityName - Indicates the abilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @param { AsyncCallback } callback - The callback of returning string in json-format of the corresponding config file. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + function getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback>): void; + + /** + * Obtains the profile designated by metadata name, abilityName and moduleName from the current application. + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } abilityName - Indicates the abilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @returns { Promise> } Returns string in json-format of the corresponding config file. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + function getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise>; + + /** + * Obtains the profile designated by metadata name, extensionAbilityName and moduleName from the current application. + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } extensionAbilityName - Indicates the extensionAbilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @param { AsyncCallback } callback - The callback of returning string in json-format of the corresponding config file. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback>): void; + + /** + * Obtains the profile designated by metadata name, extensionAbilityName and moduleName from the current application. + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } extensionAbilityName - Indicates the extensionAbilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @returns { Promise> } Returns string in json-format of the corresponding config file. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise>; + + /** + * Obtains based on a given bundleName and bundleFlags. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the ApplicationInfo object + * that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @returns Returns the ApplicationInfo object. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getApplicationInfoSync(bundleName: string, bundleFlags: number, userId: number) : ApplicationInfo; + function getApplicationInfoSync(bundleName: string, bundleFlags: number) : ApplicationInfo; + + /** + * Obtains bundleInfo based on bundleName, bundleFlags and options. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo object + * that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @returns Returns the BundleInfo object. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleInfoSync(bundleName: string, bundleFlags: number, userId: number): BundleInfo; + function getBundleInfoSync(bundleName: string, bundleFlags: number): BundleInfo; + + /** + * Obtains configuration information about an application. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type ApplicationInfo = _ApplicationInfo; + + /** + * Indicates the Metadata. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type Metadata = _Metadata; + + /** + * Obtains configuration information about a bundle. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type BundleInfo = _BundleInfo.BundleInfo; + + /** + * The scene which is used. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type UsedScene = _BundleInfo.UsedScene; + + /** + * Indicates the required permissions details defined in file config.json. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type ReqPermissionDetail = _BundleInfo.ReqPermissionDetail; + + /** + * Indicates the PermissionGrantState. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type PermissionGrantState = _BundleInfo.PermissionGrantState; + + /** + * Indicates the SignatureInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type SignatureInfo = _BundleInfo.SignatureInfo; + + /** + * Obtains configuration information about an module. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type HapModuleInfo = _HapModuleInfo; + + /** + * Obtains configuration information about an ability. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type AbilityInfo = _AbilityInfo; + + /** + * Obtains extension information about a bundle. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type ExtensionAbilityInfo = _ExtensionAbilityInfo; + + /** + * Indicates extension ability type + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type ExtensionAbilityType = _ExtensionAbilityType; + + /** + * Indicates the defined permission details in file config.json. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + export type PermissionDef = _PermissionDef; + + /** + * Contains basic Ability information, which uniquely identifies an ability. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type ElementName = _ElementName; +} + +export default bundleManager; diff --git a/api/@ohos.bundle.bundleMonitor.d.ts b/api/@ohos.bundle.bundleMonitor.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1ed03ad4957c22d6cbfd93b01a567465f8c461ec --- /dev/null +++ b/api/@ohos.bundle.bundleMonitor.d.ts @@ -0,0 +1,83 @@ +/* + * 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 { Callback } from './basic'; + +/** + * Bundle monitor + * @namespace bundleMonitor + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ +declare namespace bundleMonitor { + /** + * This module is used to define the result information of monitoring install, update and uninstall. + * @typedef BundleChangedInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + interface BundleChangedInfo { + /** + * The bundle name + * @type {string} + * @systemapi + * @since 9 + */ + bundleName: string; + /** + * The user id + * @type {number} + * @systemapi + * @since 9 + */ + userId: number; + } + + /** + * Indicates the event type of bundle change + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + type BundleChangedEvent = 'add' | 'update' | 'remove'; + + /** + * Register to monitor the installation status + * @permission ohos.permission.LISTEN_BUNDLE_CHANGE + * @param { BundleChangedEvent } type - Indicates the command should be implement. + * @param { Callback } callback - Indicates the callback to be register. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function on(type: BundleChangedEvent, callback: Callback): void; + + /** + * Unregister to monitor the installation status + * @permission ohos.permission.LISTEN_BUNDLE_CHANGE + * @param { BundleChangedEvent } type -type Indicates the command should be implement. + * @param { Callback } callback - Indicates the callback to be unregister. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function off(type: BundleChangedEvent, callback?: Callback): void; +} + +export default bundleMonitor diff --git a/api/@ohos.bundle.d.ts b/api/@ohos.bundle.d.ts index 468be9fb97238214a070f680c72daccf4123437f..25d38f7a71b0cbbca57009a6b3432a9f05945286 100644 --- a/api/@ohos.bundle.d.ts +++ b/api/@ohos.bundle.d.ts @@ -37,6 +37,8 @@ import * as _BundleInstaller from './bundle/bundleInstaller'; * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager */ declare namespace bundle { @@ -46,6 +48,8 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @import NA * @permission NA + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.BundleFlag */ enum BundleFlag { GET_BUNDLE_DEFAULT = 0x00000000, @@ -95,6 +99,8 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @import NA * @permission NA + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.ExtensionAbilityFlag */ enum ExtensionFlag { GET_EXTENSION_INFO_DEFAULT = 0x00000000, @@ -109,6 +115,7 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @import NA * @permission NA + * @deprecated since 9 */ export enum ColorMode { AUTO_MODE = -1, @@ -122,6 +129,8 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @import NA * @permission NA + * @deprecated since 9 + * @useinstead bundleInfo.PermissionGrantStatus */ export enum GrantStatus { PERMISSION_DENIED = -1, @@ -134,6 +143,8 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @import NA * @permission NA + * @deprecated since 9 + * @useinstead abilityInfo.AbilityType */ export enum AbilityType { /** @@ -171,6 +182,7 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @import NA * @permission NA + * @deprecated since 9 */ export enum AbilitySubType { UNSPECIFIED = 0, @@ -183,6 +195,8 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @import NA * @permission NA + * @deprecated since 9 + * @useinstead abilityInfo.DisplayOrientation */ export enum DisplayOrientation { /** @@ -283,6 +297,8 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @import NA * @permission NA + * @deprecated since 9 + * @useinstead bundleManager/AbilityInfo.LaunchType */ export enum LaunchMode { /** @@ -306,6 +322,8 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @import NA * @permission NA + * @deprecated since 9 + * @useinstead bundleManager/ExtensionAbilityInfo.ExtensionAbilityType */ export enum ExtensionAbilityType { /** @@ -406,6 +424,7 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @import NA * @permission NA + * @deprecated since 9 */ export interface BundleOptions { /** @@ -422,6 +441,7 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @import NA * @permission NA + * @deprecated since 9 */ export enum InstallErrorCode{ SUCCESS = 0, @@ -472,6 +492,8 @@ declare namespace bundle { * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.freeInstall.UpgradeFlag */ export enum UpgradeFlag { /** @@ -500,6 +522,8 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @import NA * @permission NA + * @deprecated since 9, use @ohos.bundle.AbilityInfo.SupportWindowMode + * @useinstead bundleManager/AbilityInfo.SupportWindowMode */ export enum SupportWindowMode { /** @@ -532,6 +556,8 @@ declare namespace bundle { * @param options Indicates the bundle options object. * @return Returns the BundleInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getBundleInfo */ function getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback): void; function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback): void; @@ -545,6 +571,8 @@ declare namespace bundle { * @return Returns the IBundleInstaller interface. * @permission ohos.permission.INSTALL_BUNDLE * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.installer.getBundleInstaller */ function getBundleInstaller(callback: AsyncCallback): void; function getBundleInstaller(): Promise; @@ -558,6 +586,8 @@ declare namespace bundle { * @param abilityName Indicates the ability name. * @return Returns the AbilityInfo object for the current ability. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.queryAbilityInfo */ function getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityInfo(bundleName: string, abilityName: string): Promise; @@ -573,6 +603,8 @@ declare namespace bundle { * @param userId Indicates the user ID or do not pass user ID. * @return Returns the ApplicationInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getApplicationInfo */ function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback) : void; function getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback) : void; @@ -590,6 +622,8 @@ declare namespace bundle { * @param userId Indicates the user ID. * @return Returns a list of AbilityInfo objects. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.queryAbilityInfo */ function queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback>): void; function queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback>): void; @@ -605,6 +639,8 @@ declare namespace bundle { * @param userId Indicates the user id. * @return Returns a list of BundleInfo objects. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getAllBundleInfo */ function getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback>) : void; function getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback>) : void; @@ -620,6 +656,8 @@ declare namespace bundle { * @param userId Indicates the user ID or do not pass user ID. * @return Returns a list of ApplicationInfo objects. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getAllApplicationInfo */ function getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback>) : void; function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback>) : void; @@ -632,6 +670,8 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @param uid Indicates the UID of an application. * @return Returns the bundle name. + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getNameForUid */ function getNameForUid(uid: number, callback: AsyncCallback) : void function getNameForUid(uid: number) : Promise; @@ -646,6 +686,8 @@ declare namespace bundle { * @param bundleFlags Indicates the flag used to specify information contained in the BundleInfo object to be * returned. * @return Returns the BundleInfo object. + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getBundleArchiveInfo */ function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback) : void function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise; @@ -662,6 +704,8 @@ declare namespace bundle { * @return Returns the Want for starting the application's main ability if any; returns null if * the given bundle does not exist or does not contain any main ability. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getLaunchWantForBundle */ function getLaunchWantForBundle(bundleName: string, callback: AsyncCallback): void; function getLaunchWantForBundle(bundleName: string): Promise; @@ -675,6 +719,8 @@ declare namespace bundle { * @param callback Indicates the callback to be invoked for returning the operation result. * @permission ohos.permission.REMOVE_CACHE_FILES * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.cleanBundleCacheFiles */ function cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback): void; function cleanBundleCacheFiles(bundleName: string): Promise; @@ -689,6 +735,8 @@ declare namespace bundle { * value false means to disable it. * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.setApplicationEnabled */ function setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback): void; function setApplicationEnabled(bundleName: string, isEnable: boolean): Promise; @@ -703,6 +751,8 @@ declare namespace bundle { * value false means to disable it.. * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.setAbilityEnabled */ function setAbilityEnabled(info: AbilityInfo, isEnable: boolean, callback: AsyncCallback): void; function setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise; @@ -718,6 +768,8 @@ declare namespace bundle { * @param userId Indicates the user ID. * @return Returns a list of ExtensionInfo objects. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.queryExtensionAbilityInfo */ function queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, userId: number, callback: AsyncCallback>): void; function queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, callback: AsyncCallback>): void; @@ -732,6 +784,8 @@ declare namespace bundle { * @return Returns permissionDef object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getPermissionDef */ function getPermissionDef(permissionName: string, callback: AsyncCallback): void; function getPermissionDef(permissionName: string): Promise; @@ -745,6 +799,8 @@ declare namespace bundle { * @param abilityName Indicates the ability name. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO * @return Returns the label representing the label of the specified ability. + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getAbilityLabel */ function getAbilityLabel(bundleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityLabel(bundleName: string, abilityName: string): Promise; @@ -758,6 +814,8 @@ declare namespace bundle { * @param abilityName Indicates the ability name. * @return Returns the PixelMap object representing the icon of the specified ability. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getAbilityIcon */ function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityIcon(bundleName: string, abilityName: string): Promise; @@ -769,6 +827,8 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @param info Indicates information about the ability to check. * @returns Returns true if the ability is enabled; returns false otherwise. + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.isAbilityEnabled */ function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback): void; function isAbilityEnabled(info: AbilityInfo): Promise; @@ -780,6 +840,8 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @param bundleName Indicates the bundle name of the application. * @returns Returns true if the application is enabled; returns false otherwise. + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.isApplicationEnabled */ function isApplicationEnabled(bundleName: string, callback: AsyncCallback): void; function isApplicationEnabled(bundleName: string): Promise; @@ -793,6 +855,8 @@ declare namespace bundle { * @param moduleName Indicates the module name of the application. * @param upgradeFlag Indicates upgradeFlag of the application. * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.freeInstall.setHapModuleUpgradeFlag */ function setModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag, callback: AsyncCallback):void; function setModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag): Promise; @@ -806,6 +870,8 @@ declare namespace bundle { * @param moduleName Indicates the module name of the application. * @returns Returns true if the module is removable; returns false otherwise. * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.freeInstall.isHapModuleRemovable */ function isModuleRemovable(bundleName: string, moduleName: string, callback: AsyncCallback): void; function isModuleRemovable(bundleName: string, moduleName: string): Promise; @@ -819,6 +885,8 @@ declare namespace bundle { * @param bundlePackFlag Indicates the application bundle pack flag to be queried. * @return Returns the BundlePackInfo object. * @systemapi hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.freeInstall.getBundlePackInfo */ function getBundlePackInfo(bundleName: string, bundlePackFlag : pack.BundlePackFlag, callback: AsyncCallback): void; function getBundlePackInfo(bundleName: string, bundlePackFlag : pack.BundlePackFlag): Promise; @@ -833,6 +901,8 @@ declare namespace bundle { * @param abilityName Indicates the ability name. * @return Returns the AbilityInfo object for the current ability. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getAbilityInfo */ function getAbilityInfo(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityInfo(bundleName: string, moduleName: string, abilityName: string): Promise; @@ -844,6 +914,8 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @return Returns the DispatchInfo object for the current ability. * @systemapi hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.freeInstall.getDispatchInfo */ function getDispatcherVersion(callback: AsyncCallback): void; function getDispatcherVersion(): Promise; @@ -858,6 +930,8 @@ declare namespace bundle { * @param abilityName Indicates the ability name. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO * @return Returns the label representing the label of the specified ability. + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getAbilityLabel */ function getAbilityLabel(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Promise; @@ -872,6 +946,8 @@ declare namespace bundle { * @param abilityName Indicates the ability name. * @return Returns the PixelMap object representing the icon of the specified ability. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getAbilityIcon */ function getAbilityIcon(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityIcon(bundleName: string, moduleName: string, abilityName: string): Promise; @@ -885,6 +961,8 @@ declare namespace bundle { * @param abilityName Indicates the abilityName of the application. * @param metadataName Indicates the name of metadata in ability. * @return Returns string in json-format of the corresponding config file. + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getProfileByAbility */ function getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback>): void; function getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise>; @@ -898,6 +976,8 @@ declare namespace bundle { * @param extensionAbilityName Indicates the extensionAbilityName of the application. * @param metadataName Indicates the name of metadata in ability. * @return Returns string in json-format of the corresponding config file. + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleManager.getProfileByExtensionAbility */ function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback>): void; function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise>; @@ -912,6 +992,8 @@ declare namespace bundle { * @return Returns the disposed status of a specified bundle. * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.appControl.setDisposedStatus */ function setDisposedStatus(bundleName: string, status: number, callback: AsyncCallback): void; function setDisposedStatus(bundleName: string, status: number): Promise; @@ -925,6 +1007,8 @@ declare namespace bundle { * @return Returns the disposed status of a specified bundle. * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.appControl.getDisposedStatus */ function getDisposedStatus(bundleName: string, callback: AsyncCallback): void; function getDisposedStatus(bundleName: string): Promise; @@ -940,6 +1024,8 @@ declare namespace bundle { * @param userId Indicates the user ID or do not pass user ID. * @return Returns the ApplicationInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead @ohos.bundle.appControl.getApplicationInfoSync */ function getApplicationInfoSync(bundleName: string, bundleFlags: number, userId: number) : ApplicationInfo; function getApplicationInfoSync(bundleName: string, bundleFlags: number) : ApplicationInfo; @@ -955,6 +1041,8 @@ declare namespace bundle { * @param options Indicates the bundle options object. * @return Returns the BundleInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead @ohos.bundle.appControl.getApplicationInfoSync */ function getBundleInfoSync(bundleName: string, bundleFlags: number, options: BundleOptions): BundleInfo; function getBundleInfoSync(bundleName: string, bundleFlags: number): BundleInfo; diff --git a/api/@ohos.bundle.defaultAppManager.d.ts b/api/@ohos.bundle.defaultAppManager.d.ts index d467bb1b4a8d8e4d78dabfdff5e52e53682214e3..d0f888b238cc0c24e3504721f8d946e493d4e31e 100644 --- a/api/@ohos.bundle.defaultAppManager.d.ts +++ b/api/@ohos.bundle.defaultAppManager.d.ts @@ -14,130 +14,175 @@ */ import { AsyncCallback } from './basic'; -import { BundleInfo } from './bundle/bundleInfo'; -import { ElementName } from './bundle/elementName'; +import { BundleInfo } from './bundleManager/bundleInfo'; +import { ElementName } from './bundleManager/elementName'; /** * default application manager. - * @name defaultAppManager + * @namespace defaultAppManager + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA */ declare namespace defaultAppManager { /** * the constant for application type. - * @name ApplicationType + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @permission N/A */ export enum ApplicationType { /** * default browser identifier. - * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager * @since 9 */ - BROWSER = "BROWSER", + BROWSER = "Web Browser", /** * default image identifier. - * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager * @since 9 */ - IMAGE = "IMAGE", + IMAGE = "Image Gallery", /** * default audio identifier. - * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager * @since 9 */ - AUDIO = "AUDIO", + AUDIO = "Audio Player", /** * default video identifier. - * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager * @since 9 */ - VIDEO = "VIDEO", + VIDEO = "Video Player", /** - * default pdf identifier. - * + * default PDF identifier. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager * @since 9 */ - PDF = "PDF", + PDF = "PDF Viewer", /** * default word identifier. - * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager * @since 9 */ - WORD = "WORD", + WORD = "Word Viewer", /** * default excel identifier. - * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager * @since 9 */ - EXCEL = "EXCEL", + EXCEL = "Excel Viewer", /** - * default ppt identifier. - * + * default PPT identifier. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager * @since 9 */ - PPT = "PPT", + PPT = "PPT Viewer", } /** * query whether the caller is default application based on type. - * + * @param { string } type - application type or file type. + * @param { AsyncCallback } callback - The callback of querying default application result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param type application type or file type. - * @return return true if caller is default application; return false otherwise. - * @permission N/A */ - function isDefaultApplication(type: string) : Promise; function isDefaultApplication(type: string, callback: AsyncCallback) : void; /** - * get default application based on type. - * + * query whether the caller is default application based on type. + * @param { string } type - application type or file type. + * @returns { Promise } return true if caller is default application; return false otherwise. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param type application type or file type. - * @param userId indicates the id for the user. - * @return return the BundleInfo object. + */ + function isDefaultApplication(type: string) : Promise; + + /** + * get default application based on type. * @permission ohos.permission.GET_DEFAULT_APPLICATION - * @systemapi hide this for inner system use. + * @param { string } type - application type or file type. + * @param { number } userId - indicates the id for the user. + * @param { AsyncCallback } callback - the callback of the BundleInfo object result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager + * @systemapi + * @since 9 */ - function getDefaultApplication(type: string, userId?: number) : Promise; function getDefaultApplication(type: string, userId: number, callback: AsyncCallback) : void; function getDefaultApplication(type: string, callback: AsyncCallback) : void; /** - * set default application based on type. - * + * get default application based on type. + * @param { string } type - application type or file type. + * @param { number } userId - indicates the id for the user. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @return { Promise } return the BundleInfo object. + * @permission ohos.permission.GET_DEFAULT_APPLICATION + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager + * @systemapi * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param type application type or file type. - * @param elementName uniquely identifies an ability or extensionAbility. - * @param userId indicates the id for the user. + */ + function getDefaultApplication(type: string, userId?: number) : Promise; + + /** + * set default application based on type. * @permission ohos.permission.SET_DEFAULT_APPLICATION - * @systemapi hide this for inner system use. + * @param { string } type - application type or file type. + * @param { ElementName } elementName - uniquely identifies an ability or extensionAbility. + * @param { number } userId - indicates the id for the user. + * @param { AsyncCallback } callback - the callback of setting default application result. + * @throws { BusinessError } if the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager.defaultAppManager + * @systemapi + * @since 9 */ - function setDefaultApplication(type: string, elementName: ElementName, userId?: number) : Promise; function setDefaultApplication(type: string, elementName: ElementName, userId: number, callback: AsyncCallback) : void; function setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCallback) : void; /** - * reset default application based on type. - * + * set default application based on type. + * @permission ohos.permission.SET_DEFAULT_APPLICATION + * @param { string } type - application type or file type. + * @param { ElementName } elementName - uniquely identifies an ability or extensionAbility. + * @param { number } userId - indicates the id for the user. + * @returns { Promise } the resut of setting default application. + * @throws { BusinessError } if the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager.defaultAppManager + * @systemapi * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param type application type or file type. - * @param userId indicates the id for the user. + */ + function setDefaultApplication(type: string, elementName: ElementName, userId?: number) : Promise; + + /** + * reset default application based on type. * @permission ohos.permission.SET_DEFAULT_APPLICATION - * @systemapi hide this for inner system use. + * @param { string } type - application type or file type. + * @param { number } userId - indicates the id for the user. + * @param { AsyncCallback } callback - the callback of resetting default application result. + * @throws { BusinessError } if the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager.defaultAppManager + * @systemapi + * @since 9 */ - function resetDefaultApplication(type: string, userId?: number) : Promise; function resetDefaultApplication(type: string, userId: number, callback: AsyncCallback) : void; function resetDefaultApplication(type: string, callback: AsyncCallback) : void; + + /** + * reset default application based on type. + * @permission ohos.permission.SET_DEFAULT_APPLICATION + * @param { string } type - application type or file type. + * @param { number } userId - indicates the id for the user. + * @returns { Promise } the result of resetting default application. + * @throws { BusinessError } if the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager.defaultAppManager + * @systemapi + * @since 9 + */ + function resetDefaultApplication(type: string, userId?: number) : Promise; } export default defaultAppManager; diff --git a/api/@ohos.bundle.distributedBundle.d.ts b/api/@ohos.bundle.distributedBundle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2744bbcb418949075ae67261cb1c0bbb35fbe33f --- /dev/null +++ b/api/@ohos.bundle.distributedBundle.d.ts @@ -0,0 +1,137 @@ +/* + * 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 { ElementName } from './bundleManager/elementName'; +import { RemoteAbilityInfo as _RemoteAbilityInfo } from './bundleManager/remoteAbilityInfo'; + +/** + * distributedBundle. + * @namespace distributedBundle + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ +declare namespace distributedBundle { + /** + * Obtains information about the ability info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { ElementName } elementName - Indicates the elementName. + * @param { AsyncCallback } callback - The callback of getting the ability info of the remote device. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback): void; + + /** + * Obtains information about the ability info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { ElementName } elementName - Indicates the elementName. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @return { Promise } Returns the ability info of the remote device. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementName: ElementName): Promise; + + /** + * Obtains information about the abilities info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { Array } elementNames - Indicates the elementNames, Maximum array length ten. + * @param { AsyncCallback> } callback - the callback of getting the abilities info of the remote device. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementNames: Array, callback: AsyncCallback>): void; + + /** + * Obtains information about the abilities info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { Array } elementNames - Indicates the elementNames, Maximum array length ten. + * @returns { Promise> } The result of getting the abilities info of the remote device. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementNames: Array): Promise>; + + /** + * Obtains information about the ability info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { ElementName } elementName - Indicates the elementName. + * @param { string } locale - Indicates the locale info + * @param { AsyncCallback } callback - The callback of getting the ability info of the remote device. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementName: ElementName, locale: string, callback: AsyncCallback): void; + + /** + * Obtains information about the ability info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { ElementName } elementName - Indicates the elementName. + * @param { string } locale - Indicates the locale info + * @returns { Promise> } The result of getting the ability info of the remote device. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementName: ElementName, locale: string): Promise; + + /** + * Obtains information about the ability info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { Array } elementNames - Indicates the elementNames, Maximum array length ten. + * @param { string } locale - Indicates the locale info + * @param { AsyncCallback } callback - Returns the abilities info of the remote device. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementNames: Array, locale: string, callback: AsyncCallback>): void; + + /** + * Obtains information about the abilities info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { Array } elementNames - Indicates the elementNames, Maximum array length ten. + * @param { string } locale - Indicates the locale info + * @returns { Promise> } Returns the abilities info of the remote device. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementNames: Array, locale: string): Promise>; + + /** + * Contains basic remote ability information. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + export type RemoteAbilityInfo = _RemoteAbilityInfo; +} + +export default distributedBundle; diff --git a/api/@ohos.bundle.freeInstall.d.ts b/api/@ohos.bundle.freeInstall.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c3817f0d6810644052a42c91d33844ada3e2579b --- /dev/null +++ b/api/@ohos.bundle.freeInstall.d.ts @@ -0,0 +1,294 @@ +/* + * 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 + * @systemapi + * @since 9 + */ + NOT_UPGRADE = 0, + /** + * Indicates single module need to be upgraded + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + SINGLE_UPGRADE = 1, + /** + * Indicates relation module need to be upgraded + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @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 + * @systemapi + * @since 9 + */ + GET_PACK_INFO_ALL = 0x00000000, + /** + * Query package information + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + GET_PACKAGES = 0x00000001, + /** + * Query the brief information of the package + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + GET_BUNDLE_SUMMARY = 0x00000002, + /** + * Query the brief information of the module. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + GET_MODULE_SUMMARY = 0x00000004, + } + + /** + * Set the module wether need upgrade + * @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 } callback - The callback of setting module upgrade flag result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function setHapModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag, callback: AsyncCallback) : void; + + /** + * Set the module wether need upgrade + * @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 } - Return the result of setting module upgrade flag. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function setHapModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag): Promise; + + /** + * 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 } callback - The callback of checking module removable result.The result is true if the module is removable, false otherwise. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function isHapModuleRemovable(bundleName: string, moduleName: string, callback: AsyncCallback): 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} Returns true if the module is removable; returns false otherwise. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function isHapModuleRemovable(bundleName: string, moduleName: string): Promise; + + /** + * 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 } callback - The callback of getting the BundlePackInfo object result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag, callback: AsyncCallback): 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} Returns the BundlePackInfo object. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag): Promise; + + /** + * Obtains information about the dispatcher version. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { AsyncCallback } callback - The callback of getting the dispatchInfo object for the current ability result. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function getDispatchInfo(callback: AsyncCallback): void; + + /** + * Obtains information about the dispatcher version. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @returns { Promise } Returns the DispatchInfo object for the current ability. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function getDispatchInfo(): Promise; + + /** + * 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; diff --git a/api/@ohos.bundle.innerBundleManager.d.ts b/api/@ohos.bundle.innerBundleManager.d.ts index 9eaaeee19f2a5d289681f7acd18a7e9f9bfcc5ee..5d16e31b9604c879be1ae441476f18e41dae2ff2 100644 --- a/api/@ohos.bundle.innerBundleManager.d.ts +++ b/api/@ohos.bundle.innerBundleManager.d.ts @@ -25,6 +25,8 @@ import * as _ShortCutInfo from './bundle/shortcutInfo'; * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA * @systemapi Hide this for inner system use + * @deprecated since 9, + * @useinstead launcherBundleManager */ declare namespace innerBundleManager { @@ -38,6 +40,8 @@ declare namespace innerBundleManager { * @return Returns the LauncherAbilityInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead launcherBundleManager.getLauncherAbilityInfo */ function getLauncherAbilityInfos(bundleName: string, userId: number, callback: AsyncCallback>) : void; function getLauncherAbilityInfos(bundleName: string, userId: number) : Promise>; @@ -52,6 +56,8 @@ declare namespace innerBundleManager { * @return Returns the result or error maeeage. * @permission ohos.permission.LISTEN_BUNDLE_CHANGE * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead bundleMonitor.on */ function on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback, callback: AsyncCallback) : void; function on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback): Promise; @@ -65,6 +71,8 @@ declare namespace innerBundleManager { * @return Returns the result or error maeeage. * @permission ohos.permission.LISTEN_BUNDLE_CHANGE * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead bundleMonitor.off */ function off(type:"BundleStatusChange", callback: AsyncCallback) : void; function off(type:"BundleStatusChange"): Promise; @@ -78,6 +86,8 @@ declare namespace innerBundleManager { * @return Returns the LauncherAbilityInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead launcherBundleManager.getAllLauncherAbilityInfo */ function getAllLauncherAbilityInfos(userId: number, callback: AsyncCallback>) : void; function getAllLauncherAbilityInfos(userId: number) : Promise>; @@ -91,6 +101,8 @@ declare namespace innerBundleManager { * @return Returns the LauncherShortcutInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead launcherBundleManager.getShortcutInfo */ function getShortcutInfos(bundleName :string, callback: AsyncCallback>) : void; function getShortcutInfos(bundleName : string) : Promise>; diff --git a/api/@ohos.bundle.installer.d.ts b/api/@ohos.bundle.installer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6db851cba86906fc396dd402ae447721e318ee71 --- /dev/null +++ b/api/@ohos.bundle.installer.d.ts @@ -0,0 +1,163 @@ +/* + * 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'; + +/** + * Support install, upgrade, remove and recover bundles on the devices. + * @namespace installer + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ +declare namespace installer { + /** + * Obtains the interface used to install bundle. + * @param { AsyncCallback } callback - The callback of BundleInstaller object. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleInstaller(callback: AsyncCallback): void + + /** + * Obtains the interface used to install bundle. + * @param { AsyncCallback } callback - The callback of getting a list of BundleInstaller objects. + * @returns { Promise } BundleInstaller object. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleInstaller(): Promise; + + /** + * Bundle installer interface, include install uninstall recover. + * @interface BundleInstaller + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + interface BundleInstaller { + /** + * Install haps for an application. + * @permission ohos.permission.INSTALL_BUNDLE + * @param { Array } hapFilePaths - Indicates the path where the hap of the application is stored. + * @param { InstallParam } installParam - Indicates other parameters required for the installation. + * @param { AsyncCallback } callback - The callback of installing haps result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + install(hapFilePaths: Array, installParam: InstallParam, callback: AsyncCallback) : void; + + /** + * Uninstall an application. + * @permission ohos.permission.INSTALL_BUNDLE + * @param { string } bundleName - Indicates the bundle name of the application to be uninstalled. + * @param { InstallParam } installParam - Indicates other parameters required for the uninstallation. + * @param { AsyncCallback } callback - The callback of uninstalling application result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + uninstall(bundleName: string, installParam: InstallParam, callback : AsyncCallback) : void; + + /** + * recover an application. + * @permission ohos.permission.INSTALL_BUNDLE + * @param { string } bundleName - Indicates the bundle name of the application to be uninstalled. + * @param { InstallParam } installParam - Indicates other parameters required for the uninstallation. + * @param { AsyncCallback } callback - The callback of recoverring application result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback): void; + } + + /** + * Provides parameters required for hashParam. + * @typedef HashParam + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + export interface HashParam { + /** + * Indicates the moduleName + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + moduleName: string; + + /** + * Indicates the hash value + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + hashValue: string; + } + + /** + * Provides parameters required for installing or uninstalling an application. + * @typedef InstallParam + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + export interface InstallParam { + /** + * Indicates the user id + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + userId: number; + + /** + * Indicates the install flag + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + installFlag: number; + + /** + * Indicates whether the param has data + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + isKeepData: boolean; + + /** + * Indicates the hash params + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + hashParams?: Array; + + /** + * Indicates the deadline of the crowdtesting bundle + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + crowdtestDeadline?: number; + } +} + +export default installer; diff --git a/api/@ohos.bundle.launcherBundleManager.d.ts b/api/@ohos.bundle.launcherBundleManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b7ff1432c409afe0b3bc3c6ddc6fb788cdd9737 --- /dev/null +++ b/api/@ohos.bundle.launcherBundleManager.d.ts @@ -0,0 +1,128 @@ +/* + * 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 { LauncherAbilityInfo as _LauncherAbilityInfo } from './bundleManager/launcherAbilityInfo'; +import { ShortcutInfo as _ShortcutInfo, ShortcutWant as _ShortcutWant} from './bundleManager/ShortcutInfo'; + + +/** + * Launcher bundle manager. + * @namespace launcherBundleManager + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ +declare namespace launcherBundleManager { + /** + * Obtains launcher abilities info based on a given bundleName and userId. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } userId - Indicates the id for the user. + * @param { AsyncCallback } callback -The callback of the LauncherAbilityInfo object result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + function getLauncherAbilityInfo(bundleName: string, userId: number, callback: AsyncCallback>) : void; + + /** + * Obtains launcher abilities info based on a given bundleName and userId. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } userId - Indicates the id for the user. + * @returns { Promise> } the LauncherAbilityInfo object. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + function getLauncherAbilityInfo(bundleName: string, userId: number) : Promise>; + + /** + * Obtains launcher abilities info based on a given userId. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } userId - Indicates the id for the user. + * @param { AsyncCallback } callback -The callback of the LauncherAbilityInfo object result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + function getAllLauncherAbilityInfo(userId: number, callback: AsyncCallback>) : void; + + /** + * Obtains launcher abilities info based on a given userId. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } userId - Indicates the id for the user. + * @returns { Promise> } the LauncherAbilityInfo object. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + function getAllLauncherAbilityInfo(userId: number) : Promise>; + + /** + * Obtains shortcut info based on a given bundleName. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { AsyncCallback } callback -The callback of the ShortcutInfo object result. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + function getShortcutInfo(bundleName :string, callback: AsyncCallback>) : void; + + /** + * Obtains shortcut info based on a given bundleName. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @returns { Promise> } the LauncherShortcutInfo object. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + function getShortcutInfo(bundleName : string) : Promise>; + + /** + * Contains basic launcher Ability information, which uniquely identifies an LauncherAbilityInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + export type LauncherAbilityInfo = _LauncherAbilityInfo; + + /** + * Information about a shortcut, including the shortcut ID and label. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + export type ShortcutInfo = _ShortcutInfo; + + /** + * Information about the ability that a shortcut will start, including the target bundle name, target module name and ability class name. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + export type ShortcutWant = _ShortcutWant; +} + +export default launcherBundleManager; diff --git a/api/@ohos.distributedBundle.d.ts b/api/@ohos.distributedBundle.d.ts index beaf21575af453570f75e4e5c38aab81f6ac4897..1df5fb558f15744856cb617303386193de0c33d4 100644 --- a/api/@ohos.distributedBundle.d.ts +++ b/api/@ohos.distributedBundle.d.ts @@ -24,6 +24,8 @@ import { RemoteAbilityInfo as _RemoteAbilityInfo } from './bundle/remoteAbilityI * @syscap SystemCapability.BundleManager.DistributedBundleFramework * @permission NA * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead bundle.distributeBundle */ declare namespace distributedBundle { /** @@ -35,6 +37,8 @@ import { RemoteAbilityInfo as _RemoteAbilityInfo } from './bundle/remoteAbilityI * @return Returns the ability info of the remote device. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi + * @deprecated since 9 + * @useinstead bundle.distributeBundle.getRemoteAbilityInfo */ function getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback): void; function getRemoteAbilityInfo(elementName: ElementName): Promise; @@ -48,6 +52,8 @@ import { RemoteAbilityInfo as _RemoteAbilityInfo } from './bundle/remoteAbilityI * @return Returns the ability infos of the remote device. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi + * @deprecated since 9 + * @useinstead bundle.distributeBundle.getRemoteAbilityInfos */ function getRemoteAbilityInfos(elementNames: Array, callback: AsyncCallback>): void; function getRemoteAbilityInfos(elementNames: Array): Promise>; @@ -62,6 +68,8 @@ import { RemoteAbilityInfo as _RemoteAbilityInfo } from './bundle/remoteAbilityI * @return Returns the ability info of the remote device. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi + * @deprecated since 9 + * @useinstead bundle.distributeBundle.getRemoteAbilityInfo */ function getRemoteAbilityInfo(elementName: ElementName, locale: string, callback: AsyncCallback): void; function getRemoteAbilityInfo(elementName: ElementName, locale: string): Promise; @@ -76,6 +84,8 @@ import { RemoteAbilityInfo as _RemoteAbilityInfo } from './bundle/remoteAbilityI * @return Returns the ability infos of the remote device. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi + * @deprecated since 9 + * @useinstead bundle.distributeBundle.getRemoteAbilityInfos */ function getRemoteAbilityInfos(elementNames: Array, locale: string, callback: AsyncCallback>): void; function getRemoteAbilityInfos(elementNames: Array, locale: string): Promise>; diff --git a/api/@ohos.zlib.d.ts b/api/@ohos.zlib.d.ts index a7da314d6ee77d02b4212a5d1cd5e7b72e6aaa13..782f20e273e56c964018e11577f57628b9482993 100644 --- a/api/@ohos.zlib.d.ts +++ b/api/@ohos.zlib.d.ts @@ -91,9 +91,35 @@ declare namespace zlib { * @param inFile Indicates the path of the file to be compressed. * @param outFile Indicates the path of the output compressed file. * @return Returns error code. + * @deprecated since 9 + * @useinstead compressFile */ function zipFile(inFile:string, outFile:string, options: Options): Promise; + /** + * Compress the specified file. + * @param {string} inFile Indicates the path of the file to be compressed. + * @param {string} outFile Indicates the path of the output compressed file. + * @param {Options} options Indicates the options of compressing file. + * @param {AsyncCallback} callback - The callback of compressing file result. + * @throws {BusinessError} 401 - The parameter check failed. + * @syscap SystemCapability.BundleManager.Zlib + * @since 9 + */ + function compressFile(inFile: string, outFile: string, options: Options, callback: AsyncCallback): void; + + /** + * Compress the specified file. + * @param {string} inFile Indicates the path of the file to be compressed. + * @param {string} outFile Indicates the path of the output compressed file. + * @param {Options} options Indicates the options of compressing file. + * @returns {Promise} Returns the result of compressing file. + * @throws {BusinessError} 401 - The parameter check failed. + * @syscap SystemCapability.BundleManager.Zlib + * @since 9 + */ + function compressFile(inFile:string, outFile:string, options: Options): Promise; + /** * Decompress the specified file. * @@ -102,7 +128,33 @@ declare namespace zlib { * @param inFile Indicates the path of the file to be decompressed. * @param outFile Indicates the path of the decompressed file. * @return Returns error code. + * @deprecated since 9 + * @useinstead decompressFile */ function unzipFile(inFile:string, outFile:string, options: Options): Promise; + + /** + * Decompress the specified file. + * @param {string} inFile Indicates the path of the file to be decompressed. + * @param {string} outFile Indicates the path of the output decompressed file. + * @param {Options} options Indicates the options of decompressing file. + * @param {AsyncCallback} callback - The callback of decompressing file result. + * @throws {BusinessError} 401 - The parameter check failed. + * @syscap SystemCapability.BundleManager.Zlib + * @since 9 + */ + function decompressFile(inFile: string, outFile: string, options: Options, callback: AsyncCallback): void; + + /** + * Decompress the specified file. + * @param {string} inFile Indicates the path of the file to be decompressed. + * @param {string} outFile Indicates the path of the output decompressing file. + * @param {Options} options Indicates the options of decompressing file. + * @returns {Promise} Returns the result of decompressing file. + * @throws {BusinessError} 401 - The parameter check failed. + * @syscap SystemCapability.BundleManager.Zlib + * @since 9 + */ + function decompressFile(inFile: string, outFile: string, options: Options): Promise; } export default zlib; \ No newline at end of file diff --git a/api/bundle/PermissionDef.d.ts b/api/bundle/PermissionDef.d.ts index 6be050d5d9c4f317090f05de501fd41b9ac49346..2df2276e243ee8bdb1a83a373df468110f93cde7 100644 --- a/api/bundle/PermissionDef.d.ts +++ b/api/bundle/PermissionDef.d.ts @@ -19,6 +19,8 @@ * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA * @systemapi + * @deprecated since 9 + * @useinstead ../bundleManager/PermissionDef */ export interface PermissionDef { /** diff --git a/api/bundle/abilityInfo.d.ts b/api/bundle/abilityInfo.d.ts index b1ae1d907f5d8290801f0f1eef179f6ff5ad5a63..1c9626fa4b3748e183892926c5bc0627a2a59de3 100644 --- a/api/bundle/abilityInfo.d.ts +++ b/api/bundle/abilityInfo.d.ts @@ -23,6 +23,8 @@ import bundle from './../@ohos.bundle'; * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA + * @deprecated since 9 + * @useinstead ../bundleManager/AbilityInfo */ export interface AbilityInfo { /** diff --git a/api/bundle/applicationInfo.d.ts b/api/bundle/applicationInfo.d.ts index 73477bb49bc2aab39ecb3ae0367e76a56f8469fe..98bd9226394d75809ad150df596b984c7c596873 100644 --- a/api/bundle/applicationInfo.d.ts +++ b/api/bundle/applicationInfo.d.ts @@ -23,7 +23,8 @@ import { Resource } from './../global/resource'; * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA - * + * @deprecated since 9 + * @useinstead ../bundleManager/Application */ export interface ApplicationInfo { /** diff --git a/api/bundle/bundleInfo.d.ts b/api/bundle/bundleInfo.d.ts index 4da8310f4300f390e4faf00594cd3c43730c4cca..9c6fdcf3fc5080567be9b6b33b505539ba8fb346 100644 --- a/api/bundle/bundleInfo.d.ts +++ b/api/bundle/bundleInfo.d.ts @@ -23,7 +23,8 @@ import { HapModuleInfo } from './hapModuleInfo'; * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA - * + * @deprecated since 9 + * @useinstead ../bundleManager/BundleInfo */ export interface UsedScene { /** @@ -46,7 +47,8 @@ export interface UsedScene { * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA - * + * @deprecated since 9 + * @useinstead ../bundleManager/BundleInfo */ export interface ReqPermissionDetail { /** @@ -83,7 +85,8 @@ export interface ReqPermissionDetail { * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA - * + * @deprecated since 9 + * @useinstead ../bundleManager/BundleInfo */ export interface BundleInfo { /** diff --git a/api/bundle/bundleInstaller.d.ts b/api/bundle/bundleInstaller.d.ts index a2e31165f8399857295d904a3bae7aa1c19a3f5d..a564776c5eede06ae4ed5f2330581fe3714ccf68 100644 --- a/api/bundle/bundleInstaller.d.ts +++ b/api/bundle/bundleInstaller.d.ts @@ -22,6 +22,8 @@ import bundle from './../@ohos.bundle'; * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.installer.HashParam */ export interface HashParam { /** @@ -45,6 +47,8 @@ import bundle from './../@ohos.bundle'; * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.installer.InstallParam */ export interface InstallParam { /** @@ -89,6 +93,8 @@ export interface InstallParam { * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.installer.InstallStatus */ export interface InstallStatus { @@ -113,6 +119,8 @@ export interface InstallStatus { * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.installer.BundleInstaller */ export interface BundleInstaller { /** @@ -126,6 +134,8 @@ export interface BundleInstaller { * @param installParam Indicates other parameters required for the installation. * @return InstallStatus * @permission ohos.permission.INSTALL_BUNDLE + * @deprecated since 9 + * @useinstead @ohos.bundle.installer.BundleInstaller.install */ install(bundleFilePaths: Array, param: InstallParam, callback: AsyncCallback): void; @@ -139,6 +149,8 @@ export interface BundleInstaller { * @param installParam Indicates other parameters required for the uninstallation. * @return InstallStatus * @permission ohos.permission.INSTALL_BUNDLE + * @deprecated since 9 + * @useinstead @ohos.bundle.installer.BundleInstaller.uninstall */ uninstall(bundleName: string, param: InstallParam, callback: AsyncCallback): void; @@ -153,6 +165,8 @@ export interface BundleInstaller { * @return InstallStatus * @permission ohos.permission.INSTALL_BUNDLE * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.installer.BundleInstaller.recover */ recover(bundleName: string, param: InstallParam, callback: AsyncCallback): void; } \ No newline at end of file diff --git a/api/bundle/bundleStatusCallback.d.ts b/api/bundle/bundleStatusCallback.d.ts index b5c4d368583d4bffdefc1f34d8fe4d41654cdf0c..0bd1be08c16e04b4c5c2b9bb678237a230393589 100644 --- a/api/bundle/bundleStatusCallback.d.ts +++ b/api/bundle/bundleStatusCallback.d.ts @@ -23,6 +23,8 @@ * * @permission ohos.permission.LISTEN_BUNDLE_CHANGE * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.bundleMonitor */ export interface BundleStatusCallback { /** diff --git a/api/bundle/customizeData.d.ts b/api/bundle/customizeData.d.ts index 4427daf06140214d97ac34ea92efb612e3812218..e5fea0d3dbdb6516253b995dd09b747f2f5c93ee 100644 --- a/api/bundle/customizeData.d.ts +++ b/api/bundle/customizeData.d.ts @@ -18,7 +18,7 @@ * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA - * + * @deprecated since 9, not recommended */ export interface CustomizeData { /** diff --git a/api/bundle/dispatchInfo.d.ts b/api/bundle/dispatchInfo.d.ts index 2538eb4c831ea6986e6501eec53294e77820b8ba..d06f05889b4844f747e0cf488b2b57a534c6b640 100644 --- a/api/bundle/dispatchInfo.d.ts +++ b/api/bundle/dispatchInfo.d.ts @@ -18,6 +18,8 @@ * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @systemapi hide this for inner system use + * @deprecated since 9 + * @useinstead @ohos.bundle.freeInstall.DispacthInfo */ export interface DispatchInfo { /** diff --git a/api/bundle/elementName.d.ts b/api/bundle/elementName.d.ts index 3eeff9218e709706e4821e0a0b66f6186e924396..ef8f03fc1fe08ebaed0dee1e16dd92756f240c2d 100644 --- a/api/bundle/elementName.d.ts +++ b/api/bundle/elementName.d.ts @@ -22,6 +22,8 @@ * @syscap SystemCapability.BundleManager.BundleFramework * * @permission N/A + * @deprecated since 9 + * @useinstead ../bundleManager/ElementName */ export interface ElementName { /** diff --git a/api/bundle/extensionAbilityInfo.d.ts b/api/bundle/extensionAbilityInfo.d.ts index c533ad6dc54b7aab9eb928e0b6be0940c01001f5..d5c2c9ec2f7e0d1b4dd5485cbf71fd47ffdf7a89 100644 --- a/api/bundle/extensionAbilityInfo.d.ts +++ b/api/bundle/extensionAbilityInfo.d.ts @@ -22,7 +22,8 @@ import bundle from './../@ohos.bundle'; * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA - * + * @deprecated since 9 + * @useinstead ../bundleManager/ExtensionAbilityInfo */ export interface ExtensionAbilityInfo { /** diff --git a/api/bundle/hapModuleInfo.d.ts b/api/bundle/hapModuleInfo.d.ts index 5ed5be922e699bba39e878bdec513cbdfba1df67..9b26a652296c5e741ded78b4f24fd57892f0e8f3 100644 --- a/api/bundle/hapModuleInfo.d.ts +++ b/api/bundle/hapModuleInfo.d.ts @@ -22,7 +22,8 @@ import { Metadata } from './metadata' * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA - * + * @deprecated since 9 + * @useinstead ../bundleManager/HapModuleInfo */ export interface HapModuleInfo { /** diff --git a/api/bundle/launcherAbilityInfo.d.ts b/api/bundle/launcherAbilityInfo.d.ts index a73f3ce63f7f6ffc9a3a054479a95437c99d0e72..36c4f182a58d5a828401ca8a3c2f01585e77d79f 100644 --- a/api/bundle/launcherAbilityInfo.d.ts +++ b/api/bundle/launcherAbilityInfo.d.ts @@ -26,6 +26,8 @@ import { ElementName } from './elementName' * * @permission N/A * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ../bundleManager/LauncherAbilityInfo */ export interface LauncherAbilityInfo { /** diff --git a/api/bundle/metadata.d.ts b/api/bundle/metadata.d.ts index 4fba45c5348ca3d4806cf46783ba4570b1c7e6c3..638ec8a4674e0adc7174df279111bb4279e1909d 100644 --- a/api/bundle/metadata.d.ts +++ b/api/bundle/metadata.d.ts @@ -18,7 +18,8 @@ * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA - * + * @deprecated since 9 + * @useinstead ../bundleManager/Metadata */ export interface Metadata { /** diff --git a/api/bundle/moduleInfo.d.ts b/api/bundle/moduleInfo.d.ts index f961a10b9d6cabbadef869709aaa1a848f860e43..9e27a103b339467594b7d1050e94943490776fcd 100644 --- a/api/bundle/moduleInfo.d.ts +++ b/api/bundle/moduleInfo.d.ts @@ -18,7 +18,8 @@ * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA - * + * @deprecated since 9 + * @useinstead ../bundleManager/HapModuleInfo */ export interface ModuleInfo { /** diff --git a/api/bundle/packInfo.d.ts b/api/bundle/packInfo.d.ts index 1c4a45903d8717db95af7b2fc2ca5ae93fd72b60..b27898259351a02d483ca87a0688e1e6d304cf9c 100644 --- a/api/bundle/packInfo.d.ts +++ b/api/bundle/packInfo.d.ts @@ -18,6 +18,8 @@ * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @systemapi hide this for inner system use + * @deprecated since 9 + * @useinstead ../bundleManager/PackInfo.BundlePackInfo */ export interface BundlePackInfo { /** @@ -40,6 +42,7 @@ export interface BundlePackInfo { * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @systemapi hide this for inner system use + * @useinstead ../bundleManager/PackInfo.PackageConfig */ export interface PackageConfig { /** @@ -76,6 +79,8 @@ export interface PackageConfig { * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @systemapi hide this for inner system use + * @deprecated since 9 + * @useinstead ../bundleManager/PackInfo.PackageSummary */ export interface PackageSummary { /** @@ -98,6 +103,8 @@ export interface PackageSummary { * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @systemapi hide this for inner system use + * @deprecated since 9 + * @useinstead ../bundleManager/PackInfo.BundleConfigInfo */ export interface BundleConfigInfo { /** @@ -120,6 +127,8 @@ export interface BundleConfigInfo { * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @systemapi hide this for inner system use + * @deprecated since 9 + * @useinstead ../bundleManager/PackInfo.ExtensionAbility */ export interface ExtensionAbilities { /** @@ -142,6 +151,8 @@ export interface BundleConfigInfo { * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @systemapi hide this for inner system use + * @deprecated since 9 + * @useinstead ../bundleManager/PackInfo.ModuleConfigInfo */ export interface ModuleConfigInfo { /** @@ -185,6 +196,8 @@ export interface ModuleConfigInfo { * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @systemapi hide this for inner system use + * @deprecated since 9 + * @useinstead ../bundleManager/PackInfo.ModuleDistroInfo */ export interface ModuleDistroInfo { /** @@ -228,6 +241,8 @@ export interface ModuleDistroInfo { * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @systemapi hide this for inner system use + * @deprecated since 9 + * @useinstead ../bundleManager/PackInfo.ModuleAbilityInfo */ export interface ModuleAbilityInfo { /** @@ -264,6 +279,8 @@ export interface ModuleAbilityInfo { * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @systemapi hide this for inner system use + * @deprecated since 9 + * @useinstead ../bundleManager/PackInfo.AbilityFormInfo */ export interface AbilityFormInfo { /** @@ -321,6 +338,8 @@ export interface AbilityFormInfo { * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @systemapi hide this for inner system use + * @deprecated since 9 + * @useinstead ../bundleManager/PackInfo.Version */ export interface Version { /** @@ -350,6 +369,8 @@ export interface Version { * @since 9 * @syscap SystemCapability.BundleManager.BundleFramework * @systemapi hide this for inner system use + * @deprecated since 9 + * @useinstead ../bundleManager/PackInfo.ApiVersion */ export interface ApiVersion { /** @@ -380,6 +401,7 @@ export interface ApiVersion { * @syscap SystemCapability.BundleManager.BundleFramework * @import NA * @systemapi hide this for inner system use +* @deprecated since 9, use @ohos.bundle.freeInstall.BundlePackFlag */ export enum BundlePackFlag { GET_PACK_INFO_ALL = 0x00000000, diff --git a/api/bundle/remoteAbilityInfo.d.ts b/api/bundle/remoteAbilityInfo.d.ts index e9a1585c266935fe61704347a15a25eaebd4ccb3..a2184e7ccac96947dc6d21f9ba83807c759b2321 100644 --- a/api/bundle/remoteAbilityInfo.d.ts +++ b/api/bundle/remoteAbilityInfo.d.ts @@ -22,6 +22,8 @@ import { ElementName } from './elementName'; * @systemapi * * @permission N/A + * @deprecated since 9 + * @useinstead ../bundleManager/RemoteAbilityInfo */ export interface RemoteAbilityInfo { /** diff --git a/api/bundle/shortcutInfo.d.ts b/api/bundle/shortcutInfo.d.ts index 98c0a85563cd95a2dad1f72bd0a3305fe0fc7a15..f03995b715b4a7489d7ddb33cff1b431b45a636b 100644 --- a/api/bundle/shortcutInfo.d.ts +++ b/api/bundle/shortcutInfo.d.ts @@ -20,6 +20,8 @@ * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ../bundleManager/ShortcutWant */ export interface ShortcutWant{ /** @@ -47,7 +49,8 @@ * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework * @permission NA - * + * @deprecated since 9 + * @useinstead ../bundleManager/ShortcutInfo */ export interface ShortcutInfo { /** diff --git a/api/bundleManager/abilityInfo.d.ts b/api/bundleManager/abilityInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b5410ecd3913afacdc94d93044fab8d89732caf3 --- /dev/null +++ b/api/bundleManager/abilityInfo.d.ts @@ -0,0 +1,469 @@ +/* + * 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 { ApplicationInfo } from './applicationInfo'; +import { Metadata } from './metadata' + +/** + * Obtains configuration information about an ability + * @typedef AbilityInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface AbilityInfo { + /** + * Indicates the name of the bundle containing the ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly bundleName: string; + + /** + * Indicates the name of the .hap package to which the capability belongs + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly moduleName: string; + + /** + * Ability simplified class name + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly name: string; + + /** + * Indicates the label of the ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly label: string; + + /** + * Indicates the label id of the ability + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly labelId: number; + + /** + * Indicates the ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly description: string; + + /** + * Indicates the description id of the ability + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly descriptionId: number; + + /** + * Indicates the icon of the ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly icon: string; + + /** + * Indicates the icon id of the ability + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly iconId: number; + + /** + * Process of ability, if user do not set it, the value equal application process + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly process: string; + + /** + * Indicates whether an ability can be called by other abilities + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly isVisible: boolean; + + /** + * Enumerates types of templates that can be used by an ability + * @type {AbilityType} + * @syscap SystemCapability.BundleManager.BundleFramework + * @FAModelOnly + * @since 9 + */ + readonly type: AbilityType; + + /** + * Enumerates ability display orientations + * @type {DisplayOrientation} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly orientation: DisplayOrientation; + + /** + * Enumerates ability launch type + * @type {LaunchType} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly launchType: LaunchType; + + /** + * The permissions that others need to launch this ability + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly permissions: Array; + + /** + * Indicates the permission required for reading ability data + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework + * @FAModelOnly + * @since 9 + */ + readonly readPermission: string; + + /** + * Indicates the permission required for writing data to the ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework + * @FAModelOnly + * @since 9 + */ + readonly writePermission: string; + + /** + * Uri of ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework + * @FAModelOnly + * @since 9 + */ + readonly uri: string; + + /** + * The device types that this ability can run on + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly deviceTypes: Array; + + /** + * Obtains configuration information about an application + * @type {ApplicationInfo} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly applicationInfo: ApplicationInfo; + + /** + * Indicates the metadata of ability + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly metadata: Array; + + /** + * Indicates whether the ability is enabled + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly enabled: boolean; + + /** + * Indicates which window mode is supported + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly supportWindowModes: Array; + + /** + * Indicates window size + * @type {WindowSize} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly windowSize: WindowSize; +} + +/** + * Indicates the window size. + * @typedef WindowSize + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface WindowSize { + /** + * Indicates maximum ratio of width over height of window under free window status. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly maxWindowRatio: number; + + /** + * Indicates minimum ratio of width over height of window under free window status. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly minWindowRatio: number; + + /** + * Indicates maximum width of window under free window status. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly maxWindowWidth: number; + + /** + * Indicates minimum width of window under free window status. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly minWindowWidth: number; + + /** + * Indicates maximum height of window under free window status. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly maxWindowHeight: number; + + /** + * Indicates minimum height of window under free window status. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly minWindowHeight: number; +} + +/** + * Support window mode + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export enum SupportWindowMode { + /** + * Indicates supported window mode of full screen mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + FULL_SCREEN = 0, + /** + * Indicates supported window mode of split mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + SPLIT = 1, + /** + * Indicates supported window mode of floating mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + FLOATING = 2, +} + +/** + * Launch type + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export enum LaunchType { + /** + * Indicates that the ability has only one instance + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + SINGLETON = 0, + + /** + * Indicates that the ability can have multiple instances + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + STANDARD = 1, + + /** + * Indicates that the ability can have specified instances + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + SPECIFIED = 2, +} + +/** + * Indicates ability type + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export enum AbilityType { + /** + * Indicates an unknown ability type + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + UNKNOWN, + + /** + * Indicates that the ability has a UI + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + PAGE, + + /** + * Indicates that the ability does not have a UI + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + SERVICE, + + /** + * Indicates that the ability is used to provide data access services + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + DATA, +} + + +/** + * Display orientation + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export enum DisplayOrientation { + /** + * Indicates that the system automatically determines the display orientation + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + UNSPECIFIED, + + /** + * Indicates the landscape orientation + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + LANDSCAPE, + + /** + * Indicates the portrait orientation + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + PORTRAIT, + + /** + * Indicates the page ability orientation is the same as that of the nearest ability in the stack + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + FOLLOW_RECENT, + + /** + * Indicates the inverted landscape orientation + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + LANDSCAPE_INVERTED, + + /** + * Indicates the inverted portrait orientation + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + PORTRAIT_INVERTED, + + /** + * Indicates the orientation can be auto-rotated + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + AUTO_ROTATION, + + /** + * Indicates the landscape orientation rotated with sensor + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + AUTO_ROTATION_LANDSCAPE, + + /** + * Indicates the portrait orientation rotated with sensor + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + AUTO_ROTATION_PORTRAIT, + + /** + * Indicates the sensor restricted mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + AUTO_ROTATION_RESTRICTED, + + /** + * Indicates the sensor landscape restricted mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + AUTO_ROTATION_LANDSCAPE_RESTRICTED, + + /** + * Indicates the sensor portrait restricted mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + AUTO_ROTATION_PORTRAIT_RESTRICTED, + + /** + * Indicates the locked orientation mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + LOCKED, +} diff --git a/api/bundleManager/applicationInfo.d.ts b/api/bundleManager/applicationInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2ea06512bd506f37145d4f46bc8fb2f37b804661 --- /dev/null +++ b/api/bundleManager/applicationInfo.d.ts @@ -0,0 +1,212 @@ +/* + * 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 { HapModuleInfo } from './hapModuleInfo'; +import { Metadata } from './metadata'; +import { Resource } from '../global/resource'; + +/** + * Obtains configuration information about an application + * @typedef ApplicationInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface ApplicationInfo { + /** + * Indicates the application name, which is the same as {@code bundleName} + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly name: string; + + /** + * Description of application + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly description: string; + + /** + * Indicates the description id of the application + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly descriptionId: number; + + /** + * Indicates whether or not this application may be instantiated + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly enabled: boolean; + + /** + * Indicates the label of the application + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly label: string; + + /** + * Indicates the label id of the application + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly labelId: number; + + /** + * Indicates the icon of the application + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly icon: string; + + /** + * Indicates the icon id of the application + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly iconId: number; + + /** + * Process of application, if user do not set it ,the value equal bundleName + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly process: string; + + /** + * Indicates the path storing the module resources of the application + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly moduleSourceDirs: Array; + + /** + * Indicates the permissions required for accessing the application. + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly permissions: Array; + + /** + * Indicates modules information about an application + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly modulesInfo: Array; + + /** + * Indicates the path where the {@code Entry.hap} file of the application is saved + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly entryDir: string; + + /** + * Indicates the application source code path + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly codePath: string; + + /** + * Indicates the metadata of module + * @type {Map>} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly metadata: Map>; + + /** + * Indicates whether or not this application may be removable + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly removable: boolean; + + /** + * Indicates the access token of the application + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly accessTokenId: number; + + /** + * Indicates the uid of the application + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly uid: number; + + /** + * Indicates icon resource of the application + * @type {Resource} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly iconResource: Resource; + + /** + * Indicates label resource of the application + * @type {Resource} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly labelResource: Resource; + + /** + * Indicates description resource of the application + * @type {Resource} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly descriptionResource: Resource; + + /** + * Indicates the appDistributionType of the application + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + readonly appDistributionType: string; + + /** + * Indicates the appProvisionType of the application + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + readonly appProvisionType: string; +} diff --git a/api/bundleManager/bundleInfo.d.ts b/api/bundleManager/bundleInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d10973b14d84905530145f7cc94f950a34a99461 --- /dev/null +++ b/api/bundleManager/bundleInfo.d.ts @@ -0,0 +1,240 @@ +/* + * 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 { ApplicationInfo } from './applicationInfo'; +import { HapModuleInfo } from './hapModuleInfo'; + +/** + * Obtains configuration information about a bundle + * @typedef BundleInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface BundleInfo { + /** + * Indicates the name of this bundle + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly name: string; + + /** + * Indicates the bundle vendor + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly vendor: string; + + /** + * Indicates the version code of the bundle + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly versionCode: number; + + /** + * Indicates the version name of the bundle + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly versionName: string; + + /** + * Indicates the earliest historical version compatible with the bundle + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly minCompatibleVersionCode: number; + + /** + * Indicates the target version number of the bundle + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly targetVersion: number; + + /** + * Obtains configuration information about an application + * @type {ApplicationInfo} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly appInfo: ApplicationInfo; + + /** + * Obtains configuration information about an module + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly hapModulesInfo: Array; + + /** + * Indicates the required permissions details defined in file config.json + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly reqPermissionDetails: Array; + + /** + * Indicates the grant status of required permissions + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly permissionGrantStates: Array; + + /** + * Indicates the SignatureInfo of the bundle + * @type {SignatureInfo} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly signatureInfo: SignatureInfo; + + /** + * Indicates the hap install time + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly installTime: number; + + /** + * Indicates the hap update time + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly updateTime: number; +} + +/** + * Indicates the required permissions details defined in configuration file + * @typedef ReqPermissionDetail + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface ReqPermissionDetail { + /** + * Indicates the name of this required permissions + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + name: string; + + /** + * Indicates the reason of this required permissions + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + reason: string; + + /** + * Indicates the reason id of this required permissions + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + reasonId: number; + + /** + * Indicates the used scene of this required permissions + * @type {UsedScene} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + usedScene: UsedScene; +} + +/** + * The scene which is used + * @typedef UsedScene + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface UsedScene { + /** + * Indicates the abilities that need the permission + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + abilities: Array; + + /** + * Indicates the time when the permission is used + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + when: string; +} + +/** + * PermissionGrantState + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export enum PermissionGrantState { + /** + * PERMISSION_DENIED + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + PERMISSION_DENIED = -1, + + /** + * PERMISSION_GRANTED + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + PERMISSION_GRANTED = 0, +} + +/** + * Indicates SignatureInfo + * @typedef SignatureInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface SignatureInfo { + /** + * Indicates the ID of the application to which this bundle belongs + * The application ID uniquely identifies an application. It is determined by the bundle name and signature + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly appId: string; + + /** + * Indicates the fingerprint of the certificate + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly fingerprint: string; +} diff --git a/api/bundleManager/dispatchInfo.d.ts b/api/bundleManager/dispatchInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cbfb489f4913354071de98ad54ba9deff98b1d9b --- /dev/null +++ b/api/bundleManager/dispatchInfo.d.ts @@ -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 installation free + * @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 dispatchAPI: string; +} \ No newline at end of file diff --git a/api/bundleManager/elementName.d.ts b/api/bundleManager/elementName.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5e95cdf6d4ecf6990c14bdf80619eb74d5812f5d --- /dev/null +++ b/api/bundleManager/elementName.d.ts @@ -0,0 +1,72 @@ +/* + * 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. + */ + +/** + * Contains basic Ability information, which uniquely identifies an ability. + * You can use this class to obtain values of the fields set in an element, + * such as the device ID, bundle name, and ability name. + * @typedef ElementName + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface ElementName { + /** + * Indicates device id + * @type {?string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + deviceId?: string; + + /** + * @default Indicates bundle name + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + bundleName: string; + + /** + * Indicates ability name + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + abilityName: string; + + /** + * Indicates uri + * @type {?string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + uri?: string; + + /** + * Indicates short name + * @type {?string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + shortName?: string; + + /** + * @default Indicates module name + * @type {?string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + moduleName?: string; +} diff --git a/api/bundleManager/extensionAbilityInfo.d.ts b/api/bundleManager/extensionAbilityInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..507dc4d3a2f711be86fd49bb2ffa1da7456e1c19 --- /dev/null +++ b/api/bundleManager/extensionAbilityInfo.d.ts @@ -0,0 +1,252 @@ +/* + * 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 { ApplicationInfo } from './applicationInfo'; +import { Metadata } from './metadata' + +/** + * Extension information about a bundle + * @typedef ExtensionAbilityInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface ExtensionAbilityInfo { + /** + * Indicates the name of the bundle + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly bundleName: string; + + /** + * Indicates the name of the module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly moduleName: string; + + /** + * Indicates the name of the extension ability info + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly name: string; + + /** + * Indicates the label id of the extension ability info + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly labelId: number; + + /** + * Indicates the description id of the extension ability info + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly descriptionId: number; + + /** + * Indicates the icon id of the extension ability info + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly iconId: number; + + /** + * Indicates whether the extension ability info can be visible or not + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly isVisible: boolean; + + /** + * Enumerates types of the extension ability info + * @type {ExtensionAbilityType} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly extensionAbilityType: ExtensionAbilityType; + + /** + * The permissions that others need to use this extension ability info + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly permissions: Array; + + /** + * Obtains configuration information about an application + * @type {ApplicationInfo} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly applicationInfo: ApplicationInfo; + + /** + * Indicates the metadata of bundle + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly metadata: Array; + + /** + * Indicates the src language to express extension ability info + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly enabled: boolean; + + /** + * Indicates the read permission extension ability info + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly readPermission: string; + + /** + * Indicates the write permission of extension ability info + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly writePermission: string; +} + +/** + * This enumeration value is used to identify various types of extension ability + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export enum ExtensionAbilityType { + /** + * Indicates extension info with type of form + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + FORM = 0, + + /** + * Indicates extension info with type of work schedule + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + WORK_SCHEDULER = 1, + + /** + * Indicates extension info with type of input method + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + INPUT_METHOD = 2, + + /** + * Indicates extension info with type of service + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + SERVICE = 3, + + /** + * Indicates extension info with type of accessibility + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + ACCESSIBILITY = 4, + + /** + * Indicates extension info with type of dataShare + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + DATA_SHARE = 5, + + /** + * Indicates extension info with type of filesShare + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + FILE_SHARE = 6, + + /** + * Indicates extension info with type of staticSubscriber + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + STATIC_SUBSCRIBER = 7, + + /** + * Indicates extension info with type of wallpaper + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + WALLPAPER = 8, + + /** + * Indicates extension info with type of backup + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + BACKUP = 9, + + /** + * Indicates extension info with type of window + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + WINDOW = 10, + + /** + * Indicates extension info with type of enterprise admin + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + ENTERPRISE_ADMIN = 11, + + /** + * Indicates extension info with type of thumbnail + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + THUMBNAIL = 13, + + /** + * Indicates extension info with type of preview + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + PREVIEW = 14, + + /** + * Indicates extension info with type of unspecified + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + UNSPECIFIED = 255, +} diff --git a/api/bundleManager/hapModuleInfo.d.ts b/api/bundleManager/hapModuleInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..722a9e19ee4051b5189d295bb15c6e18a21628a6 --- /dev/null +++ b/api/bundleManager/hapModuleInfo.d.ts @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2021 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 { AbilityInfo } from "./abilityInfo"; +import { ExtensionAbilityInfo } from "./extensionAbilityInfo"; +import { Metadata } from './metadata' + +/** + * Obtains configuration information about a hap module. + * @typedef HapModuleInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface HapModuleInfo { + /** + * Indicates the name of this hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly name: string; + + /** + * Indicates the icon of this hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly icon: string; + + /** + * Indicates the icon id of this hap module + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly iconId: number; + + /** + * Indicates the label of this hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly label: string; + + /** + * Indicates the label id of this hap module + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly labelId: number; + + /** + * Describes the hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly description: string; + + /** + * Indicates the description of this hap module + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly descriptionId: number; + + /** + * Indicates main elementName of the hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly mainElementName: string; + + /** + * Obtains configuration information about abilities + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly abilitiesInfo: Array; + + /** + * Obtains configuration information about extension abilities + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly extensionAbilitiesInfo: Array; + + /** + * Indicates the metadata of ability + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly metadata: Array; + + /** + * The device types that this hap module can run on + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly deviceTypes: Array; + + /** + * Indicates whether free installation of the hap module is supported + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly installationFree: boolean; + + /** + * Indicates the hash value of the hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + readonly hashValue: string; + + /** + * Indicates the module source dir of this hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly moduleSourceDir: string; +} diff --git a/api/bundleManager/launcherAbilityInfo.d.ts b/api/bundleManager/launcherAbilityInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..acf192f1b52b81ec9c4d5ef8a997747a5189837e --- /dev/null +++ b/api/bundleManager/launcherAbilityInfo.d.ts @@ -0,0 +1,74 @@ +/* + * 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 { ApplicationInfo } from './applicationInfo'; +import { ElementName } from './elementName' + +/** + * Contains basic launcher Ability information, which uniquely identifies an LauncherAbilityInfo + * @typedef LauncherAbilityInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ +export interface LauncherAbilityInfo { + /** + * Obtains application info information about an launcher ability. + * @type {ApplicationInfo} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly applicationInfo: ApplicationInfo; + + /** + * Obtains element name about an launcher ability. + * @type {ElementName} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly elementName : ElementName; + + /** + * Obtains labelId about an launcher ability. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly labelId: number; + + /** + * Obtains iconId about an launcher ability. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly iconId: number; + + /** + * Obtains userId about an launcher ability. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly userId: number; + + /** + * Obtains installTime about an launcher ability. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly installTime : number; +} diff --git a/api/bundleManager/metadata.d.ts b/api/bundleManager/metadata.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aa154973cd2677329fa6cbd3c417c493d5f906db --- /dev/null +++ b/api/bundleManager/metadata.d.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + + /** + * Indicates the Metadata + * @typedef Metadata + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export interface Metadata { + /** + * Indicates the metadata name + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + name: string; + + /** + * Indicates the metadata value + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + value: string; + + /** + * Indicates the metadata resource + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + resource: string; + } \ No newline at end of file diff --git a/api/bundleManager/packInfo.d.ts b/api/bundleManager/packInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1182243208569d5e0bd9e49c064a0ff0141ceee3 --- /dev/null +++ b/api/bundleManager/packInfo.d.ts @@ -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; + + /** + * 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} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly deviceTypes: Array; + + /** + * 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} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly modules: Array; +} + +/** + * 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} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly forms: Array; +} + +/** + * 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; + + /** + * 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} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly abilities: Array; + + /** + * Indicates extension abilities info of this module + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly extensionAbilities: Array; +} + +/** + * ModuleDistroInfo: the bundle info summary class. + * @typedef ModuleDistroInfo + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ +export interface ModuleDistroInfo { + /** + * Indicates is delivery with install + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly deliveryWithInstall: boolean; + + /** + * Indicates 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 is visible + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly visible: boolean; + + /** + * Indicates the ability forms info + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly forms: Array; +} + +/** + * 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 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} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly supportDimensions: Array; + + /** + * 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 min compatible code of this version + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly releaseType: string; + + /** + * Indicates the name of this version + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly compatible: number; + + /** + * Indicates the code of this version + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly target: number; +} diff --git a/api/bundleManager/permissionDef.d.ts b/api/bundleManager/permissionDef.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c1df5fb88b077cb6f1c931c72d27f1f5f25a282a --- /dev/null +++ b/api/bundleManager/permissionDef.d.ts @@ -0,0 +1,55 @@ +/* + * 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. + */ + +/** + * Indicates the defined permission details in file config.json + * @typedef PermissionDef + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + export interface PermissionDef { + /** + * Indicates the name of this permission + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + permissionName: string; + + /** + * Indicates the grant mode of this permission + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + grantMode: number; + + /** + * Indicates the labelId of this permission + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + labelId: number; + + /** + * Indicates the descriptionId of this permission + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + descriptionId: number; +} diff --git a/api/bundleManager/remoteAbilityInfo.d.ts b/api/bundleManager/remoteAbilityInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..16b91e764145cafa3951ae58a554bee555f6f55c --- /dev/null +++ b/api/bundleManager/remoteAbilityInfo.d.ts @@ -0,0 +1,49 @@ +/* + * 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 { ElementName } from './elementName'; + +/** + * Contains basic remote ability information. + * @typedef RemoteAbilityInfo + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ +export interface RemoteAbilityInfo { + /** + * Indicates the ability information + * @type {ElementName} + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @since 9 + */ + readonly elementName: ElementName; + + /** + * Indicates the label of the ability + * @type {string} + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @since 9 + */ + readonly label: string; + + /** + * Indicates the icon of the ability + * @type {string} + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @since 9 + */ + readonly icon: string; +} \ No newline at end of file diff --git a/api/bundleManager/shortcutInfo.d.ts b/api/bundleManager/shortcutInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e8763ab3f49cc10b65cf8fbd16ac2e2c680e0cfe --- /dev/null +++ b/api/bundleManager/shortcutInfo.d.ts @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2021 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. + */ + +/** + * Provides information about a shortcut, including the shortcut ID and label. + * @typedef ShortcutInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ +export interface ShortcutInfo { + /** + * Indicates the ID of the application to which this shortcut belongs + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly id: string; + + /** + * Indicates the name of the bundle containing the shortcut + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly bundleName: string; + + /** + * Indicates the moduleName of the shortcut + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly moduleName: string; + + /** + * Indicates the host ability of the shortcut + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly hostAbility: string; + + /** + * Indicates the icon of the shortcut + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly icon: string; + + /** + * Indicate s the icon id of the shortcut + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly iconId: number; + + /** + * Indicates the label of the shortcut + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly label: string; + + /** + * Indicates the label id of the shortcut + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly labelId: number; + + /** + * Indicates the wants of the shortcut + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly wants: Array; +} + +/** + * Obtains information about the ability that a shortcut will start. + * @typedef ShortcutWant + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ +export interface ShortcutWant{ + /** + * Indicates the target bundle of the shortcut want + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly targetBundle: string; + + /** + * Indicates the target module of the shortcut want + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly targetModule: string; + + /** + * Indicates the target ability of the shortcut want + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly targetAbility: string; +} \ No newline at end of file