未验证 提交 513558c0 编写于 作者: O openharmony_ci 提交者: Gitee

!19285 【3.2-Release】翻译完成 18327+18228

Merge pull request !19285 from ester.zhou/C2-13827
......@@ -71,7 +71,7 @@ As shown above, the **module.json5** file contains several tags.
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| 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|
| name | Name of the module. The value is a string with a maximum of 31 bytes and must be unique in the entire application. | String| No|
| 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|
| srcEntry | Code path corresponding to the module. The value is a string with a maximum of 127 bytes.| String| Yes (initial value: left empty)|
| 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)|
......@@ -221,73 +221,6 @@ The **metadata** tag represents the custom metadata of the HAP file. The tag val
UIAbility configuration of the module, which is valid only for the current UIAbility component.
**By default, application icons cannot be hidden from the home screen in OpenHarmony.**
The 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.
Touching this icon will direct the user to the application details screen in **Settings**, as shown in Figure 1.
To 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).
**Objectives**:
This requirement on application icons is intended to prevent malicious applications from deliberately configuring no icon to block uninstallation attempts.
**Setting the application icon to be displayed on the home screen**:
Set **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**.
```
{
"module":{
...
"abilities": [{
"icon": "$media:icon",
"label": "Login",
"skills": [{
"actions": ["ohos.want.action.home"],
"entities": ["entity.system.home"],
"uris": []
}]
}],
...
}
}
```
**Display rules of application icons and labels on the home screen:**
* The HAP file contains UIAbility configuration.
* The application icon on the home screen is set under **abilities** in the **module.json5** file.
* The application does not have the privilege to hide its icon from the home screen.
* The application icon displayed on the home screen is the icon configured for the UIAbility.
* 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.
* The name of the UIAbility is displayed.
* When the user touches the home screen icon, the home screen of the UIAbility is displayed.
* The application has the privilege to hide its icon from the home screen.
* 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.
* The application icon on the home screen is not set under **abilities** in the **module.json5** file.
* The application does not have the privilege to hide its icon from the home screen.
* The application icon displayed on the home screen is the icon specified under **app**. (The **icon** field in the **app.json** file is mandatory.)
* The application label displayed on the home screen is the label specified under **app**. (The **label** field in the **app.json** file is mandatory.)
* Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1.
* The application has the privilege to hide its icon from the home screen.
* 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.
* The HAP file does not contain UIAbility configuration.
* The application does not have the privilege to hide its icon from the home screen.
* The application icon displayed on the home screen is the icon specified under **app**. (The **icon** field in the **app.json** file is mandatory.)
* The application label displayed on the home screen is the label specified under **app**. (The **label** field in the **app.json** file is mandatory.)
* Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1.
* The application has the privilege to hide its icon from the home screen.
* 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>
**Figure 1** Application details screen
![Application details screen](figures/application_details.jpg)
**Table 6** abilities
| Name| Description| Data Type| Initial Value Allowed|
......@@ -438,7 +371,7 @@ The **extensionAbilities** tag represents the configuration of extensionAbilitie
| 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)|
|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)|
| [metadata](#metadata)| Metadata of the ExtensionAbility component.| Object| Yes (initial value: left empty)|
| 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**)|
| 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 ExtensionAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)|
Example of the **extensionAbilities** structure:
......@@ -591,7 +524,7 @@ The **shortcut** information is identified in **metadata**, where:
## distributionFilter
The **distributionFilter** tag defines the rules for distributing HAP files based on different device specifications, so that precise matching can be performed when the application market distributes applications. 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.
The **distributionFilter** tag defines the rules for distributing HAP files based on different device specifications, so that precise matching can be performed when the application market distributes applications. Distribution rules cover the following factors: API version, 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.
**Table 12** distributionFilter
......
......@@ -7,23 +7,23 @@ The **module** tag contains the HAP configuration.
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| mainAbility | Ability whose icon is displayed in the Service Center. When the resident process is started, the **mainAbility** is started.| String| Yes (initial value: left empty)|
| package | Package 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. | String| No|
| name | Class name of the HAP file. The value is a string with a maximum of 255 bytes, in the reverse domain name notation. The prefix must be the same as the **package** value specified for this module. Alternatively, the value can start with a period (.) followed by the class name.| String| Yes (initial value: left empty)|
| 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.| String| Yes (initial value: left empty)|
| supportedModes | Modes 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)|
|deviceType | Type of device on which the ability can run. The device types predefined in the system include **tablet**, **tv**, **car**, and **wearable**.| String array| No|
|distro | Distribution description of the HAP file.| Object| No|
|metaData | Metadata of the HAP file.| Object| Yes (initial value: left empty)|
| abilities | All abilities in the current module. The value is an array of objects, each of which represents an ability.| Object array| Yes (initial value: left empty)|
| js | A set of JS modules developed using ArkUI. The value is an array of objects, each of which represents a JS module.| Object array| Yes (initial value: left empty)|
| shortcuts | Shortcuts of the application. The value is an array of objects, each of which represents a shortcut object.| Object array| Yes (initial value: left empty)|
| reqPermissions | Permissions that the application requests from the system when it is running.| Object array| Yes (initial value: left empty)|
| colorMode | Color mode of the application. The options are as follows:<br>- **dark**: Resources applicable for the dark mode are used.<br>- **light**: Resources applicable for the light mode are used.<br>- **auto**: Resources are used based on the color mode of the system.| String| Yes (initial value: **auto**)|
| mainAbility | Ability whose icon is displayed in the Service Center. When the resident process is started, the **mainAbility** is started.| String| Yes (initial value: left empty)|
| package | Package 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. | String| No|
| name | Class name of the HAP file. The value is a string with a maximum of 255 bytes, in the reverse domain name notation. The prefix must be the same as the **package** value specified for this module. Alternatively, the value can start with a period (.) followed by the class name.| String| Yes (initial value: left empty)|
| 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.| String| Yes (initial value: left empty)|
| supportedModes | Modes 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)|
|deviceType | Type of device on which the ability can run. The device types predefined in the system include **tablet**, **tv**, **car**, and **wearable**.| String array| No|
|distro | Distribution description of the HAP file.| Object| No|
|metaData | Metadata of the HAP file.| Object| Yes (initial value: left empty)|
| abilities | All abilities in the current module. The value is an array of objects, each of which represents an ability.| Object array| Yes (initial value: left empty)|
| js | A set of JS modules developed using ArkUI. The value is an array of objects, each of which represents a JS module.| Object array| Yes (initial value: left empty)|
| shortcuts | Shortcuts of the application. The value is an array of objects, each of which represents a shortcut object.| Object array| Yes (initial value: left empty)|
| reqPermissions | Permissions that the application requests from the system when it is running.| Object array| Yes (initial value: left empty)|
| colorMode | Color mode of the application. The options are as follows:<br>- **dark**: Resources applicable for the dark mode are used.<br>- **light**: Resources applicable for the light mode are used.<br>- **auto**: Resources are used based on the color mode of the system.| String| Yes (initial value: **auto**)|
| distributionFilter | Distribution rules of the application. This attribute 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 three factors: API version, screen shape, and screen resolution. During distribution, a unique HAP is determined based on the mapping between **deviceType** and these three factors.| Object| Yes (initial value: left empty) Set this attribute when an application has multiple entry modules.|
|commonEvents | Information about the common event static subscriber, which must contain the subscriber name, required permissions, and list of the common events subscribed to. When a subscribed event is sent, the static subscriber is started. Unlike the dynamic subscriber, the static subscriber does not need to proactively call the common event subscription API in the service code, and may not be running when the common event is published.| Object array| Yes (initial value: left empty)|
| entryTheme | Keyword of an OpenHarmony internal theme. Set it to the resource index of the name.| String| Yes (initial value: left empty)|
|testRunner | Test runner configuration.| Object| Yes (initial value: left empty)|
|commonEvents | Information about the common event static subscriber, which must contain the subscriber name, required permissions, and list of the common events subscribed to. When a subscribed event is sent, the static subscriber is started. Unlike the dynamic subscriber, the static subscriber does not need to proactively call the common event subscription API in the service code, and may not be running when the common event is published.| Object array| Yes (initial value: left empty)|
| entryTheme | Keyword of an OpenHarmony internal theme. Set it to the resource index of the name.| String| Yes (initial value: left empty)|
|testRunner | Test runner configuration.| Object| Yes (initial value: left empty)|
Example of the **module** tag structure:
......@@ -128,7 +128,7 @@ Example of the **distro** attribute structure:
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| 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)|
| 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 bytes.| String| Yes (initial value: left empty)|
| name | Name of the parameter passed for calling the ability. The value can contain a maximum of 255 bytes.| String| No|
| type | Type of the parameter passed for calling the ability, for example, **Integer**.| String| No|
......@@ -138,8 +138,8 @@ Example of the **distro** attribute structure:
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| 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)|
| 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 bytes.| String| Yes (initial value: left empty)|
| name | Name of the return value. The value can contain a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| type | Type of the return value, for example, **Integer**.| String| No|
## Internal Structure of the customizeData Attribute
......@@ -190,21 +190,48 @@ Example of the metadata attribute:
## Internal Structure of the abilities Attribute
**By default, application icons cannot be hidden from the home screen in OpenHarmony.**
The 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 creates a default icon for the application and displays it on the home screen.
**Table 8** Internal structure of the abilities attribute
Touching this icon will direct the user to the application details screen in **Settings**, as shown in Figure 1.
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| 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. The value can contain a maximum of 31 bytes.| String| Yes (initial value: left empty)|
| name | Ability name. The value can be a reverse domain name, in the format of "*bundleName*.*className*", for example, **"com.example.myapplication.EntryAbility"**. Alternatively, the value can start with a period (.) followed by the class name, for example, **".EntryAbility"**.<br>The ability name must be unique in an application.<br/>**NOTE**<br/>If you use DevEco Studio to create the project, an ability named **EntryAbility** will be created by default, and its configuration will be saved to the **config.json** file. If you use other IDEs, the value of this attribute can be customized. The value can contain a maximum of 127 bytes. | String| No|
| 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 bytes.| 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**<br>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 displayed to users. The value can be a name string or a resource index to names in multiple languages, for example, **$string:ability_label**. 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**<br/>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 bytes. | String| Yes (initial value: left empty)|
| uri | Uniform Resource Identifier (URI) of the ability. The value can contain a maximum of 255 bytes.| String| Yes (No for abilities using the Data template)|
| launchType | Launch 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 launch type. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String| Yes (initial value: **"singleton"**)|
| 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. 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)|
|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. The value is an array of up to 512 elements, each of which contains a maximum of 64 bytes.| String array| Yes (initial value: left empty)|
| metaData | Metadata.| Object| Yes (initial value: left empty)|
| type | Ability type. The options 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|
| orientation | Display orientations of the ability. This attribute applies only to the ability using the Page template. The options 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"**)|
| backgroundModes | Background service type of the ability. You can assign multiple background service types to a specific ability. This field applies only to the ability using the Service template. The options 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)|
| 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.| String| Yes (initial value: left empty)|
| configChanges | System configurations that the ability concerns. Upon any changes on the concerned configurations, the **onConfigurationUpdated** callback will be invoked to notify the ability. The options 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 selects 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)|
| 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.| 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.| String| Yes (initial value: left empty, indicating that the current ability is not an alias)|
| formsEnabled | Whether the ability can provide widgets. This attribute applies only to the ability using the Page template.<br>**true**: This ability can provide widgets.<br>**false**: This ability cannot provide widgets.| Boolean| Yes (initial value: **false**)|
| forms | Information about the widgets used by the ability. This attribute is valid only when **formsEnabled** is set to **true**.| Object array| Yes (initial value: left empty)|
| srcLanguage | Programming language of the ability, which you can specify when creating the project.| String| Yes (initial value: **"js"**)|
| srcPath | JS code path corresponding to the ability. The value can contain a maximum of 127 bytes.| String| No|
| 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.| Object| Yes (initial value: left empty)|
| startWindowIcon | Index to the icon file of the ability startup page. This attribute applies only to the ability using the Page template. Example: **$media:icon**.| String| Yes (initial value: left empty)|
| startWindowBackground | Index to the background color resource file of the ability startup page. This attribute applies only to the ability using the Page template. Example: **$color:red**.| String| Yes (initial value: left empty)|
| removeMissionAfterTerminate | Whether to remove the relevant task from the task list after the ability is destroyed. This attribute applies only to the ability using the Page template. The value **true** means to remove the relevant task from the task list after the ability is destroyed, and **false** means the opposite.| Boolean| Yes (initial value: **false**)|
To 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).
**Objectives**:
**By default, application icons cannot be hidden from the home screen in OpenHarmony.**
This requirement on application icons is intended to prevent malicious applications from deliberately configuring no icon to block uninstallation attempts.
OpenHarmony strictly controls applications without icons to prevent malicious applications from deliberately configuring no icon to block uninstall attempts.
**Setting the application icon to be displayed on the home screen**:
Set **icon**, **label**, and **skills** under **abilities** in the **config.json** file. In addition, make sure the **skills** configuration contains **ohos.want.action.home** and **entity.system.home**.
Set **icon**, **label**, and **skills** under **abilities** in the **config.json** file. Make sure the **skills** configuration contains **ohos.want.action.home** and **entity.system.home**.
```
{
......@@ -228,71 +255,34 @@ Set **icon**, **label**, and **skills** under **abilities** in the **config.json
}
```
**Display rules of application icons and labels on the home screen:**
To 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). The rules for displaying the entry icon and entry label are as follows:
* The HAP file contains Page ability configuration.
* The application icon on the home screen is set under **abilities** in the **config.json** file.
* The application does not have the privilege to hide its icon from the home screen.
* The application icon displayed on the home screen is the icon configured for the Page ability.
* The application label displayed on the home screen is the label configured for the Page ability. If no label is configured, the bundle name is returned.
* The name of the Page ability is displayed.
* When the user touches the home screen icon, the home screen of the Page ability is displayed.
* The system uses the icon configured for the Page ability as the entry icon and displays it on the home screen. Touching this icon will direct the user to the home page of the Page ability.
* The system uses the label configured for the PageAbility as the entry label and displays it on the home screen. If no label is configured, the bundle name is returned.
* The application has the privilege to hide its icon from the home screen.
* 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.
* The application information is not returned when the home screen queries the information, and the entry icon and label of the application are not displayed on the home screen.
* The application icon on the home screen is not set under **abilities** in the **config.json** file.
* The application does not have the privilege to hide its icon from the home screen.
* The application icon displayed on the home screen is the default icon.
* The application label displayed on the home screen is the bundle name of the application.
* Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1.
* The system uses the default icon as the entry icon and displays it on the home screen. Touching this icon will direct the user to the application details screen under application management, as shown in Figure 1.
* The system uses the bundle name of the application as the entry label and displays it on the home screen.
* The application has the privilege to hide its icon from the home screen.
* 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.
* The application information is not returned when the home screen queries the information, and the entry icon and label of the application are not displayed on the home screen.
* The HAP file does not contain Page ability configuration.
* The application does not have the privilege to hide its icon from the home screen.
* The application icon displayed on the home screen is the default icon.
* The application label displayed on the home screen is the bundle name of the application.
* Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1.
* The system uses the default icon as the entry icon and displays it on the home screen. Touching this icon will direct the user to the application details screen under application management, as shown in Figure 1.
* The system uses the bundle name of the application as the entry label and displays it on the home screen.
* The application has the privilege to hide its icon from the home screen.
* 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.
Note: The label displayed on the application details screen may be different from that displayed on the home screen. For non-Page abilities, it is the entry label set (if any).<br><br>
* The application information is not returned when the home screen queries the information, and the entry icon and label of the application are not displayed on the home screen.
**Figure 1** Application details screen
![Application details screen](figures/application_details.jpg)
**Table 8** Internal structure of the abilities attribute
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| 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. The value can contain a maximum of 31 bytes.| String| Yes (initial value: left empty)|
| name | Ability name. The value can be a reverse domain name, in the format of "*bundleName*.*className*", for example, **"com.example.myapplication.EntryAbility"**. Alternatively, the value can start with a period (.) followed by the class name, for example, **".EntryAbility"**.<br>The ability name must be unique in an application. Note: If you use DevEco Studio to create the project, an ability named **EntryAbility** will be created by default, and its configuration will be saved to the **config.json** file. If you use other IDEs, the value of this attribute can be customized. The value can contain a maximum of 127 bytes.| String| No|
| 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 bytes.| 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 displayed to users. The value can be a name string or a resource index to names in multiple languages, for example, **$string:ability_label**. 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 bytes.| String| Yes (No for abilities using the Data template)|
| launchType | Launch 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 launch type. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String| Yes (initial value: **"singleton"**)|
| 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. 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)|
|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. The value is an array of up to 512 elements, each of which contains a maximum of 64 bytes.| String array| Yes (initial value: left empty)|
| metaData | Metadata.| Object| Yes (initial value: left empty)|
| type | Ability type. The options 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|
| orientation | Display orientations of the ability. This attribute applies only to the ability using the Page template. The options 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"**)|
| backgroundModes | Background service type of the ability. You can assign multiple background service types to a specific ability. This field applies only to the ability using the Service template. The options 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)|
| 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.| String| Yes (initial value: left empty)|
| configChanges | System configurations that the ability concerns. Upon any changes on the concerned configurations, the **onConfigurationUpdated** callback will be invoked to notify the ability. The options 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 selects 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)|
| 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.| 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.| String| Yes (initial value: left empty, indicating that the current ability is not an alias)|
| formsEnabled | Whether the ability can provide widgets. This attribute applies only to the ability using the Page template.<br>**true**: This ability can provide widgets.<br>**false**: This ability cannot provide widgets.| Boolean| Yes (initial value: **false**)|
| forms | Information about the widgets used by the ability. This attribute is valid only when **formsEnabled** is set to **true**.| Object array| Yes (initial value: left empty)|
| srcLanguage | Programming language of the ability, which you can specify when creating the project.| String| Yes (initial value: **"js"**)|
| srcPath | JS code path corresponding to the ability. The value can contain a maximum of 127 bytes.| String| No|
| 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.| Object| Yes (initial value: left empty)|
| startWindowIcon | Index to the icon file of the ability startup page. This attribute applies only to the ability using the Page template. Example: **$media:icon**.| String| Yes (initial value: left empty)|
| startWindowBackground | Index to the background color resource file of the ability startup page. This attribute applies only to the ability using the Page template. Example: **$color:red**.| String| Yes (initial value: left empty)|
| removeMissionAfterTerminate | Whether to remove the relevant task from the task list after the ability is destroyed. This attribute applies only to the ability using the Page template. The value **true** means to remove the relevant task from the task list after the ability is destroyed, and **false** means the opposite.| Boolean| Yes (initial value: **false**)|
> **NOTE**
>
> The label displayed on the application details screen may be different from the one displayed on the home screen. These two are the same if the entry icon and label are configured for the non-Page ability.
## Internal Structure of the uriPermission Attribute
......
......@@ -119,7 +119,16 @@ Provides the flag attributes of this window.
## On<sup>9+</sup>
Since API version 9, the UiTest framework provides a wide range of UI component feature description APIs in the **On** class to filter and match components.
The API capabilities provided by the **On** class exhibit the following features: 1. Allow one or more attributes as the match conditions. For example, you can specify both the **text** and **id** attributes to find the target component. <br>2. Provide multiple match patterns for component attributes. <br>3. Support absolute positioning and relative positioning for components. APIs such as [ON.isBefore](#isbefore) and [ON.isAfter](#isafter) can be used to specify the features of adjacent components to assist positioning. <br>All APIs provided in the **On** class are synchronous. You are advised to use the static constructor **ON** to create an **On** object in chain mode.
The API capabilities provided by the **On** class exhibit the following features:
- Allow one or more attributes as the match conditions. For example, you can specify both the **text** and **id** attributes to find the target component.
- Provide multiple match patterns for component attributes.
- Support absolute positioning and relative positioning for components. APIs such as [ON.isBefore](#isbefore9) and [ON.isAfter](#isafter9) can be used to specify the features of adjacent components to assist positioning.
All APIs provided in the **On** class are synchronous. You are advised to use the static constructor **ON** to create an **On** object in chain mode.
```js
ON.text('123').type('button');
......@@ -420,7 +429,7 @@ let on = ON.checkable(true); // Use the static constructor ON to create an On ob
isBefore(on: On): On
Specifies the attributes of the component before which the target component is located.
Specifies that the target component is located before the given attribute component.
**System capability**: SystemCapability.Test.UiTest
......@@ -439,14 +448,14 @@ Specifies the attributes of the component before which the target component is l
**Example**
```js
let on = ON.isBefore(ON.text('123')); // Use the static constructor ON to create an On object and specify the attributes of the component before which the target component is located.
let on = ON.isBefore(ON.text('123')); // Create an On object using the static constructor ON, specifying that the target component is located before the given attribute component.
```
### isAfter<sup>9+</sup>
isAfter(on: On): On
Specifies the attributes of the component after which the target component is located.
Specifies that the target component is located after the given attribute component.
**System capability**: SystemCapability.Test.UiTest
......@@ -465,12 +474,13 @@ Specifies the attributes of the component after which the target component is lo
**Example**
```js
let on = ON.isAfter(ON.text('123')); // Use the static constructor ON to create an On object and specify the attributes of the component after which the target component is located.
let on = ON.isAfter(ON.text('123')); // Create an On object using the static constructor ON, specifying that the target component is located after the given attribute component.
```
## Component<sup>9+</sup>
In **UiTest** of API version 9, the **Component** class represents a component on the UI and provides APIs for obtaining component attributes, clicking a component, scrolling to search for a component, and text injection.
Represents a component on the UI and provides APIs for obtaining component attributes, clicking a component, scrolling to search for a component, and text injection.
All APIs provided in this class use a promise to return the result and must be invoked using **await**.
### click<sup>9+</sup>
......@@ -1476,7 +1486,7 @@ Searches this **Driver** object for the target component that matches the given
| Type | Description |
| --------------------------------- | --------------------------------- |
| Promise\<[Component](#component)> | Promise used to return the found component.|
| Promise\<[Component](#component9)> | Promise used to return the found component.|
**Error codes**
......@@ -2078,7 +2088,7 @@ Simulates a fling operation on the screen.
| from | [Point](#point9) | Yes | Coordinates of the point where the finger touches the screen. |
| to | [Point](#point9) | Yes | Coordinates of the point where the finger leaves the screen. |
| stepLen | number | Yes | Fling step length, in pixels. |
| speed | number | Yes | Scroll speed, in pixel/s. The value ranges from 200 to 15000. If the set value is not in the range, the default value 600 is used.|
| speed | number | Yes | Fling speed, in pixel/s. The value ranges from 200 to 15000. If the set value is not in the range, the default value 600 is used.|
**Error codes**
......@@ -2093,7 +2103,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
```js
async function demo() {
let driver = Driver.create();
await driver.fling({x: 500, Y: 480},{x: 450, Y: 480},5,600);
await driver.fling({x: 500, y: 480},{x: 450, y: 480},5,600);
}
```
......@@ -2649,7 +2659,13 @@ async function demo() {
## By<sup>(deprecated)</sup>
The UiTest framework provides a wide range of UI component feature description APIs in the **By** class to filter and match components.
The API capabilities provided by the **By** class exhibit the following features: <br>1. Allow one or more attributes as the match conditions. For example, you can specify both the **text** and **id** attributes to find the target component. <br>2. Provide multiple match patterns for component attributes. <br>3. Support absolute positioning and relative positioning for components. APIs such as [By.isBefore<sup>(deprecated)</sup>](#isbeforedeprecated) and [By.isAfter<sup>(deprecated)</sup>](#isafterdeprecated) can be used to specify the features of adjacent components to assist positioning. <br>All APIs provided in the **By** class are synchronous. You are advised to use the static constructor **BY** to create a **By** object in chain mode.
The API capabilities provided by the **By** class exhibit the following features:
- Allow one or more attributes as the match conditions. For example, you can specify both the **text** and **id** attributes to find the target component.
- Provide multiple match patterns for component attributes.
- Support absolute positioning and relative positioning for components. APIs such as [By.isBefore<sup>(deprecated)</sup>](#isbeforedeprecated) and [By.isAfter<sup>(deprecated)</sup>](#isafterdeprecated) can be used to specify the features of adjacent components to assist positioning.
All APIs provided in the **By** class are synchronous. You are advised to use the static constructor **BY** to create a **By** object in chain mode.
This API is deprecated since API version 9. You are advised to use [On<sup>9+</sup>](#on9) instead.
......@@ -2663,7 +2679,7 @@ text(txt: string, pattern?: MatchPattern): By
Specifies the text attribute of the target component. Multiple match patterns are supported.
This API is deprecated since API version 9. You are advised to use [text<sup>9+</sup>](#text9).
This API is deprecated since API version 9. You are advised to use [text<sup>9+</sup>](#text9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -2693,7 +2709,7 @@ key(key: string): By
Specifies the key attribute of the target component.
This API is deprecated since API version 9. You are advised to use [id<sup>9+</sup>](#id9).
This API is deprecated since API version 9. You are advised to use [id<sup>9+</sup>](#id9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -2751,7 +2767,7 @@ type(tp: string): By
Specifies the type attribute of the target component.
This API is deprecated since API version 9. You are advised to use [type<sup>9+</sup>](#type9).
This API is deprecated since API version 9. You are advised to use [type<sup>9+</sup>](#type9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -2780,7 +2796,7 @@ clickable(b?: boolean): By
Specifies the clickable status attribute of the target component.
This API is deprecated since API version 9. You are advised to use [clickable<sup>9+</sup>](#clickable9).
This API is deprecated since API version 9. You are advised to use [clickable<sup>9+</sup>](#clickable9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -2809,7 +2825,7 @@ scrollable(b?: boolean): By
Specifies the scrollable status attribute of the target component.
This API is deprecated since API version 9. You are advised to use [scrollable<sup>9+</sup>](#scrollable9).
This API is deprecated since API version 9. You are advised to use [scrollable<sup>9+</sup>](#scrollable9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -2837,7 +2853,7 @@ enabled(b?: boolean): By
Specifies the enabled status attribute of the target component.
This API is deprecated since API version 9. You are advised to use [enabled<sup>9+</sup>](#enabled9).
This API is deprecated since API version 9. You are advised to use [enabled<sup>9+</sup>](#enabled9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -2865,7 +2881,7 @@ focused(b?: boolean): By
Specifies the focused status attribute of the target component.
This API is deprecated since API version 9. You are advised to use [focused<sup>9+</sup>](#focused9).
This API is deprecated since API version 9. You are advised to use [focused<sup>9+</sup>](#focused9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -2919,7 +2935,7 @@ let by = BY.selected(true); // Use the static constructor BY to create a By obje
isBefore(by: By): By
Specifies the attributes of the component before which the target component is located.
Specifies that the target component is located before the given attribute component.
This API is deprecated since API version 9. You are advised to use [isBefore<sup>9+</sup>](#isbefore9).
......@@ -2947,9 +2963,9 @@ let by = BY.isBefore(BY.text('123')); // Use the static constructor BY to create
isAfter(by: By): By
Specifies the attributes of the component after which the target component is located.
Specifies that the target component is located after the given attribute component.
This API is deprecated since API version 9. You are advised to use [isAfter<sup>9+</sup>](#isafter9).
This API is deprecated since API version 9. You are advised to use [isAfter<sup>9+</sup>](#isafter9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -2968,7 +2984,7 @@ This API is deprecated since API version 9. You are advised to use [isAfter<sup>
**Example**
```js
let by = BY.isAfter(BY.text('123')); // Use the static constructor BY to create a By object and specify the attributes of the component after which the target component is located.
let by = BY.isAfter(BY.text('123')); // Use the static constructor BY to create a By object, specifying that the target component is located after the given attribute component.
```
## UiComponent<sup>(deprecated)</sup>
......@@ -2984,7 +3000,7 @@ click(): Promise\<void>
Clicks this component.
This API is deprecated since API version 9. You are advised to use [click<sup>9+</sup>](#click9).
This API is deprecated since API version 9. You are advised to use [click<sup>9+</sup>](#click9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3004,7 +3020,7 @@ doubleClick(): Promise\<void>
Double-clicks this component.
This API is deprecated since API version 9. You are advised to use [doubleClick<sup>9+</sup>](#doubleclick9).
This API is deprecated since API version 9. You are advised to use [doubleClick<sup>9+</sup>](#doubleclick9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3024,7 +3040,7 @@ longClick(): Promise\<void>
Long-clicks this component.
This API is deprecated since API version 9. You are advised to use [longClick<sup>9+</sup>](#longclick9).
This API is deprecated since API version 9. You are advised to use [longClick<sup>9+</sup>](#longclick9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3070,7 +3086,7 @@ getKey(): Promise\<string>
Obtains the key of this component.
This API is deprecated since API version 9. You are advised to use [getId<sup>9+</sup>](#getid9).
This API is deprecated since API version 9. You are advised to use [getId<sup>9+</sup>](#getid9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3096,7 +3112,7 @@ getText(): Promise\<string>
Obtains the text information of this component.
This API is deprecated since API version 9. You are advised to use [getText<sup>9+</sup>](#gettext9).
This API is deprecated since API version 9. You are advised to use [getText<sup>9+</sup>](#gettext9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3122,7 +3138,7 @@ getType(): Promise\<string>
Obtains the type of this component.
This API is deprecated since API version 9. You are advised to use [getType<sup>9+</sup>](#gettype9).
This API is deprecated since API version 9. You are advised to use [getType<sup>9+</sup>](#gettype9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3148,7 +3164,7 @@ isClickable(): Promise\<boolean>
Obtains the clickable status of this component.
This API is deprecated since API version 9. You are advised to use [isClickable<sup>9+</sup>](#isclickable9).
This API is deprecated since API version 9. You are advised to use [isClickable<sup>9+</sup>](#isclickable9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3178,7 +3194,7 @@ isScrollable(): Promise\<boolean>
Obtains the scrollable status of this component.
This API is deprecated since API version 9. You are advised to use [isScrollable<sup>9+</sup>](#isscrollable9).
This API is deprecated since API version 9. You are advised to use [isScrollable<sup>9+</sup>](#isscrollable9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3209,7 +3225,7 @@ isEnabled(): Promise\<boolean>
Obtains the enabled status of this component.
This API is deprecated since API version 9. You are advised to use [isEnabled<sup>9+</sup>](#isenabled9).
This API is deprecated since API version 9. You are advised to use [isEnabled<sup>9+</sup>](#isenabled9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3240,7 +3256,7 @@ isFocused(): Promise\<boolean>
Obtains the focused status of this component.
This API is deprecated since API version 9. You are advised to use [isFocused<sup>9+</sup>](#isfocused9).
This API is deprecated since API version 9. You are advised to use [isFocused<sup>9+</sup>](#isfocused9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3270,7 +3286,7 @@ isSelected(): Promise\<boolean>
Obtains the selected status of this component.
This API is deprecated since API version 9. You are advised to use [isSelected<sup>9+</sup>](#isselected9).
This API is deprecated since API version 9. You are advised to use [isSelected<sup>9+</sup>](#isselected9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3300,7 +3316,7 @@ inputText(text: string): Promise\<void>
Enters text into this component (available for text boxes).
This API is deprecated since API version 9. You are advised to use [inputText<sup>9+</sup>](#inputtext9).
This API is deprecated since API version 9. You are advised to use [inputText<sup>9+</sup>](#inputtext9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3326,7 +3342,7 @@ scrollSearch(by: By): Promise\<UiComponent>
Scrolls on this component to search for the target component (applicable to components that support scrolling, such as **\<List>**).
This API is deprecated since API version 9. You are advised to use [scrollSearch<sup>9+</sup>](#scrollsearch9).
This API is deprecated since API version 9. You are advised to use [scrollSearch<sup>9+</sup>](#scrollsearch9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3365,7 +3381,7 @@ static create(): UiDriver
Creates a **UiDriver** object and returns the object created. This API is a static API.
This API is deprecated since API version 9. You are advised to use [create<sup>9+</sup>](#create9).
This API is deprecated since API version 9. You are advised to use [create<sup>9+</sup>](#create9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3389,7 +3405,7 @@ delayMs(duration: number): Promise\<void>
Delays this **UiDriver** object within the specified duration.
This API is deprecated since API version 9. You are advised to use [delayMs<sup>9+</sup>](#delayms9).
This API is deprecated since API version 9. You are advised to use [delayMs<sup>9+</sup>](#delayms9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3414,7 +3430,7 @@ findComponent(by: By): Promise\<UiComponent>
Searches this **UiDriver** object for the target component that matches the given attributes.
This API is deprecated since API version 9. You are advised to use [findComponent<sup>9+</sup>](#findcomponent9).
This API is deprecated since API version 9. You are advised to use [findComponent<sup>9+</sup>](#findcomponent9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3445,7 +3461,7 @@ findComponents(by: By): Promise\<Array\<UiComponent>>
Searches this **UiDriver** object for all components that match the given attributes.
This API is deprecated since API version 9. You are advised to use [findComponents<sup>9+</sup>](#findcomponents9).
This API is deprecated since API version 9. You are advised to use [findComponents<sup>9+</sup>](#findcomponents9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3476,7 +3492,7 @@ assertComponentExist(by: By): Promise\<void>
Asserts that a component that matches the given attributes exists on the current page. If the component does not exist, the API throws a JS exception, causing the current test case to fail.
This API is deprecated since API version 9. You are advised to use [assertComponentExist<sup>9+</sup>](#assertcomponentexist9).
This API is deprecated since API version 9. You are advised to use [assertComponentExist<sup>9+</sup>](#assertcomponentexist9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3501,7 +3517,7 @@ pressBack(): Promise\<void>
Presses the Back button on this **UiDriver** object.
This API is deprecated since API version 9. You are advised to use [pressBack<sup>9+</sup>](#pressback9).
This API is deprecated since API version 9. You are advised to use [pressBack<sup>9+</sup>](#pressback9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3520,7 +3536,7 @@ triggerKey(keyCode: number): Promise\<void>
Triggers the key of this **UiDriver** object that matches the given key code.
This API is deprecated since API version 9. You are advised to use [triggerKey<sup>9+</sup>](#triggerkey9).
This API is deprecated since API version 9. You are advised to use [triggerKey<sup>9+</sup>](#triggerkey9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3546,7 +3562,7 @@ click(x: number, y: number): Promise\<void>
Clicks a specific point of this **UiDriver** object based on the given coordinates.
This API is deprecated since API version 9. You are advised to use [click<sup>9+</sup>](#click9).
This API is deprecated since API version 9. You are advised to use [click<sup>9+</sup>](#click9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3572,7 +3588,7 @@ doubleClick(x: number, y: number): Promise\<void>
Double-clicks a specific point of this **UiDriver** object based on the given coordinates.
This API is deprecated since API version 9. You are advised to use [doubleClick<sup>9+</sup>](#doubleclick9).
This API is deprecated since API version 9. You are advised to use [doubleClick<sup>9+</sup>](#doubleclick9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3598,7 +3614,7 @@ longClick(x: number, y: number): Promise\<void>
Long-clicks a specific point of this **UiDriver** object based on the given coordinates.
This API is deprecated since API version 9. You are advised to use [longClick<sup>9+</sup>](#longclick9).
This API is deprecated since API version 9. You are advised to use [longClick<sup>9+</sup>](#longclick9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3624,7 +3640,7 @@ swipe(startx: number, starty: number, endx: number, endy: number): Promise\<void
Swipes on this **UiDriver** object from the start point to the end point based on the given coordinates.
This API is deprecated since API version 9. You are advised to use [swipe<sup>9+</sup>](#swipe9).
This API is deprecated since API version 9. You are advised to use [swipe<sup>9+</sup>](#swipe9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3652,7 +3668,7 @@ screenCap(savePath: string): Promise\<boolean>
Captures the current screen of this **UiDriver** object and saves it as a PNG image to the given save path.
This API is deprecated since API version 9. You are advised to use [screenCap<sup>9+</sup>](#screencap9).
This API is deprecated since API version 9. You are advised to use [screenCap<sup>9+</sup>](#screencap9) instead.
**System capability**: SystemCapability.Test.UiTest
......
# Readme
- [Ability framework](changelogs-ability.md)
- [Bundle manager subsystem](changelogs-bundlemanager.md)
- [Resource scheduler subsystem](changelogs-resourceschedule.md)
- [Telephony subsystem](changelogs-telephony.md)
- [Util subsystem](changelogs-util.md)
- [Ability Framework](changelogs-ability.md)
- [ArkUI](changelogs-arkui.md)
- [Bundle Manager Subsystem](changelogs-bundlemanager.md)
- [Input Method Framework](changelogs-imf.md)
- [Resource Scheduler Subsystem](changelogs-resourceschedule.md)
- [Theme Framework Subsystem - Screenlock](changelogs-screenlock.md)
- [Telephony Subsystem](changelogs-telephony.md)
- [Util Subsystem](changelogs-util.md)
- [Theme Framework Subsystem - Wallpaper](changelogs-wallpaper.md)
- [Web Subsystem](changelogs-web.md)
# ArkUI Subsystem Changelog
## cl.arkui.1 Return Value Type Change of getInspectorTree
**Change Impact**
The code that uses the **getInspectorTree** API in versions earlier than OpenHarmony 3.2.10.7 must be adapted.
**Key API/Component Changes**
The return value of the **getInspectorTree** API is changed from the string type to the Object type.
**Adaptation Guide**
Adapt the code that takes the return value of **getInspectorTree** as a string.The sample code is as follows:
- Before change:
```typescript
console.info(getInspectorTree())
```
- After change:
```typescript
console.info(JSON.stringify(getInspectorTree()))
```
## cl.arkui.2 Deprecation the forceRebuild Attribute of \<GridItem>
**Change Impact**
None. The attribute has no effect.
**Key API/Component Changes**
Deprecate the **forceRebuild** attribute of the **\<GridItem>** component.
**Adaptation Guide**
Delete the code that uses the **forceRebuild** attribute. This will not affect the functionality of the **\<GridItem>** component.
## cl.arkui.3 Plugin Module API Changes
### 1. API Change in the **PluginComponentTemplate** Module
Renamed the **ability** parameter **bundleName** to more clearly indicate the intended meaning.
You need to adapt your application.
**Change Impact**
The application developed based on earlier versions must be adapted to the change. Otherwise, build errors will occur.
**Key API/Component Changes**
- Involved APIs:
interface PluginComponentTemplate {
source: string;
bundleName: string;
}
interface PluginComponentInterface {
(value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute;
}
- Before change:
```js
interface PluginComponentTemplate { source: string; ability: string; }
interface PluginComponentInterface {
(value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute;
}
```
- After change:
```js
interface PluginComponentTemplate { source: string; bundleName: string; }
interface PluginComponentInterface {
(value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute;
}
```
**Adaptation Guide**
Use the new API. The sample code is as follows:
- Before change:
```js
PluginComponent({
template: { source: 'plugincomponent1', ability: 'com.example.plugin' },
data: { 'countDownStartValue': 'new countDownStartValue' }
}).size({ width: 500, height: 100 })
```
- After change:
```js
PluginComponent({
template: { source: 'plugincomponent1', bundleName: 'com.example.plugin' },
data: { 'countDownStartValue': 'new countDownStartValue' }
}).size({ width: 500, height: 100 })
```
### 2. API Change in the **pluginComponentManager** Module
Renamed the **want** parameter **target** to more clearly indicate the intended meaning.
You need to adapt your application.
**Change Impact**
The application developed based on earlier versions must be adapted to the change. Otherwise, alarms will arise. Though the build may be successful, the API will not work as intended.
**Key API/Component Changes**
- Involved APIs:
interface PushParameterForStage {
owner: Want;
target: Want;
name: string;
data: KVObject;
extraData: KVObject;
jsonPath?: string;
}
function push(param: PushParameterForStage, callback: AsyncCallback\<void>): void;
interface RequestParameterForStage {
owner: Want;
target: Want;
name: string;
data: KVObject;
jsonPath?: string;
}
function request(param: RequestParameterForStage, callback: AsyncCallback\<RequestCallbackParameters>): void;
- Before change:
```js
interface PushParameterForStage {
owner: Want;
want: Want;
name: string;
data: KVObject;
extraData: KVObject;
jsonPath?: string;
}
function push(param: PushParameterForStage, callback: AsyncCallback<void>): void;
interface RequestParameterForStage {
owner: Want;
want: Want;
name: string;
data: KVObject;
jsonPath?: string;
}
function request(param: RequestParameterForStage, callback: AsyncCallback<RequestCallbackParameters>): void;
```
- After change:
```js
interface PushParameterForStage {
owner: Want;
target: Want;
name: string;
data: KVObject;
extraData: KVObject;
jsonPath?: string;
}
function push(param: PushParameterForStage, callback: AsyncCallback<void>): void;
interface RequestParameterForStage {
owner: Want;
target: Want;
name: string;
data: KVObject;
jsonPath?: string;
}
function request(param: RequestParameterForStage, callback: AsyncCallback<RequestCallbackParameters>): void;
```
**Adaptation Guide**
Use the new API. The sample code is as follows:
- Before change:
```js
import pluginComponentManager from '@ohos.pluginComponent'
pluginComponentManager.push({
owner:{
bundleName:"com.example.provider",
abilityName:"com.example.provider.MainAbility"
},
want: {
bundleName: "com.example.provider",
abilityName: "com.example.provider.MainAbility",
},
name: "ets/pages/plugin2.js",
data: {
"js": "ets/pages/plugin.js",
"key_1": 1111,
},
extraData: {
"extra_str": "this is push event"
},
jsonPath: "",
},
(err, data) => {
console.log("push_callback:err: " ,JSON.stringify(err));
console.log("push_callback:data: " , JSON.stringify(data));
console.log("push_callback: push ok!");
}
)
pluginComponentManager.request({
owner:{
bundleName:"com.example.provider",
abilityName:"com.example.provider.MainAbility"
},
want: {
bundleName: "com.example.provider",
abilityName: "ets/pages/plugin2.js",
},
name: "plugintemplate",
data: {
"key_1": " myapplication plugin component test",
"key_2": 123456
},
jsonPath: "",
},
(err, data) => {
console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability)
console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source)
}
)
```
- After change:
```js
import pluginComponentManager from '@ohos.pluginComponent'
pluginComponentManager.push({
owner:{
bundleName:"com.example.provider",
abilityName:"com.example.provider.MainAbility"
},
target: {
bundleName: "com.example.provider",
abilityName: "com.example.provider.MainAbility",
},
name: "ets/pages/plugin2.js",
data: {
"js": "ets/pages/plugin.js",
"key_1": 1111,
},
extraData: {
"extra_str": "this is push event"
},
jsonPath: "",
},
(err, data) => {
console.log("push_callback:err: " ,JSON.stringify(err));
console.log("push_callback:data: " , JSON.stringify(data));
console.log("push_callback: push ok!");
}
)
pluginComponentManager.request({
owner:{
bundleName:"com.example.provider",
abilityName:"com.example.provider.MainAbility"
},
target: {
bundleName: "com.example.provider",
abilityName: "ets/pages/plugin2.js",
},
name: "plugintemplate",
data: {
"key_1": " myapplication plugin component test",
"key_2": 123456
},
jsonPath: "",
},
(err, data) => {
console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability)
console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source)
}
)
```
# Input Method Framework Subsystem – Input Method Framework Service Changelog
## @ohos.InputMethodSubtype Change of name, label, and id
Changed the **name**, **label**, and **id** attributes since API version 9.
**Change Impact**
Applications must be adapted to the following changes.
| Name| Before Change| After Change|
| -------- | -------- | -------- |
| label | (1) Value: ID of the input method subtype.| (1) Value: Label of the input method subtype.|
| name | (1) Description: Name of the input method subtype. (2) Value: Label of the input method subtype.| (1) Description: Bundle name of the input method; (2) Value: Bundle name of the input method.|
| id | (1) Value: Bundle name of the input method.| (1) Value: ID of the input method subtype.|
**Adaptation Guide**
Update the code to adapt to the preceding changes.
# Theme Framework Subsystem – Screenlock Management Service Changelog
## cl.screenlock.1 Permission Change of isLocked and unlock
Changed the **isLocked** and **unlock** APIs to system APIs since API version 9.
You need to adapt your application based on the following information.
**Change Impact**
The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected.
- Involved APIs:
```js
function isLocked(): boolean;
function unlock(callback: AsyncCallback<boolean>): void;
function unlock():Promise<boolean>;
```
- Before change:
```js
* Checks whether the screen is currently locked.
*
* @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise.
* @syscap SystemCapability.MiscServices.ScreenLock
* @since 9
*/
function isLocked(): boolean;
/**
* Unlock the screen.
*
* @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
* @syscap SystemCapability.MiscServices.ScreenLock
* @systemapi Hide this for inner system use.
* @since 9
*/
function unlock(callback: AsyncCallback<boolean>): void;
/**
* Unlock the screen.
*
* @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
* @syscap SystemCapability.MiscServices.ScreenLock
* @systemapi Hide this for inner system use.
* @since 9
*/
function unlock():Promise<boolean>;
```
- After change:
```js
* Checks whether the screen is currently locked.
*
* @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @syscap SystemCapability.MiscServices.ScreenLock
* @systemapi Hide this for inner system use.
* @since 9
*/
function isLocked(): boolean;
/**
* Unlock the screen.
*
* @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
* @syscap SystemCapability.MiscServices.ScreenLock
* @since 9
*/
function unlock(callback: AsyncCallback<boolean>): void;
/**
* Unlock the screen.
*
* @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
* @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
* @syscap SystemCapability.MiscServices.ScreenLock
* @since 9
*/
function unlock():Promise<boolean>;
```
**Adaptation Guide**
Make sure the APIs are only invoked by system applications.
The code snippet is as follows:
```js
try {
let ret = screenLock.isLocked();
console.error(`Obtain whether the screen is locked successfully , ret is: ${ret}`);
} catch (error) {
console.error(`Failed to obtain whether the screen is locked, error is : ${error.code}, ${error.message}`);
}
```
```js
screenlock.unlock((err, data) => {
if (err) {
console.error(`Failed to unlock the screen, because: ${err.message}`);
return;
}
console.info(`unlock the screen successfully. result: ${data}`);
});
```
```js
screenlock.unlock().then((data) => {
console.info(`unlock the screen successfully. result: ${data}`);
}).catch((err) => {
console.error(`Failed to unlock the screen, because: ${err.message}`);
});
```
## cl.screenlock.2 Deprecation of isSecure
Deprecated the **isSecure** API since API version 9.
You need to adapt your application based on the following information.
**Change Impact**
The API can no longer be used after being deleted.
- Involved APIs:
```js
function isSecure(): boolean;
```
- Before change:
```js
function isSecure(): boolean;
```
- After change:
The API is deleted.
**Adaptation Guide**
Update the code so that the deprecated API is not used.
# Theme Framework Subsystem – Wallpaper Management Service Changelog
## cl.wallpaper.1 Permission Change of getColorsSync, getMinHeightSync, getMinWidthSync, restore, and setImage
Changed the **getColorsSync**, **getMinHeightSync**, **getMinWidthSync**, restore, and **setImage** APIs to system APIs since API version 9.
You need to adapt your application based on the following information.
**Change Impact**
The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected.
- Involved APIs:
```js
function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>;
function getMinHeightSync(): number;
function getMinWidthSync(): number;
function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
function restore(wallpaperType: WallpaperType): Promise<void>;
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>;
```
- Before change:
```js
/**
* Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function.
* @param wallpaperType Indicates the wallpaper type.
* @returns { Array<RgbaColor> } the Array<RgbaColor> returned by the function.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>;
/**
* Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
* @returns { number } the number returned by the function.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function getMinHeightSync(): number;
/**
* Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
* @returns { number } the number returned by the function.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function getMinWidthSync(): number;
/**
* Removes a wallpaper of the specified type and restores the default one.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
/**
* Removes a wallpaper of the specified type and restores the default one.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function restore(wallpaperType: WallpaperType): Promise<void>;
/**
* Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file.
* @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
/**
* Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file.
* @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @systemapi Hide this for inner system use.
* @since 9
*/
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>;
```
- After change:
```js
/**
* Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function.
* @param wallpaperType Indicates the wallpaper type.
* @returns { Array<RgbaColor> } the Array<RgbaColor> returned by the function.
* @throws {BusinessError} 401 - parameter error.
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>;
/**
* Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
* @returns { number } the number returned by the function.
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function getMinHeightSync(): number;
/**
* Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set.
* @returns { number } the number returned by the function.
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function getMinWidthSync(): number;
/**
* Removes a wallpaper of the specified type and restores the default one.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
/**
* Removes a wallpaper of the specified type and restores the default one.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function restore(wallpaperType: WallpaperType): Promise<void>;
/**
* Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file.
* @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
/**
* Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file.
* @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file.
* @param wallpaperType Indicates the wallpaper type.
* @throws {BusinessError} 401 - parameter error.
* @throws {BusinessError} 201 - permission denied.
* @permission ohos.permission.SET_WALLPAPER
* @syscap SystemCapability.MiscServices.Wallpaper
* @since 9
*/
function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>;
```
**Adaptation Guide**
Make sure the APIs are only invoked by system applications.
The code snippet is as follows:
```js
try {
let colors = wallpaper.getColorsSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM);
console.log(`success to getColorsSync: ${JSON.stringify(colors)}`);
} catch (error) {
console.error(`failed to getColorsSync because: ${JSON.stringify(error)}`);
}
```
```js
let minHeight = wallpaper.getMinHeightSync();
```
```js
let minWidth = wallpaper.getMinWidthSync();
```
```js
wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => {
if (error) {
console.error(`failed to restore because: ${JSON.stringify(error)}`);
return;
}
console.log(`success to restore.`);
});
```
```js
wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => {
console.log(`success to restore.`);
}).catch((error) => {
console.error(`failed to restore because: ${JSON.stringify(error)}`);
});
```
```js
// The source type is string.
let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg";
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => {
if (error) {
console.error(`failed to setImage because: ${JSON.stringify(error)}`);
return;
}
console.log(`success to setImage.`);
});
```
```js
// The source type is string.
let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg";
wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => {
console.log(`success to setImage.`);
}).catch((error) => {
console.error(`failed to setImage because: ${JSON.stringify(error)}`);
});
```
## cl.wallpaper.2 Deprecation of getIdSync, getFileSync, isChangeAllowed, isUserChangeAllowed, on, off, and RgbaColor
Deprecated the **getIdSync**, **getFileSync**, **isChangeAllowed**, **isUserChangeAllowed**, **on**, **off**, and **RgbaColor** APIs since API version 9.
You need to adapt your application based on the following information.
**Change Impact**
The APIs can no longer be used after being deleted.
- Involved APIs:
```js
function getIdSync(wallpaperType: WallpaperType): number;
function getFileSync(wallpaperType: WallpaperType): number;
function isChangeAllowed(): boolean;
function isUserChangeAllowed(): boolean;
function on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
function off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
interface RgbaColor {
red: number;
green: number;
blue: number;
alpha: number;
}
```
- Before change:
```js
function getIdSync(wallpaperType: WallpaperType): number;
function getFileSync(wallpaperType: WallpaperType): number;
function isChangeAllowed(): boolean;
function isUserChangeAllowed(): boolean;
function on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
function off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void;
interface RgbaColor {
red: number;
green: number;
blue: number;
alpha: number;
}
```
- After change:
The APIs are deleted.
**Adaptation Guide**
Update the code so that the deprecated APIs are not used.
# Web Subsystem Changelog
Compared with earlier versions, OpenHarmony 3.2.10.7 has the following API changes in its web subsystem:
## cl.web.1 HitTestTypeV9 Name Change
Renamed the enum class **HitTestTypeV9** **WebHitTestType** to meet the naming conventions.
**Change Impact**
The enum class **HitTestTypeV9** and APIs that use **HitTestTypeV9** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
enum HitTestTypeV9
- Before change:
```ts
enum HitTestTypeV9
```
- After change:
```ts
enum WebHitTestType
```
**Adaptation Guide**
Replace **HitTestTypeV9** with **WebHitTestType**.
## cl.web.2 HeaderV9 Name Change
Renamed the struct **HeaderV9** **WebHeader** to meet the naming conventions.
**Change Impact**
The struct **HeaderV9** and APIs that use **HeaderV9** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
interface HeaderV9
- Before change:
```ts
interface HeaderV9
```
- After change:
```ts
interface WebHeader
```
**Adaptation Guide**
Replace **HeaderV9** with **WebHeader**.
## cl.web.3 Member Change of HitTestValue
Rename the member variable **HitTestTypeV9** in the **HitTestValue** struct **WebHitTestType** to meet the naming conventions.
**Change Impact**
The struct **HitTestValue** and APIs that use **HitTestValue** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
interface HitTestValue
- Before change:
```ts
interface HitTestValue {
/**
* Get the hit test type.
*
* @since 9
*/
type: HitTestTypeV9;
/**
* Get the hit test extra data.
*
* @since 9
*/
extra: string;
}
```
- After change:
```ts
interface HitTestValue {
/**
* Get the hit test type.
*
* @since 9
*/
type: WebHitTestType;
/**
* Get the hit test extra data.
*
* @since 9
*/
extra: string;
}
```
**Adaptation Guide**
Replace **HitTestTypeV9** with **WebHitTestType**.
## cl.web.4 Parameter Type Change of loadUrl
Changed the type of the **headers** parameter in **loadUrl** to **WebHeader** to meet the naming conventions.
**Change Impact**
The **loadUrl** API that uses the **headers** parameter cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
loadUrl(url: string | Resource, headers?: Array\<HeaderV9>): void
- Before change:
```ts
loadUrl(url: string | Resource, headers?: Array<HeaderV9>): void
```
- After change:
```ts
loadUrl(url: string | Resource, headers?: Array<WebHeader>): void
```
**Adaptation Guide**
Change the type of the **headers** parameter in **loadUrl** from **HeaderV9** to **WebHeader**.
## cl.web.5 Return Value Type Change of getHitTest
Changed the return value type of the **getHitTest** API to **WebHitTest** to meet the naming conventions.
**Change Impact**
The **getHitTest** API cannot be used in OpenHarmony 3.2.10.7 and later versions.
**Key API/Component Changes**
- Involved APIs:
getHitTest(): HitTestTypeV9
- Before change:
```ts
getHitTest(): HitTestTypeV9
```
- After change:
```ts
getHitTest(): WebHitTestType
```
**Adaptation Guide**
Change the return value type of the **getHitTest** API from **HitTestTypeV9** to **WebHitTestType**.
## cl.web.6 Moving of the WebMessagePort Class
Moved the **WebMessagePort** class to **@ohos.web.webview.d.ts** and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing.
**Key API/Component Changes**
- Involved APIs:
postMessageEvent(message: WebMessageEvent): void;
onMessageEvent(callback: (result: string) => void): void;
- Before change:
```ts
postMessageEvent(message: WebMessageEvent): void;
onMessageEvent(callback: (result: string) => void): void;
```
- After change:
```ts
postMessageEvent(message: WebMessage): void;
onMessageEvent(callback: (result: WebMessage) => void): void;
```
**Adaptation Guide**
Instead of importing APIs from the original **WebMessagePort** class, import APIs from **@ohos.web.webview** as follows:
```ts
import web_webview from '@ohos.web.webview';
```
## cl.web.7 Moving of the HitTestValue Class
Moved the **HitTestValue** class to **@ohos.web.webview.d.ts**; changed **HitTestValue** from a class to an API; changed the **getType** and **getExtra** from APIs to attributes.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed.
**Key API/Component Changes**
- Involved APIs:
getType(): HitTestType;
getExtra(): string;
- Before change:
```ts
getType(): HitTestType;
getExtra(): string;
```
- After change:
```ts
type: WebHitTestType;
extra: string;
```
**Adaptation Guide**
Instead of importing APIs from the original **HitTestValue** class, import APIs from **@ohos.web.webview** as follows:
```ts
import web_webview from '@ohos.web.webview';
```
## cl.web.8 Moving of API Version 9 APIs Under WebCookie
Moved APIs of API version 9 in the **WebCookie** class to **web.webview.webview.WebCookieManager**
and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing.
The APIs in the class are static.
**Key API/Component Changes**
- Involved APIs:
isCookieAllowed(): boolean;
isThirdPartyCookieAllowed(): boolean;
putAcceptCookieEnabled(accept: boolean): void;
putAcceptThirdPartyCookieEnabled(accept: boolean): void;
setCookie(url: string, value: string): boolean;
saveCookieSync(): boolean;
getCookie(url: string): string;
existCookie(): boolean;
deleteEntireCookie(): void;
deleteSessionCookie(): void;
- Before change:
```ts
isCookieAllowed(): boolean;
isThirdPartyCookieAllowed(): boolean;
putAcceptCookieEnabled(accept: boolean): void;
putAcceptThirdPartyCookieEnabled(accept: boolean): void;
setCookie(url: string, value: string): boolean;
saveCookieSync(): boolean;
getCookie(url: string): string;
existCookie(): boolean;
deleteEntireCookie(): void;
deleteSessionCookie(): void;
```
- After change:
```ts
static isCookieAllowed(): boolean;
static isThirdPartyCookieAllowed(): boolean;
static putAcceptCookieEnabled(accept: boolean): void;
static putAcceptThirdPartyCookieEnabled(accept: boolean): void;
static setCookie(url: string, value: string): void;
static saveCookieAsync(): Promise<void>;
static saveCookieAsync(callback: AsyncCallback<void>): void;
static getCookie(url: string): string;
static existCookie(): boolean;
static deleteEntireCookie(): void;
static deleteSessionCookie(): void;
```
**Adaptation Guide**
Instead of importing APIs from the original **WebCookie** class, import APIs from **@ohos.web.webview** as follows:
```ts
import web_webview from '@ohos.web.webview';
```
## cl.web.9 Moving of API Version 9 APIs Under WebController
Moved APIs of API version 9 in the **WebController** class to **web.webview.webview.WebviewController** and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing.
The **getDefaultUserAgent** API is renamed **getUserAgent**.
**Key API/Component Changes**
- Involved APIs:
zoomIn(): boolean;
zoomOut(): boolean;
createWebMessagePorts(): Array\<WebMessagePort>;
postMessage(options: { message: WebMessageEvent, uri: string}): void;
getHitTestValue(): HitTestValue;
getWebId(): number;
getDefaultUserAgent(): string;
getTitle(): string;
getPageHeight(): number;
backOrForward(step: number): void;
searchAllAsync(searchString: string): void;
clearMatches(): void;
searchNext(forward: boolean): void;
clearSslCache(): void;
clearClientAuthenticationCache(): void;
getUrl(): string;
- Before change:
```ts
zoomIn(): boolean;
zoomOut(): boolean;
createWebMessagePorts(): Array<WebMessagePort>;
postMessage(options: { message: WebMessageEvent, uri: string}): void;
getHitTestValue(): HitTestValue;
getWebId(): number;
getDefaultUserAgent(): string;
getTitle(): string;
getPageHeight(): number;
backOrForward(step: number): void;
searchAllAsync(searchString: string): void;
clearMatches(): void;
searchNext(forward: boolean): void;
clearSslCache(): void;
clearClientAuthenticationCache(): void;
getUrl(): string;
```
- After change:
```ts
zoomIn(): void;
zoomOut(): void;
createWebMessagePorts(): Array<WebMessagePort>;
postMessage(name: string, ports: Array<WebMessagePort>, uri: string): void;
getHitTestValue(): HitTestValue;
getWebId(): number;
getUserAgent(): string;
getTitle(): string;
getPageHeight(): number;
backOrForward(step: number): void;
searchAllAsync(searchString: string): void;
clearMatches(): void;
searchNext(forward: boolean): void;
clearSslCache(): void;
clearClientAuthenticationCache(): void;
getUrl(): string;
```
**Adaptation Guide**
Instead of importing APIs from the original **WebController** class, import APIs from **@ohos.web.webview** as follows:
```ts
import web_webview from '@ohos.web.webview';
```
## cl.web.10 Moving of the WebAsyncController Class
Moved the APIs in the **WebAsyncController** class to the **web.webview.webview.WebviewController** class and added error throwing.
**Change Impact**
If your application is developed based on earlier versions, pay attention to error code processing.
**Key API/Component Changes**
- Involved APIs:
storeWebArchive(baseName: string, autoName: boolean): Promise\<string>;
storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback\<string>): void;
- Before change:
```ts
storeWebArchive(baseName: string, autoName: boolean): Promise<string>;
storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback<string>): void;
```
- After change:
```ts
storeWebArchive(baseName: string, autoName: boolean): Promise<string>;
storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback<string>): void;
```
**Adaptation Guide**
Example:
```ts
// xxx.ets
import web_webview from '@ohos.web.webview'
@Entry
@Component
struct WebComponent {
controller: web_webview.WebviewController = new web_webview.WebviewController();
build() {
Column() {
Button('saveWebArchive')
.onClick(() => {
try {
this.controller.storeWebArchive("/data/storage/el2/base/", true, (error, filename) => {
if (error) {
console.info(`save web archive error: ` + JSON.stringify(error))
return;
}
if (filename != null) {
console.info(`save web archive success: ${filename}`)
}
});
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
})
Web({ src: 'www.example.com', controller: this.controller })
}
}
}
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册