ohos.bundle.bundle_manager (bundleManager Management)
Note:
Currently in the beta phase.
Provides capabilities to query information related to application packages, including applications (Application), modules (HAP Module), abilities (Ability), extension abilities (ExtensionAbility), permissions, signatures, and more.
Import Module
import kit.AbilityKit.*
Usage Instructions
API sample code usage instructions:
- If the first line of sample code contains a "// index.cj" comment, it indicates that the sample can be compiled and run in the "index.cj" file of the Cangjie template project.
- If the sample requires obtaining the Context application context, it needs to be configured in the "main_ability.cj" file of the Cangjie template project.
For details about the aforementioned sample project and configuration template, refer to Cangjie Sample Code Instructions.
class AbilityInfo
public class AbilityInfo {
public let bundleName: String
public let moduleName: String
public let name: String
public let label: String
public let labelId: Int32
public let description: String
public let descriptionId: Int32
public let icon: String
public let iconId: Int32
public let process: String
public let exported: Bool
public let orientation: DisplayOrientation
public let launchType: LaunchType
public let permissions: Array<String>
public let deviceTypes: Array<String>
public let applicationInfo: ApplicationInfo
public let metadata: Array<Metadata>
public let enabled: Bool
public let supportWindowModes: Array<SupportWindowMode>
public let windowSize: WindowSize
public let excludeFromDock: Bool
public let skills: Array<Skill>
public let appIndex: Int32
}
Function: Ability information. Third-party applications can obtain Ability information via getBundleInfoForSelf, where the input parameter bundleFlags must include at least GET_BUNDLE_INFO_WITH_HAP_MODULE and GET_BUNDLE_INFO_WITH_ABILITY.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let appIndex
public let appIndex: Int32
Function: The clone index identifier of the application package, effective only in clone applications.
Type: Int32
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let applicationInfo
public let applicationInfo: ApplicationInfo
Function: Configuration information of the application. Obtained by calling the getBundleInfoForSelf interface, with bundleFlags parameters passed as GET_BUNDLE_INFO_WITH_HAP_MODULE, GET_BUNDLE_INFO_WITH_ABILITY, and GET_BUNDLE_INFO_WITH_APPLICATION.
Type: ApplicationInfo
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let bundleName
public let bundleName: String
Function: Application Bundle name.
Type: String
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let description
public let description: String
Function: Description of the Ability.
Type: String
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let descriptionId
public let descriptionId: Int32
Function: Resource ID of the Ability's description.
Type: Int32
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let deviceTypes
public let deviceTypes: Array<String>
Function: Device types supported by the Ability.
Type: Array<String>
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let enabled
public let enabled: Bool
Function: Whether the Ability is enabled.
Type: Bool
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let excludeFromDock
public let excludeFromDock: Bool
Function: Determines whether the Ability can hide its icon in the dock area.
Type: Bool
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let exported
public let exported: Bool
Function: Determines whether the Ability can be called by other applications.
Type: Bool
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let icon
public let icon: String
Function: Icon resource descriptor of the Ability, e.g., "icon": "$media: icon".
Type: String
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let iconId
public let iconId: Int32
Function: Resource ID of the Ability's icon.
Type: Int32
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let label
public let label: String
Function: Resource descriptor of the Ability's display name to users, e.g., "label": "$string: mainability_description".
Type: String
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let labelId
public let labelId: Int32
Function: Resource ID of the Ability's label.
Type: Int32
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let launchType
public let launchType: LaunchType
Function: Launch mode of the Ability.
Type: LaunchType
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let metadata
public let metadata: Array<Metadata>
Function: Metadata of the Ability. Obtained by calling the getBundleInfoForSelf interface, with bundleFlags parameters passed as GET_BUNDLE_INFO_WITH_HAP_MODULE, GET_BUNDLE_INFO_WITH_ABILITY, and GET_BUNDLE_INFO_WITH_METADATA.
Type: Array<Metadata>
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let moduleName
public let moduleName: String
Function: Name of the HAP to which the Ability belongs.
Type: String
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let name
public let name: String
Function: Name of the Ability.
Type: String
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let orientation
public let orientation: DisplayOrientation
Function: Display mode of the Ability.
Type: DisplayOrientation
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let permissions
public let permissions: Array<String>
Function: Set of permissions required when calling the Ability from other applications. Obtained by calling the getBundleInfoForSelf interface, with bundleFlags parameters passed as GET_BUNDLE_INFO_WITH_HAP_MODULE, GET_BUNDLE_INFO_WITH_ABILITY, and GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION.
Type: Array<String>
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let process
public let process: String
Function: Process of the Ability. If not set, it defaults to the package name.
Type: String
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let skills
public let skills: Array<Skill>
Function: Skills information of the Ability.
Type: Array<Skill>
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let supportWindowModes
public let supportWindowModes: Array<SupportWindowMode>
Function: Window modes supported by the Ability.
Type: Array<SupportWindowMode>
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22
let windowSize
public let windowSize: WindowSize
Function: Window size of the Ability.
Type: WindowSize
Read-Write Capability: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Initial Version: 22## class ApplicationInfo
public class ApplicationInfo {
public let name: String
public let description: String
public let descriptionId: Int32
public let enabled: Bool
public let label: String
public let labelId: Int32
public let icon: String
public let iconId: Int32
public let process: String
public let permissions: Array<String>
public let codePath: String
public let metadataArray: Array<ModuleMetadata>
public let removable: Bool
public let accessTokenId: UInt32
public let uid: Int32
public let iconResource: AppResource
public let labelResource: AppResource
public let descriptionResource: AppResource
public let appDistributionType: String
public let appProvisionType: String
public let systemApp: Bool
public let bundleType: BundleType
public let debug: Bool
public let dataUnclearable: Bool
public let cloudFileSyncEnabled: Bool
public let nativeLibraryPath: String
public let multiAppMode: MultiAppMode
public let appIndex: Int32
public let installSource: String
public let releaseType: String
}
Description: Configuration information of an application. Third-party applications can obtain their own application information through getBundleInfoForSelf, where the input parameter bundleFlags must at least include GET_BUNDLE_INFO_WITH_APPLICATION.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let accessTokenId
public let accessTokenId: UInt32
Description: The accessTokenId of the application.
Type: UInt32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let appDistributionType
public let appDistributionType: String
Description: The distribution type of the application's signing certificate, which can be: app_gallery, enterprise, os_integration, or crowdtesting.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let appIndex
public let appIndex: Int32
Description: The clone index identifier of the application package, only effective in clone applications.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let appProvisionType
public let appProvisionType: String
Description: The type of the application's signing certificate file, which can be either debug or release.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let bundleType
public let bundleType: BundleType
Description: Identifies the type of the package, which can be APP (application) or ATOMIC_SERVICE (atomic service).
Type: BundleType
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let cloudFileSyncEnabled
public let cloudFileSyncEnabled: Bool
Description: Indicates whether the current application has cloud file synchronization enabled. true means the current application has cloud file synchronization enabled, false means it does not.
Type: Bool
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let codePath
public let codePath: String
Description: The installation directory of the application.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let dataUnclearable
public let dataUnclearable: Bool
Description: Indicates whether the application data can be deleted. true means it cannot be deleted, false means it can. Default is false.
Type: Bool
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let debug
public let debug: Bool
Description: Indicates whether the application is in debug mode. Default is false.
Type: Bool
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let description
public let description: String
Description: The description information of the application, for example: "description": "$string: mainability_description". For detailed information about description, refer to the descriptionResource field.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let descriptionId
public let descriptionId: Int32
Description: The resource ID of the application's description information.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let descriptionResource
public let descriptionResource: AppResource
Description: The description resource information of the application, including bundleName, moduleName, and resource ID. The detailed resource data can be obtained by calling the globalization interface getMediaContent.
Type: AppResource
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let enabled
public let enabled: Bool
Description: Determines whether the application can be used. Default is true.
Type: Bool
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let icon
public let icon: String
Description: The icon of the application, for example: "icon": "$media: icon". For detailed information about icon, refer to the iconResource field.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let iconId
public let iconId: Int32
Description: The resource ID of the application's icon.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let iconResource
public let iconResource: AppResource
Description: The icon resource information of the application, including bundleName, moduleName, and resource ID. The detailed resource data can be obtained by calling the globalization interface getMediaContent.
Type: AppResource
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let installSource
public let installSource: String
Description: The installation source of the application. pre-installed means the application is pre-installed, a package name format means the application was installed by the application corresponding to the package name, unknown means the installation source is unknown.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let label
public let label: String
Description: The name of the application, for example: "label": "$string: mainability_description". For detailed information about label, refer to the labelResource field.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let labelId
public let labelId: Int32
Description: The resource ID of the application's name.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let labelResource
public let labelResource: AppResource
Description: The label resource information of the application, including bundleName, moduleName, and resource ID. The detailed resource data can be obtained by calling the globalization interface getMediaContent.
Type: AppResource
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let metadataArray
public let metadataArray: Array<ModuleMetadata>
Description: The metadata of the application. Obtained by calling the getBundleInfoForSelf interface, with bundleFlags parameter including GET_BUNDLE_INFO_WITH_APPLICATION and GET_BUNDLE_INFO_WITH_METADATA.
Type: Array<ModuleMetadata>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let multiAppMode
public let multiAppMode: MultiAppMode
Description: The multi-instance mode of the application.
Type: MultiAppMode
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let name
public let name: String
Description: The name of the application.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let nativeLibraryPath
public let nativeLibraryPath: String
Description: The path of the application's native library files.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let permissions
public let permissions: Array<String>
Description: The permissions required to access the application. Obtained by calling the getBundleInfoForSelf interface, with bundleFlags parameter including GET_BUNDLE_INFO_WITH_APPLICATION and GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION.
Type: Array<String>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let process
public let process: String
Description: The process of the application. If not set, it defaults to the package name.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let releaseType
public let releaseType: String
Description: Identifies the release type of the SDK used when packaging the application. Current SDK release types may include Canary, Beta, and Release, where Canary and Beta may be further subdivided by sequence numbers, such as Canary1, Canary2, Beta1, Beta2, etc. Developers can compare the SDK release type used for application packaging with the OS release type (deviceInfo.distributionOSReleaseType) to determine compatibility.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let removable
public let removable: Bool
Description: Whether the application can be removed.
Type: Bool
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let systemApp
public let systemApp: Bool
Description: Indicates whether the application is a system application.
Type: Bool
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let uid
public let uid: Int32
Description: The uid of the application.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22## class BundleFlag
public class BundleFlag {
public static const GET_BUNDLE_INFO_DEFAULT: Int32 = 0x00000000
public static const GET_BUNDLE_INFO_WITH_APPLICATION: Int32 = 0x00000001
public static const GET_BUNDLE_INFO_WITH_HAP_MODULE: Int32 = 0x00000002
public static const GET_BUNDLE_INFO_WITH_ABILITY: Int32 = 0x00000004
public static const GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY: Int32 = 0x00000008
public static const GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION: Int32 = 0x00000010
public static const GET_BUNDLE_INFO_WITH_METADATA: Int32 = 0x00000020
public static const GET_BUNDLE_INFO_WITH_DISABLE: Int32 = 0x00000040
public static const GET_BUNDLE_INFO_WITH_SIGNATURE_INFO: Int32 = 0x00000080
public static const GET_BUNDLE_INFO_WITH_MENU: Int32 = 0x00000100
public static const GET_BUNDLE_INFO_WITH_ROUTER_MAP: Int32 = 0x00000200
public static const GET_BUNDLE_INFO_WITH_SKILL: Int32 = 0x00000800
}
Description: Bundle information flags indicating the content of bundle information to be retrieved.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
static const GET_BUNDLE_INFO_DEFAULT
public static const GET_BUNDLE_INFO_DEFAULT: Int32 = 0x00000000
Description: Retrieves only the most basic bundle information. The obtained bundle information does not include HAP module information, application information, signature information, or requested permission information.
Type: Int32
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
static const GET_BUNDLE_INFO_WITH_ABILITY
public static const GET_BUNDLE_INFO_WITH_ABILITY: Int32 = 0x00000004
Description: Must be specified together with GET_BUNDLE_INFO_WITH_HAP_MODULE to include ability information in the obtained HAP module information, excluding metadata in the ability information.
Type: Int32
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
static const GET_BUNDLE_INFO_WITH_APPLICATION
public static const GET_BUNDLE_INFO_WITH_APPLICATION: Int32 = 0x00000001
Description: On top of the most basic bundle information, includes application information, excluding metadata in the application information.
Type: Int32
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
static const GET_BUNDLE_INFO_WITH_DISABLE
public static const GET_BUNDLE_INFO_WITH_DISABLE: Int32 = 0x00000040
Description: Used to retrieve BundleInfo where the application is disabled and disabled Ability information. The obtained bundleInfo does not include signatureInfo, applicationInfo, hapModuleInfo, ability, extensionAbility, or permission information.
Type: Int32
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
static const GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY
public static const GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY: Int32 = 0x00000008
Description: Must be specified together with GET_BUNDLE_INFO_WITH_HAP_MODULE to include extension ability information in the obtained HAP module information, excluding metadata in the extension ability information.
Type: Int32
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
static const GET_BUNDLE_INFO_WITH_HAP_MODULE
public static const GET_BUNDLE_INFO_WITH_HAP_MODULE: Int32 = 0x00000002
Description: On top of the most basic bundle information, includes HAP module information, excluding ability information, extension ability information, and metadata in the HAP module information.
Type: Int32
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
static const GET_BUNDLE_INFO_WITH_MENU
public static const GET_BUNDLE_INFO_WITH_MENU: Int32 = 0x00000100
Description: Used to retrieve bundleInfo containing fileContextMenuConfig. It cannot be used alone and must be used together with GET_BUNDLE_INFO_WITH_HAP_MODULE.
Type: Int32
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
static const GET_BUNDLE_INFO_WITH_METADATA
public static const GET_BUNDLE_INFO_WITH_METADATA: Int32 = 0x00000020
Description: Retrieves all metadata, including metadata in HAP module information, ability information, extension ability information, and application information. Therefore, it must be specified together with GET_BUNDLE_INFO_WITH_HAP_MODULE, GET_BUNDLE_INFO_WITH_ABILITY, GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY, and GET_BUNDLE_INFO_WITH_APPLICATION.
Type: Int32
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
static const GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION
public static const GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION: Int32 = 0x00000010
Description: On top of the most basic bundle information, includes requested permission information.
Type: Int32
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
static const GET_BUNDLE_INFO_WITH_ROUTER_MAP
public static const GET_BUNDLE_INFO_WITH_ROUTER_MAP: Int32 = 0x00000200
Description: Used to retrieve bundleInfo containing routerMap. It cannot be used alone and must be used together with GET_BUNDLE_INFO_WITH_HAP_MODULE.
Type: Int32
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
static const GET_BUNDLE_INFO_WITH_SIGNATURE_INFO
public static const GET_BUNDLE_INFO_WITH_SIGNATURE_INFO: Int32 = 0x00000080
Description: Used to retrieve bundleInfo containing signatureInfo. The obtained bundleInfo does not include applicationInfo, hapModuleInfo, extensionAbility, ability, or permission information.
Type: Int32
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
static const GET_BUNDLE_INFO_WITH_SKILL
public static const GET_BUNDLE_INFO_WITH_SKILL: Int32 = 0x00000800
Description: Used to retrieve bundleInfo containing skills. It cannot be used alone and must be used together with GET_BUNDLE_INFO_WITH_HAP_MODULE, GET_BUNDLE_INFO_WITH_ABILITY, and GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY.
Type: Int32
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
class BundleInfo
public class BundleInfo {
public let name: String
public let vendor: String
public let versionCode: UInt32
public let versionName: String
public let minCompatibleVersionCode: UInt32
public let targetVersion: UInt32
public let appInfo: ApplicationInfo
public let hapModulesInfo: Array<HapModuleInfo>
public let reqPermissionDetails: Array<ReqPermissionDetail>
public let permissionGrantStates: Array<PermissionGrantState>
public let signatureInfo: SignatureInfo
public let installTime: Int64
public let updateTime: Int64
public let routerMap: Array<RouterItem>
public let appIndex: Int32
}
Description: Bundle information. Third-party applications can retrieve their own bundle information through getBundleInfoForSelf, where the bundleFlags parameter specifies the information to be included in the returned BundleInfo.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let appIndex
public let appIndex: Int32
Description: The clone index identifier of the application bundle, effective only in clone applications.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let appInfo
public let appInfo: ApplicationInfo
Description: Configuration information of the application. Obtained by calling the getBundleInfoForSelf interface with the bundleFlags parameter set to GET_BUNDLE_INFO_WITH_APPLICATION.
Type: ApplicationInfo
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let hapModulesInfo
public let hapModulesInfo: Array<HapModuleInfo>
Description: Configuration information of the module. Obtained by calling the getBundleInfoForSelf interface with the bundleFlags parameter set to GET_BUNDLE_INFO_WITH_HAP_MODULE.
Type: Array<HapModuleInfo>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let installTime
public let installTime: Int64
Description: Installation time of the application bundle.
Type: Int64
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let minCompatibleVersionCode
public let minCompatibleVersionCode: UInt32
Description: Minimum compatible version of the application bundle in distributed scenarios.
Type: UInt32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let name
public let name: String
Description: Name of the application bundle.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let permissionGrantStates
public let permissionGrantStates: Array<PermissionGrantState>
Description: Grant states of requested permissions. Obtained by calling the getBundleInfoForSelf interface with the bundleFlags parameter set to GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION.
Type: Array<PermissionGrantState>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let reqPermissionDetails
public let reqPermissionDetails: Array<ReqPermissionDetail>
Description: Detailed information of the permission set that the application needs to request from the system during runtime. Obtained by calling the getBundleInfoForSelf interface with the bundleFlags parameter set to GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION.
Type: Array<ReqPermissionDetail>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let routerMap
public let routerMap: Array<RouterItem>
Description: Router table configuration of the application, obtained by deduplicating and merging routerMap information under hapModulesInfo based on the name field in RouterItem. Obtained by calling the getBundleInfoForSelf interface with the bundleFlags parameter set to GET_BUNDLE_INFO_WITH_HAP_MODULE and GET_BUNDLE_INFO_WITH_ROUTER_MAP.
Type: Array<RouterItem>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let signatureInfo
public let signatureInfo: SignatureInfo
Description: Signature information of the application bundle. Obtained by calling the getBundleInfoForSelf interface with the bundleFlags parameter set to GET_BUNDLE_INFO_WITH_SIGNATURE_INFO.
Type: SignatureInfo
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let targetVersion
public let targetVersion: UInt32
Description: This tag identifies the target version of the application.
Type: UInt32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let updateTime
public let updateTime: Int64
Description: Update time of the application bundle.
Type: Int64
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let vendor
public let vendor: String
Description: Vendor of the application bundle.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let versionCode
public let versionCode: UInt32
Description: Version code of the application bundle.
Type: UInt32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let versionName
public let versionName: String
Description: Version description text of the application bundle.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22## class BundleManager
public class BundleManager {}
Description: A class that provides methods for querying bundle information.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
static func canOpenLink(String)
public static func canOpenLink(link: String): Bool
Description: Queries whether a given link can be opened. The scheme of the specified link must be configured in the querySchemes field of the module.json5 file.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| link | String | Yes | - | The link to be queried. |
Return Value:
| Type | Description |
|---|---|
| Bool | Returns true if the given link can be opened; returns false otherwise. |
Exceptions:
-
BusinessException: The error codes are as follows. For details, see Common Error Codes for Package Management Subsystem.
Error Code ID Error Message 17700055 The specified link is invalid. 17700056 The scheme of the specified link is not in the querySchemes.
Example:
// index.cj
import kit.AbilityKit.*
import ohos.business_exception.BusinessException
import kit.PerformanceAnalysisKit.Hilog
try {
let link = "app1Scheme://test.example.com/home"
let canOpen = BundleManager.canOpenLink(link)
} catch (e: BusinessException) {
Hilog.info(0, "test", "${e.message}")
}
static func getBundleInfoForSelf(Int32)
public static func getBundleInfoForSelf(bundleFlags: Int32): BundleInfo
Description: Obtains the BundleInfo of the current application based on the given bundleFlags.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| bundleFlags | Int32 | Yes | - | Specifies the information to be included in the returned BundleInfo. For details, see BundleFlag. |
Return Value:
| Type | Description |
|---|---|
| BundleInfo | The BundleInfo object of the current application. |
Example:
// index.cj
import kit.AbilityKit.*
import ohos.business_exception.BusinessException
import kit.PerformanceAnalysisKit.Hilog
try {
let bundleFlags = BundleFlag.GET_BUNDLE_INFO_DEFAULT | BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY
let res = BundleManager.getBundleInfoForSelf(bundleFlags)
} catch (e: BusinessException) {
Hilog.info(0, "test", "${e.message}")
}
static func getProfileByAbility(String, String, String)
public static func getProfileByAbility(moduleName: String, abilityName: String, metadataName!: String = ""): Array<String>
Description: Obtains the JSON-formatted string of the corresponding configuration file based on the given moduleName, abilityName, and metadataName (the name under the metadata tag in module.json). The return value is a String array.
If the configuration information resource uses referenced resources in the resource file, the returned JSON string will maintain the resource reference string format, such as $string: myResourceID, where myResourceID is the resource ID automatically assigned to the resource during the project build process. Developers can use the relevant interfaces in the ohos/resource_manager package to obtain such referenced resources.
If the configuration file information uses the resource reference format, the return value will maintain the resource reference format (for example, $string: res_id). Developers can use the relevant interfaces of the resource management module to obtain the referenced resources.
Note:
- The configuration information resources of the ability are defined under the
module.abilities[].metadatatag in the corresponding module.json5 file.- The data content of the configuration information resource is returned in a compact JSON string format.
- An ability can have zero to multiple configuration information resources.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| moduleName | String | Yes | - | The name of the target module. |
| abilityName | String | Yes | - | The name of the target ability. |
| metadataName | String | No | "" | Named parameter. The name of the target configuration information resource. The metadata name of the component, that is, the name of the metadata tag under the abilities tag in the module.json5 configuration file. - When metadataName is the name of a configuration information resource of the target ability, only the data content of that configuration information will be returned. In this case, the returned array contains only one element.- When metadataName is omitted or is an empty string, the data content of all configuration information of the ability determined by the module name and ability name will be returned. In this case, the returned array contains zero to multiple elements. |
Return Value:
| Type | Description |
|---|---|
| Array<String> | Returns an array of JSON strings of the matched configuration information. If metadataName is specified and exists, only one element is returned. If metadataName is not specified or is empty, all configuration information of the ability is returned, which may be empty. If the configuration information contains resource references (for example, $string: res_id), the return value maintains the reference string, which needs to be parsed with the resource management interface. |
Exceptions:
-
BusinessException: The error codes are as follows. For details, see Common Error Codes for Package Management Subsystem.
Error Code ID Error Message 17700002 The specified moduleName is not existed. 17700003 The specified abilityName is not existed. 17700024 Failed to get the profile because there is no profile in the HAP. 17700026 The specified bundle is disabled. 17700029 The specified ability is disabled.
Example:
// index.cj
import kit.AbilityKit.*
import ohos.business_exception.BusinessException
import kit.PerformanceAnalysisKit.Hilog
try {
let moduleName = "entry"
let abilityName = "EntryAbility"
let infoList = BundleManager.getProfileByAbility(moduleName, abilityName)
} catch (e: BusinessException) {
Hilog.info(0, "test", "${e.message}")
}
static func getProfileByExtensionAbility(String, String, String)
public static func getProfileByExtensionAbility(moduleName: String, extensionAbilityName: String,
metadataName!: String = ""): Array<String>
Description: Obtains the JSON-formatted string of the corresponding configuration file based on the given moduleName, extensionAbilityName, and metadataName (the name under the metadata tag in module.json). The return value is a String array.
If the configuration information resource uses referenced resources in the resource file, the returned JSON string will maintain the resource reference string format, such as $string: myResourceID, where myResourceID is the resource ID automatically assigned to the resource during the project build process. Developers can use the relevant interfaces in the ohos/resource_manager package to obtain such referenced resources.
If the configuration file information uses the resource reference format, the return value will maintain the resource reference format (for example, $string: res_id). Developers can use the relevant interfaces of the resource management module to obtain the referenced resources.
Note:
- The configuration information resources of the extension ability are defined under the
module.extensionAbilities[].metadatatag in the corresponding module.json5 file.- The data content of the configuration information resource is returned in a compact JSON string format.
- An extension ability can have zero to multiple configuration information resources.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| moduleName | String | Yes | - | The name of the target module. |
| extensionAbilityName | String | Yes | - | The name of the target extension ability. |
| metadataName | String | No | "" | Named parameter. The name of the target configuration information resource. The metadata name of the component, that is, the name of the metadata tag under the extensionAbilities tag in the module.json5 configuration file. The default value is empty. - When metadataName is the name of a configuration information resource of the target extension ability, only the data content of that configuration information will be returned. In this case, the returned array contains only one element.- When metadataName is omitted or is an empty string, the data content of all configuration information of the extension ability determined by the module name and extension ability name will be returned. In this case, the returned array contains zero to multiple elements. |
Return Value:
| Type | Description |
|---|---|
| Array<String> | Returns an array of JSON strings of the matched configuration information. If metadataName is specified and exists, only one element is returned. If metadataName is not specified or is empty, all configuration information determined by the module name and extension ability name is returned, which may be empty. If the configuration information contains resource references (for example, $string: res_id), the return value maintains the reference string, which needs to be parsed with the resource management interface. |
Exceptions:
-
BusinessException: The error codes are as follows. For details, see Common Error Codes for Package Management Subsystem.
Error Code ID Error Message 17700002 The specified moduleName is not existed. 17700003 The specified extensionAbilityName not existed. 17700024 Failed to get the profile because there is no profile in the HAP. 17700026 The specified bundle is disabled.
Example:
// index.cj
import kit.AbilityKit.*
import ohos.business_exception.BusinessException
import kit.PerformanceAnalysisKit.Hilog
try {
let moduleName = "entry"
let extensionAbilityName = "EntryFormAbility"
let metadataName = "ohos.extension.form"
let info = BundleManager.getProfileByExtensionAbility(moduleName, extensionAbilityName, metadataName: metadataName)
} catch (e: BusinessException) {
Hilog.info(0, "test", "${e.message}")
}
class DataItem
public class DataItem {
public let key: String
public let value: String
}
Description: Describes custom data in the routing table configured by the module.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let key
public let key: String
Description: Identifies the key of the custom data in the routing table.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let value
public let value: String
Description: Identifies the value of the custom data in the routing table.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
class DefaultAppManager
public class DefaultAppManager {}
Description: This class provides the capability to query default applications, supporting queries to determine whether the current application is the default application.
System Capability: SystemCapability.BundleManager.BundleFramework.DefaultApp
Since: 22
static func isDefaultApplication(String)
public static func isDefaultApplication(appType: String): Bool
Description: Determines whether the current application is the default application of the specified type based on the application types predefined by the system.
System Capability: SystemCapability.BundleManager.BundleFramework.DefaultApp
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| appType | String | Yes | - | The application type to query. The value is from ApplicationType. |
Return Value:
| Type | Description |
|---|---|
| Bool | Returns whether the current application is the default application. true indicates that the current application is the default application; false indicates the opposite. |
Exceptions:
-
BusinessException: The error codes are as follows. For details, see Universal Error Codes.
Error Code ID Error Message 801 Capability not supported.
Example:
// index.cj
import kit.AbilityKit.*
import ohos.business_exception.BusinessException
import kit.PerformanceAnalysisKit.Hilog
try {
let tag = DefaultAppManager.isDefaultApplication(ApplicationType.Image.getValue())
} catch (e: BusinessException) {
Hilog.info(0, "test", "${e.message}")
}
class Dependency
public class Dependency {
public let bundleName: String
public let moduleName: String
public let versionCode: UInt32
}
Description: Describes the dynamic shared library information on which the module depends.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let bundleName
public let bundleName: String
Description: Identifies the bundle name of the shared library on which the current module depends.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let moduleName
public let moduleName: String
Description: Identifies the module name of the shared library on which the current module depends.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let versionCode
public let versionCode: UInt32
Description: Identifies the version code of the current shared library.
Type: UInt32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22## class ExtensionAbilityInfo
public class ExtensionAbilityInfo {
public let bundleName: String
public let moduleName: String
public let name: String
public let labelId: Int32
public let descriptionId: Int32
public let iconId: Int32
public let exported: Bool
public let extensionAbilityType: ExtensionAbilityType
public let permissions: Array<String>
public let applicationInfo: ApplicationInfo
public let metadata: Array<Metadata>
public let enabled: Bool
public let readPermission: String
public let writePermission: String
public let extensionAbilityTypeName: String
public let skills: Array<Skill>
public let appIndex: Int32
}
Function: ExtensionAbility information. Third-party applications can obtain their own ExtensionAbility information through getBundleInfoForSelf, where the input parameter bundleFlags must include at least GET_BUNDLE_INFO_WITH_HAP_MODULE and GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let appIndex
public let appIndex: Int32
Function: The clone index identifier of the application package, only effective in clone applications.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let applicationInfo
public let applicationInfo: ApplicationInfo
Function: Configuration information of the application.
Type: ApplicationInfo
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let bundleName
public let bundleName: String
Function: Bundle name of the application.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let descriptionId
public let descriptionId: Int32
Function: Resource ID of the ExtensionAbility description.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let enabled
public let enabled: Bool
Function: Whether the ExtensionAbility is enabled.
Type: Bool
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let exported
public let exported: Bool
Function: Determines whether the ExtensionAbility can be called by other applications.
Type: Bool
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let extensionAbilityType
public let extensionAbilityType: ExtensionAbilityType
Function: Type of the ExtensionAbility.
Type: ExtensionAbilityType
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let extensionAbilityTypeName
public let extensionAbilityTypeName: String
Function: Name of the ExtensionAbility type.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let iconId
public let iconId: Int32
Function: Resource ID of the ExtensionAbility icon.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let labelId
public let labelId: Int32
Function: Resource ID of the ExtensionAbility label.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let metadata
public let metadata: Array<Metadata>
Function: Metadata of the ExtensionAbility.
Type: Array<Metadata>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let moduleName
public let moduleName: String
Function: Name of the HAP to which the ExtensionAbility belongs.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let name
public let name: String
Function: Name of the ExtensionAbility.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let permissions
public let permissions: Array<String>
Function: Set of permissions required when calling the ExtensionAbility from other applications.
Type: Array<String>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let readPermission
public let readPermission: String
Function: Permission required to read data from the ExtensionAbility.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let skills
public let skills: Array<Skill>
Function: Skills information of the ExtensionAbility.
Type: Array<Skill>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let writePermission
public let writePermission: String
Function: Permission required to write data to the ExtensionAbility.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
class HapModuleInfo
public class HapModuleInfo {
public let name: String
public let icon: String
public let iconId: Int32
public let label: String
public let labelId: Int32
public let description: String
public let descriptionId: Int32
public let mainElementName: String
public let abilitiesInfo: Array<AbilityInfo>
public let extensionAbilitiesInfo: Array<ExtensionAbilityInfo>
public let metadata: Array<Metadata>
public let deviceTypes: Array<String>
public let installationFree: Bool
public let hashValue: String
public let moduleType: ModuleType
public let preloads: Array<PreloadItem>
public let dependencies: Array<Dependency>
public let fileContextMenuConfig: String
public let routerMap: Array<RouterItem>
public let codePath: String
public let nativeLibraryPath: String
}
Function: HAP information. Third-party applications can obtain their own HAP information through getBundleInfoForSelf, where the input parameter bundleFlags must include at least GET_BUNDLE_INFO_WITH_HAP_MODULE.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let abilitiesInfo
public let abilitiesInfo: Array<AbilityInfo>
Function: Ability information.
Type: Array<AbilityInfo>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let codePath
public let codePath: String
Function: Installation path of the module.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let dependencies
public let dependencies: Array<Dependency>
Function: List of dynamic shared libraries that the module depends on for operation.
Type: Array<Dependency>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let description
public let description: String
Function: Description information of the module.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let descriptionId
public let descriptionId: Int32
Function: Resource ID of the description information.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let deviceTypes
public let deviceTypes: Array<String>
Function: Device types that can run the module.
Type: Array<String>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let extensionAbilitiesInfo
public let extensionAbilitiesInfo: Array<ExtensionAbilityInfo>
Function: ExtensionAbility information.
Type: Array<ExtensionAbilityInfo>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let fileContextMenuConfig
public let fileContextMenuConfig: String
Function: File menu configuration of the module.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let hashValue
public let hashValue: String
Function: Hash value of the module.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let icon
public let icon: String
Function: Icon of the module.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let iconId
public let iconId: Int32
Function: Resource ID of the module icon.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let installationFree
public let installationFree: Bool
Function: Whether the module supports installation-free.
Type: Bool
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let label
public let label: String
Function: Label of the module.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let labelId
public let labelId: Int32
Function: Resource ID of the module label.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let mainElementName
public let mainElementName: String
Function: Entry ability information.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let metadata
public let metadata: Array<Metadata>
Function: Metadata of the Ability.
Type: Array<Metadata>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let moduleType
public let moduleType: ModuleType
Function: Identifies the type of the current module.
Type: ModuleType
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let name
public let name: String
Function: Name of the module.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let nativeLibraryPath
public let nativeLibraryPath: String
Function: Path to the native library files of a hapModule within the application.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let preloads
public let preloads: Array<PreloadItem>
Function: Preload list of the module in the meta service.
Type: Array<PreloadItem>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let routerMap
public let routerMap: Array<RouterItem>
Function: Router map configuration of the module. Obtained by calling the getBundleInfoForSelf interface, with the bundleFlags parameter passing the values of GET_BUNDLE_INFO_WITH_HAP_MODULE and GET_BUNDLE_INFO_WITH_ROUTER_MAP.
Type: Array<RouterItem>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22## class ModuleMetadata
public class ModuleMetadata {
public let moduleName: String
public let metadata: Array<Metadata>
}
Description: Describes the metadata information of a module.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let metadata
public let metadata: Array<Metadata>
Description: List of metadata information under this module.
Type: Array<Metadata>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let moduleName
public let moduleName: String
Description: Module name.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
class MultiAppMode
public class MultiAppMode {
public let multiAppModeType: MultiAppModeType
public let maxCount: Int32
}
Description: Represents the multi-instance mode of an application.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let maxCount
public let maxCount: Int32
Description: Indicates the maximum number of instances (clones/multi-instances) allowed for the application in the current multi-instance mode.
Type: Int32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let multiAppModeType
public let multiAppModeType: MultiAppModeType
Description: Type of the application's multi-instance mode.
Type: MultiAppModeType
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
class PreloadItem
public class PreloadItem {
public let moduleName: String
}
Description: Describes the preload module information in a meta-service module.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let moduleName
public let moduleName: String
Description: Module name that will be automatically preloaded by the system during runtime.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
class ReqPermissionDetail
public class ReqPermissionDetail {
public var name: String
public var moduleName: String
public var reason: String
public var reasonId: Int32
public var usedScene: UsedScene
}
Description: Detailed information about the set of permissions that an application needs to request from the system during runtime.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
var moduleName
public var moduleName: String
Description: Name of the module requesting this permission.
Type: String
Access: Read-write
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
var name
public var name: String
Description: Name of the permission to be used.
Type: String
Access: Read-write
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
var reason
public var reason: String
Description: Describes the reason for requesting the permission.
Type: String
Access: Read-write
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
var reasonId
public var reasonId: Int32
Description: Describes the reason ID for requesting the permission.
Type: Int32
Access: Read-write
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
var usedScene
public var usedScene: UsedScene
Description: Scenarios and timing for using the permission.
Type: UsedScene
Access: Read-write
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
class RouterItem
public class RouterItem {
public let name: String
public let pageSourceFile: String
public let buildFunction: String
public let data: Array<DataItem>
public let customData: String
}
Description: Describes the routing table information configured for a module.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let buildFunction
public let buildFunction: String
Description: Identifies the function decorated with @Builder, which describes the UI of the page.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let customData
public let customData: String
Description: Identifies custom data of any type in the routing table configuration file.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let data
public let data: Array<DataItem>
Description: Identifies the string-type custom data in the routing table configuration file (i.e., the information in the data field), which has been parsed by the system and does not require manual parsing by developers.
Type: Array<DataItem>
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let name
public let name: String
Description: Identifies the name of the page to navigate to.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let pageSourceFile
public let pageSourceFile: String
Description: Identifies the path of the page within the module.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
class SignatureInfo
public class SignatureInfo {
public let appId: String
public let fingerprint: String
public let appIdentifier: String
}
Description: Describes the signature information of an application package.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let appId
public let appId: String
Description: The appId of the application.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let appIdentifier
public let appIdentifier: String
Description: The unique identifier of the application, uniformly assigned by the cloud. This ID remains unchanged throughout the application's lifecycle, including version upgrades, certificate changes, developer key pair changes, application transfers, etc.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let fingerprint
public let fingerprint: String
Description: Fingerprint information of the application package.
Type: String
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
class UsedScene
public class UsedScene {
public var abilities: Array<String>
public var when: String
}
Description: Describes the scenarios and timing for using a permission.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
var abilities
public var abilities: Array<String>
Description: Collection of Abilities that use this permission.
Type: Array<String>
Access: Read-write
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
var when
public var when: String
Description: Timing for using this permission.
Type: String
Access: Read-write
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22## class WindowSize
public class WindowSize {
public let maxWindowRatio: Float64
public let minWindowRatio: Float64
public let maxWindowWidth: UInt32
public let minWindowWidth: UInt32
public let maxWindowHeight: UInt32
public let minWindowHeight: UInt32
}
Function: Describes window dimensions.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let maxWindowHeight
public let maxWindowHeight: UInt32
Function: Indicates the maximum height of a window in free window state, measured in vp units.
Type: UInt32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let maxWindowRatio
public let maxWindowRatio: Float64
Function: Indicates the maximum aspect ratio (width/height) of a window in free window state, ranging from 0 to 1.
Type: Float64
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let maxWindowWidth
public let maxWindowWidth: UInt32
Function: Indicates the maximum width of a window in free window state, measured in vp units.
Type: UInt32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let minWindowHeight
public let minWindowHeight: UInt32
Function: Indicates the minimum height of a window in free window state, measured in vp units.
Type: UInt32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let minWindowRatio
public let minWindowRatio: Float64
Function: Indicates the minimum aspect ratio (width/height) of a window in free window state, ranging from 0 to 1.
Type: Float64
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
let minWindowWidth
public let minWindowWidth: UInt32
Function: Indicates the minimum width of a window in free window state, measured in vp units.
Type: UInt32
Access: Read-only
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
enum ApplicationType
public enum ApplicationType {
| Browser
| Image
| Audio
| Video
| Pdf
| Word
| Excel
| Ppt
| Email
| ...
}
Function: Application types for default apps.
System Capability: SystemCapability.BundleManager.BundleFramework.DefaultApp
Since: 22
Audio
Audio
Function: Default audio player.
System Capability: SystemCapability.BundleManager.BundleFramework.DefaultApp
Since: 22
Browser
Browser
Function: Default browser.
System Capability: SystemCapability.BundleManager.BundleFramework.DefaultApp
Since: 22
Email
Function: Default email client.
System Capability: SystemCapability.BundleManager.BundleFramework.DefaultApp
Since: 22
Excel
Excel
Function: Default Excel document viewer.
System Capability: SystemCapability.BundleManager.BundleFramework.DefaultApp
Since: 22
Image
Image
Function: Default image viewer.
System Capability: SystemCapability.BundleManager.BundleFramework.DefaultApp
Since: 22
Pdf
Function: Default PDF document viewer.
System Capability: SystemCapability.BundleManager.BundleFramework.DefaultApp
Since: 22
Ppt
Ppt
Function: Default PowerPoint document viewer.
System Capability: SystemCapability.BundleManager.BundleFramework.DefaultApp
Since: 22
Video
Video
Function: Default video player.
System Capability: SystemCapability.BundleManager.BundleFramework.DefaultApp
Since: 22
Word
Word
Function: Default Word document viewer.
System Capability: SystemCapability.BundleManager.BundleFramework.DefaultApp
Since: 22
func getValue()
public func getValue(): String
Function: Gets the enumeration value.
System Capability: SystemCapability.BundleManager.BundleFramework.DefaultApp
Since: 22
Return Value:
| Type | Description |
|---|---|
| String | The enumeration value. |
enum BundleType
public enum BundleType {
| App
| AtomicService
| ...
}
Function: Identifies the type of application.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
App
App
Function: The bundle is an application.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
AtomicService
AtomicService
Function: The bundle is an atomic service.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
enum DisplayOrientation
public enum DisplayOrientation {
| Unspecified
| Landscape
| Portrait
| FollowRecent
| LandscapeInverted
| PortraitInverted
| AutoRotation
| AutoRotationLandscape
| AutoRotationPortrait
| AutoRotationRestricted
| AutoRotationLandscapeRestricted
| AutoRotationPortraitRestricted
| Locked
| AutoRotationUnspecified
| FollowDesktop
| ...
}
Function: Identifies the display mode of the Ability. This tag only applies to page-type Abilities.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
AutoRotation
AutoRotation
Function: Indicates sensor-based auto-rotation mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
AutoRotationLandscape
AutoRotationLandscape
Function: Indicates sensor-based auto-landscape rotation mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
AutoRotationLandscapeRestricted
AutoRotationLandscapeRestricted
Function: Indicates switch-controlled auto-landscape rotation mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
AutoRotationPortrait
AutoRotationPortrait
Function: Indicates sensor-based auto-portrait rotation mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
AutoRotationPortraitRestricted
AutoRotationPortraitRestricted
Function: Indicates switch-controlled auto-portrait rotation mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
AutoRotationRestricted
AutoRotationRestricted
Function: Indicates switch-controlled auto-rotation mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
AutoRotationUnspecified
AutoRotationUnspecified
Function: Indicates switch-controlled and system-determined auto-rotation mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
FollowDesktop
FollowDesktop
Function: Follows desktop rotation mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
FollowRecent
FollowRecent
Function: Follows the previous display mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Landscape
Landscape
Function: Indicates landscape display mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
LandscapeInverted
LandscapeInverted
Function: Indicates inverted landscape display mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Locked
Locked
Function: Indicates locked mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Portrait
Portrait
Function: Indicates portrait display mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
PortraitInverted
PortraitInverted
Function: Indicates inverted portrait display mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Unspecified
Unspecified
Function: Indicates undefined orientation mode, determined by the system.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22## enum ExtensionAbilityType
public enum ExtensionAbilityType {
| Form
| WorkScheduler
| InputMethod
| Service
| Accessibility
| DataShare
| FileShare
| StaticSubscriber
| Wallpaper
| Backup
| Window
| EnterpriseAdmin
| Thumbnail
| Preview
| Print
| Share
| Push
| Driver
| Action
| AdsService
| EmbeddedUi
| InsightIntentUi
| Unspecified
| ...
}
Function: Indicates the type of extension ability.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Accessibility
Accessibility
Function: Accessibility service extension capability, supporting access and operation of foreground interfaces.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Action
Action
Function: Custom service extension capability, providing developers with UIExtension-based custom operation business templates.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
AdsService
AdsService
Function: Advertising service extension capability, providing external background custom advertising services (currently unsupported).
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Backup
Backup
Function: Data backup extension capability, providing application data backup and recovery functionality.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
DataShare
DataShare
Function: Data sharing extension capability, enabling external read/write data services.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Driver
Driver
Function: Driver extension capability, providing peripheral driver extension functionality (currently unsupported).
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
EmbeddedUi
EmbeddedUi
Function: Embedded UI extension capability, enabling cross-process interface embedding.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
EnterpriseAdmin
EnterpriseAdmin
Function: Enterprise device management extension capability, handling management events such as application installation or excessive incorrect lock screen password attempts.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
FileShare
FileShare
Function: File sharing extension capability for inter-application file sharing (reserved capability, currently unsupported).
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Form
Form
Function: Card extension capability, providing card development functionality.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
InputMethod
InputMethod
Function: Input method extension capability for developing input method applications.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
InsightIntentUi
InsightIntentUi
Function: Provides developers with extension capability to present content in window form when invoked by Xiaoyi Intent.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Preview
Preview
Function: File preview extension capability, enabling embedded file preview display in other applications (reserved capability, currently unsupported).
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Print
Function: File printing extension capability for office scenarios like photo/document printing (currently supports image printing only).
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Push
Push
Function: Push notification extension capability for contextual messaging (reserved capability, currently unsupported).
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Service
Service
Function: Background service extension capability, providing continuous background operation with external functionality.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Share
Share
Function: Sharing business capability, providing developers with UIExtension-based sharing templates.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
StaticSubscriber
StaticSubscriber
Function: Static broadcast extension capability for handling system events like boot completion.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Thumbnail
Thumbnail
Function: File thumbnail extension capability for generating icon thumbnails (reserved capability, currently unsupported).
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Unspecified
Unspecified
Function: Unspecified type, used with queryExtensionAbilityInfo to query all ExtensionAbility types.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Wallpaper
Wallpaper
Function: Wallpaper extension capability for implementing desktop wallpapers (reserved capability, currently unsupported).
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Window
Window
Function: Interface composition extension capability, allowing system apps to launch/embed cross-application interfaces.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
WorkScheduler
WorkScheduler
Function: Deferred task extension capability, allowing apps to execute non-time-sensitive tasks during system idle periods.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
enum LaunchType
public enum LaunchType {
| Singleton
| Multiton
| Specified
| ...
}
Function: Each capability has a launch type, this enum identifies the launch mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Multiton
Multiton
Function: Capability launches as standard multi-instance.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Singleton
Singleton
Function: Capability launches as single instance.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Specified
Specified
Function: Capability launches as custom multi-instance.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
enum ModuleType
public enum ModuleType {
| Entry
| Feature
| Shared
| ...
}
Function: Identifies module type.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Entry
Entry
Function: Main module of an application.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Feature
Feature
Function: Dynamic feature module of an application.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Shared
Shared
Function: Dynamic shared library module of an application.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22## enum MultiAppModeType
public enum MultiAppModeType {
| Unspecified
| MultiInstance
| AppClone
| ...
}
Function: Identifies the mode type for application multi-opening.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
AppClone
AppClone
Function: Clone mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
MultiInstance
MultiInstance
Function: Multi-instance mode.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Unspecified
Unspecified
Function: Unspecified type.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
enum PermissionGrantState
public enum PermissionGrantState {
| PermissionDenied
| PermissionGranted
| ...
}
Function: Indicates the permission grant state.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
PermissionDenied
PermissionDenied
Function: Permission denied.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
PermissionGranted
PermissionGranted
Function: Permission granted.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
enum SupportWindowMode
public enum SupportWindowMode {
| FullScreen
| Split
| Floating
| ...
}
Function: An ability can support several window modes. This enumeration is used to indicate the supported window modes for a specific ability.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Floating
Floating
Function: Supports windowed display.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
FullScreen
FullScreen
Function: Supports full-screen display for windows.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Split
Split
Function: Supports split-screen display for windows.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22