1# module.json5 Configuration File 2 3## Configuration File Example 4 5This topic gives an overview of the **module.json5** configuration file. To start with, let's go through an example of what this file contains. 6 7```json 8{ 9 "module": { 10 "name": "entry", 11 "type": "entry", 12 "description": "$string:module_desc", 13 "mainElement": "EntryAbility", 14 "deviceTypes": [ 15 "default", 16 "tablet" 17 ], 18 "deliveryWithInstall": true, 19 "installationFree": false, 20 "pages": "$profile:main_pages", 21 "virtualMachine": "ark", 22 "metadata": [ 23 { 24 "name": "string", 25 "value": "string", 26 "resource": "$profile:distributionFilter_config" 27 } 28 ], 29 "abilities": [ 30 { 31 "name": "EntryAbility", 32 "srcEntry": "./ets/entryability/EntryAbility.ets", 33 "description": "$string:EntryAbility_desc", 34 "icon": "$media:icon", 35 "label": "$string:EntryAbility_label", 36 "startWindowIcon": "$media:icon", 37 "startWindowBackground": "$color:start_window_background", 38 "exported": true, 39 "skills": [ 40 { 41 "entities": [ 42 "entity.system.home" 43 ], 44 "actions": [ 45 "ohos.want.action.home" 46 ] 47 } 48 ] 49 } 50 ], 51 "requestPermissions": [ 52 { 53 "name": "ohos.abilitydemo.permission.PROVIDER", 54 "reason": "$string:reason", 55 "usedScene": { 56 "abilities": [ 57 "FormAbility" 58 ], 59 "when": "inuse" 60 } 61 } 62 ], 63 "targetModuleName": "feature", 64 "targetPriority": 50, 65 "querySchemes": [ 66 "app1Scheme", 67 "app2Scheme" 68 ], 69 "routerMap": "$profile:router_map" 70 } 71} 72``` 73 74## Tags in the Configuration File 75 76As shown above, the **module.json5** file contains several tags. 77 78 79 **Table 1** Tags in the module.json5 file 80 81| Name| Description| Data Type| Initial Value Allowed| 82| -------- | -------- | -------- | -------- | 83| name | Name of the module. This name must be unique in the entire application. The value is a string with a maximum of 31 bytes.<br>This name can be changed during application updates. However, if it is changed, directories related to the module must be migrated. You can use the [file operation API](../reference/apis-core-file-kit/js-apis-file-fs.md#fscopydir10) for migration.| String| No| 84| type | Type of the module. The options are as follows:<br>- **entry**: main module of the application.<br>- **feature**: feature module of the application.<br>- **har**: static shared module.<br>- **shared**: dynamic shared module.| String| No| 85| srcEntry | Code path of the module. The value is a string with a maximum of 127 bytes.| String| Yes (initial value: left empty)| 86| description | Description of the module. The value is a string with a maximum of 255 bytes. It can be a resource reference.| String| Yes (initial value: left empty)| 87| process | Process name of the module. The value is a string with a maximum of 31 bytes. If **process** is configured under **HAP**, all UIAbilities, DataShareExtensionAbilities, and ServiceExtensionAbilities of the application will run in the specified process.<br>**NOTE**<br>This tag applies only to system applications and does not take effect for third-party applications.| String| Yes (initial value: value of **bundleName** under **app** in the **app.json5** file)| 88| mainElement | Name of the entry UIAbility or ExtensionAbility of the module. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)| 89| [deviceTypes](#devicetypes) | Types of the devices on which the module can run.| String array| No| 90| deliveryWithInstall | Whether the HAP of the module is installed together with the application. This tag only applies to atomic services.<br>- **true**: The HAP of the module is installed together with the application.<br>- **false**: The HAP of the module is not installed together with the application.| Boolean| No| 91| installationFree | Whether the module supports the installation-free feature.<br>- **true**: The module supports the installation-free feature and meets installation-free constraints.<br>- **false**: The module does not support the installation-free feature.<br>**NOTE**<br>If [bundleType](./app-configuration-file.md#tags-in-the-configuration-file) is set to **atomicService**, set this tag to **true**. Otherwise, set this tag to **false**.| Boolean| No| 92| virtualMachine | Type of the target virtual machine (VM) where the module can run. It is used for cloud distribution, such as distribution by the application market and distribution center. If the target VM type is ArkTS engine, the value is **ark**+*version number*.| String| Yes (initial value: automatically inserted when DevEco Studio builds the HAP file)| 93| [pages](#pages)| Profile that represents information about each page in the module. The value is a string with a maximum of 255 bytes.| String| No in the UIAbility scenario| 94| [metadata](#metadata)| Custom metadata of the module. You can configure [distributionFilter](#distributionfilter) and [shortcuts](#shortcuts) by referencing resources. The setting is effective only for the current module, UIAbility, and ExtensionAbility.| Object array| Yes (initial value: left empty)| 95| [abilities](#abilities) | UIAbility configuration of the module. The setting is effective only for the current UIAbility.| Object array| Yes (initial value: left empty)| 96| [extensionAbilities](#extensionabilities) | ExtensionAbility configuration of the module. The setting is effective only for the current ExtensionAbility.| Object array| Yes (initial value: left empty)| 97| [requestPermissions](#requestpermissions) | A set of permissions that the application needs to request from the system for running correctly.| Object| Yes (initial value: left empty)| 98| [testRunner](#testrunner) | Test runner of the module.| Object| Yes (initial value: left empty)| 99| [atomicService](#atomicservice)| Atomic service configuration.| Object| Yes (initial value: left empty) | 100| [dependencies](#dependencies)| List of shared libraries on which the module depends during running.| Object array| Yes (initial value: left empty) | 101| targetModuleName | Target module name of the bundle. This name must be unique in the entire application. The value is a string with a maximum of 31 bytes. The module that has this tag set provides the overlay feature.|String|Yes (initial value: left empty)| 102| targetPriority | Priority of the module. The value ranges from 1 to 100. This tag is required only when **targetModuleName** is set.|Integer|Yes (initial value: **1**)| 103| [proxyData](#proxydata) | List of data proxies provided by the module.| Object array| Yes (initial value: left empty)| 104| isolationMode | Multi-process configuration of the module. The options are as follows:<br>- **nonisolationFirst**: The module preferentially runs in a non-independent process.<br>- **isolationFirst**: The module preferentially runs in an independent process.<br>- **isolationOnly**: The module runs only in an independent process.<br>- **nonisolationOnly**: The module runs only in a non-independent process.|String|Yes (initial value: **nonisolationFirst**)| 105| generateBuildHash |Whether the hash value of the HAP or HSP is generated by the packing tool. The hash value (if any) is used to determine whether the application needs to be updated when the system is updated in OTA mode but the **versionCode** value of the application remains unchanged.<br>This tag is enabled only when the **generateBuildHash** tag in the [app.json5](./app-configuration-file.md) file is **false**.**<br>NOTE**<br>This tag applies only to system applications.|Boolean|Yes (initial value: **false**)| 106| compressNativeLibs | Whether the **libs** libraries are packaged in the HAP file after being compressed.<br>- **true**: The **libs** libraries are packaged in the HAP file after being compressed.<br>- **false**: The **libs** libraries are stored without being compressed.| Boolean| Yes (initial value: **false**)| 107| libIsolation | Whether to save the .so files of the current HAP to a separate folder. This is intended to avoid .so file conflicts between HAPs.<br>- **true**: The .so files of the current HAP are stored in a separate folder (named after the module) in the **libs** directory.<br>- **false**: The .so files of the current HAP are directly stored in the **libs** directory.| Boolean| Yes (initial value: **false**)| 108| fileContextMenu | Context menu of the current HAP.| String| Yes (initial value: left empty)| 109| querySchemes | URL schemes that the current application can query for redirection. This tag is only available for entry modules. A maximum of 50 URL schemes can be configured.| String array| Yes (initial value: left empty)| 110| [routerMap](#routermap) | Path of the routing table for the current module.| String| Yes (initial value: left empty)| 111 112## deviceTypes 113 114 **Table 2** deviceTypes 115 116| Device Type| Value| Description| 117| -------- | -------- | -------- | 118| Tablet| tablet | - | 119| Smart TV| tv | - | 120| Smart watch| wearable | Watch that provides call features.| 121| Head unit| car | - | 122| Default device| default | Device that provides full access to system capabilities.| 123 124Example of the **deviceTypes** structure: 125 126 127```json 128{ 129 "module": { 130 "name": "myHapName", 131 "type": "feature", 132 "deviceTypes" : [ 133 "tablet" 134 ] 135 } 136} 137``` 138 139 140## pages 141 142The **pages** tag is a profile that represents information about specified pages. 143 144 145```json 146{ 147 "module": { 148 // ... 149 "pages": "$profile:main_pages", // Configured through the resource file in the profile 150 } 151} 152``` 153 154Define 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. 155 156 **Table 3** pages 157 158| Name| Description| Data Type| Initial Value Allowed| 159| -------- | -------- | -------- | -------- | 160| 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| 161| window | Window-related configuration. | Object| Yes (initial value: left empty)| 162 163 164 **Table 4** window 165 166| Name| Description| Data Type| Initial Value Allowed| 167| -------- | -------- | -------- | -------- | 168| designWidth | Baseline width for page design. The size of an element is scaled by the actual device width.| Number| Yes (initial value: **720px**)| 169| 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.| Boolean| Yes (initial value: **false**)| 170 171```json 172{ 173 "src": [ 174 "pages/index/mainPage", 175 "pages/second/payment", 176 "pages/third/shopping_cart", 177 "pages/four/owner" 178 ], 179 "window": { 180 "designWidth": 720, 181 "autoDesignWidth": false 182 } 183} 184``` 185 186 187## metadata 188 189The **metadata** tag represents the custom metadata of the HAP. The tag value is an array and contains three subtags: **name**, **value**, and **resource**. 190 191**Table 5** metadata 192 193| Name| Description| Data Type| Initial Value Allowed| 194| -------- | -------- | -------- | -------- | 195| name | Name of the data item. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)| 196| value | Value of the data item. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)| 197| resource | Custom data format. The value is a resource index. It contains a maximum of 255 bytes.| String| Yes (initial value: left empty)| 198 199The value of **resource** is in the format of $profile:file name, where **$profile** indicates that the resource is placed under **/resources/base/profile** in the project directory. For example, **$profile:shortcuts_config** indicates the **/resources/base/profile/shortcuts_config.json** file. 200 201```json 202{ 203 "module": { 204 "metadata": [{ 205 "name": "module_metadata", 206 "value": "a test demo for module metadata", 207 "resource": "$profile:shortcuts_config" 208 }], 209 210 "abilities": [{ 211 "metadata": [{ 212 "name": "ability_metadata", 213 "value": "a test demo for ability", 214 "resource": "$profile:config_file" 215 }, 216 { 217 "name": "ability_metadata_2", 218 "value": "a string test", 219 "resource": "$profile:config_file" 220 }], 221 }], 222 223 "extensionAbilities": [{ 224 "metadata": [{ 225 "name": "extensionAbility_metadata", 226 "value": "a test for extensionAbility", 227 "resource": "$profile:config_file" 228 }, 229 { 230 "name": "extensionAbility_metadata_2", 231 "value": "a string test", 232 "resource": "$profile:config_file" 233 }], 234 }] 235 } 236} 237``` 238 239 240## abilities 241 242The **abilities** tag represents the UIAbility configuration of the module, which is valid only for the current UIAbility component. 243 244 **Table 6** abilities 245 246| Name| Description| Data Type| Initial Value Allowed| 247| -------- | -------- | -------- | -------- | 248| name | Name of the UIAbility. This name must be unique in the entire application. The value is a string with a maximum of 127 bytes.| String| No| 249| srcEntry | Code path of the entry UIAbility. The value is a string with a maximum of 127 bytes.| String| No| 250| [launchType](../application-models/uiability-launch-type.md) | Launch type of the UIAbility. The options are as follows:<br>- **multiton**: A UIAbility instance is created each time the UIAbility is started.<br>- **singleton**: A UIAbility instance is created only when the UIAbility is started for the first time.<br>- **specified**: You can determine whether to create a UIAbility instance when the application is running.| String| Yes (initial value: **"singleton"**)| 251| description | Description of the UIAbility. The value is a string with a maximum of 255 bytes. It must be a resource index to support multiple languages.| String| Yes (initial value: left empty)| 252| icon | Icon of the UIAbility. The value is the index of the icon resource file.| String| Yes (initial value: left empty)<br>If **UIAbility** is set to **MainElement**, this attribute is mandatory.| 253| label | Name of the UIAbility displayed to users. The value must be a resource index to support multiple languages.| String| Yes (initial value: left empty)<br>If **UIAbility** is set to **MainElement**, this attribute is mandatory.| 254| permissions | Permissions required for another application to access the UIAbility.<br>The value is generally in the reverse domain name notation and contains a maximum of 255 bytes. It is an array of predefined permission names.| String array| Yes (initial value: left empty)| 255| [metadata](#metadata)| Metadata information of the UIAbility component.| Object array| Yes (initial value: left empty)| 256| exported | Whether the UIAbility can be called by other applications.<br>- **true**: The UIAbility can be called by other applications.<br>- **false**: The UIAbility cannot be called by other applications, not even by aa commands.| Boolean| Yes (initial value: **false**)| 257| continuable | Whether the UIAbility can be continued on another device.<br>- **true**: The UIAbility can be continued on another device.<br>- **false**: The UIAbility cannot be continued on another device.| Boolean| Yes (initial value: **false**)| 258| [skills](#skills) | A set of [wants](../application-models/want-overview.md) that can be received by the UIAbility or ExtensionAbility.<br>Configuration rules:<br>- For HAPs of the entry type, you can configure multiple **skills** attributes with the entry capability for an application. (A **skills** attribute with the entry capability is the one that has **ohos.want.action.home** and **entity.system.home** configured.)<br>- For HAPs of the feature type, you can configure the **skills** attribute with the entry capability for an application, but not for a service.| Object array| Yes (initial value: left empty)| 259| backgroundModes | Continuous tasks of the UIAbility.<br>Continuous tasks are classified into the following types:<br>- **dataTransfer**: data transfer through the network or peer device, such as download, backup, and share<br>- **audioPlayback**: audio playback<br>- **audioRecording**: audio recording<br>- **location**: location and navigation<br>- **bluetoothInteraction**: Bluetooth scanning, connection, and transmission (wearables)<br>- **multiDeviceConnection**: multi-device connection<br>- **wifiInteraction**: Wi-Fi scanning, connection, and transmission (as used in multi-screen collaboration and device clone features)<br>- **voip**: voice and video calls over IP networks<br>- **taskKeeping**: computing| String array| Yes (initial value: left empty)| 260| startWindowIcon | Index to the icon file of the UIAbility startup page. The value is a string with a maximum of 255 bytes.| String| No| 261| startWindowBackground | Index to the background color resource file of the UIAbility startup page. The value is a string with a maximum of 255 bytes.<br>Example: **$color:red**.| String| No| 262| removeMissionAfterTerminate | Whether to remove the relevant mission from the mission list after the UIAbility is destroyed.<br>- **true**: Remove the relevant mission from the mission list after the UIAbility is destroyed.<br>- **false**: Do not remove the relevant mission from the task mission list after the UIAbility is destroyed.| Boolean| Yes (initial value: **false**)| 263| orientation | Orientation of the UIAbility when it is started. The options are as follows:<br>- **unspecified**: automatically determined by the system.<br>- **landscape**: landscape mode.<br>- **portrait**: portrait mode.<br>- **landscape_inverted**: inverted landscape mode.<br>- **portrait_inverted**: inverted portrait mode.<br>- **auto_rotation**: determined by the sensor.<br>- **auto_rotation_landscape**: determined by the sensor in the horizontal direction, including landscape and inverted landscape modes.<br>- **auto_rotation_portrait**: determined by the sensor in the vertical direction, including portrait and inverted portrait modes.<br>- **auto_rotation_restricted**: determined by the sensor when the sensor switch is enabled.<br>- **auto_rotation_landscape_restricted**: determined by the sensor in the horizontal direction, including landscape and inverted landscape modes, when the sensor switch is enabled.<br>- **auto_rotation_portrait_restricted**: determined by the sensor in the vertical direction, including portrait and inverted portrait modes, when the sensor switch is enabled.<br>- **locked**: auto rotation disabled.| String| Yes (initial value: **"unspecified"**)| 264| supportWindowMode | Window mode supported by the UIAbility. The options are as follows:<br>- **fullscreen**: full-screen mode.<br>- **split**: split-screen mode.<br>- **floating**: floating window mode.| String array| Yes (initial value:<br>["fullscreen", "split", "floating"])| 265| priority | Priority of the UIAbility component. In the case of [implicit query](../application-models/explicit-implicit-want-mappings.md), UIAbility components with a higher priority are at the higher place of the returned list. The value ranges from 0 to 10. The greater the value, the higher the priority.<br>**NOTE**<br>This tag applies only to system applications and does not take effect for third-party applications.| Integer| Yes (initial value: **0**)| 266| 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)| 267| 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)| 268| maxWindowWidth | Maximum window width supported by the UIAbility, in vp.<br>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](../windowmanager/window-overview.md#constraints).| Number| Yes (initial value: maximum window width supported by the platform)| 269| minWindowWidth | Minimum window width supported by the UIAbility, in vp.<br>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](../windowmanager/window-overview.md#constraints).| Number| Yes (initial value: minimum window width supported by the platform)| 270| maxWindowHeight | Maximum window height supported by the UIAbility, in vp.<br>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](../windowmanager/window-overview.md#constraints).| Number| Yes (initial value: maximum window height supported by the platform)| 271| minWindowHeight | Minimum window height supported by the UIAbility, in vp.<br>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](../windowmanager/window-overview.md#constraints).| Number| Yes (initial value: minimum window height supported by the platform)| 272| excludeFromMissions | Whether the UIAbility component is displayed in Recents.<br>- **true**: displayed in Recents.<br>- **false**: not displayed in Recents.<br>**NOTE**<br>This attribute applies only to system applications and requires the **AllowAbilityExcludeFromMissions** privilege. For details, see [Application Privilege Configuration](../../device-dev/subsystems/subsys-app-privilege-config-guide.md).| Boolean| Yes (initial value: **false**)| 273| recoverable | Whether the application can be recovered to its previous state in case of faults.<br>- **true**: The application can be recovered to its previous state in case of faults.<br>- **false**: The application cannot be recovered to its previous state in case of faults.| Boolean| Yes (initial value: **false**)| 274| unclearableMission | Whether the UIAbility is unclearable in Recents.<br>- **true**: The UIAbility is unclearable in Recents.<br>- **false**: The UIAbility is clearable in Recents.<br>**NOTE**<br>This attribute works only after the [AllowMissionNotCleared](../../device-dev/subsystems/subsys-app-privilege-config-guide.md) privilege is obtained.| Boolean| Yes (initial value: **false**)| 275| isolationProcess | Whether the component can run in an independent process.<br>- **true**: The component can run in an independent process.<br>- **false**: The component cannot run in an independent process.| Boolean| Yes (initial value: **false**)| 276 277Example of the **abilities** structure: 278 279 280```json 281{ 282 "abilities": [{ 283 "name": "EntryAbility", 284 "srcEntry": "./ets/entryability/EntryAbility.ets", 285 "launchType":"singleton", 286 "description": "$string:description_main_ability", 287 "icon": "$media:icon", 288 "label": "Login", 289 "permissions": [], 290 "metadata": [], 291 "exported": true, 292 "continuable": true, 293 "skills": [{ 294 "actions": ["ohos.want.action.home"], 295 "entities": ["entity.system.home"], 296 "uris": [] 297 }], 298 "backgroundModes": [ 299 "dataTransfer", 300 "audioPlayback", 301 "audioRecording", 302 "location", 303 "bluetoothInteraction", 304 "multiDeviceConnection", 305 "wifiInteraction", 306 "voip", 307 "taskKeeping" 308 ], 309 "startWindowIcon": "$media:icon", 310 "startWindowBackground": "$color:red", 311 "removeMissionAfterTerminate": true, 312 "orientation": " ", 313 "supportWindowMode": ["fullscreen", "split", "floating"], 314 "maxWindowRatio": 3.5, 315 "minWindowRatio": 0.5, 316 "maxWindowWidth": 2560, 317 "minWindowWidth": 1400, 318 "maxWindowHeight": 300, 319 "minWindowHeight": 200, 320 "excludeFromMissions": false, 321 "unclearableMission": false, 322 "isolationProcess": false 323 }] 324} 325``` 326 327 328## skills 329 330The **skills** tag represents the feature set of [wants](../application-models/want-overview.md) that can be received by the UIAbility or ExtensionAbility component. 331 332 **Table 7** skills 333 334| Name| Description| Data Type| Initial Value Allowed| 335| -------- | -------- | -------- | -------- | 336| actions | Actions of wants that can be received, which can be predefined or customized.| String array| Yes (initial value: left empty)| 337| entities | Entities of wants that can be received.| String array| Yes (initial value: left empty)| 338| uris | URIs that match the wants.| Object array| Yes (initial value: left empty)| 339 340 341 **Table 8** uris 342 343| Name| Description| Data Type| Initial Value Allowed| 344| -------- | -------- | -------- | -------- | 345| scheme | Scheme of the URI, such as HTTP, HTTPS, file, and FTP.| String| Yes when only **type** is set in **uris** (initial value: left empty)| 346| host | Host address of the URI. This field is valid only when **scheme** is set. Common methods:<br>- domain name, for example, **example.com**.<br>- IP address, for example, **10.10.10.1**.| String| Yes (initial value: left empty)| 347| 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 field is valid only when both **scheme** and **host** are set.| String| Yes (initial value: left empty)| 348| 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 field is valid only when both **scheme** and **host** are set.| String| Yes (initial value: left empty)| 349| type | Data type that matches the want. The value complies with the Multipurpose Internet Mail Extensions (MIME) type specification. This field can be configured together with **scheme** or be configured separately.| String| Yes (initial value: left empty)| 350| utd | [Uniform data types](../reference/apis-arkdata/js-apis-data-uniformTypeDescriptor.md) that match the wants. This field is applicable to scenarios such as sharing.| String| Yes (initial value: left empty)| 351| maxFileSupported | Maximum number of files of a specified type that can be received or opened at a time. This field is applicable to scenarios such as sharing and must be used together with **utd**.| Integer| Yes (initial value: **0**)| 352 353Example of the **skills** structure: 354 355 356```json 357{ 358 "abilities": [ 359 { 360 "skills": [ 361 { 362 "actions": [ 363 "ohos.want.action.home" 364 ], 365 "entities": [ 366 "entity.system.home" 367 ], 368 "uris": [ 369 { 370 "scheme":"http", 371 "host":"example.com", 372 "port":"80", 373 "path":"path", 374 "type": "text/*" 375 } 376 ] 377 } 378 ] 379 } 380 ] 381} 382``` 383 384## extensionAbilities 385 386The **extensionAbilities** tag represents the configuration of ExtensionAbilities, which is valid only for the current ExtensionAbility. 387 388 **Table 9** extensionAbilities 389 390| Name| Description| Data Type| Initial Value Allowed| 391| -------- | -------- | -------- | -------- | 392| 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| 393| srcEntry | Code path of the ExtensionAbility. The value is a string with a maximum of 127 bytes.| String| No| 394| description | Description of the ExtensionAbility. 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)| 395| icon | Icon of the ExtensionAbility. The value is the index of the icon resource file. If **ExtensionAbility** is set to **MainElement** of the current module, this field is mandatory.| String| Yes (initial value: left empty)| 396| label | Name of the ExtensionAbility displayed to users. The value must be a resource index to support multiple languages. If **ExtensionAbility** is set to **MainElement** of the current module, this field is mandatory and its value must be unique in the application.| String| Yes (initial value: left empty)| 397| type | Type of the ExtensionAbility. The options are as follows:<br>- **form**: ExtensionAbility of a widget.<br>- **workScheduler**: ExtensionAbility of a deferred task.<br>- **inputMethod**: ExtensionAbility of an input method.<br>- **service**: service component running in the background.<br>- **accessibility**: ExtensionAbility of an accessibility feature.<br>- **fileAccess**: ExtensionAbility for public data access, allowing files and folders to be provided for file management applications to display.<br>- **dataShare**: ExtensionAbility for data sharing.<br>- **staticSubscriber**: ExtensionAbility for static broadcast.<br>- **wallpaper**: ExtensionAbility of the wallpaper.<br>- **backup**: ExtensionAbility for data backup.<br>- **window**: ExtensionAbility of a window. This type of ExtensionAbility creates a window during startup for which you can develop the GUI. The GUI you develop is combined with the windows of other applications through the **UIExtensionComponent**.<br>- **thumbnail**: ExtensionAbility for obtaining file thumbnails. You can provide thumbnails for files of customized file types.<br>- **preview**: ExtensionAbility for preview. This type of ExtensionAbility can parse the file and display it in a window. You can combine the window with other application windows.<br>- **print**: ExtensionAbility for the print framework.<br>- **push**: ExtensionAbility for the push service.<br>- **driver**: ExtensionAbility for the driver framework.<br>- **remoteNotification**: ExtensionAbility for remote notifications.<br>- **remoteLocation**: ExtensionAbility for remote location.<br>- **voip**: ExtensionAbility for VoIP calls.<br>**NOTE**<br>The **service**, **fileAccess**, and **dataShare** types apply only to system applications and do not take effect for third-party applications.| String| No| 398| permissions | Permissions required for another application to access the ExtensionAbility.<br>The value is generally in the reverse domain name notation and contains a maximum of 255 bytes. It is an array of [predefined permission names](../security/AccessToken/permissions-for-all.md).| String array| Yes (initial value: left empty)| 399| readPermission | Permission required for reading data in the ExtensionAbility. The value is a string with a maximum of 255 bytes. This field is available only when the type of the ExtensionAbility is set to **dataShare**.| String| Yes (initial value: left empty)| 400| writePermission | Permission required for writing data to the ExtensionAbility. The value is a string with a maximum of 255 bytes. This field is available only when the type of the ExtensionAbility is set to **dataShare**.| String| Yes (initial value: left empty)| 401| uri | Data URI provided by the ExtensionAbility. The value is a string with a maximum of 255 bytes, in the reverse domain name notation.<br>**NOTE**<br>This field is mandatory when the type of the ExtensionAbility is set to **dataShare**.| String| Yes (initial value: left empty)| 402|skills | A set of [wants](../application-models/want-overview.md) that can be received by the ExtensionAbility.<br>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.<br>**NOTE**<br>The **skills** attribute with the entry capability can be configured for the feature package of an application, but not for a service. | Array| Yes (initial value: left empty)| 403| [metadata](#metadata)| Metadata of the ExtensionAbility component.| Object| Yes (initial value: left empty)| 404| exported | Whether the ExtensionAbility can be called by other applications.<br>- **true**: The ExtensionAbility can be called by other applications.<br>- **false**: The ExtensionAbility cannot be called by other applications, not even by aa commands.| Boolean| Yes (initial value: **false**)| 405| extensionProcessMode | Multi-process instance model of the ExtensionAbility. Currently, this field is effective only for UIExtensionAbilities and ExtensionAbilities extended from UIExtensionAbilities.<br>- **instance**: Each instance of the ExtensionAbility has a process.<br>- **type**: All instances of the ExtensionAbility run in the same process, separated from other ExtensionAbility instances.<br>- **bundle**: All instances of the ExtensionAbility run in the same process as instances of other ExtensionAbilities using the **bundle** model.| String| Yes (initial value: left empty)| 406 407Example of the **extensionAbilities** structure: 408 409 410```json 411{ 412 "extensionAbilities": [ 413 { 414 "name": "FormName", 415 "srcEntry": "./form/MyForm.ts", 416 "icon": "$media:icon", 417 "label" : "$string:extension_name", 418 "description": "$string:form_description", 419 "type": "form", 420 "permissions": ["ohos.abilitydemo.permission.PROVIDER"], 421 "readPermission": "", 422 "writePermission": "", 423 "exported": true, 424 "uri":"scheme://authority/path/query", 425 "skills": [{ 426 "actions": [], 427 "entities": [], 428 "uris": [] 429 }], 430 "metadata": [ 431 { 432 "name": "ohos.extension.form", 433 "resource": "$profile:form_config", 434 } 435 ], 436 "extensionProcessMode": "instance" 437 } 438 ] 439} 440``` 441 442 443## requestPermissions 444 445The **requestPermissions** tag represents a set of permissions that the application needs to request from the system for running correctly. For details about how to request permissions, see [Requesting Permissions for Applications](../security/AccessToken/determine-application-mode.md). 446 447> **NOTE** 448> 449> - The permission settings configured in the **requestPermissions** tag apply to the entire application. 450> - If your application needs to subscribe to an event published by itself and the permissions required for accessing the application are set in the **permissions** tag under **extensionAbilities**, then the application must register the related permissions in the **requestPermissions** tag to receive the event. 451 452**Table 10** requestPermissions 453 454| Name| Description| Data Type| Initial Value Allowed| 455| -------- | -------- | -------- | -------- | 456| name | Name of the permission to request.| String| No| 457| reason | Reason for requesting the permission. The value must be a resource reference to support multiple languages. | String| Yes (initial value: left empty)<br>**NOTE**<br>If the permission to request is **user_grant**, this field is required for the application to be released to the application market.| 458| usedScene | Scene under which the permission is used. It consists of the **abilities** and **when** sub-attributes.<br>- **abilities**: array of UIAbility or ExtensionAbility names.<br>- **when**: when the permission is used. The options are **inuse** and **always**.| Object| Yes (initial value: left empty)<br>**NOTE**<br>If the permission to request is **user_grant**, the **abilities** sub-attribute is mandatory and **when** is optional.| 459 460Example of the **requestPermissions** structure: 461 462 463```json 464{ 465 "module" : { 466 "requestPermissions": [ 467 { 468 "name": "ohos.abilitydemo.permission.PROVIDER", 469 "reason": "$string:reason", 470 "usedScene": { 471 "abilities": [ 472 "EntryFormAbility" 473 ], 474 "when": "inuse" 475 } 476 } 477 ] 478 } 479} 480``` 481 482 483## shortcuts 484 485The **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**. 486 487The **shortcut** information is identified in **metadata**, where: 488 489- **name** indicates the name of the shortcut, identified by **ohos.ability.shortcuts**. 490 491- **resource** indicates where the resources of the shortcut are stored. 492 493**Table 11** shortcuts 494 495| Name| Description| Data Type | Initial Value Allowed| 496| -------- | -------- | -------- | -------- | 497| shortcutId | ID of the shortcut. The value is a string with a maximum of 63 bytes.| String| No| 498| 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)| 499| icon | Icon of the shortcut. The value is the index to the icon resource file.| String| Yes (initial value: left empty)| 500| [wants](../application-models/want-overview.md) | Wants to which the shortcut points. Each want can contain one or more of the **bundleName**, **moduleName**, and **abilityName** sub-attributes.<br>- **bundleName**: target bundle name of the shortcut. The value is a string.<br>- **moduleName**: target module name of the shortcut. The value is a string.<br>- **abilityName**: target ability name of the shortcut. The value is a string.| Object| Yes (initial value: left empty)| 501 502 5031. Configure the **shortcuts_config.json** file in **/resources/base/profile/**. 504 505 ```json 506 { 507 "shortcuts": [ 508 { 509 "shortcutId": "id_test1", 510 "label": "$string:shortcut", 511 "icon": "$media:aa_icon", 512 "wants": [ 513 { 514 "bundleName": "com.ohos.hello", 515 "moduleName": "entry", 516 "abilityName": "EntryAbility" 517 } 518 ] 519 } 520 ] 521 } 522 ``` 523 5242. 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. 525 526 ```json 527 { 528 "module": { 529 // ... 530 "abilities": [ 531 { 532 "name": "EntryAbility", 533 "srcEntry": "./ets/entryability/EntryAbility.ets", 534 // ... 535 "skills": [ 536 { 537 "entities": [ 538 "entity.system.home" 539 ], 540 "actions": [ 541 "ohos.want.action.home" 542 ] 543 } 544 ], 545 "metadata": [ 546 { 547 "name": "ohos.ability.shortcuts", 548 "resource": "$profile:shortcuts_config" 549 } 550 ] 551 } 552 ] 553 } 554 } 555 ``` 556 557 558## distributionFilter 559 560The **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. 561 562> **NOTE** 563> 564> This tag is supported since API version 10. In earlier versions, the **distroFilter** tag is used. 565 566- **Application scenario**: 567 568 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. 569 570 ```json 571 // Device types supported by entry1 572 { 573 "module": { 574 "name": "entry1", 575 "type": "entry", 576 "deviceTypes" : [ 577 "tv", 578 "tablet" 579 ] 580 } 581 } 582 ``` 583 ```json 584 // Device types supported by entry2 585 { 586 "module": { 587 "name": "entry2", 588 "type": "entry", 589 "deviceTypes" : [ 590 "car", 591 "tablet" 592 ] 593 } 594 } 595 ``` 596 597- **Configuration rules**: 598 599 This tag consists of four attributes: [screenShape](#screenshape), [screenWindow](#screenwindow), [screenDensity](#screendensity), and [countryCode](#countrycode). 600 601 During distribution, a unique HAP is determined based on the mapping between **deviceTypes** and the preceding attributes. 602 603 * When configuring this tag, include at least one of the attributes. 604 * 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. 605 * The **screenShape** and **screenWindow** attributes are available only for lite wearables. 606 607- **Configuration**: 608 609 This tag must be configured in the **/resource/profile** directory and be referenced in the **resource** field of **metadata**. 610 611 612**Table 12** distributionFilter 613 614| Name| Description| Data Type| Initial Value Allowed| 615| -------- | -------- | -------- | -------- | 616| [screenShape](#screenshape) | Supported screen shapes.| Object array| Yes (initial value: left empty)| 617| [screenWindow](#screenwindow) | Supported application window resolutions.| Object array| Yes (initial value: left empty)| 618| [screenDensity](#screendensity)| Pixel density of the screen, in dots per inch (DPI).| Object array| Yes (initial value: left empty)| 619| [countryCode](#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)| 620 621### screenShape 622 623**Table 13** screenShape 624 625| Name| Description| Data Type| Initial Value Allowed| 626| -------- | -------- | -------- | -------- | 627| policy | Rule for the sub-attribute value.<br>- **exclude**: Exclude the matches of the sub-attribute value.<br>- **include**: Include the matches of the sub-attribute value.| String| No| 628| 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| 629 630### screenWindow 631 632**Table 14** screenWindow 633 634| Name| Description| Data Type| Initial Value Allowed| 635| -------- | -------- | -------- | -------- | 636| policy | Rule for the sub-attribute value. Currently, the value can only be **include**.<br>- **include**: Include the matches of the sub-attribute value.| String| No| 637| 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| 638 639### screenDensity 640 641**Table 15** screenDensity 642 643| Name| Description| Data Type| Initial Value Allowed| 644| -------- | -------- | -------- | -------- | 645| policy | Rule for the sub-attribute value.<br>- **exclude**: Exclude the matches of the sub-attribute value.<br>- **include**: Include the matches of the sub-attribute value.| String| No| 646| value | Pixel density of the screen, in DPI. The options are as follows:<br>- **sdpi**: small-scale DPI. This value is applicable to devices with a DPI range of (0, 120].<br>- **mdpi**: medium-scale DPI. This value is applicable to devices with a DPI range of (120, 160].<br>- **ldpi**: large-scale DPI. This value is applicable to devices with a DPI range of (160, 240].<br>- **xldpi**: extra-large-scale DPI. This value is applicable to devices with a DPI range of (240, 320].<br>- **xxldpi**: extra-extra-large-scale DPI. This value is applicable to devices with a DPI range of (320, 480].<br>- **xxxldpi**: extra-extra-extra-large-scale DPI. This value is applicable to devices with a DPI range of (480, 640].| String array| No| 647 648### countryCode 649 650**Table 16** countryCode 651 652| Name| Description| Data Type| Initial Value Allowed| 653| -------- | -------- | -------- | -------- | 654| policy | Rule for the sub-attribute value.<br>- **exclude**: Exclude the matches of the sub-attribute value.<br>- **include**: Include the matches of the sub-attribute value.| String| No| 655| value | Code of the country or region to which the application is to be distributed.| String array| No| 656 657 658Example: 659 6601. Configure the **distributionFilter_config.json** file (this file name is customizable) in **resources/base/profile** under the development view. 661 ```json 662 { 663 "distributionFilter": { 664 "screenShape": { 665 "policy": "include", 666 "value": [ 667 "circle", 668 "rect" 669 ] 670 }, 671 "screenWindow": { 672 "policy": "include", 673 "value": [ 674 "454*454", 675 "466*466" 676 ] 677 }, 678 "screenDensity": { 679 "policy": "exclude", 680 "value": [ 681 "ldpi", 682 "xldpi" 683 ] 684 }, 685 "countryCode": {// Distribution in China is supported. 686 "policy": "include", 687 "value": [ 688 "CN" 689 ] 690 } 691 } 692 } 693 ``` 694 695 6962. Configure **metadata** in the **module** tag in the **module.json5** file. 697 698 699 ```json 700 { 701 "module": { 702 // ... 703 "metadata": [ 704 { 705 "name": "ohos.module.distribution", 706 "resource": "$profile:distributionFilter_config", 707 } 708 ] 709 } 710 } 711 ``` 712 713 714## testRunner 715 716The **testRunner** tag represents the supported test runner. 717 718**Table 17** testRunner 719 720| Name| Description| Data Type| Initial Value Allowed| 721| -------- | -------- | -------- | -------- | 722| name | Name of the test runner object. The value is a string with a maximum of 255 bytes.| String| No| 723| srcPath | Code path of the test runner. The value is a string with a maximum of 255 bytes. | String| No| 724 725Example of the **testRunner** structure: 726 727 728```json 729{ 730 "module": { 731 // ... 732 "testRunner": { 733 "name": "myTestRunnerName", 734 "srcPath": "etc/test/TestRunner.ts" 735 } 736 } 737} 738``` 739 740## atomicService 741 742The **atomicService** tag represents the atomic service configuration. It is available only when **bundleType** is set to **atomicService** in the **app.json** file. 743 744**Table 18** atomicService 745 746| Name| Description| Data Type| Initial Value Allowed| 747| -------- | -------- | -------- | -------- | 748| preloads | List of modules to preload in the atomic service.| Object array| Yes (initial value: left empty)| 749 750 751**Table 19** preloads 752 753| Name| Description| Data Type| Initial Value Allowed| 754| -------- | -------- | -------- | -------- | 755| moduleName | Name of the module to be preloaded when the current module is loaded in the atomic service.| String| No| 756 757 758Example of the **atomicService** structure: 759 760```json 761{ 762 "module": { 763 "atomicService": { 764 "preloads":[ 765 { 766 "moduleName":"feature" 767 } 768 ] 769 } 770 } 771} 772``` 773 774## dependencies 775 776The **dependencies** tag identifies the list of shared libraries that the module depends on when it is running. 777 778**Table 20** dependencies 779 780| Name | Description | Data Type| Initial Value Allowed| 781| ----------- | ------------------------------ | -------- | ---------- | 782| bundleName | Name of the shared bundle on which the current module depends. | String | Yes (initial value: left empty)| 783| moduleName | Module name of the shared bundle on which the current module depends.| String | No| 784| versionCode | Version number of the shared bundle. | Number | Yes (initial value: left empty)| 785 786Example of the **dependencies** structure: 787 788```json 789{ 790 "module": { 791 "dependencies": [ 792 { 793 "bundleName":"com.share.library", 794 "moduleName": "library", 795 "versionCode": 10001 796 } 797 ] 798 } 799} 800``` 801 802## proxyData 803 804The **proxyDatas** tag provides the list of data proxies provided by the module. It can be configured only for entry and feature modules. 805 806**Table 21** proxyData 807| Name | Description | Data Type| Initial Value Allowed| 808| ----------- | ------------------------------ | -------- | ---------- | 809| 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. | String | No| 810| 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 [Permissions for All Applications](../security/AccessToken/permissions-for-all.md).| String | Yes (initial value: left empty)| 811| 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 [Permissions for All Applications](../security/AccessToken/permissions-for-all.md).| String | Yes (initial value: left empty)| 812| [metadata](#metadata)| Metadata of the data proxy. Only the **name** and **resource** fields can be configured.| Object| Yes (initial value: left empty)| 813 814Example of the **proxyData** structure: 815 816```json 817{ 818 "module": { 819 "proxyData": [ 820 { 821 "uri":"datashareproxy://com.ohos.datashare/event/Meeting", 822 "requiredReadPermission": "ohos.permission.GET_BUNDLE_INFO", 823 "requiredWritePermission": "ohos.permission.GET_BUNDLE_INFO", 824 "metadata": { 825 "name": "datashare_metadata", 826 "resource": "$profile:datashare" 827 } 828 } 829 ] 830 } 831} 832``` 833 834## routerMap 835 836The **routerMap** tag represents the path to the routing table for the module. 837 838The **routerMap** configuration file provides the routing table information of the module. The value of the **routerMap** tag is an array. 839 840**Table 22** routerMap 841 842| Name| Description| Data Type| Initial Value Allowed| 843| -------- | -------- | -------- | -------- | 844| name | Name of the page to be redirected to.| String | No | 845| pageModule | Name of the module where the page is located.| String| Yes (initial value: left empty)| 846| pageSourceFile| Path of the page in the module.| String| No | 847| buildFunction | Function decorated by @Builder. The function describes the UI of the page.| String | No | 848| [data](#data) | Custom data.| Object | Yes (initial value: left empty) | 849 850Example: 851 8521. 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**. 853 854```json 855{ 856 "routerMap": [ 857 { 858 "name": "DynamicPage1", 859 "pageModule": "library1", 860 "pageSourceFile": "entry/src/index", 861 "buildFunction": "myFunction" 862 }, 863 { 864 "name": "DynamicPage2", 865 "pageModule": "library2", 866 "pageSourceFile": "entry/src/index", 867 "buildFunction": "myBuilder", 868 "data": { 869 "key1": "data1", 870 "key2": "data2" 871 } 872 } 873 ] 874} 875``` 876 8772. 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"**. 878 879### data 880 881The **data** tag represents custom data in the routing table. 882In a **data** object, you can specify custom data of the string type. 883 884Example of the **data** structure: 885 886```json 887{ 888 "routerMap": [ 889 { 890 "name": "DynamicPage", 891 "pageModule": "library", 892 "pageSourceFile": "entry/src/index", 893 "buildFunction": "myBuilder", 894 "data": { 895 "key1": "data1", 896 "key2": "data2" 897 } 898 } 899 ] 900} 901``` 902<!--no_check-->