1# module.json5 Configuration File 2 3 4This topic gives an overview of the **module.json5** configuration file. To start with, let's go through an example of what this file contains. 5 6```json 7{ 8 "module": { 9 "name": "entry", 10 "type": "entry", 11 "description": "$string:module_desc", 12 "mainElement": "EntryAbility", 13 "deviceTypes": [ 14 "default", 15 "tablet" 16 ], 17 "deliveryWithInstall": true, 18 "installationFree": false, 19 "pages": "$profile:main_pages", 20 "virtualMachine": "ark", 21 "metadata": [ 22 { 23 "name": "string", 24 "value": "string", 25 "resource": "$profile:distributionFilter_config" 26 } 27 ], 28 "abilities": [ 29 { 30 "name": "EntryAbility", 31 "srcEntry": "./ets/entryability/EntryAbility.ts", 32 "description": "$string:EntryAbility_desc", 33 "icon": "$media:icon", 34 "label": "$string:EntryAbility_label", 35 "startWindowIcon": "$media:icon", 36 "startWindowBackground": "$color:start_window_background", 37 "exported": true, 38 "skills": [ 39 { 40 "entities": [ 41 "entity.system.home" 42 ], 43 "actions": [ 44 "ohos.want.action.home" 45 ] 46 } 47 ] 48 } 49 ], 50 "requestPermissions": [ 51 { 52 "name": "ohos.abilitydemo.permission.PROVIDER", 53 "reason": "$string:reason", 54 "usedScene": { 55 "abilities": [ 56 "FormAbility" 57 ], 58 "when": "inuse" 59 } 60 } 61 ] 62 } 63} 64``` 65 66 67As shown above, the **module.json5** file contains several tags. 68 69 70 **Table 1** Tags in the module.json5 file 71 72| Name| Description| Data Type| Initial Value Allowed| 73| -------- | -------- | -------- | -------- | 74| name | Name of the module. The value is a string with a maximum of 31 bytes and must be unique in the entire application. Chinese characters are not allowed.| String| No| 75| type | Type of the module. The options are as follows:<br>- **entry**: main module of the application.<br>- **feature**: dynamic feature module of the application.<br>- **har**: static shared module.<br>- **shared**: dynamic shared module.| String| No| 76| srcEntry | Code path corresponding to the module. The value is a string with a maximum of 127 bytes.| String| Yes (initial value: left empty)| 77| description | Description of the module. The value is a string with a maximum of 255 bytes or a string resource index.| String| Yes (initial value: left empty)| 78| process | Process name of the current module. The value is a string with a maximum of 31 bytes. If **process** is configured under **HAP**, all UIAbility, DataShareExtensionAbility, and ServiceExtensionAbility components of the application 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)| 79| 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)| 80| [deviceTypes](#devicetypes) | Type of the device on which the module can run.| String array| No (can be left empty)| 81| deliveryWithInstall | Whether the HAP file of the module will be installed when the user installs the application.<br>- **true**: The HAP file will be installed when the user installs the application.<br>- **false**: The HAP file will not be installed when the user installs the application.| Boolean| No| 82| 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 this tag is set to **true** for an entry-type module, it must also be set to **true** for feature-type modules of the same application.<br>If this tag is set to **false** for an entry-type module, it can be set to **true** or **false** for feature-type modules of the same application based on service requirements.| Boolean| No| 83| virtualMachine | Type of the target virtual machine (VM) where the module runs. It is used for cloud distribution, such as distribution by the application market and distribution center.<br> 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)| 84| [pages](#pages)| Profile that represents information about each page in the current module. The value can contain a maximum of 255 bytes.| String| No in the UIAbility scenario| 85| [metadata](#metadata)| Custom metadata of the module. The setting is valid only for the current module, UIAbility, or ExtensionAbility.| Object array| Yes (initial value: left empty)| 86| [abilities](#abilities) | UIAbility configuration of the module, which is valid only for the current UIAbility component.| Object| Yes (initial value: left empty)| 87| [extensionAbilities](#extensionabilities) | ExtensionAbility configuration of the module, which is valid only for the current ExtensionAbility component.| Object| Yes (initial value: left empty)| 88| [requestPermissions](#requestpermissions) | A set of permissions that the application needs to request from the system for running correctly.| Object| Yes (initial value: left empty)| 89| [testRunner](#testrunner) | Test runner configuration of the module.| Object| Yes (initial value: left empty)| 90| [atomicService](#atomicservice)| Atomic service configuration.| Object| Yes (initial value: left empty) | 91| [dependencies](#dependencies)| List of shared libraries on which the current module depends during running.| Object array| Yes (initial value: left empty) | 92 93 94## deviceTypes 95 96 **Table 2** deviceTypes 97 98| Device Type| Value| Description| 99| -------- | -------- | -------- | 100| Tablet| tablet | - | 101| Smart TV| tv | - | 102| Smart watch| wearable | Watch that provides call features.| 103| Head unit| car | - | 104| Default device| default | OpenHarmony device that provides full access to system capabilities.| 105 106Example of the **deviceTypes** structure: 107 108 109```json 110{ 111 "module": { 112 "name": "myHapName", 113 "type": "feature", 114 "deviceTypes" : [ 115 "tablet" 116 ] 117 } 118} 119``` 120 121 122## pages 123 124The **pages** tag is a profile that represents information about specified pages. 125 126 127```json 128{ 129 "module": { 130 // ... 131 "pages": "$profile:main_pages", // Configured through the resource file in the profile 132 } 133} 134``` 135 136Define 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. 137 138 **Table 3** Tags in the pages configuration file 139 140| Name| Description| Data Type| Initial Value Allowed| 141| -------- | -------- | -------- | -------- | 142| src | Route information about all pages in the JavaScript module, including the page path and page name. The value is an array, each element of which represents a page and the first element represents the home page.| String array| No| 143| window | Window-related configuration. | Object| Yes (initial value: left empty)| 144 145 **Table 4** window tag in the pages configuration file 146 147| Name| Description| Data Type| Initial Value Allowed| 148| -------- | -------- | -------- | -------- | 149| designWidth | Baseline width for page design. The size of an element is scaled by the actual device width.| Number| Yes (initial value: **720px**)| 150| 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**)| 151 152```json 153{ 154 "src": [ 155 "pages/index/mainPage", 156 "pages/second/payment", 157 "pages/third/shopping_cart", 158 "pages/four/owner" 159 ], 160 "window": { 161 "designWidth": 720, 162 "autoDesignWidth": false 163 } 164} 165``` 166 167 168## metadata 169 170The **metadata** tag represents the custom metadata of the HAP file. The tag value is an array and contains three subtags: **name**, **value**, and **resource**. 171 172**Table 5** metadata 173 174| Name| Description| Data Type| Initial Value Allowed| 175| -------- | -------- | -------- | -------- | 176| name | Name of the data item. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)| 177| value | Value of the data item. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)| 178| resource | Custom data format. The value is a resource index that identifies the data. It contains a maximum of 255 bytes.| String| Yes (initial value: left empty)| 179 180 181```json 182{ 183 "module": { 184 "metadata": [{ 185 "name": "module_metadata", 186 "value": "a test demo for module metadata", 187 "resource": "$profile:shortcuts_config", 188 }], 189 190 "abilities": [{ 191 "metadata": [{ 192 "name": "ability_metadata", 193 "value": "a test demo for ability", 194 "resource": "$profile:config_file" 195 }, 196 { 197 "name": "ability_metadata_2", 198 "value": "a string test", 199 "resource": "$profile:config_file" 200 }], 201 }], 202 203 "extensionAbilities": [{ 204 "metadata": [{ 205 "name": "extensionAbility_metadata", 206 "value": "a test for extensionAbility", 207 "resource": "$profile:config_file" 208 }, 209 { 210 "name": "extensionAbility_metadata_2", 211 "value": "a string test", 212 "resource": "$profile:config_file" 213 }], 214 }] 215 } 216} 217``` 218 219 220## abilities 221 222UIAbility configuration of the module, which is valid only for the current UIAbility component. 223 224**By default, application icons cannot be hidden from the home screen in OpenHarmony.** 225 226The OpenHarmony system imposes a strict rule on the presence of application icons. If no icon is configured in the HAP file of an application, the system uses the icon specified in the **app.json** file as the application icon and displays it on the home screen. 227 228Touching this icon will direct the user to the application details screen in **Settings**, as shown in Figure 1. 229 230To hide an application icon from the home screen, you must configure the **AllowAppDesktopIconHide** privilege. For details, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md). 231 232**Objectives**: 233 234This requirement on application icons is intended to prevent malicious applications from deliberately configuring no icon to block uninstallation attempts. 235 236**Setting the application icon to be displayed on the home screen**: 237 238Set **icon**, **label**, and **skills** under **abilities** in the **module.json5** file. In addition, make sure the **skills** configuration contains **ohos.want.action.home** and **entity.system.home**. 239 240``` 241{ 242 "module":{ 243 244 ... 245 246 "abilities": [{ 247 "icon": "$media:icon", 248 "label": "Login", 249 "skills": [{ 250 "actions": ["ohos.want.action.home"], 251 "entities": ["entity.system.home"], 252 "uris": [] 253 }] 254 }], 255 ... 256 257 } 258} 259``` 260 261**Display rules of application icons and labels on the home screen:** 262* The HAP file contains UIAbility configuration. 263 * The application icon on the home screen is set under **abilities** in the **module.json5** file. 264 * The application does not have the privilege to hide its icon from the home screen. 265 * The application icon displayed on the home screen is the icon configured for the UIAbility. 266 * The application label displayed on the home screen is the label configured for the UIAbility. If no label is configured, the bundle name is returned. 267 * The name of the UIAbility is displayed. 268 * When the user touches the home screen icon, the home screen of the UIAbility is displayed. 269 * The application has the privilege to hide its icon from the home screen. 270 * The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen. 271 * The application icon on the home screen is not set under **abilities** in the **module.json5** file. 272 * The application does not have the privilege to hide its icon from the home screen. 273 * The application icon displayed on the home screen is the icon specified under **app**. (The **icon** field in the **app.json** file is mandatory.) 274 * The application label displayed on the home screen is the label specified under **app**. (The **label** field in the **app.json** file is mandatory.) 275 * Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1. 276 * The application has the privilege to hide its icon from the home screen. 277 * The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen. 278* The HAP file does not contain UIAbility configuration. 279 * The application does not have the privilege to hide its icon from the home screen. 280 * The application icon displayed on the home screen is the icon specified under **app**. (The **icon** field in the **app.json** file is mandatory.) 281 * The application label displayed on the home screen is the label specified under **app**. (The **label** field in the **app.json** file is mandatory.) 282 * Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1. 283 * The application has the privilege to hide its icon from the home screen. 284 * The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen.<br><br> 285 286**Figure 1** Application details screen 287 288![Application details screen](figures/application_details.jpg) 289 290 291 **Table 6** abilities 292 293| Name| Description| Data Type| Initial Value Allowed| 294| -------- | -------- | -------- | -------- | 295| name | Name of the UIAbility component, which must be unique in the entire application. The value is a string with a maximum of 127 bytes. Chinese characters are not allowed.| String| No| 296| srcEntry | Code path of the entry UIAbility component. The value is a string with a maximum of 127 bytes.| String| No| 297| [launchType](../application-models/uiability-launch-type.md) | Launch type of the UIAbility component. The options are as follows:<br>- **multiton**: A new UIAbility instance is created each time the UIAbility component is started.<br>- **singleton**: A new UIAbility instance is created only when the UIAbility component is started for the first time.<br>- **specified**: You can determine whether to create a new UIAbility instance when the application is running.| String| Yes (initial value: **"singleton"**)| 298| description | Description of the UIAbility component. The value is a string with a maximum of 255 bytes or a resource index to the description in multiple languages.| String| Yes (initial value: left empty)| 299| icon | Icon of the UIAbility component. The value is an icon resource index.| String| Yes (initial value: left empty)<br>If **UIAbility** is set to **MainElement**, this attribute is mandatory.| 300| label | Name of the UIAbility component displayed to users. The value is a string resource index.| String| Yes (initial value: left empty)<br>If **UIAbility** is set to **MainElement**, this attribute is mandatory.| 301| permissions | Permissions required for another application to access the UIAbility component.<br>The value is an array of permission names predefined by the system, generally in the reverse domain name notation. It contains a maximum of 255 bytes.| String array| Yes (initial value: left empty)| 302| [metadata](#metadata)| Metadata information of the UIAbility component.| Object array| Yes (initial value: left empty)| 303| exported | Whether the UIAbility component can be called by other applications.<br>- **true**: The UIAbility component can be called by other applications.<br>- **false**: The UIAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)| 304| continuable | Whether the UIAbility component can be [migrated](../application-models/hop-cross-device-migration.md).<br>- **true**: The UIAbility component can be migrated.<br>- **false**: The UIAbility component cannot be migrated.| Boolean| Yes (initial value: **false**)| 305| [skills](#skills) | Feature set of [wants](../application-models/want-overview.md) that can be received by the current UIAbility or ExtensionAbility component.<br>Configuring rule:<br>- For HAPs of the entry type, you can configure multiple **skills** attributes with the entry capability for an OpenHarmony 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 **skills** attributes with the entry capability for an OpenHarmony application, but not for an OpenHarmony service.| Object array| Yes (initial value: left empty)| 306| backgroundModes | Continuous tasks of the UIAbility component. <br>Continuous tasks are classified into the following types:<br>- **dataTransfer**: service for downloading, backing up, sharing, or transferring data from the network or peer devices.<br>- **audioPlayback**: audio playback service.<br>- **audioRecording**: audio recording service.<br>- **location**: location and navigation services.<br>- **bluetoothInteraction**: Bluetooth scanning, connection, and transmission services (wearables).<br>- **multiDeviceConnection**: multi-device interconnection service.<br>- **wifiInteraction**: Wi-Fi scanning, connection, and transmission services (as used in the Multi-screen Collaboration and clone features)<br>- **voip**: voice/video call and VoIP services.<br>- **taskKeeping**: computing service.| String array| Yes (initial value: left empty)| 307| startWindowIcon | Index to the icon file of the UIAbility component startup page. Example: **$media:icon**.<br>The value is a string with a maximum of 255 bytes.| String| No| 308| startWindowBackground | Index to the background color resource file of the UIAbility component startup page. Example: **$color:red**.<br>The value is a string with a maximum of 255 bytes.| String| No| 309| removeMissionAfterTerminate | Whether to remove the relevant task from the task list after the UIAbility component is destroyed.<br>- **true**: Remove the relevant task from the task list after the UIAbility component is destroyed.<br>- **false**: Do not remove the relevant task from the task list after the UIAbility component is destroyed.| Boolean| Yes (initial value: **false**)| 310| orientation | Orientation of the UIAbility component 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"**)| 311| supportWindowMode | Window mode supported by the UIAbility component. 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"])| 312| 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 is an integer ranging from 0 to 10. The greater the value, the higher the priority.<br>**NOTE**<br>This attribute applies only to system applications and does not take effect for third-party applications.| Number| Yes (initial value: **0**)| 313| 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)| 314| 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)| 315| maxWindowWidth | Maximum window width supported by the UIAbility component, in vp. The minimum value is 0, and 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)| 316| minWindowWidth | Minimum window width supported by the UIAbility component, in vp. The minimum value is 0, and 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)| 317| maxWindowHeight | Maximum window height supported by the UIAbility component, in vp. The minimum value is 0, and 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)| 318| minWindowHeight | Minimum window height supported by the UIAbility component, in vp. The minimum value is 0, and 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)| 319| excludeFromMissions | Whether the UIAbility component is displayed in the recent task list.<br>- **true**: displayed in the recent task list.<br>- **false**: not displayed in the recent task list.<br>**NOTE**<br>This attribute applies only to system applications and does not take effect for third-party applications.| Boolean| Yes (initial value: **false**)| 320 321Example of the **abilities** structure: 322 323 324```json 325{ 326 "abilities": [{ 327 "name": "EntryAbility", 328 "srcEntry": "./ets/entryability/EntryAbility.ts", 329 "launchType":"singleton", 330 "description": "$string:description_main_ability", 331 "icon": "$media:icon", 332 "label": "Login", 333 "permissions": [], 334 "metadata": [], 335 "exported": true, 336 "continuable": true, 337 "skills": [{ 338 "actions": ["ohos.want.action.home"], 339 "entities": ["entity.system.home"], 340 "uris": [] 341 }], 342 "backgroundModes": [ 343 "dataTransfer", 344 "audioPlayback", 345 "audioRecording", 346 "location", 347 "bluetoothInteraction", 348 "multiDeviceConnection", 349 "wifiInteraction", 350 "voip", 351 "taskKeeping" 352 ], 353 "startWindowIcon": "$media:icon", 354 "startWindowBackground": "$color:red", 355 "removeMissionAfterTerminate": true, 356 "orientation": " ", 357 "supportWindowMode": ["fullscreen", "split", "floating"], 358 "maxWindowRatio": 3.5, 359 "minWindowRatio": 0.5, 360 "maxWindowWidth": 2560, 361 "minWindowWidth": 1400, 362 "maxWindowHeight": 300, 363 "minWindowHeight": 200, 364 "excludeFromMissions": false 365 }] 366} 367``` 368 369 370## skills 371 372The **skills** tag represents the feature set of [wants](../application-models/want-overview.md) that can be received by the UIAbility or ExtensionAbility component. 373 374 **Table 7** skills 375 376| Name| Description| Data Type| Initial Value Allowed| 377| -------- | -------- | -------- | -------- | 378| actions | [Actions](../application-models/actions-entities.md) of wants that can be received, which can be predefined or customized.| String array| Yes (initial value: left empty)| 379| entities | [Entities](../application-models/actions-entities.md) of wants that can be received.| String array| Yes (initial value: left empty)| 380|uris | URIs that match the wants.| Object array| Yes (initial value: left empty)| 381 382 **Table 8** Internal structure of the uris tag 383 384| Name| Description| Data Type| Initial Value Allowed| 385| -------- | -------- | -------- | -------- | 386| 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)| 387| host | Host address of the URI. This attribute is valid only when **schema** 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)| 388| 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 attribute is valid only when both **scheme** and **host** are set.| String| Yes (initial value: left empty)| 389| 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 attribute is valid only when both **scheme** and **host** are set.| String| Yes (initial value: left empty)| 390| type | Data type that matches the want. The value compiles with the Multipurpose Internet Mail Extensions (MIME) type specification. This attribute can be configured together with **scheme** or be configured separately.| String| Yes (initial value: left empty)| 391 392Example of the **skills** structure: 393 394 395```json 396{ 397 "abilities": [ 398 { 399 "skills": [ 400 { 401 "actions": [ 402 "ohos.want.action.home" 403 ], 404 "entities": [ 405 "entity.system.home" 406 ], 407 "uris": [ 408 { 409 "scheme":"http", 410 "host":"example.com", 411 "port":"80", 412 "path":"path", 413 "type": "text/*" 414 } 415 ] 416 } 417 ] 418 } 419 ] 420} 421``` 422 423## extensionAbilities 424 425The **extensionAbilities** tag represents the configuration of extensionAbilities, which is valid only for the current extensionAbility. 426 427 **Table 9** extensionAbilities 428 429| Name| Description| Data Type| Initial Value Allowed| 430| -------- | -------- | -------- | -------- | 431| name | Name of the ExtensionAbility component. The value is a string with a maximum of 127 bytes. The name must be unique in the entire application.| String| No| 432| srcEntry | Code path corresponding to the ExtensionAbility component. The value is a string with a maximum of 127 bytes.| String| No| 433| description | Description of the ExtensionAbility component. The value is a string with a maximum of 255 bytes or a resource index to the description.| String| Yes (initial value: left empty)| 434| icon | Icon of the ExtensionAbility component. The value is an icon resource index. If **ExtensionAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| Yes (initial value: left empty)| 435| label | Name of the ExtensionAbility component displayed to users. The value is a string resource index.<br>**NOTE**<br>If **ExtensionAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| No| 436| type | Type of the ExtensionAbility component. The options are as follows:<br>- **form**: ExtensionAbility of a widget.<br>- **workScheduler**: ExtensionAbility of a Work Scheduler task.<br>- **inputMethod**: ExtensionAbility of an input method.<br>- **service**: service component running in the background.<br>- **accessibility**: ExtensionAbility of an accessibility feature.<br>- **dataShare**: ExtensionAbility for data sharing.<br>- **fileShare**: ExtensionAbility for file 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 window is then combined with other application windows through **abilityComponent**.<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>**NOTE**<br>The **service** and **dataShare** types apply only to system applications and do not take effect for third-party applications. | String| No| 437| permissions | Permissions required for another application to access the ExtensionAbility component.<br>The value is generally in the reverse domain name notation and contains a maximum of 255 bytes. It is an array of permission names predefined by the system or customized. The name of a customized permission must be the same as the **name** value of a permission defined in the **defPermissions** attribute.| String array| Yes (initial value: left empty)| 438| uri | Data URI provided by the ExtensionAbility component. The value is a string with a maximum of 255 bytes, in the reverse domain name notation.<br>**NOTE**<br>This attribute is mandatory when the type of the ExtensionAbility component is set to **dataShare**.| String| Yes (initial value: left empty)| 439|skills | Feature set of [wants](../application-models/want-overview.md) that can be received by the ExtensionAbility component.<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** in the first ExtensionAbility that has **skills** configured are used as the **label** and **icon** of the entire OpenHarmony service/application.<br>**NOTE**<br>The **skills** attribute with the entry capability can be configured for the feature package of an OpenHarmony application, but not for an OpenHarmony service.| Array| Yes (initial value: left empty)| 440| [metadata](#metadata)| Metadata of the ExtensionAbility component.| Object| Yes (initial value: left empty)| 441| exported | Whether the ExtensionAbility component can be called by other applications. <br>- **true**: The ExtensionAbility component can be called by other applications.<br>- **false**: The UIAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)| 442 443Example of the **extensionAbilities** structure: 444 445 446```json 447{ 448 "extensionAbilities": [ 449 { 450 "name": "FormName", 451 "srcEntry": "./form/MyForm.ts", 452 "icon": "$media:icon", 453 "label" : "$string:extension_name", 454 "description": "$string:form_description", 455 "type": "form", 456 "permissions": ["ohos.abilitydemo.permission.PROVIDER"], 457 "readPermission": "", 458 "writePermission": "", 459 "exported": true, 460 "uri":"scheme://authority/path/query", 461 "skills": [{ 462 "actions": [], 463 "entities": [], 464 "uris": [] 465 }], 466 "metadata": [ 467 { 468 "name": "ohos.extension.form", 469 "resource": "$profile:form_config", 470 } 471 ] 472 } 473 ] 474} 475``` 476 477 478## requestPermissions 479 480The **requestPermissions** tag represents a set of permissions that the application needs to request from the system for running correctly. 481 482> **NOTE** 483> 484> - The permission settings configured in the **requestPermissions** tag apply to the entire application. 485> - 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. 486 487**Table 10** requestPermissions 488 489| Name| Description| Data Type| Value Range| Default Value| 490| -------- | -------- | -------- | -------- | -------- | 491| name | Permission name. This attribute is mandatory.| String| Custom| –| 492| reason | Reason for requesting the permission. This attribute is mandatory when the permission to request is **user_grant**.<br>**NOTE**<br>If the permission to request is **user_grant**, this attribute is required for the application to be released to the application market. Multi-language adaptation is required.| String| Resource reference of the string type in $string: \*\*\* format| A null value| 493| usedScene | Scene under which the permission is used. It consists of the **abilities** and **when** sub-attributes. Multiple abilities can be configured.<br>**NOTE**<br>This attribute is optional by default. If the permission to request is **user_grant**, the **abilities** sub-attribute is mandatory and **when** is optional.| **abilities**: string array<br>**when**: string| **abilities**: array of names of UIAbility or ExtensionAbility components<br>**when**: **inuse** or **always**| **abilities**: null<br>**when**: null| 494 495Example of the **requestPermissions** structure: 496 497 498```json 499{ 500 "module" : { 501 "requestPermissions": [ 502 { 503 "name": "ohos.abilitydemo.permission.PROVIDER", 504 "reason": "$string:reason", 505 "usedScene": { 506 "abilities": [ 507 "EntryFormAbility" 508 ], 509 "when": "inuse" 510 } 511 } 512 ] 513 } 514} 515``` 516 517 518## shortcuts 519 520The **shortcuts** tag provides the shortcut information of an application. The value is an array of up to four shortcuts. It consists of four sub-attributes: **shortcutId**, **label**, **icon**, and **wants**. 521 522The **shortcut** information is identified in **metadata**, where: 523 524- **name** indicates the name of the shortcut, identified by **ohos.ability.shortcuts**. 525 526- **resource** indicates where the resources of the shortcut are stored. 527 528**Table 11** shortcuts 529 530| Name| Description| Data Type | Default Value| 531| -------- | -------- | -------- | -------- | 532| shortcutId | ID of the shortcut. The value is a string with a maximum of 63 bytes.| String| No| 533| label | Label of the shortcut, that is, the text description displayed for the shortcut. The value can be a string or a resource index to the label, with a maximum of 255 bytes.| String| Yes (initial value: left empty)| 534| icon | Icon of the shortcut. The value is an icon resource index.| String| Yes (initial value: left empty)| 535| [wants](../application-models/want-overview.md) | Wants to which the shortcut points. Each want consists of the **bundleName** and **abilityName** sub-attributes.<br>- **bundleName**: target bundle name of the shortcut. The value is a string.<br>- **abilityName**: target component name of the shortcut. The value is a string.| Object| Yes (initial value: left empty)| 536 537 5381. Configure the **shortcuts_config.json** file in **/resource/base/profile/**. 539 540 ```json 541 { 542 "shortcuts": [ 543 { 544 "shortcutId": "id_test1", 545 "label": "$string:shortcut", 546 "icon": "$media:aa_icon", 547 "wants": [ 548 { 549 "bundleName": "com.ohos.hello", 550 "abilityName": "EntryAbility" 551 } 552 ] 553 } 554 ] 555 } 556 ``` 557 5582. 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. 559 560 ```json 561 { 562 "module": { 563 // ... 564 "abilities": [ 565 { 566 "name": "EntryAbility", 567 "srcEntry": "./ets/entryability/EntryAbility.ts", 568 // ... 569 "skills": [ 570 { 571 "entities": [ 572 "entity.system.home" 573 ], 574 "actions": [ 575 "ohos.want.action.home" 576 ] 577 } 578 ], 579 "metadata": [ 580 { 581 "name": "ohos.ability.shortcuts", 582 "resource": "$profile:shortcuts_config" 583 } 584 ] 585 } 586 ] 587 } 588 } 589 ``` 590 591 592## distributionFilter 593 594The **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. Distribution rules cover the following factors: screen shape, screen size, screen resolution, and country/region code. During distribution, a unique HAP is determined based on the mapping between **deviceType** and these five factors. This tag must be configured in the **/resource/profile resource** directory. Its sub-tags are optional. 595 596 **Table 12** distributionFilter 597 598| Name| Description| Data Type| Initial Value Allowed| 599| -------- | -------- | -------- | -------- | 600| screenShape | Supported screen shapes.| Object array| Yes (initial value: left empty)| 601| screenWindow | Supported window resolutions for when the application is running. This attribute applies only to the lite wearables.| Object array| Yes (initial value: left empty)| 602| screenDensity | Pixel density of the screen, in dots per inch (DPI). This attribute is optional. The value 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].| Object array| Yes (initial value: left empty)| 603| 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)| 604 605 606 **Table 13** Internal structure of the screenShape tag 607 608| Name| Description| Data Type| Initial Value Allowed| 609| -------- | -------- | -------- | -------- | 610| policy | Rule for the sub-attribute value. Set this attribute to **exclude** or **include**.<br>- **exclude**: Exclude the matches of the sub-attribute value.<br>- **include**: Include the matches of the sub-attribute value.| String| No| 611| value | Screen shapes. The value can be **circle**, **rect**, or both. Example: Different HAP files can be provided for a smart watch with a circular face and that with a rectangular face.| String array| No| 612 613 **Table 14** Internal structure of the screenWindow tag 614 615| Name| Description| Data Type| Initial Value Allowed| 616| -------- | -------- | -------- | -------- | 617| policy | Rule for the sub-attribute value. Set this attribute to **exclude** or **include**.<br>- **exclude**: Exclude the matches of the sub-attribute value.<br>- **include**: Include the matches of the sub-attribute value.| String| No| 618| value | Screen width and height, in pixels. The value an array of supported width and height pairs, each in the "width * height" format, for example, **"454 * 454"**.| String array| No| 619 620 **Table 15** Internal structure of the screenDensity tag 621 622| Name| Description| Data Type| Initial Value Allowed| 623| -------- | -------- | -------- | -------- | 624| policy | Rule for the sub-attribute value. Set this attribute to **exclude** or **include**.<br>- **exclude**: Exclude the matches of the sub-attribute value.<br>- **include**: Include the matches of the sub-attribute value.| String| No| 625| value | Pixel density of the screen, in DPI.| String array| No| 626 627 **Table 16** Internal structure of the countryCode tag 628 629| Name| Description| Data Type| Initial Value Allowed| 630| -------- | -------- | -------- | -------- | 631| policy | Rule for the sub-attribute value. Set this attribute to **exclude** or **include**.<br>- **exclude**: Exclude the matches of the sub-attribute value.<br>- **include**: Include the matches of the sub-attribute value.| String| No| 632| value | Code of the country or region to which the application is to be distributed.| String array| No| 633 634Configure the **distro_filter_config.json** file (this file name is customizable) in **resources/base/profile** under the development view. 635 636 637```json 638{ 639 "distributionFilter": { 640 "screenShape": { 641 "policy": "include", 642 "value": [ 643 "circle", 644 "rect" 645 ] 646 }, 647 "screenWindow": { 648 "policy": "include", 649 "value": [ 650 "454*454", 651 "466*466" 652 ] 653 }, 654 "screenDensity": { 655 "policy": "exclude", 656 "value": [ 657 "ldpi", 658 "xldpi" 659 ] 660 }, 661 "countryCode": {// Distribution to the Chinese mainland and Hong Kong, China is supported. 662 "policy": "include", 663 "value": [ 664 "CN", 665 "HK" 666 ] 667 } 668 } 669} 670``` 671 672Configure **metadata** in the **module** tag in the **module.json5** file. 673 674 675```json 676{ 677 "module": { 678 // ... 679 "metadata": [ 680 { 681 "name": "ohos.module.distro", 682 "resource": "$profile:distro_filter_config", 683 } 684 ] 685 } 686} 687``` 688 689 690## testRunner 691 692The **testRunner** tag represents the supported test runner. 693 694**Table 17** Internal structure of the testRunner tag 695 696| Name| Description| Data Type| Initial Value Allowed| 697| -------- | -------- | -------- | -------- | 698| name | Name of the test runner object. The value is a string with a maximum of 255 bytes.| String| No| 699| srcPath | Code path of the test runner. The value is a string with a maximum of 255 bytes.| String| No| 700 701Example of the **testRunner** structure: 702 703 704```json 705{ 706 "module": { 707 // ... 708 "testRunner": { 709 "name": "myTestRunnerName", 710 "srcPath": "etc/test/TestRunner.ts" 711 } 712 } 713} 714``` 715 716## atomicService 717 718The **atomicService** tag represents the atomic service configuration. It is available only when **bundleType** is set to **atomicService** in the **app.json** file. 719 720**Table 18** Internal structure of the atomicService tag 721 722| Name| Description| Data Type| Initial Value Allowed| 723| -------- | -------- | -------- | -------- | 724| preloads | List of modules to pre-load.| Object array| Yes (initial value: left empty)| 725 726Example of the **atomicService** structure: 727 728 729```json 730{ 731 "module": { 732 "atomicService": { 733 "preloads":[ 734 { 735 "moduleName":"feature" 736 } 737 ] 738 } 739 } 740} 741``` 742 743## preloads 744 745The **preloads** tag represents a list of modules to pre-load in an atomic service. 746 747**Table 19** Internal structure of the preloads tag 748 749| Name| Description| Data Type| Initial Value Allowed| 750| -------- | -------- | -------- | -------- | 751| moduleName | Name of the module to be preloaded when the current module is loaded in the atomic service.| String| No| 752 753Example of the **preloads** structure: 754 755```json 756{ 757 "module": { 758 "atomicService": { 759 "preloads":[ 760 { 761 "moduleName":"feature" 762 } 763 ] 764 } 765 } 766} 767``` 768 769## dependencies 770 771The **dependencies** tag identifies the list of shared libraries that the module depends on when it is running. 772 773**Table 20** Internal structure of the dependencies tag 774 775| Name | Description | Data Type| Initial Value Allowed| 776| ----------- | ------------------------------ | -------- | ---------- | 777| moduleName | Module name of the shared bundle on which the current module depends.| String | No| 778 779Example of the **dependencies** structure: 780 781```json 782{ 783 "module": { 784 "dependencies": [ 785 { 786 "moduleName": "library" 787 } 788 ] 789 } 790} 791``` 792