We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All

module.json5 Configuration File

A module-level configuration file provides the basic configuration of the module, information about the UIAbility and ExtensionAbility components, and permissions required during application running for the compilation tool, OS, and AppGallery. Each module must contain a module.json5 configuration file, which is stored in the project or module name/src/main/module.json5 directory, for example, entry/src/main/module.json5.

NOTE

Using the sample code in the actual project may cause a compilation failure. You need to configure the code as required. For example, if the resource file referenced by the $ symbol does not exist in the project, you need to manually add the resource file or replace it with the actual one.

In the configuration file, fields can be repeated. The last field is used.

Configuration File Example

This topic gives an overview of the module.json5 configuration file. To start with, let's go through an example of what this file contains.

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. "name": "entry",
  4. "type": "entry",
  5. "description": "$string:module_desc",
  6. "mainElement": "EntryAbility",
  7. "deviceTypes": [
  8. "tv",
  9. "tablet"
  10. ],
  11. "deliveryWithInstall": true,
  12. "pages": "$profile:main_pages", // Resource configuration, pointing to the main_pages.json configuration file defined in the profile.
  13. "appStartup": "$profile:app_startup_config",
  14. "metadata": [
  15. {
  16. "name": "string",
  17. "value": "string",
  18. "resource": "$profile:distributionFilter_config"
  19. },
  20. // ...
  21. ],
  22. "abilities": [
  23. {
  24. "name": "EntryAbility",
  25. "srcEntry": "./ets/entryability/EntryAbility.ets",
  26. "description": "$string:EntryAbility_desc",
  27. "icon": "$media:layered_image",
  28. "label": "$string:EntryAbility_label",
  29. "startWindow": "$profile:start_window",
  30. "startWindowIcon": "$media:icon",
  31. "startWindowBackground": "$color:start_window_background",
  32. "exported": true,
  33. "skills": [
  34. // ...
  35. {
  36. "entities": [
  37. "entity.system.home"
  38. ],
  39. "actions": [
  40. "ohos.want.action.home"
  41. ]
  42. }
  43. ],
  44. // ...
  45. "continueType": [
  46. "continueType1"
  47. ],
  48. "continueBundleName": [
  49. "com.example.myapplication1",
  50. "com.example.myapplication2"
  51. ],
  52. }
  53. ],
  54. "requestPermissions": [
  55. {
  56. "name": "ohos.permission.ACCESS_BLUETOOTH",
  57. "reason": "$string:reason",
  58. "usedScene": {
  59. "abilities": [
  60. "EntryAbility"
  61. ],
  62. "when": "inuse"
  63. }
  64. }
  65. ],
  66. "querySchemes": [
  67. "app1Scheme",
  68. "app2Scheme"
  69. ],
  70. "routerMap": "$profile:router_map",
  71. "appEnvironments": [
  72. {
  73. "name": "name1",
  74. "value": "value1"
  75. }
  76. ],
  77. "fileContextMenu": "$profile:menu", // Resource configuration, which points to the menu.json configuration file defined in the profile.
  78. "crossAppSharedConfig": "$profile:shared_config",
  79. "skillProfiles": [
  80. {
  81. "name": "my-skill",
  82. "abilityName": "EntryAbility",
  83. "version": "1.0.0",
  84. "visibility": "public",
  85. "srcEntries": [
  86. "../../my-skill/scripts/Test.ets"
  87. ],
  88. "permissions": []
  89. }
  90. ],
  91. // ...
  92. }
  93. }

Tags in the Configuration File

As shown above, the module.json5 file contains several tags.

Table 1 Tags in the module.json5 file

Expand
Attribute Name Description Data Type Whether It Can Be Omitted
name

Identifies the name of the current module. The name must be unique within the entire app. The naming rules are as follows :

- It consists of letters, digits, and underscores, and must start with a letter.

- The maximum length is 128 bytes.

You can change the name during an app upgrade, but the app must adapt to the migration of the module-related data directories. For details, see @ohos.file.fs (File Management).

Note:

When creating a module in DevEco Studio, the module name cannot exceed 31 characters. If this length does not meet your requirements, you can change this tag in the configuration file.

string This tag cannot be omitted.
type

Identifies the type of the current module. The supported values are as follows:

- entry: the main module of the app.

- feature: the dynamic feature module of the app.

- har: the static shared package module.

- shared: the dynamic shared package module.

- skill: the skill package module, used to define the skill capabilities of an AI agent. A module of this type must have the skillProfiles tag configured. Only when bundleType of the app is set to skill, that is, when bundleType in the app.json5 configuration file is skill, can the type of the module be set to skill. In this case, the app can contain only one module. This tag is supported since API version 26.0.0. It takes effect only for preset apps.

string This tag cannot be omitted.
srcEntry Identifies the code path of the AbilityStage component. For details, see AbilityStage Component Container. The value is a string of no more than 127 bytes. string This tag can be omitted. The default value is empty.
description Identifies the description of the current module. You can use this tag to describe the functions and purpose of the current module. The value is a string of no more than 255 bytes, and can be in the string resource index format. string This tag can be omitted. The default value is empty.
mainElement Identifies the name of the entry UIAbility of the current module. The value is a string of no more than 255 bytes. For details, see Configuration Priority and Build Policy in Configuring the App Icon and Name. string This tag can be omitted. The default value is empty.
deviceTypes

Identifies the types of devices on which the current module can run.

Note:

When there are multiple modules, the configuration of each module can be different, but each must include the device types on which it will be installed to ensure normal running.

string array This tag cannot be omitted.
deliveryWithInstall

Indicates whether the current module is installed when the user actively installs the app, that is, whether the HAP/HSP corresponding to the module is installed together with the app.

- true: installed together with the app.

- false: not installed together with the app.They are installed through on-demand feature distribution.

boolean When the current module type is HAP or HSP, this tag cannot be omitted.
installationFree

Indicates whether the current module supports the installation-free feature.

- true: the installation-free feature is supported and the installation-free constraints are met.

- false: the installation-free feature is not supported.

boolean

This tag can be omitted. It is automatically generated during compilation and building, and manual configuration does not take effect.

Note:

When bundleType is an atomic service, this tag is automatically set to true. Otherwise, it is automatically set to false.

virtualMachine Identifies the target virtual machine type on which the current module runs, for cloud distribution, such as the app market and distribution center. If the target virtual machine type is the ArkTS engine, the value is "ark+version number". string This tag can be omitted. Manual configuration does not take effect, and it is automatically generated during compilation and building.
pages Identifies the profile resource of the current module, used to list the information of each page. The value is a string of no more than 255 bytes. string This tag can be omitted. The default value is empty.
metadata Identifies the custom metadata of the current module. You can configure distributionFilter, shortcuts, and other information by referencing resources. It takes effect only for the current module, UIAbility, and ExtensionAbility. object array This tag can be omitted. The default value is empty.
abilities Identifies the configuration information of UIAbility in the current module. It takes effect only for the current UIAbility. object array This tag can be omitted. The default value is empty.
extensionAbilities Identifies the configuration information of ExtensionAbility in the current module. It takes effect only for the current ExtensionAbility. object array This tag can be omitted. The default value is empty.
requestPermissions Identifies the set of permissions that the current app needs to request from the system at runtime. object array This tag can be omitted. The default value is empty.
testRunner Identifies the configuration of the test framework used to test the current module. For details, see test. object This tag can be omitted. The default value is empty.
atomicService Identifies the configuration related to the atomic service when the current app is an atomic service. object This tag can be omitted. The default value is empty.
dependencies Identifies the list of shared libraries that the current module depends on at runtime. object array This tag can be omitted. The default value is empty. Manual configuration does not take effect, and it is automatically generated during compilation and building.
targetModuleName Identifies the target module specified by the current package. The value is a string of no more than 128 bytes, and Chinese characters are not supported. A module with this tag configured has the overlay feature. It applies only to dynamic shared packages (HSPs). string This tag can be omitted. The default value is empty.
targetPriority Identifies the priority of the current module. The value range is 1 to 100. This tag needs to be configured only after the targetModuleName tag is configured. It applies only to dynamic shared packages (HSPs). integer value This tag can be omitted. The default value is 1.
proxyData Identifies the list of data proxies provided by the current module. object array This tag can be omitted. The default value is empty.
isolationMode

Identifies the multi-process configuration item of the current module. The supported values are as follows:

- nonisolationFirst: run in a non-isolated process first.

- isolationFirst: run in an isolated process first.

- isolationOnly: run only in an isolated process.

- nonisolationOnly: run only in a non-isolated process.

Note:

1. Only 2in1 and tablet devices support setting the current module to an isolated process.

2. This tag takes effect only for HAPs.

string This tag can be omitted. The default value is nonisolationFirst.
generateBuildHash

Indicates whether the current HAP/HSP has a hash value generated by the packaging tool. When set to true, if the app versionCode remains unchanged during an OTA upgrade, the system can determine whether the app needs to be upgraded based on the hash value.

This tag is enabled only when the generateBuildHash tag in the app.json5 file is false.

Note:

This tag takes effect only for preset apps.

boolean This tag can be omitted. The default value is false.
compressNativeLibs

When packaging a HAP, this tag indicates whether the libs library is packaged into the HAP in a compressed manner.

- true: the libs library is stored in a compressed manner.

- false: the libs library is stored in an uncompressed manner.

boolean This tag can be omitted. When packaging a HAP, the default value is false.
extractNativeLibs

Indicates whether the libs library is extracted to the app installation directory when the app is installed. When both compressNativeLibs and extractNativeLibs are set to false, the app is installed without extracting the libs library. In other scenarios, the app is installed with the libs library extracted.

Note:

This tag is supported since API version 20.

boolean This tag can be omitted. The default value is true.
libIsolation

Indicates whether a directory named after the module is generated under the libs directory to store .so files, so as to distinguish the .so files of different HAPs in the same app and prevent .so file conflicts.

- true: the .so files of the current HAP are stored in the path named after the module under the libs directory.

- false: the .so files of the current HAP are stored directly in the libs directory.

boolean This tag can be omitted. The default value is false.
fileContextMenu

Identifies the context menu configuration item of the current HAP. It is a profile file resource. The value is a string of no more than 255 bytes.

Note:

It takes effect only on PC/2in1 devices.

It can be configured only in modules of the entry type.

string This tag can be omitted. The default value is empty.
querySchemes

Identifies the URL schemes that the current app is allowed to query for redirection. It can be configured only in modules of the entry type. Each string value is no more than 128 bytes.

Note:

Since API version 21, a maximum of 200 URL schemes can be configured. In API version 20 and earlier, a maximum of 50 URL schemes can be configured.

string array This tag can be omitted. The default value is empty.
routerMap Identifies the path of the route table configured for the current module. The value is a string of no more than 255 bytes. string This tag can be omitted. The default value is empty.
appEnvironments Identifies the app environment variables configured for the current module. It can be configured only in modules of the entry and feature types. object array This tag can be omitted. The default value is empty.
appStartup

Identifies the configuration path of the startup framework of the current module. It can be configured only in modules of the entry type.

Since API version 18, configuration in HSPs and HARs is supported.

Since API version 20, configuration in modules of the feature type is supported.

string This tag can be omitted. The default value is empty.
hnpPackages Identifies the information of the native software packages included in the current app. It can be configured only in modules of the entry type. object array This tag can be omitted. The default value is empty.
systemTheme

Identifies the system theme configuration item currently in use. It can be configured only in modules of the entry type. The value is a string of no more than 255 bytes.

Note:

This tag is supported since API version 20.

string This tag can be omitted. The default value is empty.
abilitySrcEntryDelegator

Identifies the name of the UIAbility to which the current module needs to be redirected. It is used together with the abilityStageSrcEntryDelegator tag to specify the redirection target.

Note:

1. This tag is supported since API version 17.

2. This tag does not take effect when the UIAbility is started through the startAbilityByCall API.

3. This tag cannot be configured in the configuration file of a HAR, and redirection to the UIAbility of a HAR is not supported.

string This tag can be omitted. The default value is empty.
abilityStageSrcEntryDelegator

Identifies the name of the module corresponding to the UIAbility to which the current module needs to be redirected (it cannot be the name of the current module). It is used together with the abilitySrcEntryDelegator tag to specify the redirection target.

Note:

1. This tag is supported since API version 17.

2. This tag does not take effect when the UIAbility is started through the startAbilityByCall API.

3. This tag cannot be configured in the configuration file of a HAR, and redirection to the UIAbility of a HAR is not supported.

string This tag can be omitted. The default value is empty.
crossAppSharedConfig

Identifies the name of the configuration file for cross-app shared configuration. The value is a string of no more than 255 bytes. It is used to publish the configuration for other apps to read. It takes effect when the app is installed and becomes invalid when the app is uninstalled. For details about how to use it, see Configuring the Publisher.

Note:

This tag is supported since API version 20.

string This tag can be omitted. The default value is empty.
formWidgetModule

In an independent widget package, the app package needs to configure this tag to associate with the widget package. The value is the module name of the widget package, corresponding to the name tag in the module.json5 file of the widget package. For details about how to use it, see FormExtensionAbility Configuration.

Note:

1. This tag is supported since API version 20.

2. This tag takes effect only in the app package of an independent widget package, and the corresponding widget package module must have the formExtensionModule tag configured.

string This tag can be omitted. The default value is empty.
formExtensionModule

In an independent widget package, the widget package needs to configure this tag to associate with the app package. The value is the module name of the app package, corresponding to the name tag in the module.json5 file of the app package. For details about how to use it, see Standalone Widget Package Configuration.

Note:

1. This tag is supported since API version 20.

2. This tag takes effect only in the widget package of an independent widget package, and the corresponding app package module must have the formWidgetModule tag configured.

string This tag can be omitted. The default value is empty.
shareFiles

Identifies the configuration file path of the shared directory in the app sandbox. It is used to provide a secure open scope for app files and protect app assets. It can be configured only in modules of the entry type. The value is a string of no more than 255 bytes. For details about how to use it, see App Shared Directory Configuration.

Note:

This tag is supported since API version 23.

string This tag can be omitted. The default value is empty.
skillProfiles

Identifies the skill configuration information of the current module, used to define the skill capabilities of an AI agent. It can be configured only in modules whose type field is entry, feature, shared, or skill. For modules of the skill type, this tag must be configured.

Note:

This tag is supported since API version 26.0.0.

object array For modules of the skill type, this tag cannot be omitted. For modules of other types, this tag can be omitted. The default value is empty.
executableBinaryPaths

Identifies the path information of executable binary files in the app.

Note:

1. This tag is supported since API version 24.

2. It takes effect only on PC/2in1 devices.

object array This tag can be omitted. The default value is empty.
uiSyntax(deprecated)

Identifies the syntax type of the JS Component defined by the current Module syntax.

- hml: indicates that the JS Component is developed using hml/css/js.

- ets: indicates that the JS Component is developed using the ArkTS declarative syntax.

Note:

This tag is deprecated since API version 9.

string This tag can be omitted. The default value is hml.
srcEntrance(deprecated)

Identifies the code path corresponding to the current module. The value is a string of no more than 127 bytes.

Note:

This tag is deprecated since API version 9. Use the srcEntry field instead.

string This tag can be omitted. The default value is empty.
requiredDeviceFeatures

Specific device features required for running the current module. AGC can distribute the application to devices that support the features based on the configuration.

NOTE

1. This field is supported since API version 19.

2. This tag is not supported for plugin applications.

Object Yes (initial value: left empty)
easyGo

Configuration file path in compatible mode provided by the system to meet the customization requirements of different products. Currently, only the App Multiplier capability is supported. Only entry modules can be configured. The value is a string of up to 255 bytes.

NOTE

This tag is supported since API version 23.

String Yes (initial value: left empty)

deviceTypes

Table 2 deviceTypes

Expand
Device Type Enumerated Value Description
Mobile phone phone -
Tablets tablet -
PC/2in1 2in1 PC, mainly used for multi-window and multi-task interactions, and keyboard and mouse operations. It fully showcases the device productivity. In the HarmonyOS topics, "2-in-1" indicates PC/2-in-1 device.
Vision tv -
Smart watch wearable Watch that provides the call feature.
Telematics device car -
Default Device default Default application configuration. Applications with the default configuration can be compiled and built but cannot be released. Change the device type to phone.

Example of the deviceTypes structure:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. "name": "myHapName",
  4. "type": "feature",
  5. "deviceTypes": [
  6. "tv",
  7. "tablet"
  8. ],
  9. // ...
  10. }
  11. }

pages

The pages tag is a profile that represents information about specified pages.

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. // ...
  4. "pages": "$profile:main_pages", // Resource configuration, pointing to the main_pages.json configuration file defined in the profile.
  5. // ...
  6. }
  7. }

Define the main_pages.json file under resources/base/profile in the development view. The file name (main_pages in this example) can be customized, but must be consistent with the information specified by the pages tag. The file lists the page information of the current application, including the route information and the window-related configuration.

Table 3 pages

Expand
Name Description Data Type Initial Value Allowed
src Route information about all pages in the module, including the page path and page name. The page path is relative to the src/main/ets directory of the current module. The value is a string array, each element of which represents a page. String array No
window Window-related configuration. Object Yes (initial value: left empty)

Table 4 window

Expand
Name Description Data Type Initial Value Allowed
designWidth Baseline width for page design. The size of an element is scaled by the actual device width. Number Yes (initial value: 720px)
autoDesignWidth Whether to automatically calculate the baseline width for page design. If it is set to true, the designWidth attribute becomes invalid. The baseline width is calculated based on the device width and screen density. If it is set to false, the baseline width uses the value of designWidth. Boolean Yes (initial value: false)
Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "src": [
  3. "pages/Index"
  4. ],
  5. "window": {
  6. "designWidth": 720,
  7. "autoDesignWidth": false
  8. }
  9. }

metadata

The metadata tag represents the custom metadata of the HAP. The tag value is an array and contains three subtags: name, value, and resource.

Table 5 metadata

Expand
Name Description Data Type Initial Value Allowed
name Name of the data item. The value is a string with a maximum of 255 bytes. String Yes (initial value: left empty)
value Value of the data item. The value is a string with a maximum of 255 bytes. String Yes (initial value: left empty)
resource Custom data, which is a resource index. The value is a string with a maximum of 255 bytes. For example, $profile:shortcuts_config indicates that the data points to the /resources/base/profile/shortcuts_config.json configuration file. String Yes (initial value: left empty)
Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. // ...
  4. "metadata": [
  5. // ...
  6. {
  7. "name": "pageConfig",
  8. "value": "main page config of application",
  9. "resource": "$profile:main_pages" // Resource configuration, pointing to the main_pages.json configuration file defined in the profile.
  10. }
  11. ],
  12. // ...
  13. }
  14. }

abilities

The abilities tag represents the UIAbility configuration of the module, which is valid only for the current UIAbility component.

Table 6 abilities

Expand
Name Description Data Type Initial Value Allowed
name Name of the UIAbility, which must be unique in the entire application. The value is a string with a maximum of 127 bytes. It must start with a letter and can contain letters, digits, underscores (_), and periods (.). String No
srcEntry Code path of the UIAbility. The value is a string with a maximum of 127 bytes. String No
launchType

Launch type of the UIAbility. The options are as follows:

- multiton: A UIAbility instance is created each time the UIAbility is started.

- singleton: A UIAbility instance is created only when the UIAbility is started for the first time.

- specified: You can determine whether to create a UIAbility instance when the application is running.

- standard: original name of multiton. The effect is the same as that multiton mode.

NOTE

The startup mode of the meta service must be set to the singleton mode.

String Yes (initial value: "singleton")
description Description of the UIAbility component, used to describe the component functions. The value is a string with a maximum of 255 bytes. It is advised to use a resource index to support multiple languages. String Yes (initial value: left empty)
icon Icon of the current UIAbility component. The value is the index of an icon resource file. Both single-layer icons and layered icons are supported. For the configuration rules and examples, see Configuring an Application Icon and Label. String This tag can be omitted, and the default value is empty.
label Name of the current UIAbility component displayed to users. The value is the index of a string resource to support multiple languages, and it is a string of no more than 255 bytes. For details, see Configuring an Application Icon and Label. String This tag can be omitted, and the default value is empty.
permissions

Permissions required for another application to access the UIAbility component. When other applications access the UIAbility, they need to apply for the corresponding permissions.

Each array element is a permission name with a maximum of 255 bytes. For details about the value, see Application Permissions.

String array Yes (initial value: left empty)
metadata Metadata information of the UIAbility. For details about the typical use scenarios, see metadata. Object array Yes (initial value: left empty)
exported

Whether the UIAbility component can be started by other applications.

- true: The UIAbility component can be started by other applications. (It is recommended that this tag be set to true for the entry UIAbility.)

- false: The UIAbility component can be started only by the same application or an application with the ohos.permission.START_INVISIBLE_ABILITY permission (only system applications can request this permission).

For example, if this attribute is set to false, the UIAbility component can be started through the application icon, shortcut, or push notification on the home screen which has the permission. However, it cannot be started by the Ability Assistant, which does not have this permission.

Boolean Yes (initial value: false)
continuable

Whether the UIAbility can be continued on another device.

- true: The UIAbility can be continued on another device.

- false: The UIAbility cannot be continued on another device.

Boolean Yes (initial value: false)
skills

A set of wants that can be received by the UIAbility.

Configuration rules:

- For HAPs of the entry type, you can configure multiple skills tags with the entry capability for an application. (A skills tag with the entry capability is the one that has ohos.want.action.home and entity.system.home configured.)

- For HAPs of the feature type, you can configure the skills tag with the entry capability for an application, but not for a service.

Object array Yes (initial value: left empty)
backgroundModes

Continuous tasks of the UIAbility.

For details about the continuous task types, see Continuous Task (ArkTS).

String array Yes (initial value: left empty)
startWindow

Profile resource of the UIAbility startup page. The value is a string with a maximum of 255 bytes. If this tag is set, the startWindowIcon and startWindowBackground tags do not take effect.

NOTE

Since API version 19, this field can be used to configure an enhanced starting window.

String Yes (initial value: left empty)
startWindowIcon Index to the icon file of the UIAbility startup page. The value is a string with a maximum of 255 bytes. String No
startWindowBackground

Index to the background color resource file of the UIAbility startup page. The value is a string with a maximum of 255 bytes.

Example: $color:red.

String No
removeMissionAfterTerminate

Whether to remove the relevant mission from the mission list after the UIAbility is destroyed.

- true: Remove the relevant mission from the mission list after the UIAbility is destroyed.

- false: Do not remove the relevant mission from the task mission list after the UIAbility is destroyed.

NOTE

This attribute is invalid in freeform window mode on 2-in-1 devices and tablets, and tasks are removed by default.

Boolean Yes (initial value: false)
allowSelfRedirect

Whether the application can be redirected to itself through App Linking.

- true: Self-redirection is allowed.

- false: Self-redirection is not allowed.

NOTE

This tag is supported since API version 23.

Boolean Yes (initial value: true)
orientation

Startup direction of the UIAbility component. The enum and startup direction resource index can be configured.

The enum values are as follows:

- unspecified: automatically determined by the system.

- landscape: landscape mode.

- portrait: portrait mode.

- follow_recent: rotation mode following the background window.

- landscape_inverted: inverted landscape mode.

- portrait_inverted: inverted portrait mode.

- auto_rotation: determined by the sensor.

- auto_rotation_landscape: determined by the sensor in the horizontal direction, including landscape and inverted landscape modes.

- auto_rotation_portrait: determined by the sensor in the vertical direction, including portrait and inverted portrait modes.

- auto_rotation_restricted: determined by the sensor when the sensor switch is enabled.

- auto_rotation_landscape_restricted: determined by the sensor in the horizontal direction, including landscape and inverted landscape modes, when the sensor switch is enabled.

- auto_rotation_portrait_restricted: determined by the sensor in the vertical direction, including portrait and inverted portrait modes, when the sensor switch is enabled.

- locked: auto-rotation disabled.

- auto_rotation_unspecified: auto-rotation controlled by the switch and determined by the system.

- follow_desktop: following the orientation of the home screen.

To configure the startup direction resource index, the value should be a string with a maximum of 255 bytes, for example, $string:orientation.

NOTE

- The startup direction resource index is supported since API version 14.

String Yes (initial value: "unspecified")
supportWindowMode

Window modes supported by the current UIAbility component. The supported values are as follows:

- fullscreen: full-screen mode.

- split: split-screen mode.

- floating: floating window mode.

When both fullscreen and split are configured in the freeform window state, if the targetAPIVersion of the app is earlier than 15, the window starts in floating window mode; if the targetAPIVersion of the app is 15 or later, the window starts in full-screen mode.

In addition, the window mode can be configured through metadata. For the configuration rules and priority, see metadata.

String array

This tag can be omitted, and the default value is

["fullscreen", "split", "floating"].

maxWindowRatio Maximum aspect ratio supported by the UIAbility component. The minimum value is 0. Number Yes (initial value: maximum aspect ratio supported by the platform)
minWindowRatio Minimum aspect ratio supported by the UIAbility component. The minimum value is 0. Number Yes (initial value: minimum aspect ratio supported by the platform)
maxWindowWidth

Maximum window width supported by the UIAbility, in vp.

The value cannot be less than the value of minWindowWidth or greater than the maximum window width allowed by the platform. For details about the window size, see Constraints.

Number Yes (initial value: maximum window width supported by the platform)
minWindowWidth

Minimum window width supported by the UIAbility, in vp.

The value cannot be less than the minimum window width allowed by the platform or greater than the value of maxWindowWidth. For details about the window size, see Constraints.

Number Yes (initial value: minimum window width supported by the platform)
maxWindowHeight

Maximum window height supported by the UIAbility, in vp.

The value cannot be less than the value of minWindowHeight or greater than the maximum window height allowed by the platform. For details about the window size, see Constraints.

Number Yes (initial value: maximum window height supported by the platform)
minWindowHeight

Minimum window height supported by the UIAbility, in vp.

The value cannot be less than the minimum window height allowed by the platform or greater than the value of maxWindowHeight. For details about the window size, see Constraints.

Number Yes (initial value: minimum window height supported by the platform)
excludeFromMissions

Whether the UIAbility component is displayed in Recents.

- true: not displayed in Recents.

- false: displayed in Recents.

NOTE

Configurations of third-party applications do not take effect; the current configurations are only valid for system applications. To make system application configurations take effect, you need to apply for the application privilege. Privilege application is not open to third-party applications.

Boolean Yes (initial value: false)
recoverable

Whether the current UIAbility component can be restored to the original UI after an app fault is detected. For details, see Development of Application Recovery.

- true: The original UI can be restored after a fault is detected.

- false: The original UI cannot be restored after a fault is detected.

Boolean This tag can be omitted, and the default value is false.
isolationProcess

Whether the component can run in an isolated process.

- true: The component can run in an isolated process.

- false: The component cannot run in an isolated process.

NOTE

The UIAbility can serve as an isolated process on 2-in-1 devices and tablets.

Boolean Yes (initial value: false)
excludeFromDock

Whether the UIAbility can be hidden from the dock.

- true: The UIAbility can be hidden from the dock.

- false: The UIAbility cannot be hidden from the dock.

NOTE

The configuration of this tag does not take effect.

Boolean Yes (initial value: false)
preferMultiWindowOrientation

Multi-window orientation of the UIAbility.

- default: default value. Do not set this parameter to the default value. You are advised to set this parameter for other applications.

- portrait: portrait. This option is recommended for games in portrait mode.

- landscape: landscape. This option is recommended for games in landscape mode. With this option, the floating window and upper and lower split screens are supported in landscape mode.

- landscape_auto: automatically landscape. This option is recommended for video applications. It must be used together with the enableLandScapeMultiWindow/disableLandScapeMultiWindow API.

String Yes (initial value: default)
continueType Continuation type of the UIAbility. String array Yes (initial value: name of the UIAbility)
continueBundleName

List of other applications that support cross-device migration.

NOTE

This parameter cannot be set to the application bundle name. It is used only for migration with different bundle names.

This tag is supported since API version 13.

String array Yes (initial value: left empty)
process

Name of the process where the component runs.

Note:

1. This tag takes effect only on PCs/2-in-1 devices and tablets.

2. The UIAbility component and the ExtensionAbility component whose type is embeddedUI run in the same process when their tags are the same.

3. This tag is supported since API version 14.

String Yes (initial value: left empty)

Example of the abilities structure:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. // ...
  3. "abilities": [
  4. {
  5. "name": "EntryAbility",
  6. "srcEntry": "./ets/entryability/EntryAbility.ets",
  7. "launchType": "singleton",
  8. "description": "$string:description_main_ability",
  9. "icon": "$media:layered_image",
  10. "label": "$string:EntryAbility_label",
  11. "permissions": [],
  12. "metadata": [],
  13. "exported": true,
  14. "continuable": true,
  15. "skills": [
  16. {
  17. "actions": [
  18. "ohos.want.action.home"
  19. ],
  20. "entities": [
  21. "entity.system.home"
  22. ],
  23. "uris": []
  24. }
  25. ],
  26. "backgroundModes": [
  27. "dataTransfer"
  28. ],
  29. "startWindowIcon": "$media:icon",
  30. "startWindowBackground": "$color:red",
  31. "removeMissionAfterTerminate": true,
  32. "allowSelfRedirect": true, // This tag is supported starting from API version 23.
  33. "orientation": "$string:orientation",
  34. "supportWindowMode": [
  35. "fullscreen",
  36. "split",
  37. "floating"
  38. ],
  39. "maxWindowRatio": 3.5,
  40. "minWindowRatio": 0.5,
  41. "maxWindowWidth": 2560,
  42. "minWindowWidth": 1400,
  43. "maxWindowHeight": 300,
  44. "minWindowHeight": 200,
  45. "excludeFromMissions": false,
  46. "preferMultiWindowOrientation": "default",
  47. "isolationProcess": false,
  48. "continueType": [
  49. "continueType1",
  50. "continueType2"
  51. ],
  52. "continueBundleName": [
  53. "com.example.myapplication1",
  54. "com.example.myapplication2"
  55. ],
  56. "process": ":processTag"
  57. }
  58. ],
  59. // ...
  60. }

skills

The skills tag represents the feature set of wants that can be received by the UIAbility or ExtensionAbility component.

For example, when downloading a PDF file in a browser, you can configure the skills tag to open the specified PDF file. For details, see Using startAbility to Start a File Application.

Table 7 skills

Expand
Name Description Data Type Initial Value Allowed
actions

Actions of wants that can be received, which can be predefined or customized.

You are advised not to configure multiple actions for a skill. Otherwise, the expected scenario may not be matched. For details, see Common action and entities Values.

String array Yes (initial value: left empty)
entities

Entities of wants that can be received.

You are advised not to configure multiple entities for a skill. Otherwise, the expected scenario may not be matched. For details, see Common action and entities Values.

String array Yes (initial value: left empty)
uris URIs that match the wants. Object array Yes (initial value: left empty)
permissions

Permissions required for another application to access the UIAbility or ExtensionAbility component.

Each array element is a permission name with a maximum of 255 bytes. For details about the value, see Application Permissions.

String array Yes (initial value: left empty)
domainVerify

Whether to enable Domain name verification. For details, see Configuring the Associated Website Domain Name in the module.json5 File..

- true: Domain name verification is enabled.

- false: Domain name verification is disabled.

Boolean Yes (initial value: false)

Table 8 uris

NOTE

The following tags of the string type cannot be configured using resource indexes ($string).

Expand
Name Description Data Type Initial Value Allowed
scheme

Scheme of the URI, such as HTTP, HTTPS, file, and FTP.

NOTE

This tag is case-insensitive when it is used for implicit Want matching since API version 18.

String Yes when only type is set in uris (initial value: left empty)
host

Host address of the URI. This tag is valid only when scheme is set. Common methods:

- domain name, for example, example.com.

- IP address, for example, 10.10.10.1.

NOTE

This tag is case-insensitive when it is used for implicit Want matching since API version 18.

String Yes (initial value: left empty)
port Port number of the URI. For example, the default HTTP port number is 80, the default HTTPS port number is 443, and the default FTP port number is 21. This tag takes effect only when both scheme and host are configured. String Yes (initial value: left empty)
path | pathStartWith | pathRegex Path of the URI. path, pathStartWith, and pathRegex represent different matching modes between the paths in the URI and the want. Set any one of them as needed. path indicates full matching, pathStartWith indicates prefix matching, and pathRegex indicates regular expression matching. This tag takes effect only when both scheme and host are configured. String Yes (initial value: left empty)
type Data type that matches the want. The value complies with the Multipurpose Internet Mail Extensions (MIME) and UniformDataType specifications. This tag can be configured together with scheme or configured separately. String Yes (initial value: left empty)
utd Standardized data type that matches the Want. For details, see @ohos.data.uniformTypeDescriptor (Uniform Data Definition and Description). This field is applicable to scenarios such as sharing. String Yes (initial value: left empty)
maxFileSupported Maximum number of files of a specified type that can be received or opened at a time. This tag is applicable to scenarios such as sharing and must be used together with utd. Integer Yes (initial value: 0)
linkFeature Feature type provided by the URI. It is used to implement redirection between applications. The value is a string with a maximum of 127 bytes. The number of linkFeature declared in a bundle cannot exceed 150. For details, see Description of linkFeature String Yes (initial value: left empty)

Example of the skills structure:

NOTE

The following example is a common configuration. Some components and modules are different in actual configuration.For example, there is a restriction for clicking a message to access the app home page. For details, see the corresponding document.

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. // ...
  3. "abilities": [
  4. {
  5. // ...
  6. "skills": [
  7. {
  8. "actions": [
  9. "ohos.want.action.home"
  10. ],
  11. "entities": [
  12. "entity.system.home"
  13. ],
  14. "uris": [
  15. {
  16. "scheme":"http",
  17. "host":"example.com",
  18. "port":"80",
  19. "path":"path",
  20. "type": "text/*",
  21. "linkFeature": "Login"
  22. }
  23. ],
  24. "permissions": [],
  25. "domainVerify": false
  26. },
  27. // ...
  28. ],
  29. // ...
  30. }
  31. ],
  32. // ...
  33. }

extensionAbilities

The extensionAbilities tag represents the configuration of ExtensionAbilities, which is valid only for the current ExtensionAbility.

Table 9 extensionAbilities

Expand
Name Description Data Type Initial Value Allowed
name Name of the ExtensionAbility. This name must be unique in the entire application. The value is a string with a maximum of 127 bytes. String No
srcEntry Code path of the ExtensionAbility. The value is a string with a maximum of 127 bytes. String No
description Description of the ExtensionAbility component, used to describe the component functions. The value is a string with a maximum of 255 bytes. It can be a resource index to support multiple languages. String Yes (initial value: left empty)
icon Icon of the ExtensionAbility. The value is the index of the icon resource file. String Yes (initial value: left empty)
label Name of the ExtensionAbility displayed to users. The value must be a resource index to support multiple languages. It contains a maximum of 255 bytes. String Yes (initial value: left empty)
type Identifies the type of the current ExtensionAbility component. For details, see type Tag. string This tag is mandatory.
permissions

Permissions required for another application to access the ExtensionAbility component.

Each permission name is an array element, with a maximum of 255 bytes. For details about the value, see Application Permissions.

String array Yes (initial value: left empty)
appIdentifierAllowList

Identifies the list of apps that are allowed to start this ExtensionAbility.

Each array element is the appIdentifier of an app. For details about appIdentifier, see What Is appIdentifier.

Note:

This tag can be configured only when the type of the ExtensionAbility component is appService or embeddedUI.

This tag is supported since API version 20.

Since API version 26.0.0, embeddedUI supports this tag and allows configuring allow_all (allowing any app to start this ExtensionAbility).

string array This tag is optional. The default value is empty.
readPermission Permission required for reading data in the ExtensionAbility. The value is a string with a maximum of 255 bytes. This tag takes effect only when type of the preset ExtensionAbility of the system application is set to dataShare. The dataShare type is invalid for third-party applications. String Yes (initial value: left empty)
writePermission Permission required for writing data to the ExtensionAbility. The value is a string with a maximum of 255 bytes. This tag takes effect only when type of the preset ExtensionAbility of the system application is set to dataShare. The dataShare type is invalid for third-party applications. String Yes (initial value: left empty)
uri

Data URI provided by the ExtensionAbility. The value is a string with a maximum of 255 bytes, in the reverse domain name notation.

NOTE

This tag is mandatory when the type of the ExtensionAbility is set to dataShare.

String Yes (initial value: left empty)
skills

A set of wants that can be received by the ExtensionAbility.

Configuration rule: In an entry package, you can configure multiple skills attributes with the entry capability. (A skills attribute with the entry capability is the one that has ohos.want.action.home and entity.system.home configured.) The label and icon of the first ExtensionAbility that has skills configured are used as the label and icon of the entire service/application.

NOTE

The feature package of a service does not support the skills tag with the entry capability.

The feature package of an application supports the skills tag with entry capability.

Array Yes (initial value: left empty)
metadata

Metadata of the ExtensionAbility component.

NOTE

When type is set to form, this tag cannot be left empty. In addition, an object value ohos.extension.form must exist. Its corresponding resource value cannot be left empty and is the level-2 resource reference of the service widgets.

Object array Yes (initial value: left empty)
exported

Whether the ExtensionAbility can be called by other applications.

- true: The ExtensionAbility can be called by other applications.

- false: The UIAbility cannot be called by other applications, not even by Ability Assistant.

Boolean Yes (initial value: false)
extensionProcessMode

Identifies the process model of the current ExtensionAbility component. The supported configuration items vary depending on the type of the ExtensionAbility. The supported value range is as follows, and the default value is bundle.

- instance: Each instance of this ExtensionAbility runs in a separate process.

- type: All instances of this ExtensionAbility run in the same independent process, and run in a different process from ExtensionAbility component instances with other names.

- bundle: The instances of this ExtensionAbility run in the same process as the ExtensionAbility instances with the same extensionType under the same bundle name.

For UIExtensionAbility and its subclasses, the three process models instance, type, and bundle are supported.

For an ExtensionAbility of the appService type, the two process models type and bundle are supported.

- runWithMainProcess: The ExtensionAbility shares the same process with the main process of the application. Only the ExtensionAbility of the Desktop Extension Kit can be configured with runWithMainProcess.

string This tag is optional. The default value is bundle.
dataGroupIds Data group IDs of the ExtensionAbility. If the application where the current ExtensionAbility component is located also applies for a dataGroupId in the groupIds of the certificate applied by the AppGallery, the current ExtensionAbility component can share the directory generated by the dataGroupId with the application, therefore, the dataGroupId of the ExtensionAbility component takes effect only when it is configured in the groupIds tag in the signing certificate. This tag takes effect only when the ExtensionAbility component has an independent sandbox directory.For details, see step a in the shared sandbox configuration process in Shared Sandbox. String array Yes (initial value: left empty)
process

Name of the process where the component runs. This tag can be configured only when type is set to embeddedUI.

NOTE

1. This tag takes effect only on PCs/2-in-1 devices and tablets.

2. The UIAbility and ExtensionAbility components run in the same process when their tags are the same.

3. This tag is supported since API version 14.

String Yes (initial value: left empty)
isolationProcess

Whether the ExtensionAbility component can run in an isolated process.

- true: The component can run in an isolated process.

- false: The component cannot run in an isolated process.

NOTE

This tag takes effect only when type of ExtensionAbility is set to sys/commonUI (for system applications only).

This tag is supported since API version 20.

Boolean Yes (initial value: false)
skipAbilityStageLifecycle

Whether an ExtensionAbility component of the backup type skips AbilityStage lifecycle callbacks.

- true: Skips the AbilityStage lifecycle and does not execute callbacks such as onCreate and onDestroy.

- false: Does not skip the AbilityStage lifecycle and executes lifecycle callbacks normally.

NOTE

1. This tag takes effect only when the type of the ExtensionAbility is backup.

2. This tag is supported starting from API version 26.0.0.

Boolean Yes (initial value: false)

Example of the extensionAbilities structure:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. // ...
  3. "extensionAbilities": [
  4. {
  5. "name": "FormName",
  6. "srcEntry": "./ets/form/MyForm.ets",
  7. "icon": "$media:icon",
  8. "label" : "$string:extension_name",
  9. "description": "$string:form_description",
  10. "type": "form",
  11. "permissions": ["ohos.permission.ACCESS_BLUETOOTH"],
  12. "exported": true,
  13. "uri":"scheme://authority/path/query",
  14. "skills": [{
  15. "actions": [],
  16. "entities": [],
  17. "uris": [],
  18. "permissions": []
  19. }],
  20. "metadata": [
  21. {
  22. "name": "ohos.extension.form",
  23. "resource": "$profile:form_config",
  24. }
  25. ],
  26. "extensionProcessMode": "instance",
  27. "dataGroupIds": [
  28. "testGroupId1"
  29. ]
  30. }
  31. ],
  32. // ...
  33. }

type

Indicates the type of the current ExtensionAbility component. The supported values are as follows:

Expand
Tag Value Description
form The ExtensionAbility of a widget.
workScheduler The ExtensionAbility of a deferred task.
inputMethod The ExtensionAbility of an input method.
share The ShareExtensionAbility that provides the content sharing processing capability.
service The service component running in the background. A third-party configuration cannot install the app, and the privilege must be requested. The privilege request is not open to third-party applications.
accessibility The ExtensionAbility of accessibility capabilities.
fileAccess The ExtensionAbility for public data access, which allows an application to provide files and folders for display by file management applications. The configuration does not take effect for third-party applications, and it is valid only in system applications.
dataShare The ExtensionAbility for data sharing. A third-party configuration cannot install the app, and the privilege must be requested. The privilege request is not open to third-party applications.
staticSubscriber The ExtensionAbility of a static broadcast. The configuration does not take effect for third-party applications, and it is valid only in system applications.
fileShare The ExtensionAbility for file sharing.
vpn The ExtensionAbility that provides @ohos.app.ability.VpnExtensionAbility (Third-Party VPN Capability) for developers.
wallpaper The ExtensionAbility of wallpapers.
backup The ExtensionAbility for data backup.
enterpriseAdmin The ExtensionAbility for enterprise device management. An enterprise device management app must have an ExtensionAbility of this type.
window This ExtensionAbility creates a window during startup to provide UI development for developers. The UI developed by developers is combined into the windows of other apps through the UIExtensionComponent control. The configuration does not take effect for third-party applications, and it is valid only in system applications.
thumbnail An ExtensionAbility that obtains file thumbnails. You can provide thumbnails for files of custom file types. Reserved field. Not supported yet.
preview This ExtensionAbility parses a file and displays it in a window. You can combine this window into other application windows. Reserved field. Not supported yet.
print The ExtensionAbility of the print framework.
push The ExtensionAbility for push.
driver The ExtensionAbility of the driver framework. An app with an ExtensionAbility of the driver type configured is regarded as a driver app. A driver app does not distinguish users during installation, uninstallation, and restoration, and existing driver apps on the device are also installed when a new user is created. For example, when a child user is created, the existing driver apps of the primary user are installed by default. When a driver app is uninstalled on a child user, the corresponding driver app on the primary user is also uninstalled.
remoteNotification The ExtensionAbility for remote notifications.
remoteLocation The ExtensionAbility for remote location.
voip The ExtensionAbility for network audio and video calls.
action The ExtensionAbility of the custom operation business template, which provides developers with a custom operation business template based on UIExtension.
adsService The ExtensionAbility of the advertising service, which provides the advertising service framework. The configuration does not take effect for third-party applications, and it is valid only in system applications.
embeddedCashier23+ The ExtensionAbility of the payment service. It is used together with the CashierComponent control to display the payment page in other apps. The configuration does not take effect for third-party applications, and it is valid only in system applications. It is supported only on TV devices, and the configuration does not take effect on other devices.
embeddedUI The embedded UI extension capability, which provides the capability of embedding UIs across processes.
insightIntentUI The extension capability that provides developers with content that can be invoked by system entries and presented in a window.
ads The ExtensionAbility of the advertising service. It is used together with the AdComponent control to display the advertising page in other apps. It is supported only for device vendors.
photoEditor The ExtensionAbility of the image editing service, which provides developers with an image editing business template based on UIExtension.
appAccountAuthorization The ExtensionAbility of the app account authorization extension capability, used to process account authorization requests, such as account login authorization.
autoFill/password The ExtensionAbility for the account and password autofill service, which supports data saving and filling.
hms/account The ExtensionAbility of the app account management capability.
sysDialog/atomicServicePanel The ExtensionAbility that provides the basic capability of building an atomic service panel. It is implemented based on UIExtensionAbility. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysDialog/userAuth The ExtensionAbility for local user authentication. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysDialog/common The ExtensionAbility of a general dialog box. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysDialog/power The ExtensionAbility of the power-off and restart dialog box. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysDialog/print The ExtensionAbility of the print modal dialog box. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysDialog/meetimeCall The ExtensionAbility of MeeTime calls. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysDialog/meetimeContact The ExtensionAbility of MeeTime contacts. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysDialog/meetimeMessage The ExtensionAbility of MeeTime messages. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysPicker/meetimeContact The ExtensionAbility of the MeeTime contact list. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysPicker/meetimeCallLog The ExtensionAbility of the MeeTime call log list. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysPicker/share The ExtensionAbility of system sharing. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysPicker/mediaControl The ExtensionAbility of the casting component. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysPicker/photoPicker A third-party application launches the gallery picker UI through the corresponding UIExtensionType. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysPicker/filePicker The ExtensionAbility of the file download dialog box. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysPicker/audioPicker The ExtensionAbility of the audio management dialog box. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sysPicker/photoEditor The ExtensionAbility of the image editing dialog box. The configuration does not take effect for third-party applications, and it is valid only in system applications.
sys/commonUI A non-general ExtensionAbility that provides embedded display or dialog boxes strongly related to business attributes. The configuration does not take effect for third-party applications, and it is valid only in system applications.
autoFill/smart The ExtensionAbility for the autofill service in contextual scenarios, which supports data saving and filling.
modularObject The ExtensionAbility for modular object management. This tag is supported since API version 26.0.0.
uiService The dialog box service component, which creates a Window during startup and supports bidirectional communication. The configuration does not take effect for third-party applications, and it is valid only in system applications.
recentPhoto The ExtensionAbility for recent photo recommendations.
fence The ExtensionAbility for geofencing.
callerInfoQuery The ExtensionAbility for enterprise contact query.
assetAcceleration The ExtensionAbility for resource pre-download.
formEdit The ExtensionAbility for widget editing.
distributed The ExtensionAbility for distributed extension.
liveForm20+ The ExtensionAbility of an interactive widget.
appService20+ The AppServiceExtensionAbility that provides background service-related extension capabilities for apps, including lifecycle callbacks such as creation, destruction, connection, and disconnection of background services.
webNativeMessaging21+ The ExtensionAbility that provides Web message communication capabilities for developers.
faultLog21+ The ExtensionAbility for delayed fault notification.
notificationSubscriber22+ The ExtensionAbility that provides notification subscription-related functions.
crypto22+ The ExtensionAbility for external key management extension.
partnerAgent23+ The ExtensionAbility that provides device discovery and device offline notification functions based on Bluetooth communication technology.
contentEmbed24+ The ExtensionAbility of the object insertion editing framework.
selection The ExtensionAbility for text selection extension. Since API version 20, it is supported only for system applications, and the configuration does not take effect for third-party applications. Since API version 24, configuration by third-party applications is supported.
awc/webpage The ExtensionAbility for general web page browsing.
awc/newsfeed The ExtensionAbility of the news feed service.
assetCache24+ The ExtensionAbility that provides general app data caching capabilities. The configuration does not take effect for third-party applications, and it is valid only in system applications.
statusBarView ExtensionAbility of the Desktop Extension Kits.
liveViewLockScreen ExtensionAbility of live view lock screen immersive state.
liveViewCard ExtensionAbility of customized extension area of the live view widget. This tag is supported since API version 26.0.0.
accountLogout ExtensionAbility of the HUAWEI ID sign-out capability. Currently, the setting is valid only for system apps.
sysPicker/navigation ExtensionAbility that starts the system navigation application panel. Currently, the setting is valid only for system apps.
sysPicker/appSelector ExtensionAbility that starts the system app selection dialog box. Currently, the setting is valid only for system apps.
sys/visualExtension ExtensionAbility for visual search of the smart image control. Currently, the setting is valid only for system apps.
screenTimeGuard20+ ExtensionAbility of the screen time guard service.

shortcuts

The shortcuts tag provides the shortcut information of an application. The value is an array and consists of four sub-attributes: shortcutId, label, icon, and wants.

The shortcut information is specified in metadata, where:

  • name indicates the name of the shortcut, identified by ohos.ability.shortcuts.

  • resource indicates where the resources of the shortcut are stored.

NOTE

A maximum of four shortcuts can be displayed on the desktop.

Table 10 Shortcuts

Expand
Name Description Data Type Initial Value Allowed
shortcutId ID of the shortcut. The value is a string with a maximum of 63 bytes. This tag cannot be configured using the resource index ($string). String No
label Label of the shortcut, that is, the text description displayed for the shortcut. The value is a string with a maximum of 255 bytes. It can be descriptive content or a resource index. String Yes (initial value: left empty)
icon

Icon of the shortcut. The value is the index of the icon resource file.

NOTE

Icons are classified into single-layer icons and layered icons. A single-layer icon contains only one image, and a layered icon contains a foreground image and a background image. The following configurations are recommended:

1. Foreground image: a transparent layer whose icon size is 450 × 450 px and resource size is 1024 × 1024 px.

2. Background image: The size is 1024 × 1024 px.

String Yes (initial value: left empty)
visible

Whether the shortcut is visible. The value true indicates that the shortcut is visible; false indicates the opposite.

NOTE

This tag is supported since API version 20.

Boolean Yes (initial value: true)
wants Wants to which the shortcut points. If the startShortcut API of launcherBundleManager is called, the first target component in the wants is started. As such, you are advised to configure only one element for wants. Object Yes (initial value: left empty)
  1. Configure the shortcuts_config.json file in /resources/base/profile/.

    Collapse
    Word wrap
    Dark theme
    Copy code
    1. {
    2. "shortcuts": [
    3. {
    4. "shortcutId": "id_test1",
    5. "label": "$string:shortcut",
    6. "icon": "$media:aa_icon",
    7. "visible": true,
    8. "wants": [
    9. {
    10. "bundleName": "com.ohos.hello",
    11. "moduleName": "entry",
    12. "abilityName": "EntryAbility",
    13. "parameters": {
    14. "testKey": "testValue"
    15. }
    16. }
    17. ]
    18. }
    19. ]
    20. }
  2. In the abilities tag of the module.json5 file, configure the metadata tag for the UIAbility component to which a shortcut needs to be added so that the shortcut configuration file takes effect for the UIAbility.

    Collapse
    Word wrap
    Dark theme
    Copy code
    1. {
    2. "module": {
    3. // ...
    4. "abilities": [
    5. {
    6. "name": "EntryAbility",
    7. "srcEntry": "./ets/entryability/EntryAbility.ets",
    8. // ...
    9. "skills": [
    10. // ...
    11. {
    12. "entities": [
    13. "entity.system.home"
    14. ],
    15. "actions": [
    16. "ohos.want.action.home"
    17. ]
    18. }
    19. ],
    20. "metadata": [
    21. {
    22. "name": "ohos.ability.shortcuts",
    23. "resource": "$profile:shortcuts_config"
    24. }
    25. ],
    26. // ...
    27. }
    28. ],
    29. // ...
    30. }
    31. }

wants

The wants tag provides wants information for a shortcut.

Table 11 wants

Expand
Name Description Data Type Initial Value Allowed
bundleName Target bundle name of the shortcut. String Yes
moduleName Target module name of the shortcut. String Yes
abilityName Target ability name of the shortcut. String Yes
parameters Custom data when the shortcut is started. The data must be strings. A key can contain a maximum of 1024 characters. Object Yes

Example of the wants tag:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "wants": [
  3. {
  4. "bundleName": "com.ohos.hello",
  5. "moduleName": "entry",
  6. "abilityName": "EntryAbility",
  7. "parameters": {
  8. "testKey": "testValue"
  9. }
  10. }
  11. ]
  12. }

distributionFilter

The distributionFilter tag defines the rules for distributing HAP files based on different device specifications, so that precise matching can be performed when the application market distributes applications.

NOTE

This tag is supported since API version 10. For API version 9 and earlier, the distroFilter tag is used.

  • Application scenario: If a project has multiple entry-type modules and the values of deviceType configured for these modules overlap, you need to use this tag to distinguish the modules. In the following example, both entry-type modules support the tablet type, and therefore the distributionFilter tag is required.

    Collapse
    Word wrap
    Dark theme
    Copy code
    1. // Device types supported by entry1
    2. {
    3. "module": {
    4. "name": "entry1",
    5. "type": "entry",
    6. "deviceTypes": [
    7. "tv",
    8. "tablet"
    9. ],
    10. // ...
    11. }
    12. }
    Collapse
    Word wrap
    Dark theme
    Copy code
    1. // Device types supported by entry2
    2. {
    3. "module": {
    4. "name": "entry2",
    5. "type": "entry",
    6. "deviceTypes": [
    7. "tv",
    8. "tablet"
    9. ],
    10. // ...
    11. }
    12. }
  • Configuration rule: This tag consists of four attributes, including screenShape, screenWindow, screenDensity, and countryCode. For details, see the following table.

    During distribution, a unique HAP is determined based on the mapping between deviceTypes and the preceding attributes.

    • When configuring this tag, include at least one of the attributes.
    • If any one or more attributes are set for one entry-type module, the same attributes must be set for all other entry-type modules.
    • The screenShape and screenWindow attributes are available only for lite wearables.
  • Configuration: This tag must be configured in the /resources/base/profile directory and be referenced in the resource tag of metadata.

Table 12 distributionFilter

Expand
Name Description Data Type Initial Value Allowed
screenShape Supported screen shapes. Object array Yes (initial value: left empty)
screenWindow Supported application window resolutions. Object array Yes (initial value: left empty)
screenDensity Pixel density of the screen, in dots per inch (DPI). Object array Yes (initial value: left empty)
countryCode Code of the country or region to which the application is to be distributed. The value is subject to the ISO-3166-1 standard. Enumerated definitions of multiple countries and regions are supported. Object array Yes (initial value: left empty)

screenShape

Table 13 screenShape

Expand
Name Description Data Type Initial Value Allowed
policy

Rule for the sub-attribute value.

- exclude: Exclude the matches of the sub-attribute value.

- include: Include the matches of the sub-attribute value.

String No
value Screen shapes. The value can be circle, rect, or both. For example, different HAPs can be provided for a smart watch with a circular face and that with a rectangular face. String array No

screenWindow

Table 14 screenWindow

Expand
Name Description Data Type Initial Value Allowed
policy

Rule for the sub-attribute value. Currently, the value can only be include.

- include: Include the matches of the sub-attribute value.

String No
value Screen width and height, in pixels. The value is an array of supported width and height pairs, each in the "width * height" format, for example, "454 * 454". String array No

screenDensity

Table 15 screenDensity

Expand
Name Description Data Type Initial Value Allowed
policy

Rule for the sub-attribute value.

- exclude: Exclude the matches of the sub-attribute value.

- include: Include the matches of the sub-attribute value.

String No
value

Identifies the pixel density (dpi: Dot Per Inch) of the screen. The options are as follows:

- sdpi: small-scale DPI. This value is applicable to devices with a DPI range of (0, 120].

- mdpi: medium-scale DPI. This value is applicable to devices with a DPI range of (120, 160].

- ldpi: large-scale DPI. This value is applicable to devices with a DPI range of (160, 240].

- xldpi: extra-large-scale DPI. This value is applicable to devices with a DPI range of (240, 320].

- xxldpi: extra-extra-large-scale DPI. This value is applicable to devices with a DPI range of (320, 480].

- xxxldpi: extra-extra-extra-large-scale DPI. This value is applicable to devices with a DPI range of (480, 640].

string array No

countryCode

Table 16 countryCode

Expand
Name Description Data Type Initial Value Allowed
policy

Rule for the sub-attribute value.

- exclude: Exclude the matches of the sub-attribute value.

- include: Include the matches of the sub-attribute value.

String No
value Code of the country or region to which the application is to be distributed. String array No

Example:

  1. Configure the distributionFilter_config.json file (this file name is customizable) in resources/base/profile under the development view.

    Collapse
    Word wrap
    Dark theme
    Copy code
    1. {
    2. "distributionFilter": {
    3. "screenShape": {
    4. "policy": "include",
    5. "value": [
    6. "circle",
    7. "rect"
    8. ]
    9. },
    10. "screenWindow": {
    11. "policy": "include",
    12. "value": [
    13. "454*454",
    14. "466*466"
    15. ]
    16. },
    17. "screenDensity": {
    18. "policy": "exclude",
    19. "value": [
    20. "ldpi",
    21. "xldpi"
    22. ]
    23. },
    24. "countryCode": {
    25. "policy": "include",
    26. "value": [
    27. "CN"
    28. ]
    29. }
    30. }
    31. }
  2. Configure metadata in the module tag in the module.json5 file.

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. // ...
  4. "metadata": [
  5. {
  6. "name": "ohos.module.distribution",
  7. "resource": "$profile:distributionFilter_config"
  8. }
  9. ],
  10. // ...
  11. }
  12. }

testRunner

The testRunner tag represents the supported test runner.

Table 17 testRunner

Expand
Name Description Data Type Initial Value Allowed
name Name of the test runner object. The value is a string with a maximum of 255 bytes. String No
srcPath Code path of the test runner. The value is a string with a maximum of 255 bytes. String No

Example of the testRunner structure:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. // ...
  4. "testRunner": {
  5. "name": "myTestRunnerName",
  6. "srcPath": "etc/test/TestRunner.ts"
  7. },
  8. // ...
  9. }
  10. }

atomicService

The atomicService tag represents the atomic service configuration. It takes effect only when bundleType is set to atomicService in the app.json5 file.

Table 18 atomicService

Expand
Name Description Data Type Initial Value Allowed
preloads List of modules to preload. Object array Yes (initial value: left empty)
resizeable

Whether an atomic service supports adaptive window. If this tag is set to true, the width and height of the window automatically adapt to the screen when the tablet is switched from landscape mode to portrait mode or the foldable screen is folded.

NOTE

1. This tag is supported since API version 20.

2. If the window has adapted to the tablet (landscape) and foldable screen (unfolded), you are advised to set this tag to true.

- true: The atomic service supports adaptive window.

- false: The atomic service does not support adaptive window.

Boolean Yes (initial value: false)

Table 19 preloads

Expand
Name Description Data Type Initial Value Allowed
moduleName Name of the module to be preloaded when the current module is loaded in the atomic service. The value must match an existing module other than the current one. It contains a maximum of 31 bytes. String No

Example of the atomicService structure:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. // ...
  4. "atomicService": {
  5. "preloads":[
  6. {
  7. "moduleName":"feature"
  8. }
  9. ],
  10. "resizeable": true
  11. },
  12. // ...
  13. }
  14. }

dependencies

The dependencies tag identifies the list of shared libraries that the module depends on when it is running.

Table 20 dependencies

Expand
Name Description Data Type Initial Value Allowed
bundleName Name of the shared bundle on which the current module depends. The value is a string of 7 to 128 bytes. String Yes (initial value: left empty)
moduleName Module name of the shared bundle on which the current module depends. The value is a string with a maximum of 31 bytes. String No
versionCode Version number of the shared bundle on which the current module depends. The value ranges from 0 to 2147483647. Number Yes (initial value: left empty)

Example of the dependencies structure:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. // ...
  4. "dependencies": [
  5. {
  6. "bundleName":"com.share.library",
  7. "moduleName": "library",
  8. "versionCode": 10001
  9. }
  10. ],
  11. // ...
  12. }
  13. }

proxyData

The proxyDatas tag provides the list of data proxies provided by the module. It can be configured only for entry and feature modules.

Table 21 proxyData

Expand
Name Description Data Type Initial Value Allowed
uri URI of the data proxy. The URIs configured for different data proxies must be unique and must be in the datashareproxy://Current application bundle name/xxx format. The value is a string with a maximum of 255 bytes. String No
requiredReadPermission Permission required for reading data from the data proxy. If it is not specified, other applications will not be able to use the data proxy. For non-system applications, the level of the set permission must be system_basic or system_core. For system applications, the permission level is not limited. For details about the permission levels, see Application Permissions. The value is a string with a maximum of 255 bytes. String Yes (initial value: left empty)
requiredWritePermission Permission required for writing data to the data proxy. If it is not specified, other applications will not be able to use the data proxy. For non-system applications, the level of the set permission must be system_basic or system_core. For system applications, the permission level is not limited. For details about the permission levels, see Application Permissions. The value is a string with a maximum of 255 bytes. String Yes (initial value: left empty)
metadata Metadata of the data proxy. Only the name and resource tags can be configured. Object Yes (initial value: left empty)

Example of the proxyData structure:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. // ...
  4. "proxyData": [
  5. {
  6. "uri":"datashareproxy://ohos.app.hap.myapplication/event/Meeting",
  7. "requiredReadPermission": "ohos.permission.SYSTEM_FLOAT_WINDOW",
  8. "requiredWritePermission": "ohos.permission.SYSTEM_FLOAT_WINDOW",
  9. "metadata": {
  10. "name": "datashare_metadata",
  11. "resource": "$profile:datashare"
  12. }
  13. }
  14. ],
  15. // ...
  16. }
  17. }

routerMap

The routerMap tag represents the path to the routing table for the module.

The routerMap configuration file provides the routing table information of the module. The value of the routerMap tag is an array.

Table 22 routerMap

Expand
Name Description Data Type Initial Value Allowed
name Name of the page to be redirected to. The value is a string with a maximum of 1023 bytes. String No
pageSourceFile Path of the page in the module. The value is a string with a maximum of 255 bytes. String No
buildFunction Function decorated by @Builder. The function describes the UI of the page. The value is a string with a maximum of 1023 bytes. String No
data Custom data of the string type. You can extend capabilities and obtain the content from the data field in routerMap of the HapModuleInfo object. This tag has been parsed by the system. Each piece of custom data cannot exceed 128 bytes. Object Yes (initial value: left empty)
customData Custom data of any type. You can extend capabilities and obtain the content from the customData field in routerMap of the HapModuleInfo object. You have to call the JSON.parse function to parse this tag. The total length of the value cannot exceed 4096 bytes. Object Yes (initial value: left empty)

Example:

  1. Define a routing table configuration file under resources/base/profile in the development view. The file name can be customized, for example, router_map.json.

    Collapse
    Word wrap
    Dark theme
    Copy code
    1. {
    2. "routerMap": [
    3. {
    4. "name": "DynamicPage1",
    5. "pageSourceFile": "src/main/ets/pages/pageOne.ets",
    6. "buildFunction": "myFunction",
    7. "customData": {
    8. "stringKey": "data1",
    9. "numberKey": 123,
    10. "booleanKey": true,
    11. "objectKey": {
    12. "name": "test"
    13. },
    14. "arrayKey": [
    15. {
    16. "id": 123
    17. }
    18. ]
    19. }
    20. },
    21. {
    22. "name": "DynamicPage2",
    23. "pageSourceFile": "src/main/ets/pages/pageTwo.ets",
    24. "buildFunction": "myBuilder",
    25. "data": {
    26. "key1": "data1",
    27. "key2": "data2"
    28. }
    29. }
    30. ]
    31. }
  2. Define the routerMap tag under module of the module.json5 file, set it to point to the defined routing table configuration file, for example, set it to "routerMap": "$profile:router_map".

data

The data tag is used to configure custom string data in the routing table.

Example of the data structure:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "routerMap": [
  3. {
  4. "name": "DynamicPage",
  5. "pageSourceFile": "src/main/ets/pages/pageOne.ets",
  6. "buildFunction": "myBuilder",
  7. "data": {
  8. "key1": "data1",
  9. "key2": "data2"
  10. }
  11. }
  12. ]
  13. }

customData

The data tag represents custom data in the routing table.

The customData tag is used to configure custom data of any type.

Example of the customData structure:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "routerMap": [
  3. {
  4. "name": "DynamicPage",
  5. "pageSourceFile": "src/main/ets/pages/pageOne.ets",
  6. "buildFunction": "myBuilder",
  7. "customData": {
  8. "stringKey": "data1",
  9. "numberKey": 123,
  10. "booleanKey": true,
  11. "objectKey": {
  12. "name": "test"
  13. },
  14. "arrayKey": [
  15. {
  16. "id": 123
  17. }
  18. ]
  19. }
  20. }
  21. ]
  22. }

appEnvironments

The appEnvironments tag represents the application environment variables configured for the module.

Table 23 appEnvironments

Expand
Name Description Data Type Initial Value Allowed
name Name of the environment variable. The value is a string with a maximum of 4,096 bytes. String Yes (initial value: left empty)
value Value of the environment variable. The value is a string with a maximum of 4,096 bytes. String Yes (initial value: left empty)

Example of the appEnvironments structure:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. // ...
  4. "appEnvironments": [
  5. {
  6. "name": "name1",
  7. "value": "value1"
  8. }
  9. ],
  10. // ...
  11. }
  12. }

hnpPackages

The hnpPackages tag provides information about the native software package contained in the application.

Table 24 hnpPackages

Expand
Name Description Data Type Initial Value Allowed
package Name of the native software package. String No
type

Type of the native software package. The options are as follows:

- public: public type.

- private: private type.

String No
independentSign

Whether a native software package supports independent signature.

NOTE

This tag is supported since API version 23.

Boolean Yes (initial value: false)

Example of the hnpPackages structure:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. // ...
  4. "hnpPackages": [
  5. {
  6. "package": "hnpsample.hnp",
  7. "type": "public",
  8. "independentSign": true
  9. }
  10. ],
  11. // ...
  12. },
  13. }

fileContextMenu

The fileContextMenu tag provides configuration options for the context menu (displayed upon right-clicking) of the current HAP. It is a profile that contains the context menu configuration registered by the application. This tag takes effect only on PCs/2-in-1 devices and can be configured only in entry modules.

Example of the fileContextMenu structure:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. // ...
  4. "fileContextMenu": "$profile:menu", // Resource configuration, which points to the menu.json configuration file defined in the profile.
  5. // ...
  6. }
  7. }

Define the menu.json file under resources/base/profile in the development view. The file name (menu.json in this example) can be customized, but must be consistent with the information specified by the fileContextMenu tag. The file describes the items and response behavior of the context menu registered by the application.

The root node of the file is fileContextMenu, which is an object array and indicates the number of context menus registered by the current module. (The number must not exceed 5 per module and per application. If the number exceeds 5, only five random menus are parsed.)

Table 25 fileContextMenu

Expand
Name Description Data Type Initial Value Allowed
abilityName Name of the ability to be started for the context menu. String No
menuItem

Information displayed on the context menu. Naming rules:

Rule 1: [Action] + [Application name]. Example: Open with {application}, or Open with {application} ({plugin}).

Rule 2: [Action] + [Purpose]. Example: Compress to {file name}, Compress to {path}, or Convert to {format} with {application}.

Resource ID No
menuHandler Context menu handler. An ability can be used to create multiple shortcut menus. Each tag corresponds to one shortcut menu item, so you can customize the value of this tag to ensure that each tag is unique in the ability. When a user right-clicks a context menu to start an application, this tag is passed to the application as a parameter. String No
menuContext Context required for displaying the context menu. Multiple contexts are supported. Object array No

Table 26 menuContext

Expand
Name Description Data Type Initial Value Allowed
menuKind

Condition in which the context menu is displayed. The options are as follows:

- 0: blank area

- 1: file

- 2: folder

- 3: file and folder

Number No
menuRule

Operations that can trigger context menu. The options are as follows:

- single: Single file or folder is selected.

- multi: Multiple files or folders are selected.

- both: Both.

String No (This tag is read when menuKind is set to 1 or 2.)
fileSupportType

Supported types of files. The context menu is displayed when the selected file list contains files of these types.

If the value of this tag is set to ["*"], the fileNotSupportType tag is read.

When the value is left empty, no processing is performed.

String array No (This tag is read when menuKind is set to 1.)
fileNotSupportType

Types of files not supported. The context menu is not displayed when the selected file list contains files of these types.

This tag is read only when menuKind is set to 1 and fileSupportType is set to ["*"].

String array Yes (initial value: left empty)

Example of the menu.json file in the resources/base/profile directory:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "fileContextMenu": [
  3. {
  4. "abilityName": "EntryAbility",
  5. "menuItem": "$string:module_desc",
  6. "menuHandler": "openCompress",
  7. "menuContext": [
  8. {
  9. "menuKind": 0
  10. },
  11. {
  12. "menuKind": 1,
  13. "menuRule": "both",
  14. "fileSupportType": [
  15. ".rar",
  16. ".zip"
  17. ],
  18. "fileNotSupportType": [
  19. ""
  20. ]
  21. },
  22. {
  23. "menuKind": 2,
  24. "menuRule": "single"
  25. },
  26. {
  27. "menuKind": 3
  28. }
  29. ]
  30. }
  31. ]
  32. }

Response Behavior

After a context menu is registered, the More option of the menu, when clicked, displays a sublist of menu items specified in menuItem. After you click any of the items, the file manager starts the third-party application using startAbility by default. In addition to the bundle name and ability name of the third-party application, the following tags are also passed in parameter of want:

Table 27 parameter field in want

Expand
Name Value Data Type
menuHandler Value of menuHandler in the registration configuration file. String
uriList URIs for redirection when the user right-clicks files. If the context menu is displayed by right-clicking a blank area, the value is null. If the context menu is displayed by right-clicking a single file, the array length is 1. If the context menu is displayed by right-clicking multiple files, the URIs of all files should be passed in. String array

startWindow

This tag points to a profile resource and is used to define the configuration file start_window.json of the UIAbility startup page in resources/base/profile. If this tag is set, the startWindowIcon and startWindowBackground tags do not take effect.

NOTE

Since API version 19, this field can be used to configure an enhanced starting window.

Table 28 startWindow

Expand
Name Description Data Type Initial Value Allowed
startWindowType

Visibility type of the UIAbility startup page.

This tag is supported only on 2-in-1 devices or tablets in freeform mode.

The options are as follows:

- REQUIRED_SHOW: The starting window is displayed. This setting is not affected by the setting of the hideStartWindow tag in StartOptions.

- REQUIRED_HIDE: The starting window is hidden. This setting is not affected by the setting of the hideStartWindow tag in StartOptions.

- OPTIONAL_SHOW: The starting window is displayed by default, but it can be hidden if the hideStartWindow tag in StartOptions is set to hide it.

- The default value is REQUIRED_SHOW.

This tag is supported since API version 20.

String Yes (initial value: REQUIRED_SHOW)
startWindowAppIcon

Index to the icon file of the UIAbility startup page. The value is a string with a maximum of 255 bytes.

This field is supported since API version 19.

String Yes (initial value: left empty)
startWindowIllustration

Index to the illustration file of the UIAbility startup page. The value is a string with a maximum of 255 bytes.

This field is supported since API version 19.

String Yes (initial value: left empty)
startWindowBrandingImage

Index to the brand logo file of the UIAbility startup page. The value is a string with a maximum of 255 bytes.

This field is supported since API version 19.

String Yes (initial value: left empty)
startWindowBackgroundColor

Index to the background color resource file of the UIAbility startup page. The value is a string with a maximum of 255 bytes.

This field is supported since API version 19.

String No
startWindowBackgroundImage

Index to the background image file of the UIAbility startup page. The value is a string with a maximum of 255 bytes.

This field is supported since API version 19.

String Yes (initial value: left empty)
startWindowBackgroundImageFit

Background image adaptation mode of the UIAbility startup page. The options are as follows:

- Contain: Proportionally scaled based on the aspect ratio, the image is fully contained within the display area.

- Cover: Proportionally scaled based on the aspect ratio, both width and height of the image are greater than or equal to that of the display area.

- Auto: adaptive display.

- Fill: The image fills the display area without any aspect ratio scaling applied.

- ScaleDown: The image is displayed in accordance with its aspect ratio, either scaled down or kept unchanged.

- None: The image is displayed in its original size.

This field is supported since API version 19.

String Yes (initial value: Cover)
startWindowColorModeType

Color mode of the UIAbility launch page, which applies only to the scenario where the UIAbility is started between processes.

The options are as follows:

- "FOLLOW_SYSTEM": The launch page color mode follows the system dark light color.

- "FOLLOW_APPLICATION": The launch page color mode follows the application's dark light color.

- If this field is not set, the default value "FOLLOW_SYSTEM" is used, indicating that the launch page color mode follows the system dark light color.

This field is supported since API version 20.

String Yes (default value: FOLLOW_SYSTEM)

Example of the start_window.json file in the resources/base/profile directory:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "startWindowType": "REQUIRED_SHOW",
  3. "startWindowColorModeType": "FOLLOW_SYSTEM",
  4. "startWindowAppIcon": "$media:start_window_app_icon",
  5. "startWindowIllustration": "$media:start_window_illustration",
  6. "startWindowBrandingImage": "$media:start_window_branding_image",
  7. "startWindowBackgroundColor": "$color:start_window_back_ground_color",
  8. "startWindowBackgroundImage": "$media:start_window_back_ground_image",
  9. "startWindowBackgroundImageFit": "Cover"
  10. }

systemTheme

The systemTheme tag points to a profile resource, which is used to specify the system theme configuration file used by the current application. This tag is supported since API version 20.

Example:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. // ...
  4. "systemTheme": "$profile:theme_config", // Resource configuration, which points to the theme_config.json configuration file defined in the profile.
  5. }
  6. }

Define the theme_config.json configuration file in resources/base/profile. The file's base name can be customized but must be either theme_config or a name that starts with theme_config (e.g. theme_config_1). The configuration file specifies the system theme used by the current application, corresponding to the information specified by the systemTheme tag.

Table 29 theme_config.json

Expand
Name Description Data Type Initial Value Allowed
systemTheme

System theme used by the current application. The value is an enum of the system theme name. The options are as follows:

- $ohos:theme:ohos_theme: default system theme

String No

Example of the theme_config.json file in the resources/base/profile directory:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "systemTheme": "$ohos:theme:ohos_theme"
  3. }

requiredDeviceFeatures

Table 30 requiredDeviceFeatures

Expand
Name Description Data Type Initial Value Allowed
phone

Device feature supported by the mobile phone. The options are as follows:

- large_screen: large screen in landscape mode

- paint: stylus drawing This field is supported since API version 23.

String array Yes (initial value: empty array)
2in1

Device feature supported by the PC/2-in-1 device. The options are as follows:

- paint: stylus drawing This field is supported since API version 23.

String array Yes (initial value: empty array)
wearable

Device features that need to be supported by a wearble. The options are as follows:

- child: The device must be a kids' smartwatch. This field is supported since API version 24.

String array Yes (initial value: empty array)

Example:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. "requiredDeviceFeatures": {
  4. "phone": [
  5. "large_screen"
  6. ],
  7. "2in1": [
  8. "paint"
  9. ]
  10. },
  11. }
  12. }

executableBinaryPaths

Identifies the path information of executable binary files in the application and takes effect only on PCs/2-in-1 devices. This tag is supported since API version 24.

Table 31 executableBinaryPaths

Expand
Name Description Data Type Initial Value Allowed
path Path of the executable file. This path is a relative path and must start with the libs/{abi}/ prefix, where {abi} indicates the device CPU architecture type, such as arm64-v8a, x86_64, or armeabi-v7a. Executable binary files must be placed in the libs/{abi}/ directory. String No

Example of the executableBinaryPaths structure:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. // ...
  4. "executableBinaryPaths": [
  5. {
  6. "path": "libs/arm64-v8a/test.bin"
  7. }
  8. ],
  9. // ...
  10. },
  11. }

skillProfiles

Starting from API version 26.0.0, the skillProfiles tag is added. This tag identifies the skill configuration information of the current module and is used to define the skill capabilities of an AI agent. By defining skills, an application can expose the capabilities of its AI agent to the system or other applications, allowing the skills to be discovered and invoked by other applications. This tag takes effect only for modules whose type is entry, feature, shared, or skill.

Table 32 skillProfiles

Expand
Name Description Data Type Initial Value Allowed
name

Identifies the name of the skill. Ensure that the name is unique within the current module. The naming rules are as follows:

- Only lowercase letters, digits, and hyphens (-) are allowed.

- It must start with a lowercase letter or digit.

- It must end with a lowercase letter or digit.

- It cannot start or end with a hyphen, and consecutive hyphens are not allowed.

- The maximum length is 64 bytes.

string This tag cannot be omitted.
abilityName

Name of the component associated with the skill. The value must be configured as the name of a UIAbility under the abilities tag or the name of a ServiceExtension component whose type is service under the extensionabilities tag. The value is a string with a maximum of 127 bytes. It must start with a letter and can contain letters, digits, underscores (_), and periods (.).

NOTE

This field applies only to modules of the entry, feature, and shared types. This field is not supported for modules of the skill type.

String Yes (initial value: name of the entry ability; if no entry ability exists, the value is an empty string.)
srcEntries

List of code file paths that implement the skill and points to .ets files that contain the skill implementation logic. Each element in the array is a file path relative to the skills directory of the current module.

NOTE

The .ets files specified by srcEntries must be placed in the skills/{skill-name}/scripts directory, where {skill-name} is the skill name configured in skillProfiles. For example, if the skill name is my-skill, the .ets files must be placed in the skills/my-skill/scripts/ directory under the module root directory. Up to 100 file paths are supported.

String array Yes (initial value: left empty)
permissions List of permissions required to invoke the skill. Other applications must request the corresponding permissions before invoking the skill. Each array element is a permission name with a maximum of 255 bytes. For details about the value, see Application Permissions. String array Yes (initial value: left empty)
version

Identifies the version number of the skill, in the format of major.minor.patch, where each version number is a non-negative integer and cannot start with 0 (unless it is 0 itself).

Example: "1.0.1", "0.1.1"

string This tag cannot be omitted.
visibility

Identifies the visibility of the skill, which controls the visibility scope of the skill. The supported values are as follows:

- "private": private, visible only to the current app.

- "system": system-level, visible to system apps and the current app.

- "public": public, visible to all apps.

Note:

The default value of this tag is "system".

string This tag can be omitted. The default value is "system".

Example:

Collapse
Word wrap
Dark theme
Copy code
  1. {
  2. "module": {
  3. // ...
  4. "skillProfiles": [
  5. {
  6. "name": "my-skill",
  7. "abilityName": "EntryAbility",
  8. "version": "1.0.0",
  9. "visibility": "public",
  10. "srcEntries": [
  11. "../../my-skill/scripts/Test.ets"
  12. ],
  13. "permissions": []
  14. }
  15. ],
  16. // ...
  17. }
  18. }
Search in Guides
Enter a keyword.