• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# AbilityInfo
2<!--Kit: Ability Kit-->
3<!--Subsystem: BundleManager-->
4<!--Owner: @wanghang904-->
5<!--Designer: @hanfeng6-->
6<!--Tester: @kongjing2-->
7<!--Adviser: @Brilliantry_Rui-->
8
9The module defines the ability information. An application can obtain its own ability information through [bundleManager.getBundleInfoForSelf](js-apis-bundleManager.md#bundlemanagergetbundleinfoforself), with **GET_BUNDLE_INFO_WITH_HAP_MODULE** and **GET_BUNDLE_INFO_WITH_ABILITY** passed in to [bundleFlags](js-apis-bundleManager.md#bundleflag).
10
11> **NOTE**
12>
13> 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.
14
15## Modules to Import
16
17```ts
18import { bundleManager } from '@kit.AbilityKit';
19```
20
21## AbilityInfo
22
23**System capability**: SystemCapability.BundleManager.BundleFramework.Core
24
25| Name                 | Type                                                    | Read-Only| Optional| Description                                     |
26| --------------------- | -------------------------------------------------------- | ---- | ---- | ------------------------------------------ |
27| bundleName            | string                                                   | Yes  | No  | Bundle name.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
28| moduleName            | string                                                   | Yes  | No  | Module name to which the ability belongs.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
29| name                  | string                                                   | Yes  | No  | Ability name.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
30| label                 | string                                                   | Yes  | No  | Resource descriptor of the ability name visible to users. Example: **"label": "$string: mainability_description"**. Starting from API version 20, if [bundleManager.getAbilityInfo](js-apis-bundleManager.md#bundlemanagergetabilityinfo20) is used to obtain ability information, this field is the ability name visible to users.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
31| labelId               | number                                                   | Yes  | No  | ID of the ability label.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
32| description           | string                                                   | Yes  | No  | Ability description.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
33| descriptionId         | number                                                   | Yes  | No  | ID of the ability description.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
34| icon                  | string                                                   | Yes  | No  | Resource descriptor of the ability icon. Example: **"icon": "$media:icon"**.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
35| iconId                | number                                                   | Yes  | No  | ID of the ability icon.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
36| process               | string                                                   | Yes  | No  | Process name of the ability.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
37| exported             | boolean                                                  | Yes  | No  | Whether the ability can be called by other applications. **true** if the ability can be called by other applications, **false** otherwise.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
38| type                  | [bundleManager.AbilityType](js-apis-bundleManager.md#abilitytype)      | Yes  | No  | Ability type.<br>**Model restriction**: This API can be used only in the FA model.|
39| orientation           | [bundleManager.DisplayOrientation](js-apis-bundleManager.md#displayorientation)  | Yes  | No  | Ability display orientation.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
40| launchType            | [bundleManager.LaunchType](js-apis-bundleManager.md#launchtype)        | Yes  | No  | Ability launch mode.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
41| permissions           | Array\<string>                                           | Yes  | No  | Permissions required for other applications to call the ability.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
42| readPermission        | string                                                   | Yes  | No  | Permission required for reading the ability data.<br>**Model restriction**: This API can be used only in the FA model.|
43| writePermission       | string                                                   | Yes  | No  | Permission required for writing data to the ability.<br>**Model restriction**: This API can be used only in the FA model.|
44| uri                   | string                                                   | Yes  | No  | URI of the ability.<br>**Model restriction**: This API can be used only in the FA model.|
45| deviceTypes           | Array\<string>                                           | Yes  | No  | Device types supported by the ability.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
46| applicationInfo       | [ApplicationInfo](js-apis-bundleManager-applicationInfo.md)     | Yes  | No  | Application information. The information can be obtained by passing in **GET_BUNDLE_INFO_WITH_HAP_MODULE**, **GET_BUNDLE_INFO_WITH_ABILITY**, and **GET_BUNDLE_INFO_WITH_APPLICATION** to the **bundleFlags** parameter of [getBundleInfoForSelf](js-apis-bundleManager.md#bundlemanagergetbundleinfoforself).<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
47| metadata              | Array\<[Metadata](js-apis-bundleManager-metadata.md)>           | Yes  | No  | Metadata of the ability. The information can be obtained by passing in **GET_BUNDLE_INFO_WITH_HAP_MODULE**, **GET_BUNDLE_INFO_WITH_ABILITY**, and **GET_BUNDLE_INFO_WITH_METADATA** to the **bundleFlags** parameter of [getBundleInfoForSelf](js-apis-bundleManager.md#bundlemanagergetbundleinfoforself).<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
48| enabled               | boolean                                                  | Yes  | No  | Whether the ability is enabled. **true** if enabled, **false** otherwise.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
49| supportWindowModes    | Array\<[bundleManager.SupportWindowMode](js-apis-bundleManager.md#supportwindowmode)> | Yes  | No  | Window modes supported by the ability.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
50| windowSize|[WindowSize](#windowsize)                                            |    Yes  | No  | Window size.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
51| excludeFromDock<sup>12+</sup>             | 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.<br>**Atomic service API**: This API can be used in atomic services since API version 12.|
52| skills<sup>12+</sup>             | Array\<[Skill](js-apis-bundleManager-skill.md)>                                                 | Yes  | No  | Skills of the ability.<br>**Atomic service API**: This API can be used in atomic services since API version 12.  |
53| appIndex<sup>12+</sup>    | number    | Yes  | No  | Index of an application clone. It takes effect only for [application clones](../../quick-start/app-clone.md).|
54| orientationId<sup>14+</sup>    | number      | Yes  | No  | Resource ID of the ability display mode. 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.<br>**Atomic service API**: This API can be used in atomic services since API version 14.|
55
56## WindowSize
57
58Describes the window size.
59
60**Atomic service API**: This API can be used in atomic services since API version 11.
61
62**System capability**: SystemCapability.BundleManager.BundleFramework.Core
63
64| Name              | Type   | Read-Only| Optional| Description                              |
65| -------------------| ------- | ---- | ---- | ---------------------------------- |
66| 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.|
67| 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.|
68| maxWindowWidth     | number  | Yes  | No  | Maximum width of the window in free window mode. The unit is vp.|
69| minWindowWidth     | number  | Yes  | No  | Minimum width of the window in free window mode. The unit is vp.|
70| maxWindowHeight    | number  | Yes  | No  | Maximum height of the window in free window mode. The unit is vp.|
71| minWindowHeight    | number  | Yes  | No  | Minimum height of the window in free window mode. The unit is vp.|
72