package-structure.md 64.1 KB
Newer Older
Z
zengyawen 已提交
1 2


E
ester.zhou 已提交
3
# Application Package Structure Configuration File
Z
zengyawen 已提交
4

E
ester.zhou 已提交
5 6 7 8
In an application development project, you need to declare the package structure of the application in the **config.json** file.

## Internal Structure of the config.json File

E
ester.zhou 已提交
9
The **config.json** file consists of three mandatory tags, namely, **app**, **deviceConfig**, and **module**. See Table 1 for details.
E
ester.zhou 已提交
10 11 12

Table 1 Internal structure of the config.json file

E
ester.zhou 已提交
13
| Tag    | Description                                                        | Data Type| Initial Value Allowed|
E
ester.zhou 已提交
14
| ------------ | ------------------------------------------------------------ | -------- | ---------- |
E
ester.zhou 已提交
15 16 17
| app          | Global configuration of an application. Different HAP files of the same application must use the same **app** configuration. For details, see [Internal Structure of the app Tag](#internal-structure-of-the-app-tag).| Object    | No        |
| deviceConfig | Application configuration applied to a specific type of device. For details, see [Internal Structure of the deviceconfig Tag](#internal-structure-of-the-deviceconfig-tag).| Object    | No        |
| module       | Configuration of a HAP file. The **module** configuration is valid only for the current HAP file. For details, see [Internal Structure of the module Tag](#internal-structure-of-the-module-tag).| Object    | No        |
E
ester.zhou 已提交
18

E
ester.zhou 已提交
19
Example of the **config.json** file:
E
ester.zhou 已提交
20 21

```json
Z
zengyawen 已提交
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
{
  "app": {
    "bundleName": "com.example.myapplication",
    "vendor": "example",
    "version": {
      "code": 1,
      "name": "1.0"
    },
    "apiVersion": {
      "compatible": 4,
      "target": 5,
      "releaseType": "Beta1"
    }
  },
  "deviceConfig": {},
  "module": {
    "package": "com.example.myapplication.entrymodule",
    "name": ".MyApplication",
    "deviceType": [
R
RayShih 已提交
41
      "default"
Z
zengyawen 已提交
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
    ],
    "distro": {
      "moduleName": "entry",
      "moduleType": "entry"
    },
    "abilities": [
      {
        "skills": [
          {
            "entities": [
              "entity.system.home"
            ],
            "actions": [
              "action.system.home"
            ]
          }
        ],
        "name": "com.example.myapplication.entrymodule.MainAbility",
        "icon": "$media:icon",
        "description": "$string:mainability_description",
        "label": "$string:app_name",
        "type": "page",
        "launchType": "standard"
      }
    ],
    "js": [
      {
        "pages": [
          "pages/index/index"
        ],
        "name": "default",
        "window": {
          "designWidth": 720,
          "autoDesignWidth": false
        }
      }
    ]
  }
}
```

E
ester.zhou 已提交
83 84 85 86 87 88
### Internal Structure of the app Tag

The **app** tag contains the global configuration information of the application. For details about the internal structure, see Table 2.

Table 2 Internal structure of the app tag

E
ester.zhou 已提交
89
| Attribute  | Description                                                        | Data Type| Initial Value Allowed        |
E
ester.zhou 已提交
90
| ---------- | ------------------------------------------------------------ | -------- | ------------------ |
E
ester.zhou 已提交
91
| bundleName | Bundle name of the application. It uniquely identifies the application. The bundle name can contain only letters, digits, underscores (_), and periods (.). It must start with a letter. The value is a string with 7 to 127 bytes of a reverse domain name, for example, **com.example.myapplication**. It is recommended that the first level be the domain suffix "com" and the second level be the vendor/individual name. More levels are also accepted.| String  | No                |
E
ester.zhou 已提交
92 93 94 95 96 97
| vendor     | Description of the application vendor. The value is a string with a maximum of 255 bytes.         | String  | Yes (initial value: left empty)|
| version    | Version information of the application. For details, see Table 3.                               | Object    | No                |
| apiVersion | OpenHarmony API version on which the application depends. For details, see Table 4.          | Object    | Yes (initial value: left empty)|

Table 3 Internal structure of version

E
ester.zhou 已提交
98
| Attribute                | Description                                                        | Data Type| Initial Value Allowed                |
E
ester.zhou 已提交
99 100 101 102 103 104 105
| ------------------------ | ------------------------------------------------------------ | -------- | -------------------------- |
| name                     | Application version number visible to users. The value can be customized and cannot exceed 127 bytes. The customization rules are as follows:<br>API 5 and earlier versions: A three-segment version number is recommended, for example, A.B.C (also compatible with A.B). In the version number, A, B, and C are integers ranging from 0 to 999. Other formats are not supported.<br>     A indicates the major version number. <br>     B indicates the minor version number.<br>     C indicates the patch version number.<br>API 6 and later versions: A four-segment version number is recommended, for example, A.B.C.D. In the version number, A, B, and C are integers ranging from 0 to 99, and D is an integer ranging from 0 to 999.<br>     A indicates the major version number. <br>     B indicates the minor version number.<br>     C indicates the feature version number.<br>     D indicates the patch version number.| Number    | No                  |
| code                     | Application version number used only for application management by OpenHarmony. This version number is not visible to users of the application. The value rules are as follows:<br>API 5 and earlier versions: It is a non-negative integer less than 32 bits in binary mode, converted from the value of version.name as follows: The conversion rules are as follows:<br> Value of **code** = A * 1,000,000 + B * 1,000 + C. For example, if the value of **version.name** is 2.2.1, the value of **code** is 2002001.<br> API 6 and later versions: The value of **code** is not associated with the value of **version.name** and can be customized. The value is a non-negative integer ranging from 2 to 31. Note that the value must be updated each time the application version is updated. The value for a later version must be greater than that for an earlier version.| Number    | No                  |
| minCompatibleVersionCode | Minimum compatible version of the application. It is used to check whether the application is compatible with the version on other devices in the cross-device scenario.<br> The value rules are the same as those of **version.code**.| Number    | No (initial value: **code** attribute value)|

Table 4 Internal structure of apiVersion

E
ester.zhou 已提交
106
| Attribute   | Description                                                       | Data Type| Initial Value Allowed|
E
ester.zhou 已提交
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
| ----------- | ----------------------------------------------------------- | -------- | ---------- |
| compatible  | Minimum API version required for running the application. The value ranges from 0 to 2147483647.      | Integer    | Yes    |
| target      | Target API version required for running the application. The value ranges from 0 to 2147483647.| Integer    | Yes    |
| releaseType | Type of the target API version required for running the application.                  | String  | Yes    |

Example of the app tag structure:

```json
"app": {
    "bundleName": "com.example.myapplication",
    "vendor": "example",
    "version": {
      "code": 1,
      "name": "1.0"
    },
    "apiVersion": {
      "compatible": 4,
      "target": 5,
      "releaseType": "Beta1"
    }
  }
```

### Internal Structure of the deviceConfig Tag

E
ester.zhou 已提交
132
The **deviceConfig** tag contains the application configuration information on the device, including attributes such as **default**, **tv**, **car**, and **wearable**. The **default** configuration applies to all types of devices. You need to declare the peculiar configuration of a specific device type in the associated sub-tag of this type. For details about the internal structure, see Table 5.
E
ester.zhou 已提交
133 134 135

Table 5 Internal structure of the deviceConfig tag

E
ester.zhou 已提交
136
| Attribute    | Description                                           | Data Type| Initial Value Allowed        |
E
ester.zhou 已提交
137 138 139 140 141 142 143 144 145 146 147
| ------------ | ----------------------------------------------- | -------- | ------------------ |
| default      | Application configuration applied to all types of devices. See Table 6.      | Object    | No                |
| tablet       | Application configuration specific to tablets. See Table 6.              | Object    | Yes (initial value: left empty)|
| tv           | Application configuration specific to smart TVs. See Table 6.        | Object    | Yes (initial value: left empty)|
| car          | Application configuration specific to head units. See Table 6.          | Object    | Yes (initial value: left empty)|
| wearable     | Application configuration specific to wearables. See Table 6.      | Object    | Yes (initial value: left empty)|

For details about the internal structures of device attributes, see Table 6.

Table 6 Internal structure of device attributes

E
ester.zhou 已提交
148
| Attribute          | Description                                                        | Data Type| Initial Value Allowed             |
E
ester.zhou 已提交
149
| ------------------ | ------------------------------------------------------------ | -------- | ----------------------- |
E
ester.zhou 已提交
150 151 152 153
| process            | Name of the process running the application or ability. If the **process** attribute is configured in the **deviceConfig** tag, all abilities of the application run in this process. You can set the **process** attribute for a specific ability in the **abilities** attribute, so that the ability can run in the particular process. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types. The value can contain a maximum of 31 characters.| String  | Yes                     |
| supportBackup      | Whether the application supports backup and restoration. The value **false** means that the application does not support backup or restoration.<br> This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| Boolean  | Yes (initial value: **false**)|
| compressNativeLibs | Whether the **libs** libraries are packaged in the HAP file after being compressed. The value **false** means that the **libs** libraries are stored without being compressed and will be directly loaded during the installation of the HAP file.<br> This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| Boolean  | Yes (initial value: **true**) |
| directLaunch       | Whether the application can be started when the device is locked. The value **true** means that the application can be started when the device is locked. Devices running OpenHarmony do not support this attribute.| Boolean  | Yes (initial value: **false**)|
E
ester.zhou 已提交
154 155 156
| ark                | Maple configuration. See Table 7.                                | Object    | Yes (initial value: left empty)             |
| network            | Network security configuration. You can customize the network security settings of the application in the security statement of the configuration file without modifying the application code. See Table 9.| Object    | Yes (initial value: left empty)     |

E
ester.zhou 已提交
157
Table 7 Internal structure of the ark attribute
E
ester.zhou 已提交
158

E
ester.zhou 已提交
159
| Attribute  | Description                            | Data Type| Initial Value Allowed                    |
E
ester.zhou 已提交
160 161 162 163 164 165
| ---------- | -------------------------------- | -------- | ------------------------------ |
| reqVersion | Maple version required for the application. For details, see Table 8.| Object    | No                      |
| flag       | Type of the Maple application.       | String  | No (available options: **m**, **mo**, **z**).|

Table 8 Internal structure of the reqVersion attribute

E
ester.zhou 已提交
166
| Attribute  | Description                                                     | Data Type| Initial Value Allowed|
E
ester.zhou 已提交
167 168 169 170 171 172
| ---------- | --------------------------------------------------------- | -------- | ---------- |
| compatible | Minimum Maple version required for the application. The value is a 32-bit unsigned integer.| Integer    | No  |
| target     | Type of the Maple application. The value is a 32-bit unsigned integer.        | Integer    | No  |

Table 9 Internal structure of the network attribute

E
ester.zhou 已提交
173
| Attribute        | Description                                                        | Data Type| Initial Value Allowed             |
E
ester.zhou 已提交
174 175 176 177 178 179
| ---------------- | ------------------------------------------------------------ | -------- | ----------------------- |
| cleartextTraffic | Whether to allow the application to use plaintext traffic, for example, plaintext HTTP traffic.<br> **true**: The application is allowed to use plaintext traffic.<br> **false**: The application is not allowed to use plaintext traffic.| Boolean  | Yes (initial value: **false**)|
| securityConfig   | Network security configuration of the application. For details, see Table 10.                      | Object    | Yes (initial value: left empty)       |

Table 10 Internal structure of the securityConfig attribute

E
ester.zhou 已提交
180
| Attribute      | Sub-attribute        | Description                                                        | Data Type| Initial Value Allowed      |
E
ester.zhou 已提交
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
| -------------- | ------------------ | ------------------------------------------------------------ | -------- | ---------------- |
| domainSettings | -                  | Security settings of the custom network domain. This attribute allows nested domains. To be more specific, the **domainSettings** object of a large domain can be nested with the **domainSettings** objects of small network domains.| Object| Yes (initial value: left empty)|
|                | cleartextPermitted | Whether plaintext traffic can be transmitted in the custom network domain. If both **cleartextTraffic** and **security** are declared, whether plaintext traffic can be transmitted in the custom network domain is determined by the **cleartextPermitted** attribute.<br>**true**: Plaintext traffic can be transmitted.<br>**false**: Plaintext traffic cannot be transmitted.| Boolean| No              |
|                | domains            | Domain name configuration. This attribute consists of the **subdomains** and **name** sub-attributes.<br> **subdomains** (boolean): specifies whether the domain name contains subdomains. If this sub-attribute is set to **true**, the domain naming convention applies to all related domains and subdomains (including the lower-level domains of the subdomains). Otherwise, the convention applies only to exact matches.<br> **name** (string): indicates the domain name.| Object array| No              |

Example of the deviceConfig tag structure:

```json
"deviceConfig": {
	"default": {
		"process": "com.example.test.example",
		"supportBackup": false,
		"network": {
			"cleartextTraffic": true,
			"securityConfig": {
				"domainSettings": {
					"cleartextPermitted": true,
					"domains": [
						{
							"subdomains": true,
							"name": "example.ohos.com"
						}
					]
				}
			}
		}
	}
}
```

### Internal Structure of the module Tag

The **module** tag contains the configuration information of the HAP file. For details about the internal structure, see Table 11.

Table 11 Internal structure of the module tag

E
ester.zhou 已提交
217
| Attribute       | Description                                                        | Data Type  | Initial Value Allowed                                                  |
E
ester.zhou 已提交
218 219
| --------------- | ------------------------------------------------------------ | ---------- | ------------------------------------------------------------ |
| mainAbility     | Ability displayed on the Service Center icon. When the resident process is started, the **mainAbility** is started.| String    | No if any ability using the Page template exists               |
E
ester.zhou 已提交
220 221 222
| package         | Structure name of the HAP file, which must be unique in the application. The value is a string with a maximum of 127 bytes, in the reverse domain name notation. It is recommended that the value be the same as the project directory of the HAP file. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String    | No                                                          |
| name            | Class name of the HAP file. The value is in the reverse domain name notation. The prefix must be the same as the package name specified by the **package** label at the same level. The value can also start with a period (.). The value is a string with a maximum of 255 bytes.<br> This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String    | No                                                          |
| description     | Description of the HAP file. The value is a string with a maximum of 255 bytes. If the value exceeds the limit or needs to support multiple languages, you can use a resource index to the description. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String    | Yes (initial value: left empty)                                          |
E
ester.zhou 已提交
223
| supportedModes  | Mode supported by the application. Currently, only the **drive** mode is defined. This attribute applies only to head units.| String array| Yes (initial value: left empty)                                          |
E
ester.zhou 已提交
224 225
| deviceType      | Type of device on which the abilities can run. The device types predefined in the system include **tablet**, **tv**, **car**, and **wearable**.| String array| No                                                          |
| distro          | Distribution description of the current HAP file. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types. For details, see Table 12.| Object      | No                                                          |
E
ester.zhou 已提交
226 227 228 229 230
| metaData        | Metadata of the HAP file. For details, see Table 13.                                 | Object      | Yes (initial value: left empty)                                          |
| abilities       | All abilities in the current module. The value is an array of objects, each of which represents a shortcut object. For details, see Table 17.| Object array  | Yes (initial value: left empty)                                          |
| js              | A set of JS modules developed using the ArkUI framework. Each element in the set represents the information about a JS module. For details, see Table 22.| Object array  | Yes (initial value: left empty)                                          |
| shortcuts       | Shortcut information of the application. The value is an array of objects, each of which represents a shortcut object. For details, see Table 25.| Object array  | Yes (initial value: left empty)                                          |
| reqPermissions  | Permissions that the application applies for from the system before its running. For details, see Table 21.                  | Object array  | Yes (initial value: left empty)                                          |
E
ester.zhou 已提交
231 232
| colorMode       | Color mode of the application.<br>**dark**: Resources applicable for the dark mode are selected.<br>**light**: Resources applicable for the light mode are selected.<br>**auto**: Resources are selected based on the color mode of the system.<br>This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types. | String    | Yes (initial value: **auto**)                                      |
| distroFilter    | Application distribution rules.<br>AppGallery uses these rules to distribute HAP files to the matching devices. Distribution rules cover three factors: API version, screen shape, and screen resolution. AppGallery distributes a HAP file to the device whose on the mapping between **deviceType** and these three factors. For details, see Table 29. | Object      | Yes (initial value: left empty)<br/>Set this attribute when an application has multiple entry modules. |
E
ester.zhou 已提交
233 234 235
| reqCapabilities | Device capabilities required for running the application.                              | String array| Yes (initial value: left empty)                                            |
| commonEvents    | Static broadcast. For details, see Table 35.                                        | Object array  | Yes (initial value: left empty)                                            |
| allowClassMap   | Metadata of the HAP file. The value can be **true** or **false**. If the value is **true**, the HAP file uses the Java object proxy mechanism provided by the OpenHarmony framework. | Boolean    | No (initial value: **false**)                                     |
E
ester.zhou 已提交
236
| entryTheme      | Keyword of an OpenHarmony internal theme. Set it to the resource index of the name.| String    | Yes (initial value: left empty)                                          |
E
ester.zhou 已提交
237

E
ester.zhou 已提交
238
Example of the **module** tag structure:
E
ester.zhou 已提交
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273

```json
"module": {
	"mainAbility": "MainAbility",
	"package": "com.example.myapplication.rntry",
	"name": ".MyOHOSAbilityPackage",
	"description": "$string:description_application",
	"supportModes": [
		"drive"
	],
	"deviceType": [
		"car"
	],
	"distro": {
		"moduleName": "ohos_entry",
		"moduleType": "entry"
	},
	"abilities": [
		...
	],
	"shortcuts": [
		...
	],
	"js": [
		...
	],
	"reqPermissions": [
		...
	],
	"colorMode": "light"
}
```

Table 12 Internal structure of the distro attribute

E
ester.zhou 已提交
274
| Attribute        | Description                                                        | Data Type| Initial Value Allowed|
E
ester.zhou 已提交
275 276 277 278 279
| ---------------- | ------------------------------------------------------------ | -------- | ---------- |
| moduleName       | Name of the current HAP file. The maximum length is 31 characters.                           | String  | No  |
| moduleType       | Type of the current HAP file. The value can be **entry** or **feature**. For the HAR type, set this attribute to **har**.| String  | No  |
| installationFree | Whether the HAP file supports the installation-free feature.<br> **true**: The HAP file supports the installation-free feature and meets installation-free constraints.<br> **false**: The HAP file does not support the installation-free feature.<br> Pay attention to the following:<br> When **entry.hap** is set to **true**, all **feature.hap** fields related to **entry.hap **must be **true**.<br> When **entry.hap** is set to **false**, **feature.hap** related to **entry.hap** can be set to **true** or **false** based on service requirements.| Boolean  | No        |

E
ester.zhou 已提交
280
Example of the **distro** attribute structure:
E
ester.zhou 已提交
281 282 283 284 285 286 287 288 289 290 291

```json
"distro": {
	"moduleName": "ohos_entry",
	"moduleType": "entry",
	"installationFree": true
}
```

Table 13 Internal structure of the metaData attribute

E
ester.zhou 已提交
292
| Attribute     | Description                                                        | Data Type| Initial Value Allowed          |
E
ester.zhou 已提交
293 294 295 296 297 298 299
| ------------- | ------------------------------------------------------------ | -------- | -------------------- |
| parameters    | Metadata of the parameters to be passed for calling the ability. The metadata of each parameter consists of the **description**, **name**, and **type** sub-attributes. For details, see Table 14.| Object array| Yes (initial value: left empty)  |
| results       | Metadata of the ability return value. The metadata of each return value consists of the **description**, **name**, and **type** sub-attributes. For details, see Table 15.| Object array| Yes (initial value: left empty)|
| customizeData | Custom metadata of the parent component. **parameters** and **results** cannot be configured in **application**. For details, see Table 16.| Object array| Yes (initial value: left empty)|

Table 14 Internal structure of the parameters attribute

E
ester.zhou 已提交
300
| Attribute   | Description                                                        | Data Type| Initial Value Allowed        |
E
ester.zhou 已提交
301 302 303 304 305 306 307
| ----------- | ------------------------------------------------------------ | -------- | ------------------ |
| description | Description of the parameter. The value can be a string or a resource index to descriptions in multiple languages. The value can contain a maximum of 255 characters.| String  | Yes (initial value: left empty)|
| name        | Name of the parameter. The value can contain a maximum of 255 characters.                   | String  | Yes (initial value: left empty)|
| type        | Type of the parameter, for example, **Integer**.                             | String  | No          |

Table 15 Internal structure of the results attribute

E
ester.zhou 已提交
308
| Attribute   | Description                                                        | Data Type| Initial Value Allowed          |
E
ester.zhou 已提交
309 310 311 312 313 314 315
| ----------- | ------------------------------------------------------------ | -------- | -------------------- |
| description | Description of the return value. The value can be a string or a resource index to descriptions in multiple languages. The value can contain a maximum of 255 characters.| String  | Yes (initial value: left empty)|
| name        | Name of the return value. The value can contain a maximum of 255 characters.                     | String  | Yes (initial value: left empty)|
| type        | Type of the return value, for example, **Integer**.                               | String  | No                  |

Table 16 Internal structure of the customizeData attribute

E
ester.zhou 已提交
316
| Attribute| Description                                                      | Data Type| Initial Value Allowed          |
E
ester.zhou 已提交
317 318 319 320 321
| -------- | ---------------------------------------------------------- | -------- | -------------------- |
| name     | Key of a data element. The value is a string with a maximum of 255 bytes.       | String  | Yes (initial value: left empty)|
| value    | Value of a data element. The value is a string with a maximum of 255 bytes.       | String  | Yes (initial value: left empty)|
| extra    | Custom format of the data element. The value is an index to the resource that identifies the data.| String  | Yes (initial value: left empty)|

E
ester.zhou 已提交
322
Example of the **metaData** attribute structure:
E
ester.zhou 已提交
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345

```json
"metaData": {
    "parameters" : [{
        "name" : "string",
        "type" : "Float",
        "description" : "$string:parameters_description"
    }],
    "results" : [{
        "name" : "string",
        "type" : "Float",
        "description" : "$string:results_description"
    }],
    "customizeData" : [{
        "name" : "string",
        "value" : "string",
        "extra" : "$string:customizeData_description"
    }]
}
```

Table 17 Internal structure of the abilities attribute

E
ester.zhou 已提交
346
| Attribute        | Description                                                        | Data Type  | Initial Value Allowed                                              |
E
ester.zhou 已提交
347 348
| ---------------- | ------------------------------------------------------------ | ---------- | -------------------------------------------------------- |
| process          | Name of the process running the application or ability. If the **process** attribute is configured in the **deviceConfig** tag, all abilities of the application run in this process. You can set the **process** attribute for a specific ability in the **abilities** attribute, so that the ability can run in the particular process. If this attribute is set to the name of the process running other applications, all these applications can run in the same process, provided they have the same unified user ID and the same signature. Devices running OpenHarmony do not support this attribute.| String    | Yes (initial value: left empty)                                    |
E
ester.zhou 已提交
349
| name             | Name of the ability. The value is a reverse domain name, in the format of "*Bundle name*.*Class name*", for example, **"com.example.myapplication.MainAbility"**. Alternatively, the value can start with a period (.) followed by the class name, for example, **".MainAbility"**.<br> The ability name must be unique in an application. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.<br> Note: When you use DevEco Studio to create a project, the configuration of the first ability is generated by default, including the **MainAbility.java** file and the class name **MainAbility** defaulted in the **name** string for the **abilities** attribute in **config.json**. The value of this attribute can be customized if you use other IDE tools. The value can contain a maximum of 127 characters.| String    | No                                                      |
E
ester.zhou 已提交
350 351 352 353
| description      | Description of the ability. The value can be a string or a resource index to descriptions in multiple languages. The value can contain a maximum of 255 characters.| String    | Yes (initial value: left empty)                                    |
| icon             | Index to the ability icon file. Example value: **$media:ability_icon**. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the icon of the ability is also used as the icon of the application. If multiple abilities address this condition, the icon of the first candidate ability is used as the application icon.<br> Note: The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels.| String    | Yes (initial value: left empty)                                    |
| label            | Ability name visible to users. The value can be a name string or a resource index to names in multiple languages. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the label of the ability is also used as the label of the application. If multiple abilities address this condition, the label of the first candidate ability is used as the application label.<br> Note: The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels. The value can be a reference to a string defined in a resource file or a string enclosed in brackets ({}). The value can contain a maximum of 255 characters.| String    | Yes (initial value: left empty)                                    |
| uri              | Uniform Resource Identifier (URI) of the ability. The value can contain a maximum of 255 characters.          | String    | Yes (No for abilities using the Data template)                 |
E
ester.zhou 已提交
354
| launchType       | Startup type of the ability. The value can be **standard** or **singleton**.<br>**standard**: Multiple **Ability** instances can be created during startup. Most abilities can use this type.<br>**singleton**: Only a single **Ability** instance can be created across all task stacks during startup. For example, a globally unique incoming call screen uses the singleton startup type. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String    | Yes (initial value: **"singleton"**)                            |
E
ester.zhou 已提交
355 356 357 358 359 360
| visible          | Whether the ability can be called by other applications.<br>**true**: The ability can be called by other applications.<br>**false**: The ability cannot be called by other applications.| Boolean  | Yes (initial value: **false**)                               |
| permissions      | Permissions required for abilities of another application to call the current ability, generally in the format of a reverse domain name. The value can be either the permissions predefined in the OS or your custom permissions.| String array| Yes (initial value: left empty)                                    |
| skills           | Types of the **want** that can be accepted by the ability.                           | Object array  | Yes (initial value: left empty)                                    |
| deviceCapability | Device capabilities required to run the ability.| String array| Yes (initial value: left empty)                                    |
| metaData         | Metadata. For details, see Table 13.                                          | Object      | Yes (initial value: left empty)                                    |
| type             | Type of the ability. Available values are as follows:<br>**page**: FA developed using the Page template to provide the capability of interacting with users.<br>**service**: PA developed using the Service template to provide the capability of running tasks in the background.<br>**data**: PA developed using the Data template to provide unified data access for external systems.<br>**CA**: ability that can be started by other applications as a window.| String    | No                                                      |
E
ester.zhou 已提交
361
| orientation      | Display orientation of the ability. This attribute applies only to the ability using the Page template. Available values are as follows:<br>unspecified: indicates that the system automatically determines the display orientation of the ability.<br>**landscape**: indicates the landscape orientation.<br>**portrait**: indicates the portrait orientation.<br>**followRecent**: indicates that the orientation follows the most recent application in the stack.| String    | Yes (initial value: **"unspecified"**)                         |
E
ester.zhou 已提交
362 363
| backgroundModes  | Background service type of the ability. You can assign multiple background service types to a specific ability. This attribute applies only to the ability using the Service template. Available values are as follows:<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>**pictureInPicture**: picture in picture (PiP) and small-window video playback services<br>**voip**: voice/video call and VoIP services<br>**location**: location and navigation services<br>**bluetoothInteraction**: Bluetooth scanning, connection, and transmission services<br>**wifiInteraction**: WLAN scanning, connection, and transmission services<br>**screenFetch**: screen recording and screenshot services<br>**multiDeviceConnection**: multi-device interconnection service| String array| Yes (initial value: left empty)                                    |
| grantPermission  | Whether permissions can be granted for any data in the ability.                   | Boolean    | Yes (initial value: left empty)                                    |
E
ester.zhou 已提交
364 365
| readPermission   | Permission required for reading data in the ability. This attribute applies only to the ability using the Data template. The value is a string with a maximum of 255 bytes. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String    | Yes (initial value: left empty)                                      |
| writePermission  | Permission required for writing data to the ability. This attribute applies only to the ability using the Data template. The value is a string with a maximum of 255 bytes. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String    | Yes (initial value: left empty)                                      |
E
ester.zhou 已提交
366
| configChanges    | System configurations that the ability concerns. Upon any changes on the concerned configurations, the **onConfigurationUpdated** callback will be invoked to notify the ability. Available values are as follows:<br>**mcc**: indicates that the mobile country code (MCC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MCC is updated.<br>**mnc**: indicates that the mobile network code (MNC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MNC is updated.<br>**locale**: indicates that the locale is changed. Typical scenario: The user has selected a new language for the text display of the device.<br>**layout**: indicates that the screen layout is changed. Typical scenario: Currently, different display forms are all in the active state.<br>**fontSize**: indicates that font size is changed. Typical scenario: A new global font size is set.<br>**orientation**: indicates that the screen orientation is changed. Typical scenario: The user rotates the device.<br>**density**: indicates that the display density is changed. Typical scenario: The user may specify different display ratios, or different display forms are active at the same time.<br>**size**: indicates that the size of the display window is changed.<br>**smallestSize**: indicates that the length of the shorter side of the display window is changed.<br>**colorMode**: indicates that the color mode is changed.| String array| Yes (initial value: left empty)                                      |
E
ester.zhou 已提交
367 368 369 370
| mission          | Task stack of the ability. This attribute applies only to the ability using the Page template. By default, all abilities in an application belong to the same task stack. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String    | Yes (initial value: bundle name of the application)                              |
| targetAbility    | Target ability that this ability alias points to. This attribute applies only to the ability using the Page template. If the **targetAbility** attribute is set, only **name**, **icon**, **label**, **visible**, **permissions**, and **skills** take effect in the current ability (ability alias). Other attributes use the values of the **targetAbility** attribute. The target ability must belong to the same application as the alias and must be declared in **config.json** ahead of the alias. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String    | Yes (initial value: left empty, indicating that the current ability is not an alias)|
| multiUserShared  | Whether the ability supports data sharing among multiple users. This attribute applies only to the ability using the Data template. If this attribute is set to **true**, only one copy of data is stored for multiple users. Note that this attribute will invalidate the **visible** attribute. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| Boolean  | Yes (initial value: **false**)                               |
| supportPipMode   | Whether the ability allows the user to enter the Picture in Picture (PiP) mode. The PiP mode enables the user to watch a video in a small window that hovers on top of a full screen window (main window). This attribute applies only to the ability using the Page template. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| Boolean  | Yes (initial value: **false**)                               |
E
ester.zhou 已提交
371 372 373 374 375
| formsEnabled     | Whether the ability can provide forms. This attribute applies only to the ability using the Page template.<br>**true**: This ability can provide forms.<br>**false**: This ability cannot provide forms.| Boolean  | Yes (initial value: **false**)                               |
| forms            | Details about the forms used by the ability. This attribute is valid only when **formsEnabled** is set to **true**. For details, see Table 27.| Object array  | Yes (initial value: left empty)                                    |
| srcLanguage      | Programming language used to develop the ability.                                     | String    | The value can be **java**, **js**, or **ets**.                                     |
| srcPath          | Path of the JS code and components corresponding to the ability.                       | String    | Yes (initial value: left empty)                                    |
| uriPermission    | Application data that the ability can access. This attribute consists of the **mode** and **path** sub-attributes. This attribute is valid only for the capability of the type provider. Devices running OpenHarmony do not support this attribute. For details, see Table 18.| Object      | Yes (initial value: left empty)                                    |
E
ester.zhou 已提交
376 377
| startWindowIcon | Index to the icon file of the ability startup page. Example value: **$media:icon**. | String       | Yes (initial value: left empty)                              |
| startWindowBackground | Index to the background color resource file of the ability startup page. Example value: **$color:red**. | String       | Yes (initial value: left empty) |
E
ester.zhou 已提交
378 379 380

Table 18 Internal structure of the uriPermission attribute

E
ester.zhou 已提交
381
| Attribute| Description                   | Data Type| Initial Value Allowed               |
E
ester.zhou 已提交
382 383
| -------- | ----------------------- | -------- | ------------------------- |
| path     | Path identified by **uriPermission**.| String  | No                 |
E
ester.zhou 已提交
384
| mode     | Mode matching the **uriPermission**.| String  | Yes (initial value: *default***)|
E
ester.zhou 已提交
385

E
ester.zhou 已提交
386
Example of the **abilities** attribute structure:
E
ester.zhou 已提交
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415

```json
"abilities": [
    {
        "name": ".MainAbility",
        "description": "test main ability",
        "icon": "$media:ic_launcher",
        "label": "$media:example",
        "launchType": "standard",
        "orientation": "unspecified",
        "permissions": [
        ], 
        "visible": true,
        "skills": [
            {
                "actions": [
                    "action.system.home"
                ],
                "entities": [
                    "entity.system.home"
                ]
            }
        ],
        "configChanges": [
            "locale", 
            "layout", 
            "fontSize", 
            "orientation"
        ], 
E
ester.zhou 已提交
416 417 418
        "type": "page",
        "startWindowIcon": "$media:icon",
        "startWindowBackground": "$color:red"
E
ester.zhou 已提交
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454
    },
    {
        "name": ".PlayService",
        "description": "example play ability",
        "icon": "$media:ic_launcher",
        "label": "$media:example",
        "launchType": "standard",
        "orientation": "unspecified",
        "visible": false,
        "skills": [
            {
                "actions": [
                    "action.play.music",
                    "action.stop.music"
                ],
                "entities": [
                    "entity.audio"
                ]
            }
        ],
        "type": "service",
        "backgroundModes": [
            "audioPlayback"
        ]
    },
    {
        "name": ".UserADataAbility",
        "type": "data",
        "uri": "dataability://com.example.world.test.UserADataAbility",
        "visible": true
    }
]
```

Table 19 Internal structure of the skills attribute

E
ester.zhou 已提交
455
| Attribute| Description                                                        | Data Type  | Initial Value Allowed          |
E
ester.zhou 已提交
456 457 458 459 460 461 462
| -------- | ------------------------------------------------------------ | ---------- | -------------------- |
| actions  | Actions of the **want** that can be accepted by the ability. Generally, the value is an **action** value predefined in the system.| String array| Yes (initial value: left empty)|
| entities | Entities of the **want** that can be accepted by the ability, such as video and Home application.| String array| Yes (initial value: left empty)|
| uris     | URIs of the **want** that can be accepted by the ability. For details, see Table 20.| Object array  | Yes (initial value: left empty)|

Table 20 Internal structure of the uris attribute

E
ester.zhou 已提交
463
| Attribute     | Description                      | Data Type| Initial Value Allowed          |
E
ester.zhou 已提交
464 465 466 467 468 469 470 471 472
| ------------- | -------------------------- | -------- | -------------------- |
| scheme        | Scheme in the URI.       | String  | No          |
| host          | Host in the URI.         | String  | Yes (initial value: left empty)|
| port          | Port number in the URI.         | String  | Yes (initial value: left empty)|
| pathStartWith | **pathStartWith** value in the URI.| String  | String              |
| path          | Path in the URI.         | String  | Yes (initial value: left empty)|
| pathRegx      | **pathRegx** value in the URI.     | String  | Yes (initial value: left empty)|
| type          | Type of the URI.         | String  | Yes (initial value: left empty)|

E
ester.zhou 已提交
473
Example of the **skills** attribute structure:
E
ester.zhou 已提交
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501

```json
"skills": [
    {
        "actions": [
            "action.system.home"
        ], 
        "entities": [
            "entity.system.home"
        ],
        "uris": [
            {
                 "scheme": "http",
                 "host": "www.example.com",
                 "port": "8080",
                 "path": "query/student/name",
                 "type": "text/*"
             }
         ]
    }
]
```

Table 21 reqPermissions

| Attribute | Description                                                        | **Type**| **Value Range**                                               | **Default Value**            | **Restrictions**                                                |
| --------- | ------------------------------------------------------------ | -------- | ----------------------------------------------------------- | ---------------------- | ------------------------------------------------------------ |
| name      | Permission name, which is mandatory.                              | String  | Custom                                                     | None                    | Parsing will fail if this field is not set.                                        |
E
ester.zhou 已提交
502 503
| reason    | Reason for applying for the permission, which is mandatory only when applying for the **user_grant** permission.| String  | The displayed text cannot exceed 256 bytes.                            | Empty                    | If the requested permission is **user_grant**, this attribute is required for the application to be released to AppGallery. Multi-language adaptation is required.|
| usedScene | Application scenario and timing for using the permission, which is mandatory when the requested permission is **user_grant**. This attribute consists of the **ability** and **when** sub-attributes. Multiple abilities can be configured.| Object    | **ability**: ability name; **when**: **inuse** or **always**| **ability**: left empty; **when**: **inuse**| If the requested permission is **user_grant**, the **ability** sub-attribute is mandatory and **when** is optional.                     |
E
ester.zhou 已提交
504 505 506

Table 22 Internal structure of the js attribute

E
ester.zhou 已提交
507
| Attribute| Description                                                        | Data Type| Initial Value Allowed              |
E
ester.zhou 已提交
508 509 510
| -------- | ------------------------------------------------------------ | -------- | ------------------------ |
| name     | Name of a JavaScript component. The default value is **default**.   | String  | No                      |
| pages    | Route information about all pages in the JavaScript component, including the page path and page name. The value is an array, in which each element represents a page. The first element in the array represents the home page of the JavaScript FA.| Array    | No                      |
E
ester.zhou 已提交
511
| window   | Window-related configurations. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types. For details, see Table 23.| Object    | Yes                  |
E
ester.zhou 已提交
512 513 514 515 516
| type     | Type of the JavaScript component. Available values are as follows:<br>**normal**: indicates that the JavaScript component is an application instance.<br>**form**: indicates that the JavaScript component is a widget instance.| String  | Yes (initial value: **normal**)|
| mode     | Development mode of the JavaScript component. For details, see Table 24.                            | Object    | Yes (initial value: left empty)      |

Table 23 Internal structure of the window attribute

E
ester.zhou 已提交
517
| Attribute       | Description                                                        | Data Type| Initial Value Allowed             |
E
ester.zhou 已提交
518 519 520 521
| --------------- | ------------------------------------------------------------ | -------- | ----------------------- |
| designWidth     | Baseline width for page design, in pixels. The size of an element is scaled by the actual device width.| Number    | Yes (initial value: 720px)  |
| autoDesignWidth | Whether to automatically calculate the baseline width for page design. If it is set to **true**, the **designWidth** attribute becomes invalid. The baseline width is calculated based on the device width and screen density.| Boolean| Yes (initial value: **false**)|

E
ester.zhou 已提交
522
Table 24 Internal structure of the mode attribute
E
ester.zhou 已提交
523

E
ester.zhou 已提交
524
| Attribute| Description                | Data Type                           | Initial Value Allowed                 |
E
ester.zhou 已提交
525 526 527 528
| -------- | -------------------- | ----------------------------------- | --------------------------- |
| type     | Type of the JavaScript component.| String. The value can be **pageAbility** or **form**.| Yes (initial value: **pageAbility**)|
| syntax   | Syntax type of the JavaScript component.| String. The value can be **hml** or **ets**.         | Yes (initial value: **hml**)          |

E
ester.zhou 已提交
529
Example of the **js** attribute structure:
E
ester.zhou 已提交
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549

```json
"js": [
    {
        "name": "default", 
        "pages": [            
            "pages/index/index",
            "pages/detail/detail"
        ],         
        "window": {
            "designWidth": 720,
            "autoDesignWidth": false
        },
        "type": "form"
    }
]
```

Table 25 Internal structure of the shortcuts attribute

E
ester.zhou 已提交
550
| Attribute  | Description                                                        | Data Type| Initial Value Allowed        |
E
ester.zhou 已提交
551 552 553 554 555 556 557 558
| ---------- | ------------------------------------------------------------ | -------- | ------------------ |
| shortcutId | Shortcut ID. The value is a string with a maximum of 63 bytes.                | String  | No                |
| label      | Label of the shortcut, that is, the text description displayed by the shortcut. The value can be a string or a resource index to the description. The value is a string with a maximum of 63 bytes.| String  | Yes (initial value: left empty)|
| icon       | Icon of the shortcut. The value is a resource index to the description.          | String  | Yes (initial value: left empty)|
| intents    | Intents to which the shortcut points. The attribute consists of the **targetClass** and **targetBundle** sub-attributes. For details, see Table 26.| Object array| Yes (initial value: left empty)|

Table 26 Internal structure of the intents attribute

E
ester.zhou 已提交
559
| Attribute    | Description                                   | Data Type| Initial Value Allowed          |
E
ester.zhou 已提交
560 561 562 563
| ------------ | --------------------------------------- | -------- | -------------------- |
| targetClass  | Class name for the target ability of the shortcut.                 | String  | Yes (initial value: left empty)|
| targetBundle | Application bundle name for the target ability of the shortcut.| String  | Yes (initial value: left empty)|

E
ester.zhou 已提交
564
Example of the **shortcuts** attribute structure:
E
ester.zhou 已提交
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582

```json
"shortcuts": [
    {
        "shortcutId": "id",
        "label": "$string:shortcut",
        "intents": [
            {
                "targetBundle": "com.example.world.test",
                "targetClass": "com.example.world.test.entry.MainAbility"
            }
        ]
    }
]
```

Table 27 Internal structure of the forms attribute

E
ester.zhou 已提交
583
| Attribute           | Description                                                        | Data Type  | Initial Value Allowed              |
E
ester.zhou 已提交
584 585 586 587 588 589 590 591 592 593 594 595 596
| ------------------- | ------------------------------------------------------------ | ---------- | ------------------------ |
| name                | Class name of the widget. The value is a string with a maximum of 127 bytes.                   | String    | No                      |
| description         | Description of the widget. The value can be a string or a resource index to descriptions in multiple languages. The value is a string with a maximum of 255 bytes.| String    | Yes (initial value: left empty)      |
| isDefault           | Whether the widget is a default one. Each ability has only one default widget.<br>**true**: The widget is the default one.<br>**false**: The widget is not the default one.| Boolean    | No                      |
| type                | Type of the widget. Available values are as follows:<br>**Java**: indicates a Java-programmed widget.<br>**JS**: indicates a JavaScript-programmed widget.| String    | No                      |
| colorMode           | Color mode of the widget. Available values are as follows:<br>**auto**: The widget adopts the auto-adaptive color mode.<br>**dark**: The widget adopts the dark color mode.<br>**light**: The widget adopts the light color mode.| String    | Yes (initial value: **auto**)|
| supportDimensions   | Grid styles supported by the widget. Available values are as follows:<br>1 * 2: indicates a grid with one row and two columns.<br>2 * 2: indicates a grid with two rows and two columns.<br>2 * 4: indicates a grid with two rows and four columns.<br>4 * 4: indicates a grid with four rows and four columns.| String array| No                      |
| defaultDimension    | Default grid style of the widget. The value must be available in the **supportDimensions** array of the widget.| String    | No                      |
| landscapeLayouts    | Landscape layouts for the grid styles. Values in this array must correspond to the values in the **supportDimensions** array. This field is required only by Java-programmed widgets.| String array| No                      |
| portraitLayouts     | Portrait layouts for the grid styles. Values in this array must correspond to the values in the **supportDimensions** array. This field is required only by Java-programmed widgets.| String array| No                      |
| updateEnabled       | Whether the widget can be updated periodically. Available values are as follows:<br>**true**: The widget can be updated periodically, depending on the update way you select, either at a specified interval (**updateDuration**) or at the scheduled time (**scheduledUpdateTime**). **updateDuration** is preferentially recommended.<br>**false**: The widget cannot be updated periodically.| Boolean  | No                      |
| scheduledUpdateTime | Scheduled time to update the widget. The value is in 24-hour format and accurate to minute.        | String    | Yes (initial value: **0:0**) |
| updateDuration      | Interval to update the widget. The value is a natural number, in the unit of 30 minutes.<br>If the value is **0**, this field does not take effect.<br>If the value is a positive integer ***N***, the interval is calculated by multiplying ***N*** and 30 minutes.| Number      | Yes (initial value: **0**)   |
E
ester.zhou 已提交
597
| formConfigAbility   | Link to a specific page of the application. The value is a URI.                        | String    | Yes (initial value: left empty)    |
E
ester.zhou 已提交
598 599 600 601 602 603 604
| formVisibleNotify   | Whether the widget is allowed to use the widget visibility notification.                          | String    | Yes (initial value: left empty)    |
| jsComponentName     | Component name of the widget. The value is a string with a maximum of 127 bytes. This attribute is required only by JavaScript-programmed widgets.| String    | No                      |
| metaData            | Metadata of the widget. This attribute contains the array of the **customizeData** attribute. For details, see Table 13. | Object      | Yes (initial value: left empty)    |
| customizeData       | Custom information about the widget. For details, see Table 28.                            | Object array  | Yes (initial value: left empty)    |

Table 28 Internal structure of the customizeData attribute

E
ester.zhou 已提交
605
| Attribute| Description                                               | Data Type| Initial Value Allowed          |
E
ester.zhou 已提交
606 607 608 609 610
| -------- | --------------------------------------------------- | -------- | -------------------- |
| name     | Name in the custom name-value pair. The value is a string with a maximum of 255 bytes.      | String  | Yes (initial value: left empty)|
| value    | Value in the custom name-value pair. The value is a string with a maximum of 255 bytes.          | String  | Yes (initial value: left empty)|
| extra    | Format of the current custom data. The value is the resource value of **extra**.| String  | Yes (initial value: left empty)|

E
ester.zhou 已提交
611
Example of the **forms** attribute structure:
E
ester.zhou 已提交
612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665

```json
"forms": [
    {
        "name": "Form_Js",
        "description": "It's Js Form",
        "type": "JS",
        "jsComponentName": "card",
        "colorMode": "auto",
        "isDefault": true,
        "updateEnabled": true,
        "scheduledUpdateTime": "11:00",
        "updateDuration": 1,
        "defaultDimension": "2*2",
        "supportDimensions": [
            "2*2",
            "2*4",
            "4*4"
        ]
    },
    {
        "name": "Form_Java",
        "description": "It's Java Form",
        "type": "Java",
        "colorMode": "auto",
        "isDefault": false,
        "updateEnabled": true,
        "scheduledUpdateTime": "21:05",
        "updateDuration": 1,
        "defaultDimension": "1*2",
        "supportDimensions": [
            "1*2"
        ],
        "landscapeLayouts": [
            "$layout:ability_form"
        ],
        "portraitLayouts": [
            "$layout:ability_form"
        ],
        "formConfigAbility": "ability://com.example.myapplication.fa/.MainAbility",
        "metaData": {
            "customizeData": [
                {
                    "name": "originWidgetName",
                    "value": "com.example.weather.testWidget"
                }
            ]
        }
    }
]
```

Table 29 Internal structure of the distroFilter attribute

E
ester.zhou 已提交
666
| Attribute     | Description                                                        | Data Type| Initial Value Allowed|
E
ester.zhou 已提交
667 668 669 670 671 672 673 674 675
| ------------- | ------------------------------------------------------------ | -------- | ---------- |
| apiVersion    | Supported API versions. For details, see Table 30.                        | Object    | No      |
| screenShape   | Supported screen shapes. For details, see Table 31.                          | Object array| No      |
| screenWindow  | Supported window resolutions when the application is running. This attribute applies only to the lite wearables. For details, see Table 32.| Object array| No      |
| screenDensity | Pixel density of the screen, in dots per inch (DPI). For details, see Table 33.       | Object array| No      |
| countryCode   | Country code used during application distribution. For details, see the ISO-3166-1 standard. Multiple enumerated values of countries and regions are supported. For details, see Table 34.| Object array| No      |

Table 30 Internal structure of the apiVersion attribute

E
ester.zhou 已提交
676
| Attribute| Description                                                        | Data Type| Initial Value Allowed          |
E
ester.zhou 已提交
677
| -------- | ------------------------------------------------------------ | -------- | -------------------- |
E
ester.zhou 已提交
678
| policy   | Blocklist and trustlist rule of the sub-attribute value. Set this attribute to **exclude** or **include**. **include** indicates that the sub-attribute value is in the trustlist. If the value matches any of the **value** enums, it matches this attribute.| String  | Yes (initial value: left empty)|
E
ester.zhou 已提交
679 680 681 682
| value    | An integer of the existing API version, for example, 4, 5, or 6. Example: If an application uses two software versions developed using API 5 and API 6 for the same device model, two installation packages of the entry type can be released.| Array    | Yes (initial value: left empty)|

Table 31 Internal structure of the screenShape attribute

E
ester.zhou 已提交
683
| Attribute| Description                                                        | Data Type| Initial Value Allowed          |
E
ester.zhou 已提交
684
| -------- | ------------------------------------------------------------ | -------- | -------------------- |
E
ester.zhou 已提交
685
| policy   | Blocklist and trustlist rule of the sub-attribute value. Set this attribute to **exclude** or **include**. **include** indicates that the sub-attribute value is in the trustlist. If the value matches any of the **value** enums, it matches this attribute.| String  | Yes (initial value: left empty)|
E
ester.zhou 已提交
686 687 688 689
| value    | The value can be **circle** or **rect**. Example: Different HAPs can be provided for a smart watch with a circular face and that with a rectangular face.| Array    | Yes (initial value: left empty)|

Table 32 Internal structure of the screenWindow attribute

E
ester.zhou 已提交
690
| Attribute| Description                                                        | Data Type| Initial Value Allowed          |
E
ester.zhou 已提交
691
| -------- | ------------------------------------------------------------ | -------- | -------------------- |
E
ester.zhou 已提交
692
| policy   | Blocklist and trustlist rule of the sub-attribute value. Set this attribute to **exclude** or **include**. **include** indicates that the sub-attribute value is in the trustlist. If the value matches any of the **value** enums, it matches this attribute.| String  | Yes (initial value: left empty)|
E
ester.zhou 已提交
693 694 695 696
| value    | Width and height of the screen. The value of a single string is in the format of Width x Height in pixels, for example, **454*454**.| Array    | Yes (initial value: left empty)|

Table 33 Internal structure of the screenDensity attribute

E
ester.zhou 已提交
697
| Attribute| Description                                                        | Data Type| Initial Value Allowed          |
E
ester.zhou 已提交
698
| -------- | ------------------------------------------------------------ | -------- | -------------------- |
E
ester.zhou 已提交
699
| policy   | Blocklist and trustlist rule of the sub-attribute value. Set this attribute to **exclude** or **include**. **include** indicates that the sub-attribute value is in the trustlist. If the value matches any of the **value** enums, it matches this attribute.| String  | Yes (initial value: left empty)|
E
ester.zhou 已提交
700 701 702 703
| value    | Available values are as follows:<br>**sdpi**: screen density with small-scale dots per inch (SDPI). This value is applicable for devices with a DPI range of (0, 120].<br>**mdpi**: screen density with medium-scale dots per inch (MDPI). This value is applicable for devices with a DPI range of (120, 160].<br>**ldpi**: screen density with large-scale dots per inch (LDPI). This value is applicable for devices with a DPI range of (160, 240].<br>**xldpi**: screen density with extra-large-scale dots per inch (XLDPI). This value is applicable for devices with a DPI range of (240, 320].<br>**xxldpi**: screen density with extra-extra-large-scale dots per inch (XXLDPI). This value is applicable for devices with a DPI range of (320, 480].<br>**xxxldpi**: screen density with extra-extra-extra-large-scale dots per inch (XXXLDPI). This value is applicable for devices with a DPI range of (480, 640].| Array    | Yes (initial value: left empty)|

Table 34 Internal structure of the countryCode attribute

E
ester.zhou 已提交
704
| Attribute| Description                                                        | Data Type  | Initial Value Allowed          |
E
ester.zhou 已提交
705
| -------- | ------------------------------------------------------------ | ---------- | -------------------- |
E
ester.zhou 已提交
706
| policy   | Blocklist and trustlist rule of the sub-attribute value. Set this attribute to **exclude** or **include**. **include** indicates that the sub-attribute value is in the trustlist. If the value matches any of the **value** enums, it matches this attribute.| String    | Yes (initial value: left empty)|
E
ester.zhou 已提交
707 708
| value    | Country code of the area to which the application is to be distributed. The value is a string array, of which each substring indicates a country or region. The substring consists of two uppercase letters.| String array| Yes (initial value: left empty)|

E
ester.zhou 已提交
709
Example of the **distroFilter** attribute structure:
E
ester.zhou 已提交
710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736

```json
"distroFilter":  {
    "apiVersion": {
        "policy": "include",
        "value": [4,5]
    },
    "screenShape": {
        "policy": "include",
        "value": ["circle","rect"]
    },
    "screenWindow": {
        "policy": "include",
        "value": ["454*454","466*466"]
    },
    "screenDensity":{
    	"policy": "exclude",
    	"value": ["ldpi","xldpi"]
	},
	"countryCode": {
        "policy":"include",
        "value":["CN", "HK"]
    }
}
```

Table 35 Internal structure of the commonEvents attribute
Z
zengyawen 已提交
737

E
ester.zhou 已提交
738
| Attribute  | Description                                                        | Data Type  | Initial Value Allowed        |
E
ester.zhou 已提交
739 740
| ---------- | ------------------------------------------------------------ | ---------- | ------------------ |
| name       | Name of a static broadcast.                                            | String    | No          |
E
ester.zhou 已提交
741
| permission | Permission needed to implement the static common event.                  | String array| Yes (initial value: left empty)|
E
ester.zhou 已提交
742 743 744
| data       | Additional data array to be carried by the current static common event.              | String array| Yes (initial value: left empty)|
| type       | Type array of the current static common event.                    | String array| Yes (initial value: left empty)|
| events     | A set of events for the wants that can be received. The value can be system predefined or custom.| String array| No          |
Z
zengyawen 已提交
745

E
ester.zhou 已提交
746
Example of the **commonEvents** attribute structure:
E
ester.zhou 已提交
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763

```json
"commonEvents": [
	{
		"name":"MainAbility",
		"permission": "string",
		"data":[
			"string",
			"string"
		],
		"events": [
			"string",
			"string"
		]
	}
]
```