AbilityInfo

The module defines the ability information. An application can obtain its own ability information through bundleManager.getBundleInfoForSelf, with GET_BUNDLE_INFO_WITH_HAP_MODULE and GET_BUNDLE_INFO_WITH_ABILITY passed in to bundleFlags.

NOTE The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.

Modules to Import

import { bundleManager } from '@kit.AbilityKit';

AbilityInfo

System capability: SystemCapability.BundleManager.BundleFramework.Core

Name Type Read-Only Optional Description
bundleName string Yes No Bundle name.
Atomic service API: This API can be used in atomic services since API version 11.
moduleName string Yes No Module name to which the ability belongs.
Atomic service API: This API can be used in atomic services since API version 11.
name string Yes No Ability name.
Atomic service API: This API can be used in atomic services since API version 11.
label string Yes No Resource descriptor of the ability name visible to users. It corresponds to the label field under abilities in the module.json5 file.
Note: Starting from API version 20, if bundleManager.getAbilityInfo is used to obtain ability information, this field is the ability name visible to users.
Atomic service API: This API can be used in atomic services since API version 11.
labelId number Yes No Resource ID of the ability label. It is automatically generated during compilation and build based on the label configured in abilities of the application.
Atomic service API: This API can be used in atomic services since API version 11.
description string Yes No Ability description, which describes the content and functions of the current ability. It corresponds to the description field under abilities in the module.json5 file.
Atomic service API: This API can be used in atomic services since API version 11.
descriptionId number Yes No Resource ID of the ability description. It is automatically generated during compilation and build based on the description configured in abilities of the application.
Atomic service API: This API can be used in atomic services since API version 11.
icon string Yes No Resource descriptor of the ability icon. It corresponds to the icon field under abilities in the module.json5 file.
Atomic service API: This API can be used in atomic services since API version 11.
iconId number Yes No Resource ID of the ability icon. It is automatically generated during compilation and build based on the icon configured in abilities of the application.
Atomic service API: This API can be used in atomic services since API version 11.
process string Yes No Process name of the ability.
Atomic service API: This API can be used in atomic services since API version 11.
exported boolean Yes No Whether the ability can be launched by other applications. true if the ability can be launched by other applications, false otherwise.
Atomic service API: This API can be used in atomic services since API version 11.
type bundleManager.AbilityType Yes No Ability type.
Model restriction: This API can be used only in the FA model.
orientation bundleManager.DisplayOrientation Yes No Ability display orientation. It is derived from the orientation field under abilities in the module.json5 file. If orientation in the file is set to an enumerated value, this property is a non-zero value. For details about the available values, see displayOrientation. If orientation in the file is set to a resource index, the value of this property is 0.
Atomic service API: This API can be used in atomic services since API version 11.
launchType bundleManager.LaunchType Yes No Ability launch mode, that is, whether it can be started in multiton mode. For details, see LaunchType.
Atomic service API: This API can be used in atomic services since API version 11.
permissions Array<string> Yes No Array of permissions that other applications must request to start or access this ability. The system checks whether the caller has these permissions only if the exported property in AbilityInfo is true (meaning that the ability allows itself to be started by other applications).
Atomic service API: This API can be used in atomic services since API version 11.
readPermission string Yes No Permission required for reading the ability data.
Model restriction: This API can be used only in the FA model.
writePermission string Yes No Permission required for writing data to the ability.
Model restriction: This API can be used only in the FA model.
uri string Yes No URI of the ability.
Model restriction: This API can be used only in the FA model.
deviceTypes Array<string> Yes No Device types supported by the ability. The value is derived from that of deviceTypes in the module.json5 file.
Atomic service API: This API can be used in atomic services since API version 11.
applicationInfo ApplicationInfo Yes No Application configuration information . The information can be obtained by passing in GET_ABILITY_INFO_WITH_APPLICATION to the abilityFlags parameter of queryAbilityInfo .
This field is not returned when the getBundleInfoForSelf or getBundleInfo is used to obtain ability information. You can obtain the related information by obtaining the bundleInfo.appInfo object.
Atomic service API: This API can be used in atomic services since API version 11.
metadata Array<Metadata> Yes No Metadata of the ability. You can configure the system-defined parameters to use the capabilities provided by the system, for example, shortcuts and window metadata configuration. You can also customize the parameters and call getBundleInfoForSelf to obtain the parameters by passing GET_BUNDLE_INFO_WITH_HAP_MODULE, GET_BUNDLE_INFO_WITH_ABILITY, and GET_BUNDLE_INFO_WITH_METADATA to bundleFlags.
Atomic service API: This API can be used in atomic services since API version 11.
enabled boolean Yes No Whether the ability is available, that is, whether it can be started or queried. true if available, false otherwise. If the ability is unavailable, you must call getAbilityInfo with AbilityFlag set to GET_ABILITY_INFO_WITH_DISABLE to query the ability.
Atomic service API: This API can be used in atomic services since API version 11.
supportWindowModes Array<bundleManager.SupportWindowMode> Yes No Window modes supported by the ability.
Atomic service API: This API can be used in atomic services since API version 11.
windowSize WindowSize Yes No Window size.
Atomic service API: This API can be used in atomic services since API version 11.
excludeFromDock12+ boolean Yes No Whether the ability icon can be hidden in the dock area. true if the ability icon can be hidden in the dock area, false otherwise.
Note: This field does not take effect.
Atomic service API: This API can be used in atomic services since API version 12.
skills12+ Array<Skill> Yes No Skills information of the ability. It represents the feature set of wants that can be received by the UIAbility or ExtensionAbility.
Atomic service API: This API can be used in atomic services since API version 12.
appIndex12+ number Yes No Index of an application clone. It takes effect only for application clones.
orientationId14+ number Yes No Resource ID of the ability display mode. It is derived from the orientation field under abilities in the module.json5 file. If the orientation field in the file is set to an enumerated value, orientationId is 0. If the orientation field is set to a resource index, orientationId is a non-zero value, which is the resource ID generated during building. If orientationId is set to a value other than 0, the current display mode is customized, and this ID must be used to obtain the corresponding resource from the resource manager module. If orientationId is set to 0, no resource is configured.
Atomic service API: This API can be used in atomic services since API version 14.

WindowSize

Describes the window size.


Atomic service API: This API can be used in atomic services since API version 11.

System capability: SystemCapability.BundleManager.BundleFramework.Core

Name Type Read-Only Optional Description
maxWindowRatio number Yes No Maximum aspect ratio of the window in free window mode. The value ranges from 0 to 1. An example value is 0.12.
minWindowRatio number Yes No Minimum aspect ratio of the window in free window mode. The value ranges from 0 to 1. An example value is 0.5.
maxWindowWidth number Yes No Maximum width of the window in free window mode. The unit is vp.
minWindowWidth number Yes No Minimum width of the window in free window mode. The unit is vp.
maxWindowHeight number Yes No Maximum height of the window in free window mode. The unit is vp.
minWindowHeight number Yes No Minimum height of the window in free window mode. The unit is vp.