@@ -197,11 +197,12 @@ The framework supports multiple test case execution modes, which are triggered b
...
@@ -197,11 +197,12 @@ The framework supports multiple test case execution modes, which are triggered b
| breakOnError | Whether to enable break-on-error mode. When this mode is enabled, the test execution process exits if a test assertion error or any other error occurs.| **true**/**false** (default value) | -s breakOnError true |
| breakOnError | Whether to enable break-on-error mode. When this mode is enabled, the test execution process exits if a test assertion error or any other error occurs.| **true**/**false** (default value) | -s breakOnError true |
| testType | Type of the test case to be executed. | function, performance, power, reliability, security, global, compatibility, user, standard, safety, resilience| -s testType function |
| testType | Type of the test case to be executed. | function, performance, power, reliability, security, global, compatibility, user, standard, safety, resilience| -s testType function |
| level | Level of the test case to be executed. | 0, 1, 2, 3, 4 | -s level 0 |
| level | Level of the test case to be executed. | 0, 1, 2, 3, 4 | -s level 0 |
| size | Size of the test case to be executed. | small, medium, large | -s size small |
| size | Size of the test case to be executed. | small, medium, large | -s size small |
| stress | Number of times that the test case is executed. | Positive integer | -s stress 1000 |
**Running Commands**
**Running Commands**
Configure hdc-related environment variables, and then perform the following:
> Configure hdc-related environment variables, and then perform the following:
- Open the CLI.
- Open the CLI.
- Run the **aa test** commands.
- Run the **aa test** commands.
...
@@ -260,12 +261,18 @@ Example 9: Execute test cases at the specified level.
...
@@ -260,12 +261,18 @@ Example 9: Execute test cases at the specified level.
- During test execution in the CLI, the log information similar to the following is displayed:
- During test execution in the CLI, the log information similar to the following is displayed:
...
@@ -394,11 +401,11 @@ Run the following command, restart the device, and execute the test case again:
...
@@ -394,11 +401,11 @@ Run the following command, restart the device, and execute the test case again:
hdc shell param set persist.ace.testmode.enabled 1
hdc shell param set persist.ace.testmode.enabled 1
```
```
#### The failure log contains "uitest-api dose not allow calling concurrently"
#### The failure log contains "uitest-api does not allow calling concurrently"
**Problem**
**Problem**
The UI test case fails to be executed. The HiLog file contains the error message "uitest-api dose not allow calling concurrently".
The UI test case fails to be executed. The HiLog file contains the error message "uitest-api does not allow calling concurrently".
**Possible Causes**
**Possible Causes**
...
@@ -412,11 +419,11 @@ The UI test case fails to be executed. The HiLog file contains the error message
...
@@ -412,11 +419,11 @@ The UI test case fails to be executed. The HiLog file contains the error message
2. Do not execute UI test cases in multiple processes.
2. Do not execute UI test cases in multiple processes.
#### The failure log contains "dose not exist on current UI! Check if the UI has changed after you got the widget object"
#### The failure log contains "does not exist on current UI! Check if the UI has changed after you got the widget object"
**Problem**
**Problem**
The UI test case fails to be executed. The HiLog file contains the error message "dose not exist on current UI! Check if the UI has changed after you got the widget object".
The UI test case fails to be executed. The HiLog file contains the error message "does not exist on current UI! Check if the UI has changed after you got the widget object".
@@ -15,11 +15,11 @@ import pointer from '@ohos.multimodalInput.pointer';
...
@@ -15,11 +15,11 @@ import pointer from '@ohos.multimodalInput.pointer';
The following table lists the common APIs for mouse pointer management. For details about the APIs, see [ohos.multimodalInput.pointer](../reference/apis/js-apis-pointer.md).
The following table lists the common APIs for mouse pointer management. For details about the APIs, see [ohos.multimodalInput.pointer](../reference/apis/js-apis-pointer.md).
| pointer | function isPointerVisible(callback: AsyncCallback\<boolean>): void; | Checks the visible status of the mouse pointer. |
| pointer | function isPointerVisible(callback: AsyncCallback\<boolean>): void; | Checks the visible status of the mouse pointer. |
| pointer | function setPointerVisible(visible: boolean, callback: AsyncCallback\<void>): void; | Sets the visible status of the mouse pointer. This setting takes effect for the mouse pointer globally.|
| pointer | function setPointerVisible(visible: boolean, callback: AsyncCallback\<void>): void; | Sets the visible status of the mouse pointer. This setting takes effect for the mouse pointer globally.|
| pointer | function setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback\<void>): void; | Sets the mouse pointer style. This setting takes effect for the mouse pointer style of a specified window. |
| pointer | function setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback\<void>): void; | Sets the mouse pointer style. This setting takes effect for the mouse pointer style of a specified window. |
| pointer | function getPointerStyle(windowId: number, callback: AsyncCallback\<PointerStyle>): void; | Obtains the mouse pointer style. |
| pointer | function getPointerStyle(windowId: number, callback: AsyncCallback\<PointerStyle>): void; | Obtains the mouse pointer style. |
@@ -39,7 +39,7 @@ Fault management is an important way for applications to deliver a better user e
...
@@ -39,7 +39,7 @@ Fault management is an important way for applications to deliver a better user e
- Fault query indicates that [faultLogger](../reference/apis/js-apis-faultLogger.md) obtains the fault information using its query API.
- Fault query indicates that [faultLogger](../reference/apis/js-apis-faultLogger.md) obtains the fault information using its query API.
The figure below does not illustrate the time when [faultLogger](../reference/apis/js-apis-faultLogger.md) is called. You can refer to [LastExitReason](../reference/apis/js-apis-application-abilityConstant.md#abilityconstantlastexitreason) passed during application initialization to determine whether to call [faultLogger](../reference/apis/js-apis-faultLogger.md) to query the information about the last fault.
The figure below does not illustrate the time when [faultLogger](../reference/apis/js-apis-faultLogger.md) is called. You can refer to [LastExitReason](../reference/apis/js-apis-app-ability-abilityConstant.md#abilityconstantlastexitreason) passed during application initialization to determine whether to call [faultLogger](../reference/apis/js-apis-faultLogger.md) to query the information about the last fault.
It is recommended that you call [errorManager](../reference/apis/js-apis-application-errorManager.md) to process the exception. After the processing is complete, you can call the status saving API and restart the application.
It is recommended that you call [errorManager](../reference/apis/js-apis-application-errorManager.md) to process the exception. After the processing is complete, you can call the status saving API and restart the application.
...
@@ -134,7 +134,7 @@ After the callback triggers **appRecovery.saveAppState()**, **onSaveState(state,
...
@@ -134,7 +134,7 @@ After the callback triggers **appRecovery.saveAppState()**, **onSaveState(state,
- Restore data.
- Restore data.
After the callback triggers **appRecovery.restartApp()**, the application is restarted. After the restart, **onSaveState(state, wantParams)** of **EntryAbility** is called, and the saved data is in **parameters** of **want**.
After the callback triggers **appRecovery.restartApp()**, the application is restarted. After the restart, **onCreate(want, launchParam)** of **EntryAbility** is called, and the saved data is in **parameters** of **want**.
HiLog is the log system of OpenHarmony that provides logging for the system framework, services, and applications to record information on user operations and system running status.
HiLog is the log system of OpenHarmony that provides logging for the system framework, services, and applications to record information on user operations and system running status.
> **NOTE**
> **NOTE**
>
> This development guide is applicable only when you use Native APIs for application development. For details about the APIs, see [HiLog Native API Reference](https://gitee.com/openharmony-sig/interface_native_header/blob/master/en/native_sdk/dfx/log.h).
> This development guide is applicable only when you use Native APIs for application development. For details about the APIs, see [HiLog Native API Reference](https://gitee.com/openharmony-sig/interface_native_header/blob/master/en/native_sdk/dfx/log.h).
## Available APIs
## Available APIs
| API/Macro| Description|
| API/Macro| Description|
| -------- | -------- |
| -------- | -------- |
| int OH_LOG_Print(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...) | Outputs logs based on the specified log type, log level, service domain, log tag, and variable parameters determined by the format specifier and privacy identifier in the printf format.|
| int OH_LOG_Print(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...) | Outputs logs based on the specified log type, log level, service domain, log tag, and variable parameters determined by the format specifier and privacy identifier in the printf format.<br>Input parameters: See [Parameter Description](#parameter-description).<br>Output parameters: None<br>Return value: total number of bytes if log printing is successful; **-1** otherwise.|
| #define OH_LOG_DEBUG(type, ...) ((void)OH_LOG_Print((type), LOG_DEBUG, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__))| Outputs DEBUG logs. This is a function-like macro.|
| #define OH_LOG_DEBUG(type, ...) ((void)OH_LOG_Print((type), LOG_DEBUG, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__))| Outputs DEBUG logs. This is a function-like macro.|
| #define OH_LOG_INFO(type, ...) ((void)OH_LOG_Print((type), LOG_INFO, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__)) | Outputs INFO logs. This is a function-like macro.|
| #define OH_LOG_INFO(type, ...) ((void)OH_LOG_Print((type), LOG_INFO, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__)) | Outputs INFO logs. This is a function-like macro.|
| #define OH_LOG_WARN(type, ...) ((void)OH_LOG_Print((type), LOG_WARN, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__)) | Outputs WARN logs. This is a function-like macro.|
| #define OH_LOG_WARN(type, ...) ((void)OH_LOG_Print((type), LOG_WARN, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__)) | Outputs WARN logs. This is a function-like macro.|
| #define OH_LOG_ERROR(type, ...) ((void)OH_LOG_Print((type), LOG_ERROR, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__)) | Outputs ERROR logs. This is a function-like macro.|
| #define OH_LOG_ERROR(type, ...) ((void)OH_LOG_Print((type), LOG_ERROR, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__)) | Outputs ERROR logs. This is a function-like macro.|
| #define OH_LOG_FATAL(type, ...) ((void)OH_LOG_Print((type), LOG_FATAL, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__)) | Outputs FATAL logs. This is a function-like macro.|
| #define OH_LOG_FATAL(type, ...) ((void)OH_LOG_Print((type), LOG_FATAL, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__)) | Outputs FATAL logs. This is a function-like macro.|
| bool OH_LOG_IsLoggable(unsigned int domain, const char *tag, LogLevel level) | Checks whether logs of the specified service domain, tag, and level can be printed.<br>Input arguments:<br>- **domain**: service domain.<br>- **tag**: log tag.<br>- **level**: log level.<br>Output arguments: none<br>Return value: Returns **true** if the specified logs can be printed; returns **false** otherwise.|
| bool OH_LOG_IsLoggable(unsigned int domain, const char *tag, LogLevel level) | Checks whether logs of the specified service domain, tag, and level can be printed.<br>Input parameters: See [Parameter Description](#parameter-description).<br>Output arguments: none<br>Return value: **true** if the specified logs can be printed; **false** otherwise.|
| type | enum | Yes | Enum of log printing types. The default value is **LOG_APP** for application logs.|
| level | enum | Yes | Log printing level. For details, see [Log Level](#loglevel).|
| domain | number | Yes | Service domain of logs. The value ranges from **0x0** to **0xFFFF**.<br>You can define the value as required. |
| tag | string | Yes | Log tag in the string format. You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| fmt | string | Yes | Format string used to output logs in a specified format. It can contain several parameters, where the parameter type and privacy identifier are mandatory.<br>Parameters labeled **{public}** are public data and are displayed in plaintext; parameters labeled **{private}** (default value) are private data and are filtered by **\<private>**.|
| args | any[] | Yes | Variable-length parameter list corresponding to the format string. The number and type of parameters must map to the identifier in the format string.|
| DEBUG | 3 | Log level used to record more detailed process information than INFO logs to help developers analyze service processes and locate faults.|
| INFO | 4 | Log level used to record key service process nodes and exceptions that occur during service running,<br>Log level used to record information about unexpected exceptions, such as network signal loss and login failure.<br>These logs should be recorded by the dominant module in the service to avoid repeated logging conducted by multiple invoked modules or low-level functions.|
| WARN | 5 | Log level used to record severe, unexpected faults that have little impact on users and can be rectified by the programs themselves or through simple operations.|
| ERROR | 6 | Log level used to record program or functional errors that affect the normal running or use of the functionality and can be fixed at a high cost, for example, by resetting data.|
| FATAL | 7 | Log level used to record program or functionality crashes that cannot be rectified.
## Development Examples
## Development Examples
1. Include the **hilog** header file in the source file.
1. Add the link of **libhilog_ndk.z.so** to **CMakeLists.txt**:
```
target_link_libraries(entry PUBLIC libhilog_ndk.z.so)
```
2. Include the **hilog** header file in the source file, and define the **domain** and **tag** macros.
```c++
```c++
#include "hilog/log.h"
#include "hilog/log.h"
```
```
2. Define the **domain** and **tag** macros.
```c++
```c++
#undef LOG_DOMAIN
#undef LOG_DOMAIN
#undef LOG_TAG
#undef LOG_TAG
#define LOG_DOMAIN 0x3200 // Service domain. The value ranges from 0xD0000 to 0xDFFFF.
#define LOG_DOMAIN 0x3200 // Global domain, which identifies the service domain.
#define LOG_TAG "MY_TAG"
#define LOG_TAG "MY_TAG" // Global tag, which identifies the module log tag.
```
```
3. Print logs. For example, to print INFO logs, use the following code:
3. Print logs. For example, to print ERROR logs, use the following code:
```c++
```c++
OH_LOG_INFO(LOG_APP,"Failed to visit %{private}s, reason:%{public}d.",url,errno);
OH_LOG_ERROR(LOG_APP,"Failed to visit %{private}s, reason:%{public}d.",url,errno);
```
```
4. View the output log information.
4. View the output log information.
```
```
12-11 12:21:47.579 2695 2695 I A03200/MY_TAG: Failed to visit <private>, reason:11.
12-11 12:21:47.579 2695 2695 E A03200/MY_TAG: Failed to visit <private>, reason:11.
@@ -87,7 +87,7 @@ The development process consists of the following main steps:
...
@@ -87,7 +87,7 @@ The development process consists of the following main steps:
The required model can be downloaded directly or obtained using the model conversion tool.
The required model can be downloaded directly or obtained using the model conversion tool.
- If the downloaded model is in the `.ms` format, you can use it directly for inference. The following uses the **mobilenetv2.ms** model as an example.
- If the downloaded model is in the `.ms` format, you can use it directly for inference. The following uses the **mobilenetv2.ms** model as an example.
- If the downloaded model uses a third-party framework, such as TensorFlow, TensorFlow Lite, Caffe, or ONNX, you can use the [model conversion tool](https://www.mindspore.cn/lite/docs/zh-CN/r1.5/use/downloads.html#id1) to convert it to the `.ms` format.
- If the downloaded model uses a third-party framework, such as TensorFlow, TensorFlow Lite, Caffe, or ONNX, you can use the [model conversion tool](https://www.mindspore.cn/lite/docs/en/r1.5/use/downloads.html#id1) to convert it to the `.ms` format.
2. Create a context, and set parameters such as the number of runtime threads and device type.
2. Create a context, and set parameters such as the number of runtime threads and device type.
@@ -41,7 +41,7 @@ This document gives an overview of the **module.json5** configuration file. To s
...
@@ -41,7 +41,7 @@ This document gives an overview of the **module.json5** configuration file. To s
"entity.system.home"
"entity.system.home"
],
],
"actions":[
"actions":[
"action.system.home"
"ohos.want.action.home"
]
]
}
}
]
]
...
@@ -74,15 +74,15 @@ As shown above, the **module.json5** file contains several tags.
...
@@ -74,15 +74,15 @@ As shown above, the **module.json5** file contains several tags.
| 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|
| 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 value can be **entry** or **feature**.<br>- **entry**: main module of the application.<br>- **feature**: dynamic feature module of the application.| String| No|
| type | Type of the module. The value can be **entry** or **feature**.<br>- **entry**: main module of the application.<br>- **feature**: dynamic feature module of the application.| String| No|
| srcEntrance | Code path corresponding to the module. The value is a string with a maximum of 127 bytes.| String| Yes (initial value: left empty)|
| srcEntrance | 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)|
| 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)|
| process | Process name of the current module. The value is a string with a maximum of 31 bytes. If **process** is configured under **HAP**, all UIAbility, DataShareExtensionAbility, and ServiceExtensionAbility components of the application run in the specified process.<br>**NOTE**<br>This tag applies only to system applications and does not take effect for third-party applications.| String| Yes (initial value: value of **bundleName** under **app** in the **app.json5** file)|
| process | Process name of the current module. The value is a string with a maximum of 31 bytes. If **process** is configured under **HAP**, all UIAbility, DataShareExtensionAbility, and ServiceExtensionAbility components of the application run in the specified process.<br>**NOTE**<br>This tag applies only to system applications and does not take effect for third-party applications.| String| Yes (initial value: value of **bundleName** under **app** in the **app.json5** file)|
| mainElement | Name of the entry UIAbility or ExtensionAbility of the module. The value contains a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| mainElement | Name of the entry UIAbility or ExtensionAbility of the module. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| [deviceTypes](#devicetypes) | Type of the device on which the module can run.| String array| No (can be left empty)|
| [deviceTypes](#devicetypes) | Type of the device on which the module can run.| String array| No (can be left empty)|
| deliveryWithInstall | Whether the HAP file of the module will be installed when the user installs the application.<br>- **true**: The HAP file will be installed when the user installs the application.<br>- **false**: The HAP file will not be installed when the user installs the application.| Boolean| No|
| deliveryWithInstall | Whether the HAP file of the module will be installed when the user installs the application.<br>- **true**: The HAP file will be installed when the user installs the application.<br>- **false**: The HAP file will not be installed when the user installs the application.| Boolean| No|
| installationFree | Whether the module supports the installation-free feature.<br>- **true**: The module supports the installation-free feature and meets installation-free constraints.<br>- **false**: The module does not support the installation-free feature.<br>**NOTE**<br>- If this tag is set to **true** for an entry-type module, it must also be set to **true** for feature-type modules of the same application.<br>- If this tag is set to **false** for an entry-type module, it can be set to **true** or **false** for feature-type modules of the same application based on service requirements.| Boolean| No|
| installationFree | Whether the module supports the installation-free feature.<br>- **true**: The module supports the installation-free feature and meets installation-free constraints.<br>- **false**: The module does not support the installation-free feature.<br>**NOTE**<br>- If this tag is set to **true** for an entry-type module, it must also be set to **true** for feature-type modules of the same application.<br>- If this tag is set to **false** for an entry-type module, it can be set to **true** or **false** for feature-type modules of the same application based on service requirements.| Boolean| No|
| virtualMachine | Type of the target virtual machine (VM) where the module runs. It is used for cloud distribution, such as distribution by the application market and distribution center.<br>If the target VM type is ArkTS engine, the value is **ark**+*version number*. | String| Yes (initial value: automatically inserted when DevEco Studio builds the HAP file)|
| virtualMachine | Type of the target virtual machine (VM) where the module runs. It is used for cloud distribution, such as distribution by the application market and distribution center.<br> If the target VM type is ArkTS engine, the value is **ark**+*version number*.| String| Yes (initial value: automatically inserted when DevEco Studio builds the HAP file)|
| uiSyntax (deprecated)| Syntax type of the JS component defined by the module syntax. This tag is deprecated since API version 9.<br>- **"hml"**: The JS component is developed using HML, CSS, or JS.<br>- **"ets"**: The JS component is developed using ArkTS. | String| Yes (initial value: **"hml"**)|
| uiSyntax (deprecated)| Syntax type of the component defined by the module syntax. This tag is deprecated since API version 9.<br>- **"hml"**: The component is developed using HML, CSS, or JS.<br>- **"ets"**: The component is developed using ArkTS.| String| Yes (initial value: **"hml"**)|
| [pages](#pages)| Profile that represents information about each page in the JS component. The value can contain a maximum of 255 bytes.| String| No in the UIAbility scenario|
| [pages](#pages)| Profile that represents information about each page in the current module. The value can contain a maximum of 255 bytes.| String| No in the UIAbility scenario|
| [metadata](#metadata)| Custom metadata of the module. The setting is valid only for the current module, UIAbility, or ExtensionAbility.| Object array| Yes (initial value: left empty)|
| [metadata](#metadata)| Custom metadata of the module. The setting is valid only for the current module, UIAbility, or ExtensionAbility.| Object array| Yes (initial value: left empty)|
| [abilities](#abilities) | UIAbility configuration of the module, which is valid only for the current UIAbility component.| Object| Yes (initial value: left empty)|
| [abilities](#abilities) | UIAbility configuration of the module, which is valid only for the current UIAbility component.| Object| Yes (initial value: left empty)|
| [extensionAbilities](#extensionabilities) | ExtensionAbility configuration of the module, which is valid only for the current ExtensionAbility component.| Object| Yes (initial value: left empty)|
| [extensionAbilities](#extensionabilities) | ExtensionAbility configuration of the module, which is valid only for the current ExtensionAbility component.| Object| Yes (initial value: left empty)|
...
@@ -157,7 +157,7 @@ The **metadata** tag represents the custom metadata of the HAP file. The tag val
...
@@ -157,7 +157,7 @@ The **metadata** tag represents the custom metadata of the HAP file. The tag val
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| name | Name of the data item. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| name | Name of the data item. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| value | Value of the data item. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| value | Value of the data item. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| resource | Custom data format. The value is a resource index. It contains a maximum of 255 bytes. | String| Yes (initial value: left empty)|
| resource | Custom data format. The value is a resource index that identifies the data. It contains a maximum of 255 bytes.| String| Yes (initial value: left empty)|
```json
```json
...
@@ -210,14 +210,14 @@ The **abilities** tag describes the UIAbility configuration of the component, wh
...
@@ -210,14 +210,14 @@ The **abilities** tag describes the UIAbility configuration of the component, wh
| name | Name of the UIAbility component, which must be unique in the entire application. The value is a string with a maximum of 127 bytes.| String| No|
| name | Name of the UIAbility component, which must be unique in the entire application. The value is a string with a maximum of 127 bytes.| String| No|
| srcEntrance | Code path of the entry UIAbility component. The value is a string with a maximum of 127 bytes.| String| No|
| srcEntrance | Code path of the entry UIAbility component. The value is a string with a maximum of 127 bytes.| String| No|
| [launchType](../application-models/uiability-launch-type.md) | Launch type of the UIAbility component. The options are as follows:<br>- **standard**: A new UIAbility instance is created each time the UIAbility component is started.<br>- **singleton**: A new UIAbility instance is created only when the UIAbility component is started for the first time.<br>- **specified**: You can determine whether to create a new UIAbility instance when the application is running.| String| Yes (initial value: **"singleton"**)|
| [launchType](../application-models/uiability-launch-type.md) | Launch type of the UIAbility component. The options are as follows:<br>- **standard**: A new UIAbility instance is created each time the UIAbility component is started.<br>- **singleton**: A new UIAbility instance is created only when the UIAbility component is started for the first time.<br>- **specified**: You can determine whether to create a new UIAbility instance when the application is running.| String| Yes (initial value: **"singleton"**)|
| description | Description of the UIAbility component. The value is a string with a maximum of 255 bytes or a resource index to the description in multiple languages.| String| Yes (initial value: left empty)|
| description | Description of the UIAbility component. The value is a string with a maximum of 255 bytes or a resource index to the description in multiple languages.| String| Yes (initial value: left empty)|
| icon | Icon of the UIAbility component. The value is an icon resource index.<br/>If **UIAbility** is set to **MainElement** of the current module, this attribute is mandatory. | String| Yes (initial value: left empty) |
| icon | Icon of the UIAbility component. The value is an icon resource index.<br/>If **UIAbility** is set to **MainElement**, this attribute is mandatory. | String| Yes (initial value: left empty) |
| label | Name of the UIAbility component displayed to users. The value is a string resource index.<br>If **UIAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| No|
| label | Name of the UIAbility component displayed to users. The value is a string resource index.<br>If **UIAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| No|
| permissions | Permissions required for another application to access the UIAbility component.<br>The value is an array of permission names predefined by the system, generally in the reverse domain name notation. It contains a maximum of 255 bytes.| String array| Yes (initial value: left empty)|
| permissions | Permissions required for another application to access the UIAbility component.<br>The value is an array of permission names predefined by the system, generally in the reverse domain name notation. It contains a maximum of 255 bytes.| String array| Yes (initial value: left empty)|
| [metadata](#metadata)| Metadata information of the UIAbility component.| Object array| Yes (initial value: left empty)|
| [metadata](#metadata)| Metadata information of the UIAbility component.| Object array| Yes (initial value: left empty)|
| visible | Whether the UIAbility component can be called by other applications.<br>- **true**: The UIAbility component can be called by other applications.<br>- **false**: The UIAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)|
| visible | Whether the UIAbility component can be called by other applications.<br>- **true**: The UIAbility component can be called by other applications.<br>- **false**: The UIAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)|
| continuable | Whether the UIAbility component can be [migrated](../application-models/hop-cross-device-migration.md).<br>- **true**: The UIAbility component can be migrated.<br>- **false**: The UIAbility component cannot be migrated.| Boolean| Yes (initial value: **false**)|
| continuable | Whether the UIAbility component can be [migrated](../application-models/hop-cross-device-migration.md).<br>- **true**: The UIAbility component can be migrated.<br>- **false**: The UIAbility component cannot be migrated.| Boolean| Yes (initial value: **false**)|
| [skills](#skills) | Feature set of [wants](../application-models/want-overview.md) that can be received by the current UIAbility or ExtensionAbility component.<br>Configuring rule:<br>- For HAPs of the entry type, you can configure multiple **skills** attributes with the entry capability for an OpenHarmony application. (A **skills** attribute with the entry capability is the one that has **action.system.home** and **entity.system.home** configured.)<br>- For HAPs of the feature type, you can configure **skills** attributes with the entry capability for an OpenHarmony application, but not for an OpenHarmony service.| Object array| Yes (initial value: left empty)|
| [skills](#skills) | Feature set of [wants](../application-models/want-overview.md) that can be received by the current UIAbility or ExtensionAbility component.<br>Configuring rule:<br>- For HAPs of the entry type, you can configure multiple **skills** attributes with the entry capability for an OpenHarmony application. (A **skills** attribute with the entry capability is the one that has **ohos.want.action.home** and **entity.system.home** configured.)<br>- For HAPs of the feature type, you can configure **skills** attributes with the entry capability for an OpenHarmony application, but not for an OpenHarmony service.| Object array| Yes (initial value: left empty)|
| backgroundModes | Continuous tasks of the UIAbility component.<br>Continuous tasks are classified into the following types:<br>- **dataTransfer**: service for downloading, backing up, sharing, or transferring data from the network or peer devices.<br>- **audioPlayback**: audio playback service.<br>- **audioRecording**: audio recording service.<br>- **location**: location and navigation services.<br>- **bluetoothInteraction**: Bluetooth scanning, connection, and transmission services (wearables).<br>- **multiDeviceConnection**: multi-device interconnection service.<br>- **wifiInteraction**: Wi-Fi scanning, connection, and transmission services (as used in the Multi-screen Collaboration and clone features)<br>- **voip**: voice/video call and VoIP services.<br>- **taskKeeping**: computing service.| String array| Yes (initial value: left empty)|
| backgroundModes | Continuous tasks of the UIAbility component.<br>Continuous tasks are classified into the following types:<br>- **dataTransfer**: service for downloading, backing up, sharing, or transferring data from the network or peer devices.<br>- **audioPlayback**: audio playback service.<br>- **audioRecording**: audio recording service.<br>- **location**: location and navigation services.<br>- **bluetoothInteraction**: Bluetooth scanning, connection, and transmission services (wearables).<br>- **multiDeviceConnection**: multi-device interconnection service.<br>- **wifiInteraction**: Wi-Fi scanning, connection, and transmission services (as used in the Multi-screen Collaboration and clone features)<br>- **voip**: voice/video call and VoIP services.<br>- **taskKeeping**: computing service.| String array| Yes (initial value: left empty)|
| startWindowIcon | Index to the icon file of the UIAbility component startup page. Example: **$media:icon**.<br>The value is a string with a maximum of 255 bytes.| String| No|
| startWindowIcon | Index to the icon file of the UIAbility component startup page. Example: **$media:icon**.<br>The value is a string with a maximum of 255 bytes.| String| No|
| startWindowBackground | Index to the background color resource file of the UIAbility component startup page. Example: **$color:red**.<br>The value is a string with a maximum of 255 bytes.| String| No|
| startWindowBackground | Index to the background color resource file of the UIAbility component startup page. Example: **$color:red**.<br>The value is a string with a maximum of 255 bytes.| String| No|
...
@@ -250,7 +250,7 @@ Example of the **abilities** structure:
...
@@ -250,7 +250,7 @@ Example of the **abilities** structure:
"visible":true,
"visible":true,
"continuable":true,
"continuable":true,
"skills":[{
"skills":[{
"actions":["action.system.home"],
"actions":["ohos.want.action.home"],
"entities":["entity.system.home"],
"entities":["entity.system.home"],
"uris":[]
"uris":[]
}],
}],
...
@@ -298,11 +298,11 @@ The **skills** tag represents the feature set of [wants](../application-models/w
...
@@ -298,11 +298,11 @@ The **skills** tag represents the feature set of [wants](../application-models/w
| Name| Description| Data Type| Initial Value Allowed|
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| scheme | Scheme of the URI, such as HTTP, HTTPS, file, and FTP.| String| Yes when only **type** is set in **uris** (initial value: left empty)|
| scheme | Scheme of the URI, such as HTTP, HTTPS, file, and FTP.| String| Yes when only **type** is set in **uris** (initial value: left empty)|
| host | Host address of the URI. This attribute is valid only when **schema** is set. Common methods:<br>- domain name, for example, **example.com**.<br>- IP address, for example, **10.10.10.1**.| String| Yes (initial value: left empty)|
| host | Host address of the URI. This attribute is valid only when **schema** is set. Common methods:<br>- domain name, for example, **example.com**.<br>- IP address, for example, **10.10.10.1**.| String| Yes (initial value: left empty)|
| port | Port number of the URI. For example, the default HTTP port number is 80, the default HTTPS port number is 443, and the default FTP port number is 21. This attribute is valid only when both **scheme** and **host** are set.| String| Yes (initial value: left empty)|
| port | Port number of the URI. For example, the default HTTP port number is 80, the default HTTPS port number is 443, and the default FTP port number is 21. This attribute is valid only when both **scheme** and **host** are set.| String| Yes (initial value: left empty)|
| path \| pathStartWith \| pathRegex | Path of the URI. **path**, **pathStartWith**, and **pathRegex** represent different matching modes between the paths in the URI and the want. Set any one of them as needed. **path** indicates full matching, **pathStartWith** indicates prefix matching, and **pathRegex** indicates regular expression matching. This attribute is valid only when both **scheme** and **host** are set.| String| Yes (initial value: left empty)|
| path \| pathStartWith \| pathRegex | Path of the URI. **path**, **pathStartWith**, and **pathRegex** represent different matching modes between the paths in the URI and the want. Set any one of them as needed. **path** indicates full matching, **pathStartWith** indicates prefix matching, and **pathRegex** indicates regular expression matching. This attribute is valid only when both **scheme** and **host** are set.| String| Yes (initial value: left empty)|
| type | Data type that matches the want. The value compiles with the [Multipurpose Internet Mail Extensions (MIME)](https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com %E3%80%82) type specification. This attribute can be configured together with **scheme** or be configured separately. | String| Yes (initial value: left empty)|
| type | Data type that matches the want. The value compiles with the Multipurpose Internet Mail Extensions (MIME) type specification. This attribute can be configured together with **scheme** or be configured separately.| String| Yes (initial value: left empty)|
Example of the **skills** structure:
Example of the **skills** structure:
...
@@ -314,7 +314,7 @@ Example of the **skills** structure:
...
@@ -314,7 +314,7 @@ Example of the **skills** structure:
"skills":[
"skills":[
{
{
"actions":[
"actions":[
"action.system.home"
"ohos.want.action.home"
],
],
"entities":[
"entities":[
"entity.system.home"
"entity.system.home"
...
@@ -346,15 +346,15 @@ The **extensionAbilities** tag represents the configuration of extensionAbilitie
...
@@ -346,15 +346,15 @@ The **extensionAbilities** tag represents the configuration of extensionAbilitie
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| name | Name of the ExtensionAbility component. The value is a string with a maximum of 127 bytes. The name must be unique in the entire application.| String| No|
| name | Name of the ExtensionAbility component. The value is a string with a maximum of 127 bytes. The name must be unique in the entire application.| String| No|
| srcEntrance | Code path corresponding to the ExtensionAbility component. The value is a string with a maximum of 127 bytes.| String| No|
| srcEntrance | Code path corresponding to the ExtensionAbility component. The value is a string with a maximum of 127 bytes.| String| No|
| description | Description of the ExtensionAbility component. The value is a string with a maximum of 255 bytes or a resource index to the description.| String| Yes (initial value: left empty)|
| description | Description of the ExtensionAbility component. The value is a string with a maximum of 255 bytes or a resource index to the description.| String| Yes (initial value: left empty)|
| icon | Icon of the ExtensionAbility component. The value is the index to an icon resource file. If **ExtensionAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| Yes (initial value: left empty)|
| icon | Icon of the ExtensionAbility component. The value is an icon resource index. If **ExtensionAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| Yes (initial value: left empty)|
| label | Name of the ExtensionAbility component displayed to users. The value is the index to a string resource.<br>**NOTE**<br>If **ExtensionAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| No|
| label | Name of the ExtensionAbility component displayed to users. The value is a string resource index.<br>**NOTE**<br>If **ExtensionAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| No|
| type | Type of the ExtensionAbility component. The options are as follows:<br>- **form**: ExtensionAbility of a widget.<br>- **workScheduler**: ExtensionAbility of a Work Scheduler task.<br>- **inputMethod**: ExtensionAbility of an input method.<br>- **service**: service component running in the background.<br>- **accessibility**: ExtensionAbility of an accessibility feature.<br>- **dataShare**: ExtensionAbility for data sharing.<br>- **fileShare**: ExtensionAbility for file sharing.<br>- **staticSubscriber**: ExtensionAbility for static broadcast.<br>- **wallpaper**: ExtensionAbility of the wallpaper.<br>- **backup**: ExtensionAbility for data backup.<br>- **window**: ExtensionAbility of a window. This type of ExtensionAbility creates a window during startup for which you can develop the GUI. The window is then combined with other application windows through **abilityComponent**.<br>- **thumbnail**: ExtensionAbility for obtaining file thumbnails. You can provide thumbnails for files of customized file types.<br>- **preview**: ExtensionAbility for preview. This type of ExtensionAbility can parse the file and display it in a window. You can combine the window with other application windows.<br>**NOTE**<br>The **service** and **dataShare** types apply only to system applications and do not take effect for third-party applications. | String| No|
| type | Type of the ExtensionAbility component. The options are as follows:<br>- **form**: ExtensionAbility of a widget.<br>- **workScheduler**: ExtensionAbility of a Work Scheduler task.<br>- **inputMethod**: ExtensionAbility of an input method.<br>- **service**: service component running in the background.<br>- **accessibility**: ExtensionAbility of an accessibility feature.<br>- **dataShare**: ExtensionAbility for data sharing.<br>- **fileShare**: ExtensionAbility for file sharing.<br>- **staticSubscriber**: ExtensionAbility for static broadcast.<br>- **wallpaper**: ExtensionAbility of the wallpaper.<br>- **backup**: ExtensionAbility for data backup.<br>- **window**: ExtensionAbility of a window. This type of ExtensionAbility creates a window during startup for which you can develop the GUI. The window is then combined with other application windows through **abilityComponent**.<br>- **thumbnail**: ExtensionAbility for obtaining file thumbnails. You can provide thumbnails for files of customized file types.<br>- **preview**: ExtensionAbility for preview. This type of ExtensionAbility can parse the file and display it in a window. You can combine the window with other application windows.<br>**NOTE**<br>The **service** and **dataShare** types apply only to system applications and do not take effect for third-party applications. | String| No|
| permissions | Permissions required for another application to access the ExtensionAbility component.<br>The value is generally in the reverse domain name notation and contains a maximum of 255 bytes. It is an array of permission names predefined by the system or customized. The name of a customized permission must be the same as the **name** value of a permission defined in the **defPermissions** attribute.| String array| Yes (initial value: left empty)|
| permissions | Permissions required for another application to access the ExtensionAbility component.<br>The value is generally in the reverse domain name notation and contains a maximum of 255 bytes. It is an array of permission names predefined by the system or customized. The name of a customized permission must be the same as the **name** value of a permission defined in the **defPermissions** attribute.| String array| Yes (initial value: left empty)|
| 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 **type** of the ExtensionAbility component is set to **dataShare**.| String| Yes (initial value: left empty)|
| 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 **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 **action.system.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-type package of an OpenHarmony application, but not for an OpenHarmony service. | Array| 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-type 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)|
| [metadata](#metadata)| Metadata of the ExtensionAbility component.| Object| Yes (initial value: left empty)|
| visible | 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**)|
| visible | 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**)|
Example of the **extensionAbilities** structure:
Example of the **extensionAbilities** structure:
...
@@ -401,7 +401,7 @@ The **requestPermissions** tage represents a set of permissions that the applica
...
@@ -401,7 +401,7 @@ The **requestPermissions** tage represents a set of permissions that the applica
| name | Permission name. This attribute is mandatory.| String| Custom| –|
| name | Permission name. This attribute is mandatory.| String| Custom| –|
| reason | Reason for requesting the permission. This attribute is mandatory when the permission to request is **user_grant**.<br>**NOTE**<br>If the permission to request is **user_grant**, this attribute is required for the application to be released to the application market, and multi-language adaptation is required. | String| Resource reference of the string type in $string: \*\*\* format| A null value|
| reason | Reason for requesting the permission. This attribute is mandatory when the permission to request is **user_grant**.<br>**NOTE**<br>If the permission to request is **user_grant**, this attribute is required for the application to be released to the application market, and multi-language adaptation is required. | String| Resource reference of the string type in $string: \*\*\* format| A null value|
| usedScene | Scene under which the permission is used. It consists of the **abilities** and **when** sub-attributes. Multiple abilities can be configured.<br>**NOTE**<br>This attribute is optional by default. If the permission to request is **user_grant**, the **abilities** sub-attribute is mandatory and **when** is optional.| **abilities**: string array<br>**when**: string| **abilities**: array of names of UIAbility or ExtensionAbility components<br>**when**: **inuse** or **always**| **abilities**: null<br>**when**: null|
| usedScene | Scene under which the permission is used. It consists of the **abilities** and **when** sub-attributes. Multiple abilities can be configured.<br>**NOTE**<br>This attribute is optional by default. If the permission to request is **user_grant**, the **abilities** sub-attribute is mandatory and **when** is optional.| **abilities**: string array<br>**when**: string| **abilities**: array of names of UIAbility or ExtensionAbility components<br>**when**: **inuse** or **always**| **abilities**: null<br>**when**: null|
Example of the **requestPermissions** structure:
Example of the **requestPermissions** structure:
...
@@ -440,7 +440,7 @@ The **shortcut** information is identified in **metadata**, where:
...
@@ -440,7 +440,7 @@ The **shortcut** information is identified in **metadata**, where:
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| shortcutId | ID of the shortcut. The value is a string with a maximum of 63 bytes.| String| No|
| shortcutId | ID of the shortcut. The value is a string with a maximum of 63 bytes.| String| No|
| label | Label of the shortcut, that is, the text description displayed for the shortcut. The value can be a string or a resource index to the label, with a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| label | Label of the shortcut, that is, the text description displayed for the shortcut. The value can be a string or a resource index to the label, with a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| icon | Icon of the shortcut. The value is an icon resource index.| String| Yes (initial value: left empty)|
| icon | Icon of the shortcut. The value is an icon resource index.| String| Yes (initial value: left empty)|
| [wants](../application-models/want-overview.md) | Wants to which the shortcut points. Each want consists of the **bundleName** and **abilityName** sub-attributes.<br>**bundleName**: target bundle name of the shortcut. The value is a string.<br>**abilityName**: target component name of the shortcut. The value is a string.| Object| Yes (initial value: left empty)|
| [wants](../application-models/want-overview.md) | Wants to which the shortcut points. Each want consists of the **bundleName** and **abilityName** sub-attributes.<br>**bundleName**: target bundle name of the shortcut. The value is a string.<br>**abilityName**: target component name of the shortcut. The value is a string.| Object| Yes (initial value: left empty)|
...
@@ -481,7 +481,7 @@ The **shortcut** information is identified in **metadata**, where:
...
@@ -481,7 +481,7 @@ The **shortcut** information is identified in **metadata**, where:
"entity.system.home"
"entity.system.home"
],
],
"actions":[
"actions":[
"action.system.home"
"ohos.want.action.home"
]
]
}
}
],
],
...
@@ -509,8 +509,8 @@ The **distroFilter** tag defines the rules for distributing HAP files based on d
...
@@ -509,8 +509,8 @@ The **distroFilter** tag defines the rules for distributing HAP files based on d
| apiVersion | Supported API versions.| Object array| Yes (initial value: left empty)|
| apiVersion | Supported API versions.| Object array| Yes (initial value: left empty)|
| screenWindow | Supported window resolutions for when the application is running. This attribute applies only to the lite wearables.| Object array| Yes (initial value: left empty)|
| screenWindow | Supported window resolutions for when the application is running. This attribute applies only to the lite wearables.| Object array| Yes (initial value: left empty)|
| screenDensity | Pixel density of the screen, in dots per inch (DPI). This attribute is optional. The options are as follows:<br>- **sdpi**: small-scale DPI. This value is applicable to devices with a DPI range of (0, 120].<br>- **mdpi**: medium-scale DPI. This value is applicable to devices with a DPI range of (120, 160].<br>- **ldpi**: large-scale DPI. This value is applicable to devices with a DPI range of (160, 240].<br>- **xldpi**: extra-large-scale DPI. This value is applicable to devices with a DPI range of (240, 320].<br>- **xxldpi**: extra-extra-large-scale DPI. This value is applicable to devices with a DPI range of (320, 480].<br>- **xxxldpi**: extra-extra-extra-large-scale DPI. This value is applicable to devices with a DPI range of (480, 640]. | Object array| Yes (initial value: left empty)|
| screenDensity | Pixel density of the screen, in dots per inch (DPI). This attribute is optional. The value options are as follows:<br>- **sdpi**: small-scale DPI. This value is applicable to devices with a DPI range of (0, 120].<br>- **mdpi**: medium-scale DPI. This value is applicable to devices with a DPI range of (120, 160].<br>- **ldpi**: large-scale DPI. This value is applicable to devices with a DPI range of (160, 240].<br>- **xldpi**: extra-large-scale DPI. This value is applicable to devices with a DPI range of (240, 320].<br>- **xxldpi**: extra-extra-large-scale DPI. This value is applicable to devices with a DPI range of (320, 480].<br>- **xxxldpi**: extra-extra-extra-large-scale DPI. This value is applicable to devices with a DPI range of (480, 640].| Object array| Yes (initial value: left empty)|
| countryCode | Code of the country or region to which the application is to be distributed. The value is subject to the [ISO-3166-1](https://developer.harmonyos.com/en/docs/documentation/doc-guides/basic-resource-file-categories-0000001052066099) standard. Enumerated definitions of multiple countries and regions are supported.| Object array| Yes (initial value: left empty)|
| countryCode | Code of the country or region to which the application is to be distributed. The value is subject to the ISO-3166-1 standard. Enumerated definitions of multiple countries and regions are supported.| Object array| Yes (initial value: left empty)|
**Table 10** apiVersion
**Table 10** apiVersion
...
@@ -619,7 +619,7 @@ The **testRunner** tag represents the supported test runner.
...
@@ -619,7 +619,7 @@ The **testRunner** tag represents the supported test runner.
| Name| Description| Data Type| Initial Value Allowed|
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| name | Name of the test runner object. The value is a string with a maximum of 255 bytes.| String| No|
| name | Name of the test runner object. The value is a string with a maximum of 255 bytes.| String| No|
| srcPath | Code path of the test runner. The value is a string with a maximum of 255 bytes.| String| No|
| srcPath | Code path of the test runner. The value is a string with a maximum of 255 bytes.| String| No|
| target | AccessibilityElement | Yes | No | Target component where the event occurs.|
| target | [AccessibilityElement](js-apis-inner-application-accessibilityExtensionContext.md#accessibilityelement9) | Yes | No | Target component where the event occurs.|
| timeStamp | number | Yes | No | Timestamp of the event. |
| timeStamp | number | Yes | No | Timestamp of the event. |
## GestureType
## GestureType
...
@@ -78,8 +78,8 @@ Enumerates the touch guide event types.
...
@@ -78,8 +78,8 @@ Enumerates the touch guide event types.
| Name | Description |
| Name | Description |
| ---------- | ------------ |
| ---------- | ------------ |
| touchBegin | Start of touch in touch guide mode.|
| touchBegin | Start of touch in touch guide mode.|
| touchEnd | End of touch in touch guide mode.|
| touchEnd | End of touch in touch guide mode.|
## AccessibilityExtensionAbility.onConnect
## AccessibilityExtensionAbility.onConnect
...
@@ -137,7 +137,7 @@ Called when an event that matches the specified bundle and event type occurs. In
...
@@ -137,7 +137,7 @@ Called when an event that matches the specified bundle and event type occurs. In
The **batteryInfo** module provides APIs for querying the charger type, battery health status, and battery charging status.
The **batteryInfo** module provides APIs for querying the charger type, battery health status, and battery charging status.
> **NOTE**<br>
> **NOTE**
>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
| batterySOC | number | Yes | No | Battery state of charge (SoC) of the device, in unit of percentage. |
| batterySOC | number | Yes | No | Battery state of charge (SoC) of the device, in unit of percentage. |
| chargingStatus | [BatteryChargeState](#batterychargestate) | Yes | No | Battery charging state of the device. |
| chargingStatus | [BatteryChargeState](#batterychargestate) | Yes | No | Battery charging status of the device. |
| healthStatus | [BatteryHealthState](#batteryhealthstate) | Yes | No | Battery health state of the device. |
| healthStatus | [BatteryHealthState](#batteryhealthstate) | Yes | No | Battery health status of the device. |
| pluggedType | [BatteryPluggedType](#batterypluggedtype) | Yes | No | Charger type of the device. |
| pluggedType | [BatteryPluggedType](#batterypluggedtype) | Yes | No | Charger type of the device. |
| voltage | number | Yes | No | Battery voltage of the device, in unit of microvolt. |
| voltage | number | Yes | No | Battery voltage of the device, in unit of microvolt. |
| technology | string | Yes | No | Battery technology of the device. |
| technology | string | Yes | No | Battery technology of the device. |
| batteryTemperature | number | Yes | No | Battery temperature of the device, in unit of 0.1°C. |
| batteryTemperature | number | Yes | No | Battery temperature of the device, in unit of 0.1°C. |
| isBatteryPresent<sup>7+</sup> | boolean | Yes | No | Whether the battery is supported or present. |
| isBatteryPresent<sup>7+</sup> | boolean | Yes | No | Whether the battery is supported or present. |
| batteryCapacityLevel<sup>9+</sup> | [BatteryCapacityLevel](#batterycapacitylevel9) | Yes | No | Battery level of the device. |
| batteryCapacityLevel<sup>9+</sup> | [BatteryCapacityLevel](#batterycapacitylevel9) | Yes | No | Battery level of the device. |
| estimatedRemainingChargeTime<sup>9+</sup> | number | Yes | No | Estimated time for fully charging the current device, in unit of milliseconds. |
| estimatedRemainingChargeTime<sup>9+</sup> | number | Yes | No | Estimated time for fully charging the current device, in unit of milliseconds. **System API**: This is a system API. |
| totalEnergy<sup>9+</sup> | number | Yes | No | Total battery capacity of the device, in unit of mAh. This is a system API. |
| totalEnergy<sup>9+</sup> | number | Yes | No | Total battery capacity of the device, in unit of mAh. **System API**: This is a system API. |
| nowCurrent<sup>9+</sup> | number | Yes | No | Battery current of the device, in unit of mA. This is a system API. |
| nowCurrent<sup>9+</sup> | number | Yes | No | Battery current of the device, in unit of mA. **System API**: This is a system API. |
| remainingEnergy<sup>9+</sup> | number | Yes | No | Remaining battery capacity of the device, in unit of mAh. This is a system API.|
| remainingEnergy<sup>9+</sup> | number | Yes | No | Remaining battery capacity of the device, in unit of mAh. **System API**: This is a system API.|
# @ohos.enterprise.deviceControl (Device Control Management)
The **deviceControl** module provides APIs for device control, which can only be called by device administrator applications.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the setting is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
Obtains information about all wants with **extension** set to **fileAcesss** in the system. A want is a basic communication component used to start services. This API uses a promise to return the result.
Obtains information about all wants with **extension** set to **fileAccess** in the system. A want is a basic communication component used to start services. This API uses a promise to return the result.
Obtains information about all wants with **extension** set to **fileAcesss** in the system. A want is a basic communication component used to start services. This API uses an asynchronous callback to return the result.
Obtains information about all wants with **extension** set to **fileAccess** in the system. A want is a basic communication component used to start services. This API uses an asynchronous callback to return the result.
console.error("createFileAccessHelper interface returns an undefined object");
console.error("createFileAccessHelper interface returns an undefined object");
...
@@ -167,8 +167,7 @@ Synchronously creates a **Helper** object to connect to all file management serv
...
@@ -167,8 +167,7 @@ Synchronously creates a **Helper** object to connect to all file management serv
getRoots( ) : Promise<RootIterator>
getRoots( ) : Promise<RootIterator>
Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses a promise to return a **RootIterator** object, which
Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses a promise to return a **RootIterator** object, which returns [RootInfo](#rootinfo) by using [next()](#rootiteratornext).
returns [RootInfo](#rootinfo) by using [next()](#rootiteratornext).
Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses an asynchronous callback to return the result.
Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses an asynchronous callback to return the result. The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo) through [next()](#rootiteratornext).
The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo) through [next()](#rootiteratornext).
Uploads files. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 9 and is deprecated since API version 9. You are advised to use [request.uploadFile<sup>9+</sup>](#requestuploadfile9).
console.error('Failed to request the upload. Cause: '+JSON.stringify(err));
return;
}
uploadTask=data;
});
```
## UploadTask
## UploadTask
Implements file uploads. Before using any APIs of this class, you must obtain an **UploadTask** object through [request.uploadFile<sup>9+</sup>](#requestuploadfile9) in promise mode or [request.uploadFile<sup>9+</sup>](#requestuploadfile9-1) in callback mode.
Implements file uploads. Before using any APIs of this class, you must obtain an **UploadTask** object through [request.uploadFile<sup>9+</sup>](#requestuploadfile9) in promise mode or [request.uploadFile<sup>9+</sup>](#requestuploadfile9-1) in callback mode.
...
@@ -398,7 +309,7 @@ Subscribes to an upload event. This API uses an asynchronous callback to return
...
@@ -398,7 +309,7 @@ Subscribes to an upload event. This API uses an asynchronous callback to return
| type | string | Yes| Type of the event to subscribe to. The value is **'progress'** (upload progress).|
| type | string | Yes| Type of the event to subscribe to. The value is **'progress'** (upload progress).|
| callback | function | Yes| Callback for the upload progress event.|
| callback | function | Yes| Callback for the upload progress event.|
Parameters of the callback function
Parameters of the callback function
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -432,7 +343,7 @@ Subscribes to an upload event. This API uses an asynchronous callback to return
...
@@ -432,7 +343,7 @@ Subscribes to an upload event. This API uses an asynchronous callback to return
| type | string | Yes| Type of the event to subscribe to. The value is **'headerReceive'** (response header).|
| type | string | Yes| Type of the event to subscribe to. The value is **'headerReceive'** (response header).|
| callback | function | Yes| Callback for the HTTP Response Header event.|
| callback | function | Yes| Callback for the HTTP Response Header event.|
Parameters of the callback function
Parameters of the callback function
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -465,7 +376,7 @@ Subscribes to an upload event. This API uses an asynchronous callback to return
...
@@ -465,7 +376,7 @@ Subscribes to an upload event. This API uses an asynchronous callback to return
| type | string | Yes| Type of the event to subscribe to. The value **'complete'** means the upload completion event, and **'fail'** means the upload failure event.|
| type | string | Yes| Type of the event to subscribe to. The value **'complete'** means the upload completion event, and **'fail'** means the upload failure event.|
| callback | Callback<Array<TaskState>> | Yes| Callback used to return the result.|
| callback | Callback<Array<TaskState>> | Yes| Callback used to return the result.|
Parameters of the callback function
Parameters of the callback function
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -507,7 +418,7 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret
...
@@ -507,7 +418,7 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret
| type | string | Yes| Type of the event to unsubscribe from. The value is **'progress'** (upload progress).|
| type | string | Yes| Type of the event to unsubscribe from. The value is **'progress'** (upload progress).|
| callback | function | No| Callback for the upload progress event.|
| callback | function | No| Callback for the upload progress event.|
Parameters of the callback function
Parameters of the callback function
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -541,7 +452,7 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret
...
@@ -541,7 +452,7 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret
| type | string | Yes| Type of the event to unsubscribe from. The value is **'headerReceive'** (response header).|
| type | string | Yes| Type of the event to unsubscribe from. The value is **'headerReceive'** (response header).|
| callback | function | No| Callback for the HTTP Response Header event.|
| callback | function | No| Callback for the HTTP Response Header event.|
Parameters of the callback function
Parameters of the callback function
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -573,7 +484,7 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret
...
@@ -573,7 +484,7 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret
| type | string | Yes| Type of the event to subscribe to. The value **'complete'** means the upload completion event, and **'fail'** means the upload failure event.|
| type | string | Yes| Type of the event to subscribe to. The value **'complete'** means the upload completion event, and **'fail'** means the upload failure event.|
| callback | Callback<Array<TaskState>> | No| Callback used to return the result.|
| callback | Callback<Array<TaskState>> | No| Callback used to return the result.|
Parameters of the callback function
Parameters of the callback function
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -952,82 +863,6 @@ Downloads files. This API uses an asynchronous callback to return the result.
...
@@ -952,82 +863,6 @@ Downloads files. This API uses an asynchronous callback to return the result.
Downloads files. This API uses a promise to return the result.
> **NOTE**
>
> This API is supported since API version 9 and is deprecated since API version 9. You are advised to use [request.downloadFile<sup>9+</sup>](#requestdownloadfile9).
console.error('Failed to request the download. Cause: '+JSON.stringify(err));
return;
}
downloadTask=data;
});
```
## DownloadTask
## DownloadTask
Implements file downloads. Before using any APIs of this class, you must obtain a **DownloadTask** object through [request.downloadFile<sup>9+</sup>](#requestdownloadfile9) in promise mode or [request.downloadFile<sup>9+</sup>](#requestdownloadfile9-1) in callback mode.
Implements file downloads. Before using any APIs of this class, you must obtain a **DownloadTask** object through [request.downloadFile<sup>9+</sup>](#requestdownloadfile9) in promise mode or [request.downloadFile<sup>9+</sup>](#requestdownloadfile9-1) in callback mode.
...
@@ -1050,7 +885,7 @@ Subscribes to a download event. This API uses an asynchronous callback to return
...
@@ -1050,7 +885,7 @@ Subscribes to a download event. This API uses an asynchronous callback to return
| type | string | Yes| Type of the event to subscribe to. The value is **'progress'** (download progress).|
| type | string | Yes| Type of the event to subscribe to. The value is **'progress'** (download progress).|
| callback | function | Yes| Callback for the download progress event.|
| callback | function | Yes| Callback for the download progress event.|
Parameters of the callback function
Parameters of the callback function
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -1084,7 +919,7 @@ Unsubscribes from a download event. This API uses an asynchronous callback to re
...
@@ -1084,7 +919,7 @@ Unsubscribes from a download event. This API uses an asynchronous callback to re
| type | string | Yes| Type of the event to unsubscribe from. The value is **'progress'** (download progress).|
| type | string | Yes| Type of the event to unsubscribe from. The value is **'progress'** (download progress).|
| callback | function | No| Callback for the download progress event.|
| callback | function | No| Callback for the download progress event.|
Parameters of the callback function
Parameters of the callback function
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -1172,7 +1007,7 @@ Subscribes to the download task failure event. This API uses an asynchronous cal
...
@@ -1172,7 +1007,7 @@ Subscribes to the download task failure event. This API uses an asynchronous cal
| type | string | Yes| Type of the event to subscribe to. The value is **'fail'** (download failure).|
| type | string | Yes| Type of the event to subscribe to. The value is **'fail'** (download failure).|
| callback | function | Yes| Callback for the download task failure event.|
| callback | function | Yes| Callback for the download task failure event.|
Parameters of the callback function
Parameters of the callback function
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -1205,7 +1040,7 @@ Unsubscribes from the download task failure event. This API uses an asynchronous
...
@@ -1205,7 +1040,7 @@ Unsubscribes from the download task failure event. This API uses an asynchronous
| type | string | Yes| Type of the event to unsubscribe from. The value is **'fail'** (download failure).|
| type | string | Yes| Type of the event to unsubscribe from. The value is **'fail'** (download failure).|
| callback | function | No| Callback for the download task failure event.|
| callback | function | No| Callback for the download task failure event.|
Parameters of the callback function
Parameters of the callback function
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
...
@@ -1265,7 +1100,7 @@ Deletes this download task. This API uses an asynchronous callback to return the
...
@@ -1265,7 +1100,7 @@ Deletes this download task. This API uses an asynchronous callback to return the
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<boolean> | Yes| Callback used to return the task deletion result.|
| callback | AsyncCallback<boolean> | Yes| Callback used to return the task deletion result.|
@@ -47,7 +47,7 @@ Provides data items for setting the display effects.
...
@@ -47,7 +47,7 @@ Provides data items for setting the display effects.
| ANIMATOR_DURATION_SCALE | string | Yes | Yes | Scale factor for the animation duration. This affects the start delay and duration of all such animations.<br>If the value is **0**, the animation ends immediately. The default value is **1**.|
| ANIMATOR_DURATION_SCALE | string | Yes | Yes | Scale factor for the animation duration. This affects the start delay and duration of all such animations.<br>If the value is **0**, the animation ends immediately. The default value is **1**.|
| TRANSITION_ANIMATION_SCALE | string | Yes | Yes | Scale factor for transition animations.<br>The value **0** indicates that the transition animations are disabled. |
| TRANSITION_ANIMATION_SCALE | string | Yes | Yes | Scale factor for transition animations.<br>The value **0** indicates that the transition animations are disabled. |
| WINDOW_ANIMATION_SCALE | string | Yes | Yes | Scale factor for normal window animations.<br>The value **0** indicates that window animations are disabled. |
| WINDOW_ANIMATION_SCALE | string | Yes | Yes | Scale factor for normal window animations.<br>The value **0** indicates that window animations are disabled. |
| DISPLAY_INVERSION_STATUS | string | Yes | Yes | Whether display color inversion is enabled.<br>**1**: Display color inversion is enabled.<br>**0**: Display color inversion is disabled.|
| DISPLAY_INVERSION_STATUS | string | Yes | Yes | Whether display color inversion is enabled.<br>**1**: Display color inversion is enabled.<br>**0**: Display color inversion is disabled.|
## general
## general
...
@@ -185,121 +185,6 @@ Provides data items for setting wireless network information.
...
@@ -185,121 +185,6 @@ Provides data items for setting wireless network information.
| WIFI_STATUS | string | Yes | Yes | Whether Wi-Fi is available.<br>**true**: Wi-Fi is available.<br>**false**: Wi-Fi is unavailable.|
| WIFI_STATUS | string | Yes | Yes | Whether Wi-Fi is available.<br>**true**: Wi-Fi is available.<br>**false**: Wi-Fi is unavailable.|
| WIFI_WATCHDOG_STATUS | string | Yes | Yes | Whether Wi-Fi watchdog is available.<br>**true**: Wi-Fi watchdog is available.<br>**false**: Wi-Fi watchdog is unavailable.|
| WIFI_WATCHDOG_STATUS | string | Yes | Yes | Whether Wi-Fi watchdog is available.<br>**true**: Wi-Fi watchdog is available.<br>**false**: Wi-Fi watchdog is unavailable.|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| callback | AsyncCallback\<object> | Yes | Callback used to obtain the URI of the data item. |
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br> - Existing data items in the database<br>- Custom data items|
| callback | AsyncCallback\<object> | Yes | Callback used to return the value of the data item. |
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br> - Existing data items in the database<br>- Custom data items|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| callback | AsyncCallback\<object> | Yes | Callback used to obtain the URI of the data item. |
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br> - Existing data items in the database<br>- Custom data items|
| callback | AsyncCallback\<object> | Yes | Callback used to return the value of the data item. |
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br> - Existing data items in the database<br>- Custom data items|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| defValue | string | Yes | Default value, which is returned when the value of a data item is not found in the database. Set this parameter as needed.|
| defValue | string | Yes | Default value, which is returned when the value of a data item is not found in the database. Set this parameter as needed.|
**Return value**
**Return value**
...
@@ -533,7 +564,7 @@ let helper = featureAbility.acquireDataAbilityHelper(uri);
...
@@ -533,7 +564,7 @@ let helper = featureAbility.acquireDataAbilityHelper(uri);
@@ -541,6 +572,12 @@ Sets the value for a data item. Unlike **setValue**, this API returns the result
...
@@ -541,6 +572,12 @@ Sets the value for a data item. Unlike **setValue**, this API returns the result
If the specified data item exists in the database, the **setValueSync** method updates the value of the data item. If the data item does not exist in the database, the **setValueSync** method inserts the data item into the database.
If the specified data item exists in the database, the **setValueSync** method updates the value of the data item. If the data item does not exist in the database, the **setValueSync** method inserts the data item into the database.
> **NOTE**
>
> This API is supported since API version 8 and deprecated since API version 9.
**Model restriction**: This API can be used only in the FA model.
**Required permissions**: ohos.permission.MANAGE_SECURE_SETTINGS (available only to system applications)
**Required permissions**: ohos.permission.MANAGE_SECURE_SETTINGS (available only to system applications)
| method | string | No| Request method. The default value is **GET**. The value can be **OPTIONS**, **GET**, **HEAD**, **POST**, **PUT**, **DELETE **or **TRACE**.|
| method | string | No| Request method. The default value is **GET**. The value can be **OPTIONS**, **GET**, **HEAD**, **POST**, **PUT**, **DELETE **or **TRACE**.|
| responseType | string | No| Response type. The return type can be text or JSON. By default, the return type is determined based on **Content-Type** in the header returned by the server. For details, see return values in the **success** callback.|
| responseType | string | No| Response type. The return type can be text or JSON. By default, the return type is determined based on **Content-Type** in the header returned by the server. For details, see return values in the **success** callback.|
| success | Function | No| Called when the data is obtained successfully.|
| success | Function | No| Called when data is obtained successfully. The return value is [FetchResponse](#fetchresponse). |
| fail | Function | No| Called when the data failed to be obtained.|
| fail | Function | No| Called when data failed to be obtained.|
| complete | Function | No| Called when the execution is complete.|
| complete | Function | No| Called when the execution is complete.|
**Table 1** Mapping between data and Content-Type
**Table 1** Mapping between data and Content-Type
...
@@ -46,7 +44,7 @@ Obtains data through a network.
...
@@ -46,7 +44,7 @@ Obtains data through a network.
| Object | Not set| The default value of **Content-Type** is **application/x-www-form-urlencoded**. The **data** value is encoded based on the URL rule and appended in the request body.|
| Object | Not set| The default value of **Content-Type** is **application/x-www-form-urlencoded**. The **data** value is encoded based on the URL rule and appended in the request body.|
| Object | application/x-www-form-urlencoded | The value of data is encoded based on the URL rule and is used as the request body.|
| Object | application/x-www-form-urlencoded | The value of data is encoded based on the URL rule and is used as the request body.|
Sets the value in the cache based on the specified key.
Sets the value in the cache based on the specified key.
...
@@ -167,8 +167,8 @@ export default {
...
@@ -167,8 +167,8 @@ export default {
| key | string | Yes | Key of the data to set. |
| key | string | Yes | Key of the data to set. |
| value | string | Yes | New value to set. The length must be less than 128 bytes. |
| value | string | Yes | New value to set. The length must be less than 128 bytes. |
| success | () => void | No | Called when **storage.set()** is called successfully. |
| success | () => void | No | Called when **storage.set()** is called successfully. |
| fail | (data: string, code: number) => void | No | Called to return the result when **storage.get()** fails to be called. **data** is the error information, and **code** indicates the error code. |
| fail | (data: string, code: number) => void | No | Called to return the result when **storage.set()** fails to be called. **data** is the error information, and **code** indicates the error code. |
| complete | () => void | No | Called when **storage.get()** is complete. |
| complete | () => void | No | Called when **storage.set()** is complete. |
@@ -2339,9 +2335,9 @@ Enumerates the member types.
...
@@ -2339,9 +2335,9 @@ Enumerates the member types.
| Name | Type| Readable | Writable | Description |
| Name | Type| Readable | Writable | Description |
| ----- | ---- | ---- | ---- | ---- |
| ----- | ---- | ---- | ---- | ---- |
| number | number | Yes| Yes| The member is a number.|
| number | number | Yes| Yes| The member is a number.|
| string | string | Yes| Yes| The member is a string.|
| string | string | Yes| Yes| The member is a string.|
| boolean | boolean | Yes| Yes| The member is a Boolean value.|
| boolean | boolean | Yes| Yes| The member is a Boolean value.|
## ChangeEvent
## ChangeEvent
...
@@ -2407,7 +2403,7 @@ Defines the key information about an audio file.
...
@@ -2407,7 +2403,7 @@ Defines the key information about an audio file.
| URI | uri | File URI. |
| URI | uri | File URI. |
| DISPLAY_NAME | display_name | File name displayed. |
| DISPLAY_NAME | display_name | File name displayed. |
| DATE_ADDED | date_added | Date when the file was added. The value is the number of seconds elapsed since the Epoch time. |
| DATE_ADDED | date_added | Date when the file was added. The value is the number of seconds elapsed since the Epoch time. |
| DATE_MODIFIED | date_modified | Date when the file was last modified. The value is the number of seconds elapsed since the Epoch time. |
| DATE_MODIFIED | date_modified | Date when the file content (not the file name) was last modified. The value is the number of seconds elapsed since the Epoch time.|
| TITLE | title | Title in the file. |
| TITLE | title | Title in the file. |
| ARTIST | artist | Author of the file. |
| ARTIST | artist | Author of the file. |
| AUDIOALBUM | audio_album | Audio album. |
| AUDIOALBUM | audio_album | Audio album. |
...
@@ -2426,7 +2422,7 @@ Defines the key information about an image or video file.
...
@@ -2426,7 +2422,7 @@ Defines the key information about an image or video file.
| FILE_TYPE | file_type | Type of the file. |
| FILE_TYPE | file_type | Type of the file. |
| DISPLAY_NAME | display_name | File name displayed. |
| DISPLAY_NAME | display_name | File name displayed. |
| DATE_ADDED | date_added | Date when the file was added. The value is the number of seconds elapsed since the Epoch time. |
| DATE_ADDED | date_added | Date when the file was added. The value is the number of seconds elapsed since the Epoch time. |
| DATE_MODIFIED | date_modified | Date when the file was last modified. The value is the number of seconds elapsed since the Epoch time. |
| DATE_MODIFIED | date_modified | Date when the file content (not the file name) was last modified. The value is the number of seconds elapsed since the Epoch time.|
| TITLE | title | Title in the file. |
| TITLE | title | Title in the file. |
| DURATION | duration | Duration, in ms. |
| DURATION | duration | Duration, in ms. |
| WIDTH | width | Image width, in pixels. |
| WIDTH | width | Image width, in pixels. |
...
@@ -2447,7 +2443,7 @@ Defines the key album information.
...
@@ -2447,7 +2443,7 @@ Defines the key album information.
| FILE_TYPE | file_type | Type of the file. |
| FILE_TYPE | file_type | Type of the file. |
| ALBUM_NAME | album_name | Name of the album. |
| ALBUM_NAME | album_name | Name of the album. |
| DATE_ADDED | date_added | Date when the file was added. The value is the number of seconds elapsed since the Epoch time. |
| DATE_ADDED | date_added | Date when the file was added. The value is the number of seconds elapsed since the Epoch time. |
| DATE_MODIFIED | date_modified | Date when the file was last modified. The value is the number of seconds elapsed since the Epoch time. |
| DATE_MODIFIED | date_modified | Date when the file content (not the file name) was last modified. The value is the number of seconds elapsed since the Epoch time.|
| boolean | Whether any saved HTTP authentication credentials exist. Returns **true** if any saved HTTP authentication credentials exist exists; returns **false** otherwise.|
| boolean | Whether any saved HTTP authentication credentials exist. Returns **true** if any saved HTTP authentication credentials exist; returns **false** otherwise. |
**Example**
**Example**
...
@@ -4204,133 +4270,6 @@ struct WebComponent {
...
@@ -4204,133 +4270,6 @@ struct WebComponent {
}
}
```
```
## WebAsyncController
Implements a **WebAsyncController** object, which can be used to control the behavior of a **\<Web>** component with asynchronous callbacks. A **WebAsyncController **object controls one **\<Web>** component.
| baseName | string | Yes| Save path. The value cannot be null. |
| autoName | boolean | Yes| Whether to automatically generate a file name.<br>The value **false** means not to automatically generate a file name.<br>The value **true** means to automatically generate a file name based on the URL of current page and the **baseName** value. In this case, **baseName** is regarded as a directory. |
| callback | AsyncCallback\<string> | Yes | Callback used to return the save path if the operation is successful and null otherwise.|
| baseName | string | Yes| Save path. The value cannot be null. |
| autoName | boolean | Yes| Whether to automatically generate a file name.<br>The value **false** means not to automatically generate a file name.<br>The value **true** means to automatically generate a file name based on the URL of current page and the **baseName** value. In this case, **baseName** is regarded as a directory. |
@@ -4719,7 +4658,7 @@ Provides the element information of the area being clicked. For details about th
...
@@ -4719,7 +4658,7 @@ Provides the element information of the area being clicked. For details about th
| Name| Type| Readable| Writable| Description|
| Name| Type| Readable| Writable| Description|
| ---- | ---- | ---- | ---- |---- |
| ---- | ---- | ---- | ---- |---- |
| type | [HitTestTypeV9](#hittesttypev9) | Yes| No| Element type of the area being clicked.|
| type | [WebHitTestType](#webhittesttype) | Yes| No| Element type of the area being clicked.|
| extra | string | Yes| No|Extra information of the area being clicked. If the area being clicked is an image or a link, the extra information is the URL of the image or link.|
| extra | string | Yes| No|Extra information of the area being clicked. If the area being clicked is an image or a link, the extra information is the URL of the image or link.|
## WebMessage
## WebMessage
...
@@ -4788,7 +4727,7 @@ import image from "@ohos.multimedia.image"
...
@@ -4788,7 +4727,7 @@ import image from "@ohos.multimedia.image"
@@ -51,7 +51,7 @@ This component can contain only one child component.
...
@@ -51,7 +51,7 @@ This component can contain only one child component.
| Normal | Normal button (without rounded corners by default). |
| Normal | Normal button (without rounded corners by default). |
> **NOTE**
> **NOTE**
> - The rounded corner of a button is set by using [borderRadius](ts-universal-attributes-border.md), rather than by using the **border** API.
> - The rounded corner of a button is set by using [borderRadius](ts-universal-attributes-border.md), rather than by using the **border** API. Only a button-wide rounded corner setting is supported.
> - For a button of the **Capsule** type, the **borderRadius** settings do not take effect, and its rounded corner is always half of the button height.
> - For a button of the **Capsule** type, the **borderRadius** settings do not take effect, and its rounded corner is always half of the button height.
> - For a button of the **Circle** type, its radius is the value of **borderRadius** (if set) or the width or height (whichever is smaller).
> - For a button of the **Circle** type, its radius is the value of **borderRadius** (if set) or the width or height (whichever is smaller).
> - The button text is set using the [text style attributes](ts-universal-attributes-text-style.md).
> - The button text is set using the [text style attributes](ts-universal-attributes-text-style.md).
Sets whether to display the horizontal scrollbar, including the system default scrollbar and custom scrollbar. By default, the horizontal scrollbar is displayed.
Sets whether to display the horizontal scrollbar, including the default system scrollbar and custom scrollbar. By default, the horizontal scrollbar is displayed.
Called when an error occurs during web page loading. For better results, simplify the implementation logic in the callback.
Called when an error occurs during web page loading. For better results, simplify the implementation logic in the callback. This API is called when there is no network connection.
**Parameters**
**Parameters**
...
@@ -1780,7 +1781,7 @@ Called when the document title of the web page is changed.
...
@@ -1780,7 +1781,7 @@ Called when the document title of the web page is changed.
console.info(`onInterceptKeyEvent get event.keyCode ${event.keyCode}`)
console.info(`onInterceptKeyEvent get event.keyCode ${event.keyCode}`)
returntrue;
returntrue;
}
}
...
@@ -3178,18 +3179,6 @@ Instructs the **\<Web>** component to select a file.
...
@@ -3178,18 +3179,6 @@ Instructs the **\<Web>** component to select a file.
Implements the **FileSelectorParam** object. For the sample code, see [onShowFileSelector](#onshowfileselector9).
Implements the **FileSelectorParam** object. For the sample code, see [onShowFileSelector](#onshowfileselector9).
### getTitle<sup>9+</sup>
getTitle(): string
Obtains the title of the file selector.
**Return value**
| Type | Description |
| ------ | ---------- |
| string | Title of the file selector.|
### getMode<sup>9+</sup>
### getMode<sup>9+</sup>
getMode(): FileSelectorMode
getMode(): FileSelectorMode
...
@@ -3813,40 +3802,6 @@ This API is deprecated since API version 9. You are advised to use [forward<sup>
...
@@ -3813,40 +3802,6 @@ This API is deprecated since API version 9. You are advised to use [forward<sup>
}
}
```
```
### backOrForward<sup>9+</sup>
backOrForward(step: number): void
Performs a specific number of steps forward or backward on the current page based on the history stack. No redirection will be performed if the corresponding page does not exist in the history stack.
**Parameters**
| Name | Type | Mandatory | Default Value | Description |
| ---- | ------ | ---- | ---- | ----------- |
| step | number | Yes | - | Number of the steps to take.|
@@ -4574,44 +4336,27 @@ Clears the user operation corresponding to the SSL certificate error event recor
...
@@ -4574,44 +4336,27 @@ Clears the user operation corresponding to the SSL certificate error event recor
}
}
```
```
### clearClientAuthenticationCache
## WebCookie
clearClientAuthenticationCache(): void
Clears the user operation corresponding to the client certificate request event recorded by the **\<Web>** component.
**Example**
```ts
Manages behavior of cookies in **\<Web>** components. All **\<Web>** components in an application share a **WebCookie**. You can use the **getCookieManager** API in **controller** to obtain the **WebCookie** for subsequent cookie management.
Searches the web page for content that matches the keyword specified by **'searchString'** and highlights the matches on the page. This API returns the result asynchronously through [onSearchResultReceive](#onsearchresultreceive9).
**Parameters**
| Name | Type | Mandatory | Default Value | Description |
| [HitTestType](#hittesttype)| Element type of the area being clicked.|
### getExtra<sup>9+</sup>
getExtra(): string
Obtains the extra information of the area being clicked. If the area being clicked is an image or a link, the extra information is the URL of the image or link.
**Return value**
| Type | Description |
| ------ | ------------ |
| string | Extra information of the area being clicked.|
## WebCookie
Manages behavior of cookies in **\<Web>** components. All **\<Web>** components in an application share a **WebCookie**. You can use the **getCookieManager** API in **controller** to obtain the **WebCookie** for subsequent cookie management.
### setCookie<sup>9+</sup>
setCookie(url: string, value: string): boolean
Sets the cookie. This API returns the result synchronously. Returns **true** if the operation is successful; returns **false** otherwise.
**Parameters**
| Name | Type | Mandatory | Default Value | Description |
@@ -37,7 +37,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
...
@@ -37,7 +37,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| viewPort | {<br>x?: number \| string,<br>y?: number \| string,<br>width?: number \| string,<br>height?: number \| string<br>} | { x:0, y:0, width:0, height:0 } | View port of the shape.|
| viewPort | {<br>x?: number \| string,<br>y?: number \| string,<br>width?: number \| string,<br>height?: number \| string<br>} | { x:0, y:0, width:0, height:0 } | View port of the shape.|
| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.|
| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.|
| fillOpacity | number \| string \|[Resource](ts-types.md#resource)| 1 | Opacity of the fill area.|
| fillOpacity | number \| string \|[Resource](ts-types.md#resource)| 1 | Opacity of the fill area.|
| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, no stroke is displayed.|
| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.|
The [Ability Privilege Level (APL)](accesstoken-overview.md#app-apls) of an application can be **normal**, **system_basic**, or **system_core**. The default APL is **normal**. The [permission types](accesstoken-overview.md#permission-types) include **system_grant** and **user_grant**. For details about the permissions for applications, see the [Application Permission List](permission-list.md).
The [Ability Privilege Level (APL)](accesstoken-overview.md#app-apls) of an application can be **normal**, **system_basic**, or **system_core**. The default APL is **normal**. The [permission types](accesstoken-overview.md#permission-types) include **system_grant** and **user_grant**. For details about the permissions for applications, see the [Application Permission List](permission-list.md).
This document describes:
This document describes the following operations:
-[Declaring Permissions in the Configuration File](#declaring-permissions-in-the-configuration-file)
-[Declaring Permissions in the Configuration File](#declaring-permissions-in-the-configuration-file)
-[Declaring Permissions in the ACL](#declaring-permissions-in-the-acl)
-[Declaring the ACL](#declaring-the-acl)
-[Requesting User Authorization](#requesting-user-authorization)
-[Requesting User Authorization](#requesting-user-authorization)
During the development, you need to declare the permissions required by your application one by one in the project configuration file. The application cannot obtain the permissions that are not declared in the configuration file. OpenHarmony provides two application models: FA model and stage model. For more information, see [Application Models](../application-models/application-model-description.md). The application bundle and configuration file vary with the application model.
During the development, you need to declare the permissions required by your application one by one in the project configuration file. The application cannot obtain the permissions that are not declared in the configuration file. OpenHarmony provides two application models: FA model and stage model. For more information, see [Application Models](../application-models/application-model-description.md). The application bundle and configuration file vary with the application model.
> **NOTE**<br>The default APL of an application is **normal**. When an application needs the **system_basic** or **system_core** APL, you must declare the permission in the configuration file and the [Access Control List (ACL)](#declaring-permissions-in-the-acl).
> **NOTE**<br>The default APL of an application is **normal**. When an application of the **normal** APL needs a permission of the **system_basic** or **system_core** level, you must declare the permission in the configuration file and the [Access Control List (ACL)](#declaring-the-acl).
The following table describes the fields in the configuration file.
The following table describes the fields in the configuration file.
| reason | No | Reason for requesting the permission.<br>This field is mandatory when the requested permission needs user authorization (user_grant).|
| reason | No | Reason for requesting the permission.<br>This field is mandatory when a user_grant permission is required.|
| usedScene | No | Application scenario of the permission.<br>This field is mandatory when the requested permission needs user authorization (user_grant).|
| usedScene | No | Application scenario of the permission.<br>This field is mandatory when a user_grant permission is required.|
| abilities | No | Abilities that require the permission. The value is an array.<br>**Applicable model**: stage|
| abilities | No | Abilities that require the permission. The value is an array.<br>**Applicable model**: stage|
| ability | No | Abilities that require the permission. The value is an array.<br>**Applicable model**: FA|
| ability | No | Abilities that require the permission. The value is an array.<br>**Applicable model**: FA|
| when | No | Time when the permission is used. <br>Value:<br>- **inuse**: The permission applies only to a foreground application.<br>- **always**: The permission applies to both the foreground and background applications.|
| when | No | Time when the permission is used. <br>Value:<br>- **inuse**: The permission applies only to a foreground application.<br>- **always**: The permission applies to both the foreground and background applications.|
### Stage Model
### Stage Model
If the application is based on the stage model, declare the permissions in [**module.json5**](../quick-start/module-configuration-file.md).
If your application is based on the stage model, declare the required permissions in [**module.json5**](../quick-start/module-configuration-file.md).
```json
```json
{
{
...
@@ -64,7 +64,7 @@ If the application is based on the stage model, declare the permissions in [**mo
...
@@ -64,7 +64,7 @@ If the application is based on the stage model, declare the permissions in [**mo
### FA Model
### FA Model
If the application is based on the FA model, declare the required permissions in **config.json**.
If your application is based on the FA model, declare the required permissions in **config.json**.
```json
```json
{
{
...
@@ -96,11 +96,11 @@ If the application is based on the FA model, declare the required permissions in
...
@@ -96,11 +96,11 @@ If the application is based on the FA model, declare the required permissions in
}
}
```
```
## Declaring Permissions in the ACL
## Declaring the ACL
If an application of the **normal**level requires permissions corresponding to the **system_basic** or **system_core** level, you need to declare the required permissions in the ACL.
If an application of the **normal**APL requires permissions of the **system_basic** or **system_core** level, you need to declare the required permissions in the ACL.
For example, if an application needs to access audio files of a user and capture screenshots, it requires the **ohos.permission.WRITE_AUDIO** permission (of the **system_basic** level) and the **ohos.permission.CAPTURE_SCREEN** permission (of the **system_core** level). In this case, you need to add the related permissions to the **acl** field in the [HarmonyAppProvision configuration file](app-provision-structure.md).
For example, if an application needs to access audio files of a user and capture screenshots, it requires the **ohos.permission.WRITE_AUDIO** permission (of the **system_basic** level) and the **ohos.permission.CAPTURE_SCREEN** permission (of the **system_core** level). In this case, you need to add the required permissions to the **acls** field in the [HarmonyAppProvision configuration file](app-provision-structure.md).
```json
```json
{
{
...
@@ -116,11 +116,11 @@ For example, if an application needs to access audio files of a user and capture
...
@@ -116,11 +116,11 @@ For example, if an application needs to access audio files of a user and capture
## Requesting User Authorization
## Requesting User Authorization
If an application needs to access user privacy information or use system abilities, for example, accessing location or calendar information or using the camera to take photos or record videos, it must request the permission from users. A permission verification is performed first to determine whether the current invoker has the corresponding permission. If the application has not obtained that permission, a dialog box will be displayed to request user authorization. The following figure shows an example.
If an application needs to access user privacy information or use system abilities, for example, accessing location or calendar information or using the camera to take photos or record videos, it must request the permission from the user. A permission verification is performed first to determine whether the current caller has the corresponding permission. If the application has not obtained that permission, a dialog box will be displayed to request user authorization. The following figure shows an example.


> **NOTE**<br>Each time before an API protected by a permission is accessed, [**requestPermissionsFromUser()**](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9) will be called to request user authorization. After a permission is dynamically granted, the user may revoke the permission. Therefore, the previously granted authorization status cannot be persistent.
> **NOTE**<br>Each time before an API protected by a user_grant permission is accessed, [**requestPermissionsFromUser()**](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9) will be called to request user authorization. After the permission is dynamically granted, the user may revoke the authorization. Therefore, the previously granted authorization status cannot be persistent.
### Stage Model
### Stage Model
...
@@ -128,7 +128,7 @@ Example: Request the permission for an application to access calendar informatio
...
@@ -128,7 +128,7 @@ Example: Request the permission for an application to access calendar informatio
1. Apply for the **ohos.permission.READ_CALENDAR** permission. For details, see [Declaring Permissions in the Configuration File](#declaring-permissions-in-the-configuration-file).
1. Apply for the **ohos.permission.READ_CALENDAR** permission. For details, see [Declaring Permissions in the Configuration File](#declaring-permissions-in-the-configuration-file).
2. Call [**requestPermissionsFromUser()**](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9) in the **onWindowStageCreate()** callback of the UIAbility to dynamically apply for the permission, or request user authorization on the UI based on service requirements. The return value of [requestPermissionsFromUser()](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9) indicates whether the application has the target permission. If yes, the target API can be called normally.
2. Call [**requestPermissionsFromUser()**](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9) in the **onWindowStageCreate()** callback of the UIAbility to dynamically apply for the permission, or request user authorization on the UI based on service requirements. The return value of [requestPermissionsFromUser()](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9) indicates whether the application has the permission. If yes, the target API can be called.
Request user authorization in UIAbility.
Request user authorization in UIAbility.
...
@@ -149,11 +149,14 @@ Example: Request the permission for an application to access calendar informatio
...
@@ -149,11 +149,14 @@ Example: Request the permission for an application to access calendar informatio
console.error(`[requestPermissions] Failed to start request permissions. Error: ${JSON.stringify(err)}`);
console.error(`[requestPermissions] Failed to start request permissions. Error: ${JSON.stringify(err)}`);
})
})
...
@@ -217,7 +223,7 @@ reqPermissions() {
...
@@ -217,7 +223,7 @@ reqPermissions() {
}
}
```
```
## Pre-Authorizing user_grant Permissions
## Pre-Authorizing user_grant Permissions
By default, the **user_grant** permissions must be dynamically authorized by the user through a dialog box. However, for pre-installed applications, you can pre-authorize the permissions, for example, the **ohos.permission.MICROPHONE** permission for camera applications, in the [**install_list_permission.json**] file to prevent the user authorization dialog box from being displayed. The [**install_list_permissions.json** file](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/preinstall-config/install_list_permissions.json) is in the **/system/etc/app/** directory on a device. When the device is started, the **install_list_permissions.json** file is loaded. When the application is installed, the **user_grant** permissions in the file are granted. The **install_list_permissions.json** file contains the following fields:
By default, the **user_grant** permissions must be dynamically authorized by the user through a dialog box. However, for pre-installed applications, you can pre-authorize the permissions, for example, the **ohos.permission.MICROPHONE** permission for camera applications, in the [**install_list_permission.json**](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/preinstall-config/install_list_permissions.json) file to prevent the user authorization dialog box from being displayed. The **install_list_permissions.json** file is in the **/system/etc/app/** directory on a device. When the device is started, the **install_list_permissions.json** file is loaded. When the application is installed, the user_grant permissions in the file are granted. The **install_list_permissions.json** file contains the following fields:
-**bundleName**: bundle name of the application.
-**bundleName**: bundle name of the application.
-**app_signature**: fingerprint information of the application. For details, see **Configuration in install_list_capability.json** in [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md).
-**app_signature**: fingerprint information of the application. For details, see **Configuration in install_list_capability.json** in [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md).
OpenHarmony AccessTokenManager (ATM) implements unified app permission management based on access tokens.
OpenHarmony AccessTokenManager (ATM) implements unified management of application permissions based on access tokens.
By default, apps can access limited system resources. However, to provide extended features, an app may need to access excess data (including personal data) and functions of the system or another app. The system or apps must also explicitly share their data or functions through APIs. OpenHarmony uses app permissions to perform access control and prevent improper or malicious use of these data or functions.
By default, applications can access limited system resources. However, to provide extended features, an application may need to access excess data (including personal data) and functions of the system or another application. The system or applications must also explicitly share their data or functions through APIs. OpenHarmony uses application permissions to prevent unauthorized access to and improper or malicious use of these data or functions.
App permissions are used to protect the following objects:
Application permissions are used to protect the following objects:
- Data: personal data (such as photos, contacts, calendar, and location), device data (such as device ID, camera, and microphone), and app data.
- Data: includes personal data (such as photos, contacts, calendar, and location), device data (such as device ID, camera, and microphone), and application data.
- Functions: device functions (such as making calls, sending SMS messages, and connecting to the Internet) and app functions (such as displaying windows and creating shortcuts).
- Functions: includes device functions (such as making calls, sending SMS messages, and connecting to the Internet) and application functions (such as displaying windows and creating shortcuts).
Without the required permissions, an app cannot access or perform operations on the target object. Permissions must be clearly defined for apps. With well-defined app permissions, the system can standardize app behavior and protect user privacy. Before an app accesses the target object, the target object verifies the app's permissions and denies the access if the app does not have required permissions.
Without the required permissions, an application cannot access or perform operations on the target object. Permissions must be clearly defined for applications. With well-defined application permissions, the system can standardize application behavior and protect user privacy. Before an application accesses an object, the object verifies the application's permissions and denies the access if the application does not have required permissions.
Currently, ATM verifies app permissions based on the token identity (token ID). A token ID identifies an app. ATM manages app permissions based on the app's token ID.
Currently, ATM verifies application permissions based on the token identity (token ID). A token ID identifies an application. ATM manages application permissions based on the application's token ID.
## Basic Principles for Permission Management
## Basic Principles for Permission Management
Observe the following principles for permission management:
Observe the following permission management principles:
- Provide clear description about the functions and scenarios for each permission required by the app so that users can clearly know why and when these permissions are needed. Do not induce or mislead users' authorization. The permissions on an app must comply with the description provided in the app.
- Provide clear description about the usage and scenario for each permission required by the application so that user can clearly know why and when these permissions are needed. Do not induce or mislead users' authorization. The permissions on an application must comply with the description provided in the application.
- Use the principle of least authority for user permissions. Allow only necessary permissions for service functions.
- Use the principle of least authority for application permissions. Allow only necessary permissions for service functions.
- When an app is started for the first time, avoid frequently displaying dialog boxes to request multiple permissions. Allow the app to apply for the permission only when it needs to use the corresponding service function.
- When an application is started for the first time, avoid frequently displaying dialog boxes to request multiple permissions. Allow the application to apply for the permission only when it needs to use the corresponding service function.
- If a user rejects to grant a permission, the user can still use functions irrelevant to this permission and can register and access the app.
- If a user rejects to grant a permission, the user can still use functions irrelevant to this permission and can register and access the application.
- Provide no more message if a user rejects the authorization required by a function. Provide onscreen instructions to direct the user to grant the permission in **Settings** if the user triggers this function again or needs to use this function.
- Provide no more message if a user rejects the authorization required by a function. Provide onscreen instructions to direct the user to grant the permission in **Settings** if the user triggers this function again or needs to use this function.
- All the permissions granted to apps must come from the [App Permission List](permission-list.md). Custom permissions are not allowed currently.
- All the permissions for applications must come from the [Application Permission List](permission-list.md). Custom permissions are not allowed currently.
## Permission Workflows
## Permission Workflows
### Permission Application and Use
### Applying for and Using a Permission
Determine the permissions required by an app, and declare the required permissions in the app installation package.
Determine the permissions required by an application, and declare the required permissions in the application installation package.
Determine whether the required permissions need user authorization. If yes, display a dialog box dynamically to request user authorization.
Determine whether the required permissions need user authorization. If yes, display a dialog box dynamically to request user authorization.
After the user grants the permissions, the app can access the data or perform the operation.
After the user grants the permissions, the application can access the data or perform the operation.
The figure below illustrates the process.
The figure below illustrates the process.


1. Refer to the figure below to determine whether an app can apply for a permission.
1. Refer to the figure below to determine whether an application can apply for a permission.


1. See [Permission Levels](#permission-levels) for details about the mapping between the application Ability Privilege Level (APL) and permission level.
1. See [Permission Levels](#permission-levels) for details about the mapping between the application Ability Privilege Level (APL) and the permission level.
2. The permission authorization modes include user_grant (permission granted by the user) and system_grant (permission granted by the system). For details, see [Permission Types](#permission-types).
2. The permission authorization modes include user_grant (permission granted by the user) and system_grant (permission granted by the system). For details, see [Permission Types](#permission-types).
3. A low-APL app can have a high-level permission by using the Access Control List (ACL). For details, see [ACL](#acl).
3. A low-APL application can have a high-level permission by using the Access Control List (ACL). For details, see [ACL](#acl).
### Permission Verification
### Verifying a Permission
To protect sensitive data and eliminate security threads on core abilities, you can use the permissions in the [App Permission List](permission-list.md) to protect an API from unauthorized calling. Each time before the API is called, a permission verification is performed to check whether the caller has the required permission.
To protect sensitive data and eliminate security threats on core abilities, you can use the permissions in the [Application Permission List](permission-list.md) to protect an API from unauthorized calling. Each time before the API is called, a verification is performed to check whether the caller has the required permission.
The API can be called only after the permission verification is successful.
The API can be called only after the permission verification is successful.
...
@@ -58,37 +58,37 @@ The figure below shows the permission verification process.
...
@@ -58,37 +58,37 @@ The figure below shows the permission verification process.


1: An app permission can be used to control the access to an API that has sensitive data involved or security threats on the core abilities.
1: An application permission can be used to control the access to an API that has sensitive data involved or security threats on core abilities.
2: The API can be protected by a permission in the [ACL](#acl). For example, if contact information is involved in an API provided by an app, you can use the contact-related permissions to protect the API.
2: The API can be protected by a permission in the [ACL](#acl). For example, if contact information is involved in an API provided by an application, you can use a contact-related permission to protect the API.
3: Use **verifyAccessToken()** to check whether the caller has the required permission. For details, see [Permission Verification Guide](permission-verify-guidelines.md).
3: Use **checkAccessToken()** to check whether the caller has the required permission. For details, see [API Access Permission Verification](permission-verify-guidelines.md).
## Permission Levels
## Permission Levels
ATM defines different permission levels based on the sensitivity of the data involved or the security threat of the ability to protect user privacy.
ATM defines different permission levels based on the sensitivity of the data involved or the security threat of the ability to protect user privacy.
### App APLs
### Application APLs
The APL defines the priority of the app permission requested. Apps of different APLs can apply for permissions of different levels.
The APL defines the priority for an application to apply for permissions. Applications of different APLs can apply for permissions of different levels.
| system_core | The apps of this level provide core abilities of the operating system (OS). |
| system_core | Application that provides core abilities of the operating system (OS). |
| system_basic| The apps of this level provide basic system services. |
| system_basic| Application that provides basic system services. |
| Normal | The apps of this level are normal apps. |
| normal | Normal application. |
The default APL of apps is **normal**.
The default APL of applications is **normal**.
To set an app's APL to **system_basic** or **system_core**, declare the APL in the **apl** field of **bundle-info** in the app's profile when developing the app's installation package.
To set an application's APL to **system_basic** or **system_core**, set the **apl** field under **bundle-info** in the application's profile when developing the application's installation package.
Then, use the [hapsigner](hapsigntool-overview.md) tool to generate a certificate or use DevEco Studio to [have your app automatically signed](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-auto-configuring-signature-information-0000001271659465#section161281722111).
Then, use the [hapsigner](hapsigntool-overview.md) tool to generate a certificate or use DevEco Studio to [have your application automatically signed](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-auto-configuring-signature-information-0000001271659465#section161281722111).
> **CAUTION**<br>The method of changing the app's APL in its profile applies only to the app or service in debug mode. For a commercial app, apply for a release certificate and profile in the corresponding app market.
> **CAUTION**<br>The method of changing the application's APL in its profile applies only to the application or service in debug mode. For a commercial application, apply for a release certificate and profile in the corresponding application market.
The following is an example.
Example:
This example shows only the modification of the **apl** field. Set other fields based on your requirements. For details about the fields in the profile, see [HarmonyAppProvision Configuration File](app-provision-structure.md).
This example shows only the modification of the **apl** field. Set other fields based on your requirements. For details about the fields in the profile, see [HarmonyAppProvision Configuration File](app-provision-structure.md).
...
@@ -107,25 +107,25 @@ This example shows only the modification of the **apl** field. Set other fields
...
@@ -107,25 +107,25 @@ This example shows only the modification of the **apl** field. Set other fields
### Levels of Permissions
### Levels of Permissions
The permissions open to apps vary with the permission level. The permission levels include the following in ascending order of seniority.
The permissions available to applications vary with the APL. The permission levels include the following in ascending order of seniority.
-**normal**
-**normal**
The normal permission allows access to common system resources beyond the default rules. Access to these system resources (including data and functions) has minor risks on user privacy and other apps.
The **normal** permission allows access to common system resources beyond the default rules. Access to these resources (including data and functions) has minor risks on user privacy and other applications.
The permissions of this level are available only to apps of the normal or higher APL.
The permissions of this level are available to applications of the **normal** or higher APL.
-**system_basic**
-**system_basic**
The system_basic permission allows access to resources related to basic OS services. The basic services are basic functions provided or preconfigured by the system, such as system settings and identity authentication. Access to these resources may have considerable risks to user privacy and other apps.
The **system_basic** permission allows access to resources related to basic OS services. The basic services are basic functions provided or preconfigured by the system, such as system settings and identity authentication. Access to these resources may have considerable risks to user privacy and other applications.
The permissions of this level are available only to apps of the system_basic or system_core APL.
The permissions of this level are available only to applications of the **system_basic** or **system_core** APL.
-**system_core**
-**system_core**
The system_core permission allows access to core resources of the OS. These resources are underlying core services of the system. If these resources are corrupted, the OS cannot run properly.
The **system_core** permission allows access to core resources of the OS. These resources are underlying core services of the system. If these resources are corrupted, the OS cannot run properly.
The system_core permissions are not open to third-party apps.
The **system_core** permissions are not available to third-party applications.
## Permission Types
## Permission Types
...
@@ -133,80 +133,80 @@ Permissions can be classified into the following types based on the authorizatio
...
@@ -133,80 +133,80 @@ Permissions can be classified into the following types based on the authorizatio
-**system_grant**
-**system_grant**
The app permissions are authorized by the system. Apps granted with this type of permission cannot access user or device sensitive information, and the operations allowed for them have minor impact on the system or other apps.
A system_grant permission is authorized by the system. The application with this type of permission cannot access user or device sensitive information, and the operations allowed have minor impact on the system or other applications.
For a system_grant app, the system automatically grants the required permissions to the app when the app is installed. The system_grant permission list must be presented to users on the details page of the app in the app market.
For an application with a system_grant permission, the system automatically grants the permission to the application when the application is installed. The system_grant permission list must be presented to users on the details page of the application in the application market.
-**user_grant**
-**user_grant**
The app permissions must be authorized by users. Apps granted with this type of permissions may access user or device sensitive information, and the operations allowed for them may have a critical impact on the system or other apps.
A user_grant permission must be authorized by the user. An application with this type of permission may access user or device sensitive information, and the operations allowed may have a critical impact on the system or other applications.
This type of permissions must be declared in the app installation package and authorized by users dynamically during the running of the app. The app has the permission only after user authorization.
This type of permissions must be declared in the application installation package and authorized by users dynamically during the running of the application. The application has the permission only after user authorization.
For example, as described in the [App Permission List](permission-list.md), the permissions for microphones and cameras are user_grant. The list provides reasons for using the permissions.
For example, the permissions for microphones and cameras in the [Application Permission List](permission-list.md) are user_grant. The list provides information about when to use the permissions.
The user_grant permission list must also be presented on the details page of the app in the app market.
The user_grant permission list must also be presented on the details page of each application in the application market.
### Authorization Processes
### Authorization Processes
As described in [Permission Workflows](permission-workflows), you need to first apply for the required permissions for the app.
As described in [Permission Workflows](permission-workflows), you need to first apply for the required permissions for your application.
- Applying for permissions
- Applying for a permission
You need to [declare the required permissions](accesstoken-guidelines.md#declaring-permissions) in the configuration file.
You need to [declare the required permissions](accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file) in the configuration file.
- Authorizing permissions
- Authorizing a permission
- The system_grant permission will be pre-granted when the app is installed.
- The system_grant permission is pre-granted when the application is installed.
- For a user_grant permission, you need to trigger user authorization through a dialog box during the running of the app. For details, see [Requesting User Authorization](#requesting-user-authorization).
- For a user_grant permission, you need to trigger user authorization through a dialog box during the running of the application. For details, see [Requesting User Authorization](#requesting-user-authorization).
### Requesting User Authorization
### Requesting User Authorization
The procedure is as follows:
The procedure is as follows:
1. In the configuration file, declare the permissions required by the app. For details, see [Access Control Development](accesstoken-guidelines.md).
1. In the configuration file, declare the permissions required by your application. For details, see [Permission Application Guide](accesstoken-guidelines.md).
2. Associate the target objects in the app with the related permissions. This allows the users to know the operations that need user authorization.
2. Associate the target object in the application with the required permission. This allows the users to know the operations that need user authorization.
3. Use an API to dynamically trigger a dialog box requesting user authorization when the target object is accessed. The API first checks whether the user has granted the required permissions to the app. If yes, the app can access the data or perform the operation. Otherwise, a dialog box will be displayed to request user authorization.
3. Use an API to dynamically trigger a dialog box for requesting user authorization when the target object is accessed. This API first checks whether the user has granted the permission required. If no, a dialog box will be displayed to request authorization from the user.
4. Check the user authorization result. Allow the subsequent operation only after the user has granted the permissions to the app.
4. Check the user authorization result. Allow the subsequent operations only after the user has granted the permission to the application successfully.
**Precautions**
**Caution**
-Check the app's permission each time before the operation requiring the permission is performed.
-Each time before the operation that requires the target permission is performed, the application must check whether the permission is available.
- To check whether a user has granted specific permissions to an app, use the [verifyAccessToken](../reference/apis/js-apis-abilityAccessCtrl.md) API. This API returns [PERMISSION_GRANTED](../reference/apis/js-apis-abilityAccessCtrl.md) or [PERMISSION_DENIED](../reference/apis/js-apis-abilityAccessCtrl.md). For details about the sample code, see [Access Control Development](accesstoken-guidelines.md).
- To check whether a user has granted a permission to your application, use [checkAccessToken()](../reference/apis/js-apis-abilityAccessCtrl.md#checkaccesstoken9). This API returns [PERMISSION_GRANTED](../reference/apis/js-apis-abilityAccessCtrl.md) or [PERMISSION_DENIED](../reference/apis/js-apis-abilityAccessCtrl.md). For details about the sample code, see [Permission Application Guide](accesstoken-guidelines.md).
- Users must be able to understand and control the authorization of user_grant permissions. During the running process, the app requiring user authorization must proactively call an API to dynamically request the authorization. Then, the system displays a dialog box asking the user to grant the permission. The user will determine whether to grant the permission based on the running context of the app.
- Users must be able to understand and control the authorization of user_grant permissions. For a user_grant permission, the application must proactively call an API to dynamically request user authorization. Then, the system displays a dialog box asking the user to grant the permission. The user then determines whether to grant the permission.
- The permission authorized is not permanent, because the user may revoke the authorization at any time. Therefore, even if the user has granted the requested permission to the app, the app must check for the permission before calling the API controlled by this permission.
- The user may revoke the permission authorization at any time. Therefore, each time before an API associated with a user_grant permission is called, the application must check whether the permission is available.
## ACL
## ACL
As described above, permission levels and app APLs are in one-to-one correspondence. In principle, **an app with a lower APL cannot apply for higher permissions by default**.
Permission levels and application APLs are in one-to-one correspondence. In principle, an application with a lower APL cannot apply for higher-level permissions by default.
The ACL makes low-APL apps have high-level permissions.
The ACL makes low-APL applications have high-level permissions.
**Example**
**Example:**
The APL of app A is **normal**. App A needs to have permission B (system_basic level) and permission C (normal level).
The APL of application A is **normal**. Application A needs to have permission B (system_basic level) and permission C (normal level).
In this case, you can use the ACL to grant permission B to app A.
In this case, you can use the ACL to grant permission B to application A.
For details, see [Using the ACL](#using-the-acl).
For details, see [Using the ACL](#using-the-acl).
For details about whether a permission can be enabled through the ACL, see [App Permission List](permission-list.md).
For details about whether a permission can be enabled via the ACL, see [Application Permission List](permission-list.md).
### Using the ACL
### Using the ACL
If the permission required by an app has a higher level than the app's APL, you can use the ACL to grant the permission required.
If the permission required by an application has a higher level than the application's APL, you can use the ACL to grant the permission required.
In addition to the preceding [authorization processes](#authorization-processes), you must declare the ACL.
In addition to the preceding [authorization processes](#authorization-processes), you must declare the ACL.
That is, you need to declare the required permissions in the app's configuration file, and [declare the ACL](accesstoken-guidelines.md#declaring-permissions-in-the-acl) in the app's profile. The subsequent steps of authorization are the same.
That is, you need to declare the required permissions in the application's configuration file, and [declare the ACL](accesstoken-guidelines.md#declaring-the-acl) in the application's profile. The subsequent authorization steps are the same.
**NOTICE**
**NOTICE**
When developing an app installation package, you must declare the ACL in the **acls** field in the app's profile. Then, use the [hapsigner](hapsigntool-overview.md) tool to generate a certificate.
When developing an application installation package, you must declare the ACL in the **acls** field in the application's profile. Then, use the [hapsigner](hapsigntool-overview.md) tool to generate a certificate.
> **CAUTION**<br>The method of changing the app's APL in its profile applies only to the app or service in debug mode. For a commercial app, apply for a release certificate and profile in the corresponding app market.
> **CAUTION**<br>The method of changing the application's APL in its profile applies only to the application or service in debug mode. For a commercial application, apply for a release certificate and profile in the corresponding application market.
@@ -902,7 +902,7 @@ Allows the device administrator application to subscribe to management events.
...
@@ -902,7 +902,7 @@ Allows the device administrator application to subscribe to management events.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.ENTERPRISE_SET_DATETIME
## ohos.permission.ENTERPRISE_SET_DATETIME
...
@@ -912,7 +912,7 @@ Allows the device administrator application to set the system time.
...
@@ -912,7 +912,7 @@ Allows the device administrator application to set the system time.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.ENTERPRISE_GET_DEVICE_INFO
## ohos.permission.ENTERPRISE_GET_DEVICE_INFO
...
@@ -922,7 +922,7 @@ Allows the device administrator application to obtain device information.
...
@@ -922,7 +922,7 @@ Allows the device administrator application to obtain device information.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.ENTERPRISE_RESET_DEVICE
## ohos.permission.ENTERPRISE_RESET_DEVICE
...
@@ -932,7 +932,37 @@ Allows the device administrator to restore factory settings of the device.
...
@@ -932,7 +932,37 @@ Allows the device administrator to restore factory settings of the device.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.ENTERPRISE_SET_WIFI
Allows a device administrator application to set and query Wi-Fi information.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
## ohos.permission.ENTERPRISE_GET_NETWORK_INFO
Allows a device administrator application to query network information.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
## ohos.permission.ENTERPRISE_SET_ACCOUNT_POLICY
Allows the device administrator to set account management policies.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
## ohos.permission.NFC_TAG
## ohos.permission.NFC_TAG
...
@@ -962,7 +992,7 @@ Allows a system application to access the permission usage records.
...
@@ -962,7 +992,7 @@ Allows a system application to access the permission usage records.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.NOTIFICATION_AGENT_CONTROLLER
## ohos.permission.NOTIFICATION_AGENT_CONTROLLER
...
@@ -972,7 +1002,7 @@ Allows an application to send agent-powered notifications.
...
@@ -972,7 +1002,7 @@ Allows an application to send agent-powered notifications.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.ANSWER_CALL
## ohos.permission.ANSWER_CALL
...
@@ -982,7 +1012,7 @@ Allows an application to answer incoming calls.
...
@@ -982,7 +1012,7 @@ Allows an application to answer incoming calls.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.READ_CALENDAR
## ohos.permission.READ_CALENDAR
...
@@ -992,7 +1022,7 @@ Allows an application to read calendar data.
...
@@ -992,7 +1022,7 @@ Allows an application to read calendar data.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.READ_CALL_LOG
## ohos.permission.READ_CALL_LOG
...
@@ -1002,7 +1032,7 @@ Allows an application to read call logs.
...
@@ -1002,7 +1032,7 @@ Allows an application to read call logs.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.READ_CELL_MESSAGES
## ohos.permission.READ_CELL_MESSAGES
...
@@ -1012,7 +1042,7 @@ Allows an application to read cell broadcast messages received by the device.
...
@@ -1012,7 +1042,7 @@ Allows an application to read cell broadcast messages received by the device.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.READ_CONTACTS
## ohos.permission.READ_CONTACTS
...
@@ -1022,7 +1052,7 @@ Allows an application to read contacts.
...
@@ -1022,7 +1052,7 @@ Allows an application to read contacts.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.READ_MESSAGES
## ohos.permission.READ_MESSAGES
...
@@ -1032,7 +1062,7 @@ Allows an application to read messages.
...
@@ -1032,7 +1062,7 @@ Allows an application to read messages.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.RECEIVE_MMS
## ohos.permission.RECEIVE_MMS
...
@@ -1042,7 +1072,7 @@ Allows an application to receive and process MMS messages.
...
@@ -1042,7 +1072,7 @@ Allows an application to receive and process MMS messages.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.RECEIVE_SMS
## ohos.permission.RECEIVE_SMS
...
@@ -1052,7 +1082,7 @@ Allows an application to receive and process SMS messages.
...
@@ -1052,7 +1082,7 @@ Allows an application to receive and process SMS messages.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.RECEIVE_WAP_MESSAGES
## ohos.permission.RECEIVE_WAP_MESSAGES
...
@@ -1062,7 +1092,7 @@ Allows an application to receive and process WAP messages.
...
@@ -1062,7 +1092,7 @@ Allows an application to receive and process WAP messages.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.MICROPHONE
## ohos.permission.MICROPHONE
...
@@ -1072,7 +1102,7 @@ Allows an application to access the microphone.
...
@@ -1072,7 +1102,7 @@ Allows an application to access the microphone.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.SEND_MESSAGES
## ohos.permission.SEND_MESSAGES
...
@@ -1082,7 +1112,7 @@ Allows an application to send messages.
...
@@ -1082,7 +1112,7 @@ Allows an application to send messages.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.WRITE_CALENDAR
## ohos.permission.WRITE_CALENDAR
...
@@ -1092,7 +1122,7 @@ Allows an application to add, remove, and modify calendar events.
...
@@ -1092,7 +1122,7 @@ Allows an application to add, remove, and modify calendar events.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.WRITE_CALL_LOG
## ohos.permission.WRITE_CALL_LOG
...
@@ -1102,7 +1132,7 @@ Allows an application to add, remove, and modify call logs.
...
@@ -1102,7 +1132,7 @@ Allows an application to add, remove, and modify call logs.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.WRITE_CONTACTS
## ohos.permission.WRITE_CONTACTS
...
@@ -1112,7 +1142,7 @@ Allows an application to add, remove, and modify contacts.
...
@@ -1112,7 +1142,7 @@ Allows an application to add, remove, and modify contacts.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.DISTRIBUTED_DATASYNC
## ohos.permission.DISTRIBUTED_DATASYNC
...
@@ -1122,7 +1152,7 @@ Allows an application to exchange data with other devices.
...
@@ -1122,7 +1152,7 @@ Allows an application to exchange data with other devices.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.MANAGE_VOICEMAIL
## ohos.permission.MANAGE_VOICEMAIL
...
@@ -1132,7 +1162,7 @@ Allows an application to leave messages in the voice mailbox.
...
@@ -1132,7 +1162,7 @@ Allows an application to leave messages in the voice mailbox.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.LOCATION_IN_BACKGROUND
## ohos.permission.LOCATION_IN_BACKGROUND
...
@@ -1152,7 +1182,9 @@ Allows an application to obtain the device location.
...
@@ -1152,7 +1182,9 @@ Allows an application to obtain the device location.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
**Application conditions**: The applications developed using the SDK earlier than API version 9 can directly apply for this permission. For the applications developed using the SDK of API version 9 or later, you need to apply for [ohos.permission.APPROXIMATELY_LOCATION](#ohospermissionapproximately_location) before applying for this permission.
## ohos.permission.APPROXIMATELY_LOCATION
## ohos.permission.APPROXIMATELY_LOCATION
...
@@ -1164,6 +1196,8 @@ Allows an application to obtain the approximate location information of a device
...
@@ -1164,6 +1196,8 @@ Allows an application to obtain the approximate location information of a device
**Enable ACL**: FALSE
**Enable ACL**: FALSE
**Application conditions**: Only applications developed using the SDK of API version 9 or later can apply for this permission.
## ohos.permission.MEDIA_LOCATION
## ohos.permission.MEDIA_LOCATION
Allows an application to access geographical locations in the user's media file.
Allows an application to access geographical locations in the user's media file.
...
@@ -1172,7 +1206,7 @@ Allows an application to access geographical locations in the user's media file.
...
@@ -1172,7 +1206,7 @@ Allows an application to access geographical locations in the user's media file.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.CAMERA
## ohos.permission.CAMERA
...
@@ -1182,7 +1216,7 @@ Allows an application to use the camera to take photos and record videos.
...
@@ -1182,7 +1216,7 @@ Allows an application to use the camera to take photos and record videos.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.READ_MEDIA
## ohos.permission.READ_MEDIA
...
@@ -1192,7 +1226,7 @@ Allows an application to read media files from the user's external storage.
...
@@ -1192,7 +1226,7 @@ Allows an application to read media files from the user's external storage.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.WRITE_MEDIA
## ohos.permission.WRITE_MEDIA
...
@@ -1202,7 +1236,7 @@ Allows an application to read media files from and write media files into the us
...
@@ -1202,7 +1236,7 @@ Allows an application to read media files from and write media files into the us
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.ACTIVITY_MOTION
## ohos.permission.ACTIVITY_MOTION
...
@@ -1212,7 +1246,7 @@ Allows an application to read the current workout status of the user.
...
@@ -1212,7 +1246,7 @@ Allows an application to read the current workout status of the user.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.READ_HEALTH_DATA
## ohos.permission.READ_HEALTH_DATA
...
@@ -1222,7 +1256,7 @@ Allows an application to read the health data of the user.
...
@@ -1222,7 +1256,7 @@ Allows an application to read the health data of the user.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.GET_DEFAULT_APPLICATION
## ohos.permission.GET_DEFAULT_APPLICATION
...
@@ -1232,7 +1266,7 @@ Allows an application to query default applications.
...
@@ -1232,7 +1266,7 @@ Allows an application to query default applications.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.SET_DEFAULT_APPLICATION
## ohos.permission.SET_DEFAULT_APPLICATION
...
@@ -1242,7 +1276,7 @@ Allows an application to set and reset default applications.
...
@@ -1242,7 +1276,7 @@ Allows an application to set and reset default applications.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.MANAGE_DISPOSED_APP_STATUS
## ohos.permission.MANAGE_DISPOSED_APP_STATUS
...
@@ -1252,7 +1286,7 @@ Allows an application to set and query the application handling state.
...
@@ -1252,7 +1286,7 @@ Allows an application to set and query the application handling state.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.ACCESS_IDS
## ohos.permission.ACCESS_IDS
...
@@ -1262,7 +1296,7 @@ Allows an application to query the unique identifier of a device.
...
@@ -1262,7 +1296,7 @@ Allows an application to query the unique identifier of a device.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.DUMP
## ohos.permission.DUMP
...
@@ -1272,7 +1306,7 @@ Allows the basic system information and SA service information to be exported.
...
@@ -1272,7 +1306,7 @@ Allows the basic system information and SA service information to be exported.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.DISTRIBUTED_SOFTBUS_CENTER
## ohos.permission.DISTRIBUTED_SOFTBUS_CENTER
...
@@ -1292,7 +1326,7 @@ Allows configuration and management of the permissions on .dlp files.
...
@@ -1292,7 +1326,7 @@ Allows configuration and management of the permissions on .dlp files.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.PROVISIONING_MESSAGE
## ohos.permission.PROVISIONING_MESSAGE
...
@@ -1302,7 +1336,7 @@ Allows the Super Device Manager application to be activated.
...
@@ -1302,7 +1336,7 @@ Allows the Super Device Manager application to be activated.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.ACCESS_SYSTEM_SETTINGS
## ohos.permission.ACCESS_SYSTEM_SETTINGS
...
@@ -1312,7 +1346,7 @@ Allows an application to access or start system **Settings**.
...
@@ -1312,7 +1346,7 @@ Allows an application to access or start system **Settings**.
**Authorization mode**: system_grant
**Authorization mode**: system_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.READ_IMAGEVIDEO
## ohos.permission.READ_IMAGEVIDEO
...
@@ -1322,7 +1356,7 @@ Allows access to the images or video files in a user's directory.
...
@@ -1322,7 +1356,7 @@ Allows access to the images or video files in a user's directory.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.READ_AUDIO
## ohos.permission.READ_AUDIO
...
@@ -1332,7 +1366,7 @@ Allows access to the audio files in a user's directory.
...
@@ -1332,7 +1366,7 @@ Allows access to the audio files in a user's directory.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.READ_DOCUMENT
## ohos.permission.READ_DOCUMENT
...
@@ -1342,7 +1376,7 @@ Allows access to the files in a user's directory.
...
@@ -1342,7 +1376,7 @@ Allows access to the files in a user's directory.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.WRITE_IMAGEVIDEO
## ohos.permission.WRITE_IMAGEVIDEO
...
@@ -1352,7 +1386,7 @@ Allows modification to the images or video files in a user's directory.
...
@@ -1352,7 +1386,7 @@ Allows modification to the images or video files in a user's directory.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.WRITE_AUDIO
## ohos.permission.WRITE_AUDIO
...
@@ -1362,7 +1396,7 @@ Audio modification to the audio files in a user's directory.
...
@@ -1362,7 +1396,7 @@ Audio modification to the audio files in a user's directory.
**Authorization mode**: user_grant
**Authorization mode**: user_grant
**Enable ACL**: TRUE
**Enable via ACL**: TRUE
## ohos.permission.WRITE_DOCUMENT
## ohos.permission.WRITE_DOCUMENT
...
@@ -1372,7 +1406,7 @@ Allows modification to the files in a user's directory.
...
@@ -1372,7 +1406,7 @@ Allows modification to the files in a user's directory.
1. function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback\<DownloadTask>): void;
2. function download(context: BaseContext, config: DownloadConfig): Promise\<DownloadTask>;
3. function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback\<UploadTask>): void;
4. function upload(context: BaseContext, config: UploadConfig): Promise\<UploadTask>;
**Change Impact**
The application developed based on an earlier version in the stage model needs to be adapted to the new APIs. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/Constant | Change Type|
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
enumHitTestTypeV9
```
- After change:
```ts
enumWebHitTestType
```
**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
interfaceHeaderV9
```
- After change:
```ts
interfaceWebHeader
```
**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
interfaceHitTestValue{
/**
* Get the hit test type.
*
* @since 9
*/
type:HitTestTypeV9;
/**
* Get the hit test extra data.
*
* @since 9
*/
extra:string;
}
```
- After change:
```ts
interfaceHitTestValue{
/**
* 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.
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.
Instead of importing APIs from the original **WebMessagePort** class, import APIs from **@ohos.web.webview** as follows:
```ts
importweb_webviewfrom'@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
importweb_webviewfrom'@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.
Instead of importing APIs from the original **WebCookie** class, import APIs from **@ohos.web.webview** as follows:
```ts
importweb_webviewfrom'@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**.
Compared with earlier versions, OpenHarmony 4.0.3.2 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 4.0.3.2 and later versions.
**Key API/Component Changes**
- Involved APIs:
enum HitTestTypeV9
- Before change:
```ts
enumHitTestTypeV9
```
- After change:
```ts
enumWebHitTestType
```
**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 4.0.3.2 and later versions.
**Key API/Component Changes**
- Involved APIs:
interface HeaderV9
- Before change:
```ts
interfaceHeaderV9
```
- After change:
```ts
interfaceWebHeader
```
**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 4.0.3.2 and later versions.
**Key API/Component Changes**
- Involved APIs:
interface HitTestValue
- Before change:
```ts
interfaceHitTestValue{
/**
* Get the hit test type.
*
* @since 9
*/
type:HitTestTypeV9;
/**
* Get the hit test extra data.
*
* @since 9
*/
extra:string;
}
```
- After change:
```ts
interfaceHitTestValue{
/**
* 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 4.0.3.2 and later versions.
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 4.0.3.2 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.
Instead of importing APIs from the original **WebMessagePort** class, import APIs from **@ohos.web.webview** as follows:
```ts
importweb_webviewfrom'@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
importweb_webviewfrom'@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.
Instead of importing APIs from the original **WebCookie** class, import APIs from **@ohos.web.webview** as follows:
```ts
importweb_webviewfrom'@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**.