diff --git a/en/application-dev/IDL/idl-guidelines.md b/en/application-dev/IDL/idl-guidelines.md
index 102992de24a2879f9b08a5274058c2cdf4c0a280..7753e85d309ebbf350b7825a9ad3f76e3a3fcddf 100644
--- a/en/application-dev/IDL/idl-guidelines.md
+++ b/en/application-dev/IDL/idl-guidelines.md
@@ -62,7 +62,7 @@ sequenceable a.b..C.D
The preceding statement is parsed into the following code in the C++ header file:
```cpp
-#include "a/b/d.h"
+#include "a/b/d.h"
using C::D;
```
@@ -347,11 +347,10 @@ export default {
#### Calling Methods from the Client for IPC
-When the client calls **connectAbility()** to connect to a Service ability, the **onConnect** callback in **onAbilityConnectDone** of the client receives the **IRemoteObject** instance returned by the **onConnect()** method of the Service ability. The client and Service ability are in different applications. Therefore, the directory of the client application must contain a copy of the .idl file (the SDK automatically generates the proxy class). The **onConnect** callback then uses the **IRemoteObject** instance to create the **testProxy** instance of the **IdlTestServiceProxy** class and calls the related IPC method. The sample code is as follows:
+When the client calls **connectServiceExtensionAbility()** to connect to a Service ability, the **onConnect** callback in **onAbilityConnectDone** of the client receives the **IRemoteObject** instance returned by the **onConnect()** method of the Service ability. The client and Service ability are in different applications. Therefore, the directory of the client application must contain a copy of the .idl file (the SDK automatically generates the proxy class). The **onConnect** callback then uses the **IRemoteObject** instance to create the **testProxy** instance of the **IdlTestServiceProxy** class and calls the related IPC method. The sample code is as follows:
```ts
import IdlTestServiceProxy from './idl_test_service_proxy'
-import featureAbility from '@ohos.ability.featureAbility';
function callbackTestIntTransaction(result: number, ret: number): void {
if (result == 0 && ret == 124) {
@@ -396,13 +395,13 @@ var onAbilityConnectDone = {
}
};
-function connectAbility: void {
+function connectAbility(): void {
let want = {
bundleName: 'com.example.myapplicationidl',
abilityName: 'com.example.myapplicationidl.ServiceAbility'
};
let connectionId = -1;
- connectionId = featureAbility.connectAbility(want, onAbilityConnectDone);
+ connectionId = this.context.connectServiceExtensionAbility(want, onAbilityConnectDone);
}
diff --git a/en/application-dev/application-models/Readme-EN.md b/en/application-dev/application-models/Readme-EN.md
index ab82a4abae17e667670a2587b4016eee669abd26..7c320ef8068cd15bd0694f454c054b425d9841fd 100644
--- a/en/application-dev/application-models/Readme-EN.md
+++ b/en/application-dev/application-models/Readme-EN.md
@@ -61,7 +61,7 @@
- [Component Startup Rules (Stage Model)](component-startup-rules.md)
- Inter-Device Application Component Interaction (Continuation)
- [Continuation Overview](inter-device-interaction-hop-overview.md)
- - [Cross-Device Migration (for System Applications Only)](hop-cross-device-migration.md)
+ - [Cross-Device Migration](hop-cross-device-migration.md)
- [Multi-device Collaboration (for System Applications Only)](hop-multi-device-collaboration.md)
- [Subscribing to System Environment Variable Changes](subscribe-system-environment-variable-changes.md)
- Process Model
diff --git a/en/application-dev/application-models/accessibilityextensionability.md b/en/application-dev/application-models/accessibilityextensionability.md
index a76742c142bfccdd015665478aadbaedf19ff39e..94c4429c5b2a4b49ba4dbae48f813dce16bba68a 100644
--- a/en/application-dev/application-models/accessibilityextensionability.md
+++ b/en/application-dev/application-models/accessibilityextensionability.md
@@ -118,7 +118,12 @@ After developing the custom logic for an accessibility extension service, you mu
```
## Enabling or Disabling a Custom Accessibility Extension Service
-To enable or disable an accessibility extension service, run the following command:
+You can enable or disable a custom accessibility extension service through the command line interface or the device settings.
+
+**Method 1**: through the command line interface
+
+Run the **hdc shell** command, then the following system command:
+
- To enable the service: **accessibility enable -a AccessibilityExtAbility -b com.example.demo -c rg**
- To disable the service: **accessibility disable -a AccessibilityExtAbility -b com.example.demo**
@@ -126,3 +131,9 @@ In the preceding commands, **AccessibilityExtAbility** indicates the name of the
If the service is enabled or disabled successfully, the message "enable ability successfully" or "disable ability successfully" is displayed.
+
+ **Method 2**: through the device settings
+- From the device settings screen, access the list of installed extended services under accessibility.
+If an extended service is not installed, it is grayed out, and "No service" is displayed.
+- Select the target extended service, and toggle on or off the switch to enable or disable it.
+- If you opt to enable a service, a security reminder is displayed. Wait until the countdown ends and then select the check box indicating that you are aware of and willing to assume the listed risks.
diff --git a/en/application-dev/application-models/arkts-ui-widget-configuration.md b/en/application-dev/application-models/arkts-ui-widget-configuration.md
index ea9832f92d32dfe0c2a4160f3ac6f8e904d323fa..d86c3b6991460a25c0ea6a177a8aec8c4607364c 100644
--- a/en/application-dev/application-models/arkts-ui-widget-configuration.md
+++ b/en/application-dev/application-models/arkts-ui-widget-configuration.md
@@ -54,7 +54,7 @@ Widget-related configuration includes **FormExtensionAbility** configuration and
| formVisibleNotify | Whether the widget is allowed to use the widget visibility notification.| String| Yes (initial value: left empty)|
| metadata | Metadata of the widget. This field contains the array of the **customizeData** field.| Object| Yes (initial value: left empty)|
| dataProxyEnabled | Whether the widget supports the [update-through-proxy](./arkts-ui-widget-update-by-proxy.md) feature. - **true**: The widget supports the update-through-proxy feature. - **false**: The widget does not support the update-through-proxy feature. If this tag is set to **true**, the settings for the scheduled update time will still take effect, but the settings for the update interval and next update time will not.| Boolean| Yes (initial value: **false**)|
- | isDynamic | Whether the widget is a dynamic widget. This tag only applies to ArkTS widgets. - **true**: The widget is a dynamic widget. - **false**: The widget is a static widget. In this case, the widget is displayed as a static image after being added.| Boolean| Yes (initial value: **true**)|
+ | isDynamic | Whether the widget is a dynamic widget. This tag applies only to ArkTS widgets. - **true**: The widget is a dynamic widget. - **false**: The widget is a static widget. In this case, the widget is displayed as a static image after being added.| Boolean| Yes (initial value: **true**)|
**Table 2** Internal structure of the window object
diff --git a/en/application-dev/application-models/component-startup-rules.md b/en/application-dev/application-models/component-startup-rules.md
index bddf63dbc69ea243733e6f60f67f92a854833bf7..2db47d35f24df7d3eb155bb4ab2540f4a1af7ce0 100644
--- a/en/application-dev/application-models/component-startup-rules.md
+++ b/en/application-dev/application-models/component-startup-rules.md
@@ -26,7 +26,7 @@ In view of this, OpenHarmony formulates a set of component startup rules, as fol
- If the **exported** field of the target component is **false**, verify the **ohos.permission.START_INVISIBLE_ABILITY** permission.
- For details, see [Component exported Configuration](../quick-start/module-configuration-file.md#abilities).
-- **Before starting a component of a background application, verify the BACKGROUND permission.**
+- **Before starting a UIAbility component of a background application, verify the BACKGROUND permission.**
- An application is considered as a foreground application only when the application process gains focus or its UIAbility component is running in the foreground.
- Verify the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission.
@@ -45,7 +45,9 @@ In view of this, OpenHarmony formulates a set of component startup rules, as fol
The rules for starting components on the same device vary in the following scenarios:
-- Starting or connecting to the UIAbility, ServiceExtensionAbility, and DataShareExtensionAbility components
+- Starting the UIAbility component
+
+- Starting the ServiceExtensionAbility and DataShareExtensionAbility components
- Using **startAbilityByCall()** to start the UIAbility component
@@ -56,9 +58,10 @@ In view of this, OpenHarmony formulates a set of component startup rules, as fol
The rules for starting components on a different device vary in the following scenarios:
-- Starting or connecting to the UIAbility, ServiceExtensionAbility, and DataShareExtensionAbility components
+- Starting the UIAbility component
+
+- Starting the ServiceExtensionAbility and DataShareExtensionAbility components
- Using **startAbilityByCall()** to start the UIAbility component

-
diff --git a/en/application-dev/application-models/figures/component-startup-inner-stage.png b/en/application-dev/application-models/figures/component-startup-inner-stage.png
index 00514276f4ac3eb8ead650e5858cebb0a344d2c6..9761b9879e513f0e1ad942b5fe18997f1331c9e5 100644
Binary files a/en/application-dev/application-models/figures/component-startup-inner-stage.png and b/en/application-dev/application-models/figures/component-startup-inner-stage.png differ
diff --git a/en/application-dev/application-models/figures/component-startup-inter-stage.png b/en/application-dev/application-models/figures/component-startup-inter-stage.png
index a6f79e6803edc160e5570729456569f46cc80967..517407f6b557648db78a0de89431d8b18f8e2b59 100644
Binary files a/en/application-dev/application-models/figures/component-startup-inter-stage.png and b/en/application-dev/application-models/figures/component-startup-inter-stage.png differ
diff --git a/en/application-dev/application-models/start-pageability-from-stage.md b/en/application-dev/application-models/start-pageability-from-stage.md
index bd6a11187fdfbc81c63bcc6601f8a8e82b0dbe4c..123e15c45614f83ece1c11db87827535b2ac4937 100644
--- a/en/application-dev/application-models/start-pageability-from-stage.md
+++ b/en/application-dev/application-models/start-pageability-from-stage.md
@@ -8,6 +8,10 @@ This topic describes how the two application components of the stage model start
A UIAbility starts a PageAbility in the same way as it starts another UIAbility.
+> **NOTE**
+>
+> In the FA model, **abilityName** consists of **bundleName** and **AbilityName**. For details, see the code snippet below.
+
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
@@ -25,7 +29,7 @@ export default class EntryAbility extends UIAbility {
});
let want = {
bundleName: "com.ohos.fa",
- abilityName: "EntryAbility",
+ abilityName: "com.ohos.fa.EntryAbility",
};
this.context.startAbility(want).then(() => {
console.info('Start Ability successfully.');
diff --git a/en/application-dev/application-models/start-uiability-from-fa.md b/en/application-dev/application-models/start-uiability-from-fa.md
index 42d8e034cd6519643423bb289217d1aa140a18d4..8520cf94be0d0d21999af3175848a37edac85c52 100644
--- a/en/application-dev/application-models/start-uiability-from-fa.md
+++ b/en/application-dev/application-models/start-uiability-from-fa.md
@@ -14,7 +14,7 @@ import featureAbility from '@ohos.ability.featureAbility';
let parameter = {
"want": {
bundleName: "com.ohos.stage",
- abilityName: "com.ohos.stage.EntryAbility"
+ abilityName: "EntryAbility"
}
};
featureAbility.startAbility(parameter).then((code) => {
diff --git a/en/application-dev/application-models/want-overview.md b/en/application-dev/application-models/want-overview.md
index cf5cac43999a5efbe59659252b6b3db325cacd8a..9260c71666f3c47181756ba205c265391d989b05 100644
--- a/en/application-dev/application-models/want-overview.md
+++ b/en/application-dev/application-models/want-overview.md
@@ -12,7 +12,7 @@
## Types of Want
-- **Explicit Want**: If **abilityName** and **bundleName** are specified in the **want** parameter when starting an an application component, explicit Want is used.
+- **Explicit Want**: If **abilityName** and **bundleName** are specified in the **want** parameter when starting an application component, explicit Want is used.
Explicit Want is usually used to start a known target application component in the same application. The target application component is started by specifying **bundleName** of the application where the target application component is located and **abilityName** in the **Want** object. When there is an explicit object to process the request, explicit Want is a simple and effective way to start the target application component.
@@ -24,7 +24,7 @@
}
```
-- **Implicit Want**: If **abilityName** is not specified in the **want** parameter when starting the an application component, implicit Want is used.
+- **Implicit Want**: If **abilityName** is not specified in the **want** parameter when starting an application component, implicit Want is used.
Implicit Want can be used when the object used to process the request is unclear and the current application wants to use a capability (defined by the [skills tag](../quick-start/module-configuration-file.md#skills)) provided by another application. The system matches all applications that declare to support the capability. For example, for a link open request, the system matches all applications that support the request and provides the available ones for users to select.
@@ -47,6 +47,7 @@
> - An application component that meets the conditions is matched. That application component is started.
> - Multiple application components that meet the conditions are matched. A dialog box is displayed for users to select one of them.
>
- > - If the **want** parameter passed does not contain **abilityName** or **bundleName**, the ServiceExtensionAbility components of all applications cannot be started through implicit Want.
+ > - In the scenario for starting the ServiceExtensionAbility component:
+ > - If the **want** parameter passed in contains **abilityName**, the ServiceExtensionAbility component cannot be started through implicit Want.
>
- > - If the **want** parameter passed contains **bundleName**, the **startServiceExtensionAbility()** method can be used to implicitly start ServiceExtensionAbility. By default, ServiceExtensionAbility with the highest priority is returned. If all the matching ServiceExtensionAbility components have the same priority, the first ServiceExtensionAbility is returned.
+ > - If the **want** parameter passed in contains **bundleName**, the **startServiceExtensionAbility()** method can be used to implicitly start the ServiceExtensionAbility component. By default, the ServiceExtensionAbility component with the highest priority is returned. If all the matching ServiceExtensionAbility components have the same priority, the first ServiceExtensionAbility component is returned.
diff --git a/en/application-dev/arkts-utils/cpu-intensive-task-development.md b/en/application-dev/arkts-utils/cpu-intensive-task-development.md
index 80ecd66bb86f11bb4b0dace92e8e6924bdbd8b4f..da11a1866dbeb1d374972fde6579676387d97ada 100644
--- a/en/application-dev/arkts-utils/cpu-intensive-task-development.md
+++ b/en/application-dev/arkts-utils/cpu-intensive-task-development.md
@@ -15,6 +15,7 @@ If a task does not need to occupy a background thread for a long time (3 minutes
1. Implement the logic of image processing.
2. Segment the data, and initiate associated task scheduling through task groups.
+
Create a [task group](../reference/apis/js-apis-taskpool.md#taskgroup10), call [addTask()](../reference/apis/js-apis-taskpool.md#addtask10) to add tasks, call [execute()](../reference/apis/js-apis-taskpool.md#taskpoolexecute10) to execute the tasks in the task group, and set [a high priority](../reference/apis/js-apis-taskpool.md#priority) for the task group. After all the tasks in the task group are complete, the histogram processing result is returned simultaneously.
3. Summarize and process the result arrays.
@@ -78,7 +79,7 @@ The following uses the training of a region-specific house price prediction mode

-2. In the main thread, call [ThreadWorker()](../reference/apis/js-apis-worker.md#threadworker9) to create a **Worker** object. The calling thread is the host thread.
+2. In the main thread, call [constructor()](../reference/apis/js-apis-worker.md#constructor9) of **ThreadWorker** to create a **Worker** object. The calling thread is the host thread.
```js
import worker from '@ohos.worker';
@@ -167,24 +168,22 @@ The following uses the training of a region-specific house price prediction mode
6. After the task is completed in the worker thread, destroy the worker thread. The worker thread can be destroyed by itself or the host thread. Then, call [onexit()](../reference/apis/js-apis-worker.md#onexit9) in the host thread to define the processing logic after the worker thread is destroyed.
-
```js
// After the worker thread is destroyed, execute the onexit() callback.
workerInstance.onexit = function() {
console.info("main thread terminate");
}
```
-
- In the host thread, call [terminate()](../reference/apis/js-apis-worker.md#terminate9) to destroy the worker thread and stop the worker thread from receiving messages.
-
+ Method 1: In the host thread, call [terminate()](../reference/apis/js-apis-worker.md#terminate9) to destroy the worker thread and stop the worker thread from receiving messages.
+
```js
- // Destroy the worker thread.
+// Destroy the worker thread.
workerInstance.terminate();
```
-
- In the worker thread, call [close()](../reference/apis/js-apis-worker.md#close9) to destroy the worker thread and stop the worker thread from receiving messages.
+ Method 2: In the worker thread, call [close()](../reference/apis/js-apis-worker.md#close9) to destroy the worker thread and stop the worker thread from receiving messages.
+
```js
// Destroy the worker thread.
workerPort.close();
diff --git a/en/application-dev/arkts-utils/linear-container.md b/en/application-dev/arkts-utils/linear-container.md
index 2a160f113f68e3257278e5a18168bb811a8efe30..84ed8ab890864a7d525aa24c096431b12d3d18e5 100644
--- a/en/application-dev/arkts-utils/linear-container.md
+++ b/en/application-dev/arkts-utils/linear-container.md
@@ -44,14 +44,14 @@ The APIs provided by **Vector** are deprecated since API version 9. You are advi
| Accessing elements| Use **vec\[index]** to obtain the value at a given position (specified by **index**).|
| Accessing elements| Use **get(index: number)** to obtain the element at a given position (specified by **index**).|
| Accessing elements| Use **getLastElement()** to obtain the last element in this container.|
-| Accessing elements| Use **getlndexOf(element: T)** to obtain the index of the first occurrence of the specified element.|
-| Accessing elements| Use **getLastlndexOf(element: T)** to obtain the index of the last occurrence of the specified element.|
+| Accessing elements| Use **getIndexOf(element: T)** to obtain the index of the first occurrence of the specified element.|
+| Accessing elements| Use **getLastIndexOf(element: T)** to obtain the index of the last occurrence of the specified element.|
| Accessing elements| Use **forEach(callbackFn: (value: T, index?: number, Vector?: Vector<T>) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator<T>** for data access.|
| Modifying elements| Use **vec\[index]=xxx** to change the value at a given position (specified by **index**).|
| Modifying elements| Use **set(index: number, element: T)** to replace an element at a given position (specified by **index**) with a given element.|
| Modifying elements| Use **setLength(newSize: number)** to set the size of this container.|
-| Deleting elements| Use **removeBylndex(index: number)** to remove the value at a given position (specified by **index**).|
+| Deleting elements| Use **removeByIndex(index: number)** to remove the value at a given position (specified by **index**).|
| Deleting elements| Use **remove(element: T)** to remove the first occurrence of the specified element.|
| Deleting elements| Use **removeByRange(fromIndex: number, toIndex: number)** to remove all of the elements within a range.|
@@ -74,14 +74,14 @@ You are advised to use **List** for frequent insertion and removal operations.
| Accessing elements| Use **get(index: number)** to obtain the element at a given position (specified by **index**).|
| Accessing elements| Use **getFirst()** to obtain the first element in this container.|
| Accessing elements| Use **getLast()** to obtain the last element in this container.|
-| Accessing elements| Use **getlndexOf(element: T)** to obtain the index of the first occurrence of the specified element.|
-| Accessing elements| Use **getLastlndexOf(element: T)** to obtain the index of the last occurrence of the specified element.|
+| Accessing elements| Use **getIndexOf(element: T)** to obtain the index of the first occurrence of the specified element.|
+| Accessing elements| Use **getLastIndexOf(element: T)** to obtain the index of the last occurrence of the specified element.|
| Accessing elements| Use **forEach(callbackfn: (value: T, index?: number, list?: List<T>)=> void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator<T>** for data access.|
| Modifying elements| Use **list\[index] = xxx** to change the value at a given position (specified by **index**).|
| Modifying elements| Use **set(index: number, element: T)** to replace an element at a given position (specified by **index**) with a given element.|
| Modifying elements| Use **replaceAllElements(callbackFn:(value: T,index?: number,list?: List<T>)=>T,thisArg?: Object)** to replace all elements in this container with new elements.|
-| Deleting elements| Use **removeBylndex(index: number)** to remove the value at a given position (specified by **index**).|
+| Deleting elements| Use **removeByIndex(index: number)** to remove the value at a given position (specified by **index**).|
| Deleting elements| Use **remove(element: T)** to remove the first occurrence of the specified element.|
@@ -105,13 +105,13 @@ You are advised to use **LinkedList** for frequent insertion and removal operati
| Accessing elements| Use **get(index: number)** to obtain the element at a given position (specified by **index**).|
| Accessing elements| Use **getFirst()** to obtain the first element in this container.|
| Accessing elements| Use **getLast()** to obtain the last element in this container.|
-| Accessing elements| Use **getlndexOf(element: T)** to obtain the index of the first occurrence of the specified element.|
-| Accessing elements| Use **getLastlndexOf(element: T)** to obtain the index of the last occurrence of the specified element.|
+| Accessing elements| Use **getIndexOf(element: T)** to obtain the index of the first occurrence of the specified element.|
+| Accessing elements| Use **getLastIndexOf(element: T)** to obtain the index of the last occurrence of the specified element.|
| Accessing elements| Use **forEach(callbackFn: (value: T, index?: number, list?: LinkedList<T>) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator<T>** for data access.|
| Modifying elements| Use **list\[index]=xxx** to change the value at a given position (specified by **index**).|
| Modifying elements| Use **set(index: number, element: T)** to replace an element at a given position (specified by **index**) with a given element.|
-| Deleting elements| Use **removeBylndex(index: number)** to remove the value at a given position (specified by **index**).|
+| Deleting elements| Use **removeByIndex(index: number)** to remove the value at a given position (specified by **index**).|
| Deleting elements| Use **remove(element: T)** to remove the first occurrence of the specified element.|
diff --git a/en/application-dev/arkts-utils/multi-thread-concurrency-overview.md b/en/application-dev/arkts-utils/multi-thread-concurrency-overview.md
index 2d42ea1a56cd56eb06cd1e8394735e17fed70a2b..08451191025d01ecfcd3b70f8fb8170826c35dc4 100644
--- a/en/application-dev/arkts-utils/multi-thread-concurrency-overview.md
+++ b/en/application-dev/arkts-utils/multi-thread-concurrency-overview.md
@@ -12,7 +12,7 @@ Due to the memory isolation feature of the actor model, cross-thread serializati
## Data Transfer Objects
-Data objects that can be transferred are classified into three types: [common objects](#common-objects), [transferable objects](#transferable-objects), and [shared objects](#shared-objects).
+Data objects that can be transferred are classified into the following types: [common objects](#common-objects), [transferable objects](#transferable-objects), [shared objects](#shared-objects), and [native binding objects](#native-binding-objects).
### Common Objects
@@ -24,7 +24,7 @@ The following object types are supported: basic types except Symbol, Date, Strin
### Transferable Objects
-Transferable objects are serialized through address transfer. It transfers the ownership of an object of the ArrayBuffer type object, rather than the content in it. After the ownership is transferred, the object becomes unavailable in the sender and can be used only in the receiver.
+Transferable objects are serialized through address transfer. It transfers the ownership of an object of the ArrayBuffer type, rather than the content in it. After the ownership is transferred, the object becomes unavailable in the sender and can be used only in the receiver.
```js
@@ -47,6 +47,15 @@ If multiple operations are simultaneously performed to modify data stored in an
let sharedBuffer = new SharedArrayBuffer(1024);
```
+### Native Binding Objects
+
+Native binding objects are provided by the system. They are bound to underlying system services and enables direct access to these services.
+
+Currently, native bound objects that support serialization include [Context](../application-models/application-context-stage.md) and [RemoteObject](../reference/apis/js-apis-rpc.md#remoteobject).
+
+The **Context** object provides the context information about an application component. It provides a way to access system services and resources so that the application component can interact with the system. For details about how to obtain context information, see [Context (Stage Model)](../application-models/application-context-stage.md).
+
+The **RemoteObject** object implements remote communication. It transfers the reference of an object between processes so that these processes can share the status and methods of the object. The service provider must inherit this class. For details about how to create a **RemoteObject** object, see [RemoteObject](../reference/apis/js-apis-rpc.md#remoteobject).
## TaskPool and Worker
diff --git a/en/application-dev/arkts-utils/nonlinear-container.md b/en/application-dev/arkts-utils/nonlinear-container.md
index 3287d2675528cd73c0e43c562263b5af07bfaf46..b5c6380ae873b9dc47b69a6754b357f7dac8c1c8 100644
--- a/en/application-dev/arkts-utils/nonlinear-container.md
+++ b/en/application-dev/arkts-utils/nonlinear-container.md
@@ -52,9 +52,9 @@ You are advised to use **HashSet** when you need a set that has only unique elem
| Adding elements| Use **add(value: T)** to add a value to this container.|
| Accessing elements| Use **values()** to return an iterator that contains all the values in this container.|
| Accessing elements| Use **entries()** to return an iterator that contains all the elements in this container.|
-| Accessing elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: HashSet) => void, thisArg?: Object)** to traverse the elements in this container.|
+| Accessing elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: HashSet\) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator<T>** for data access.|
-| Modifying elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: HashSet) => void, thisArg?: Object)** to change a value in this container.|
+| Modifying elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: HashSet\) => void, thisArg?: Object)** to change a value in this container.|
| Deleting elements| Use **remove(value: T)** to remove a value.|
| Deleting elements| Use **clear()** to clear this container.|
@@ -109,9 +109,9 @@ You are advised to use **TreeSet** when you need to store data in sorted order.
| Accessing elements| Use **entries()** to return an iterator that contains all the elements in this container.|
| Accessing elements| Use **getFirstValue()** to obtain the first value in this container.|
| Accessing elements| Use **getLastValue()** to obtain the last value in this container.|
-| Accessing elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: TreeSet) => void, thisArg?: Object)** to traverse the elements in this container.|
+| Accessing elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: TreeSet\) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator<T>** for data access.|
-| Modifying elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: TreeSet) => void, thisArg?: Object)** to change a value in this container.|
+| Modifying elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: TreeSet\) => void, thisArg?: Object)** to change a value in this container.|
| Deleting elements| Use **remove(value: T)** to remove a value.|
| Deleting elements| Use **clear()** to clear this container.|
@@ -169,9 +169,9 @@ You are advised to use **LightWeightSet** when you need a set that has only uniq
| Accessing elements| Use **values()** to return an iterator that contains all the values in this container.|
| Accessing elements| Use **entries()** to return an iterator that contains all the elements in this container.|
| Accessing elements| Use **getValueAt(index: number)** to obtain the value of an element at a given position (specified by **index**).|
-| Accessing elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: LightWeightSet) => void, thisArg?: Object)** to traverse the elements in this container.|
+| Accessing elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: LightWeightSet\) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator<T>** for data access.|
-| Modifying elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: LightWeightSet) => void, thisArg?: Object)** to change a value in this container.|
+| Modifying elements| Use **forEach(callbackFn: (value?: T, key?: T, set?: LightWeightSet\) => void, thisArg?: Object)** to change a value in this container.|
| Deleting elements| Use **remove(key: K)** to remove an element with the specified key.|
| Deleting elements| Use **removeAt(index: number)** to remove an element at a given position (specified by **index**).|
| Deleting elements| Use **clear()** to clear this container.|
@@ -197,10 +197,10 @@ You are advised to use PlainArray when you need to store KV pairs whose keys are
| Accessing elements| Use **getIndexOfValue(value: T)** to obtain the index of the specified value.|
| Accessing elements| Use **getKeyAt(index: number)** to obtain the key of an element at a given position (specified by **index**).|
| Accessing elements| Use **getValueAt(index: number)** to obtain the value of an element at a given position (specified by **index**).|
-| Accessing elements| Use **forEach(callbackFn: (value: T, index?: number, PlainArray?: PlainArray) => void, thisArg?: Object)** to traverse the elements in this container.|
+| Accessing elements| Use **forEach(callbackFn: (value: T, index?: number, PlainArray?: PlainArray\) => void, thisArg?: Object)** to traverse the elements in this container.|
| Accessing elements| Use **\[Symbol.iterator]():IterableIterator<[number, T]>** for data access.|
| Modifying elements| Use **setValueAt(index:number, value: T)** to change the value of an element at a given position (specified by **index**).|
-| Modifying elements| Use **forEach(callbackFn: (value: T, index?: number, PlainArray?: PlainArray) => void, thisArg?: Object)** to modify an element in this container.|
+| Modifying elements| Use **forEach(callbackFn: (value: T, index?: number, PlainArray?: PlainArray\) => void, thisArg?: Object)** to modify an element in this container.|
| Deleting elements| Use **remove(key: number)** to remove an element with the specified key.|
| Deleting elements| Use **removeAt(index: number)** to remove an element at a given position (specified by **index**).|
| Deleting elements| Use **removeRangeFrom(index: number, size: number)** to remove elements in a specified range.|
diff --git a/en/application-dev/arkts-utils/xml-parsing.md b/en/application-dev/arkts-utils/xml-parsing.md
index dd3e46517b3eec6aafce6d6566a2da982bbd8d6c..89ed22585be75803b281517d390f400ceeda9d4d 100644
--- a/en/application-dev/arkts-utils/xml-parsing.md
+++ b/en/application-dev/arkts-utils/xml-parsing.md
@@ -4,7 +4,7 @@
Data transferred in XML format must be parsed in actual use. Generally, three types of elements need to be parsed, as described in [Parsing XML Tags and Tag Values](#parsing-xml-tags-and-tag-values), [Parsing XML Attributes and Attribute Values](#parsing-xml-attributes-and-attribute-values), and [Parsing XML Event Types and Element Depths](#parsing-xml-event-types-and-element-depths).
-The **xml** module provides the **XmlPullParser** class to parse XML files. The input is an object of the ArrayBufffer or DataView type containing XML text, and the output is the parsed information.
+The **xml** module provides the **XmlPullParser** class to parse XML files. The input is an object of the ArrayBuffer or DataView type containing XML text, and the output is the parsed information.
**Table 1** XML parsing options
diff --git a/en/application-dev/connectivity/Readme-EN.md b/en/application-dev/connectivity/Readme-EN.md
index c09ca21b6d0814bd1cd2cecb95b0d2896fada8c4..1a391bd7af03ae3c5d01eb01e14b66efd1f0c565 100755
--- a/en/application-dev/connectivity/Readme-EN.md
+++ b/en/application-dev/connectivity/Readme-EN.md
@@ -9,6 +9,8 @@
- [Ethernet Connection](net-ethernet.md)
- [Network Connection Management](net-connection-manager.md)
- [mDNS Management](net-mdns.md)
+ - [Traffic Management](net-statistics.md)
+ - [VPN Management](net-vpn.md)
- IPC & RPC
- [IPC & RPC Overview](ipc-rpc-overview.md)
- [IPC & RPC Development](ipc-rpc-development-guideline.md)
diff --git a/en/application-dev/connectivity/http-request.md b/en/application-dev/connectivity/http-request.md
index 1bb784cf96fb1d74dcbafed54498435f505814b6..a0fa4102864ba2403e7a6826f3ca3b872b5a80dd 100644
--- a/en/application-dev/connectivity/http-request.md
+++ b/en/application-dev/connectivity/http-request.md
@@ -1,6 +1,6 @@
# HTTP Data Request
-## When to Use
+## Overview
An application can initiate a data request over HTTP. Common HTTP methods include **GET**, **POST**, **OPTIONS**, **HEAD**, **PUT**, **DELETE**, **TRACE**, and **CONNECT**.
@@ -18,7 +18,7 @@ The following table provides only a simple description of the related APIs. For
| ----------------------------------------- | ----------------------------------- |
| createHttp() | Creates an HTTP request. |
| request() | Initiates an HTTP request to a given URL. |
-| request2()10+ | Initiates an HTTP network request based on the URL and returns a streaming response.|
+| requestInStream()10+ | Initiates an HTTP network request to a given URL and returns a streaming response.|
| destroy() | Destroys an HTTP request. |
| on(type: 'headersReceive') | Registers an observer for HTTP Response Header events. |
| off(type: 'headersReceive') | Unregisters the observer for HTTP Response Header events.|
@@ -27,8 +27,8 @@ The following table provides only a simple description of the related APIs. For
| off\('dataReceive'\)10+ | Unregisters the observer for events indicating receiving of HTTP streaming responses. |
| on\('dataEnd'\)10+ | Registers an observer for events indicating completion of receiving HTTP streaming responses. |
| off\('dataEnd'\)10+ | Unregisters the observer for events indicating completion of receiving HTTP streaming responses.|
-| on\('dataProgress'\)10+ | Registers an observer for events indicating progress of receiving HTTP streaming responses. |
-| off\('dataProgress'\)10+ | Unregisters the observer for events indicating progress of receiving HTTP streaming responses.|
+| on\('dataReceiveProgress'\)10+ | Registers an observer for events indicating progress of receiving HTTP streaming responses. |
+| off\('dataReceiveProgress'\)10+ | Unregisters the observer for events indicating progress of receiving HTTP streaming responses.|
## How to Develop request APIs
@@ -53,6 +53,7 @@ httpRequest.on('headersReceive', (header) => {
});
httpRequest.request(
// Customize EXAMPLE_URL in extraData on your own. It is up to you whether to add parameters to the URL.
+ "EXAMPLE_URL",
{
method: http.RequestMethod.POST, // Optional. The default value is http.RequestMethod.GET.
// You can add header fields based on service requirements.
@@ -81,7 +82,7 @@ httpRequest.request(
// Call the destroy() method to release resources after HttpRequest is complete.
httpRequest.destroy();
} else {
- console.info('error:' + JSON.stringify(err));
+ console.error('error:' + JSON.stringify(err));
// Unsubscribe from HTTP Response Header events.
httpRequest.off('headersReceive');
// Call the destroy() method to release resources after HttpRequest is complete.
@@ -91,12 +92,12 @@ httpRequest.request(
);
```
-## How to Develop request2 APIs
+## How to Develop requestInStream APIs
1. Import the **http** namespace from **@ohos.net.http.d.ts**.
2. Call **createHttp()** to create an **HttpRequest** object.
3. Depending on your need, call **on()** of the **HttpRequest** object to subscribe to HTTP response header events as well as events indicating receiving of HTTP streaming responses, progress of receiving HTTP streaming responses, and completion of receiving HTTP streaming responses.
-4. Call **request2()** to initiate a network request. You need to pass in the URL and optional parameters of the HTTP request.
+4. Call **requestInStream()** to initiate a network request. You need to pass in the URL and optional parameters of the HTTP request.
5. Parse the returned response code as needed.
6. Call **off()** of the **HttpRequest** object to unsubscribe from the related events.
7. Call **httpRequest.destroy()** to release resources after the request is processed.
@@ -122,11 +123,11 @@ httpRequest.on('dataEnd', () => {
console.info('No more data in response, data receive end');
});
// Subscribe to events indicating progress of receiving HTTP streaming responses.
-httpRequest.on('dataProgress', (data) => {
- console.log("dataProgress receiveSize:" + data.receiveSize + ", totalSize:" + data.totalSize);
+httpRequest.on('dataReceiveProgress', (data) => {
+ console.log("dataReceiveProgress receiveSize:" + data.receiveSize + ", totalSize:" + data.totalSize);
});
-httpRequest.request2(
+httpRequest.requestInStream(
// Customize EXAMPLE_URL in extraData on your own. It is up to you whether to add parameters to the URL.
"EXAMPLE_URL",
{
@@ -146,14 +147,14 @@ httpRequest.request2(
readTimeout: 60000, // Optional. The default value is 60000, in ms. If a large amount of data needs to be transmitted, you are advised to set this parameter to a larger value to ensure normal data transmission.
usingProtocol: http.HttpProtocol.HTTP1_1, // Optional. The default protocol type is automatically specified by the system.
}, (err, data) => {
- console.info('error:' + JSON.stringify(err));
+ console.error('error:' + JSON.stringify(err));
console.info('ResponseCode :' + JSON.stringify(data));
// Unsubscribe from HTTP Response Header events.
httpRequest.off('headersReceive');
// Unregister the observer for events indicating receiving of HTTP streaming responses.
httpRequest.off('dataReceive');
// Unregister the observer for events indicating progress of receiving HTTP streaming responses.
- httpRequest.off('dataProgress');
+ httpRequest.off('dataReceiveProgress');
// Unregister the observer for events indicating completion of receiving HTTP streaming responses.
httpRequest.off('dataEnd');
// Call the destroy() method to release resources after HttpRequest is complete.
@@ -161,10 +162,3 @@ httpRequest.request2(
}
);
```
-
-## Samples
-
-The following sample is provided to help you better understand how to develop the HTTP data request feature:
-
-- [`Http`: Data Request (ArkTS) (API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/Http)
-- [HTTP Communication (ArkTS) (API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/SmartChatEtsOH)
diff --git a/en/application-dev/connectivity/ipc-rpc-development-guideline.md b/en/application-dev/connectivity/ipc-rpc-development-guideline.md
index b9bbb0608dfb83ba6d2198b063e68c4b324bbd88..14016ef5da297361bd4a17a3d278357060590784 100644
--- a/en/application-dev/connectivity/ipc-rpc-development-guideline.md
+++ b/en/application-dev/connectivity/ipc-rpc-development-guideline.md
@@ -1,6 +1,6 @@
# IPC & RPC Development Guidelines
-## When to Use
+## Overview
IPC/RPC enables a proxy and a stub that run on different processes to communicate with each other, regardless of whether they run on the same or different devices.
diff --git a/en/application-dev/connectivity/net-connection-manager.md b/en/application-dev/connectivity/net-connection-manager.md
index c443c93759caddbc5203b65022426882c0bb960b..f3b945ab0970786000ab8b04adfe90592a11e0d1 100644
--- a/en/application-dev/connectivity/net-connection-manager.md
+++ b/en/application-dev/connectivity/net-connection-manager.md
@@ -1,10 +1,11 @@
# Network Connection Management
-## Introduction
+## Overview
The Network Connection Management module provides basic network management capabilities, including management of Wi-Fi/cellular/Ethernet connection priorities, network quality evaluation, subscription to network connection status changes, query of network connection information, and DNS resolution.
> **NOTE**
+>
> To maximize the application running efficiency, most API calls are called asynchronously in callback or promise mode. The following code examples use the callback mode. For details about the APIs, see [sms API Reference](../reference/apis/js-apis-net-connection.md).
## Basic Concepts
@@ -107,7 +108,7 @@ conn.on('netAvailable', (data => {
// Listen to network status change events. If the network is unavailable, an on_netUnavailable event is returned.
conn.on('netUnavailable', (data => {
- console.log("net is unavailable, netId is " + data.netId);
+ console.log("net is unavailable, data is " + JSON.stringify(data));
}));
// Register an observer for network status changes.
diff --git a/en/application-dev/connectivity/net-ethernet.md b/en/application-dev/connectivity/net-ethernet.md
index 18f20a7fd7e1a4c9516386c543c9521522df5f66..76ae1ee28078520b9d70796f71fd2b9236f47959 100644
--- a/en/application-dev/connectivity/net-ethernet.md
+++ b/en/application-dev/connectivity/net-ethernet.md
@@ -1,10 +1,11 @@
# Ethernet Connection
-## Introduction
+## Overview
The Ethernet Connection module allows a device to access the Internet through a network cable. After a device is connected to the Ethernet through a network cable, the device can obtain a series of network attributes, such as the dynamically allocated IP address, subnet mask, gateway, and DNS. You can manually configure and obtain the network attributes of the device in static mode.
> **NOTE**
+>
> To maximize the application running efficiency, most API calls are called asynchronously in callback or promise mode. The following code examples use the callback mode. For details about the APIs, see [sms API Reference](../reference/apis/js-apis-net-ethernet.md).
## **Constraints**
diff --git a/en/application-dev/connectivity/net-mdns.md b/en/application-dev/connectivity/net-mdns.md
index de7982a5c03908a70e4005bdc5fbea3584c435f5..75da959da8c4b1fc55aa0afca1cf0dcd945b86bb 100644
--- a/en/application-dev/connectivity/net-mdns.md
+++ b/en/application-dev/connectivity/net-mdns.md
@@ -1,6 +1,6 @@
# MDNS Management
-## Introduction
+## Overview
Multicast DNS (mDNS) provides functions such as adding, removing, discovering, and resolving local services on a LAN.
- Local service: a service provider on a LAN, for example, a printer or scanner.
diff --git a/en/application-dev/connectivity/net-sharing.md b/en/application-dev/connectivity/net-sharing.md
index 4072217d9ced5d99b2052b5db8ccb8333fcb7023..f2b2e6ac21362691ede111db8b16316fa9fd32cb 100644
--- a/en/application-dev/connectivity/net-sharing.md
+++ b/en/application-dev/connectivity/net-sharing.md
@@ -1,10 +1,11 @@
# Network Sharing
-## Introduction
+## Overview
The Network Sharing module allows you to share your device's Internet connection with other connected devices by means of Wi-Fi hotspot, Bluetooth, and USB sharing. It also allows you to query the network sharing state and shared mobile data volume.
> **NOTE**
+>
> To maximize the application running efficiency, most API calls are called asynchronously in callback or promise mode. The following code examples use the callback mode. For details about the APIs, see [sms API Reference](../reference/apis/js-apis-net-sharing.md).
## Basic Concepts
diff --git a/en/application-dev/connectivity/net-statistics.md b/en/application-dev/connectivity/net-statistics.md
index 47ec62ff156448b3214885176c30b2f76d77b76c..6df8800dd479b48c32619514b8e6b90d5c776330 100644
--- a/en/application-dev/connectivity/net-statistics.md
+++ b/en/application-dev/connectivity/net-statistics.md
@@ -1,6 +1,6 @@
# Traffic Management
-## Introduction
+## Overview
The traffic management module allows you to query real-time or historical data traffic by the specified network interface card (NIC) or user ID (UID).
@@ -11,6 +11,7 @@ Its functions include:
- Subscribing to traffic change events by NIC or UID
> **NOTE**
+>
> To maximize the application running efficiency, most API calls are called asynchronously in callback or promise mode. The following code examples use the callback mode. For details about the APIs, see [Traffic Management](../reference/apis/js-apis-net-statistics.md).
The following describes the development procedure specific to each application scenario.
diff --git a/en/application-dev/connectivity/net-vpn.md b/en/application-dev/connectivity/net-vpn.md
new file mode 100644
index 0000000000000000000000000000000000000000..a93b00b932bdec33de7cb45764474c163ed456ce
--- /dev/null
+++ b/en/application-dev/connectivity/net-vpn.md
@@ -0,0 +1,363 @@
+# VPN Management
+
+## Overview
+
+A virtual private network (VPN) is a dedicated network established on a public network. On a VPN, the connection between any two nodes does not have an end-to-end physical link required by the traditional private network. Instead, user data is transmitted over a logical link because a VPN is a logical network deployed over the network platform (such as the Internet) provided by the public network service provider.
+
+> **NOTE**
+>
+> To maximize the application running efficiency, most API calls are called asynchronously in callback or promise mode. The following code examples use the callback mode. For details about the APIs, see [Traffic Management](../reference/apis/js-apis-net-vpn.md).
+
+The following describes the development procedure specific to each application scenario.
+
+## Available APIs
+
+For the complete list of APIs and example code, see [VPN Management](../reference/apis/js-apis-net-vpn.md).
+
+| Type| API| Description|
+| ---- | ---- | ---- |
+| ohos.net.vpn | setUp(config: VpnConfig, callback: AsyncCallback\): void | Establishes a VPN. This API uses an asynchronous callback to return the result.|
+| ohos.net.vpn | protect(socketFd: number, callback: AsyncCallback\): void | Enables VPN tunnel protection. This API uses an asynchronous callback to return the result.|
+| ohos.net.vpn | destroy(callback: AsyncCallback\): void | Destroys a VPN. This API uses an asynchronous callback to return the result.|
+
+## Starting a VPN
+
+1. Establish a VPN tunnel. The following uses the UDP tunnel as an example.
+2. Enable protection for the UDP tunnel.
+3. Establish a VPN.
+4. Process data of the virtual network interface card (vNIC), such as reading or writing data.
+5. Destroy the VPN.
+
+This example shows how to develop an application using native C++ code. For details, see [Simple Native C++ Example (ArkTS) (API9)] (https://gitee.com/openharmony/codelabs/tree/master/NativeAPI/NativeTemplateDemo).
+
+The sample application consists of two parts: JS code and C++ code.
+
+## JS Code
+The JS code is used to implement the service logic, such as creating a tunnel, establishing a VPN, enabling VPN protection, and destroying a VPN.
+
+```js
+import hilog from '@ohos.hilog';
+import vpn from '@ohos.net.vpn';
+import UIAbility from '@ohos.app.ability.UIAbility';
+import vpn_client from "libvpn_client.so"
+
+class EntryAbility extends UIAbility {
+ onWindowStageCreate(windowStage) {
+ globalThis.context = this.context;
+ }
+}
+
+let TunnelFd = -1
+let VpnConnection = vpn.createVpnConnection(globalThis.context)
+
+@Entry
+@Component
+struct Index {
+ @State message: string = 'Test VPN'
+
+ //1. Establish a VPN tunnel. The following uses the UDP tunnel as an example.
+ CreateTunnel() {
+ TunnelFd = vpn_client.udpConnect("192.168.43.208", 8888)
+ }
+
+ // 2. Enable protection for the UDP tunnel.
+ Protect() {
+ VpnConnection.protect(TunnelFd).then(function () {
+ console.info("vpn Protect Success.")
+ }).catch(function (err) {
+ console.info("vpn Protect Failed " + JSON.stringify(err))
+ })
+ }
+
+ SetupVpn() {
+ let config = {
+ addresses: [{
+ address: {
+ address: "10.0.0.5",
+ family: 1
+ },
+ prefixLength: 24,
+ }],
+ routes: [],
+ mtu: 1400,
+ dnsAddresses: [
+ "114.114.114.114"
+ ],
+ acceptedApplications: [],
+ refusedApplications: []
+ }
+
+ try {
+ // 3. Create a VPN.
+ VpnConnection.setUp(config, (error, data) => {
+ console.info("tunfd: " + JSON.stringify(data));
+ // 4. Process data of the virtual vNIC, such as reading or writing data.
+ vpn_client.startVpn(data, TunnelFd)
+ })
+ } catch (error) {
+ console.info("vpn setUp fail " + JSON.stringify(error));
+ }
+ }
+
+ // 5. Destroy the VPN.
+ Destroy() {
+ vpn_client.stopVpn(TunnelFd)
+ VpnConnection.destroy().then(function () {
+ console.info("vpn Destroy Success.")
+ }).catch(function (err) {
+ console.info("vpn Destroy Failed " + JSON.stringify(err))
+ })
+ }
+
+ build() {
+ Row() {
+ Column() {
+ Text(this.message)
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ .onClick(() => {
+ console.info("vpn Client")
+ })
+ Button('CreateTunnel').onClick(() => {
+ this.CreateTunnel()
+ }).fontSize(50)
+ Button('Protect').onClick(() => {
+ this.Protect()
+ }).fontSize(50)
+ Button('SetupVpn').onClick(() => {
+ this.SetupVpn()
+ }).fontSize(50)
+ Button('Destroy').onClick(() => {
+ this.Destroy()
+ }).fontSize(50)
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+```
+
+## C++ Code
+The C++ code is used for underlying service implementation, such as UDP tunnel client implementation and vNIC data read and write.
+
+```c++
+#include "napi/native_api.h"
+#include "hilog/log.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#define BUFFER_SIZE 2048
+
+#define VPN_LOG_TAG "NetMgrVpn"
+#define VPN_LOG_DOMAIN 0x15b0
+#define MAKE_FILE_NAME (strrchr(__FILE__, '/') + 1)
+
+#define NETMANAGER_VPN_LOGE(fmt, ...) \
+ OH_LOG_Print(LOG_APP, LOG_ERROR, VPN_LOG_DOMAIN, VPN_LOG_TAG, "vpn [%{public}s %{public}d] " fmt, MAKE_FILE_NAME, \
+ __LINE__, ##__VA_ARGS__)
+
+#define NETMANAGER_VPN_LOGI(fmt, ...) \
+ OH_LOG_Print(LOG_APP, LOG_INFO, VPN_LOG_DOMAIN, VPN_LOG_TAG, "vpn [%{public}s %{public}d] " fmt, MAKE_FILE_NAME, \
+ __LINE__, ##__VA_ARGS__)
+
+#define NETMANAGER_VPN_LOGD(fmt, ...) \
+ OH_LOG_Print(LOG_APP, LOG_DEBUG, VPN_LOG_DOMAIN, VPN_LOG_TAG, "vpn [%{public}s %{public}d] " fmt, MAKE_FILE_NAME, \
+ __LINE__, ##__VA_ARGS__)
+
+struct FdInfo {
+ int32_t tunFd = 0;
+ int32_t tunnelFd = 0;
+ struct sockaddr_in serverAddr;
+};
+
+static FdInfo fdInfo;
+static bool threadRunF = false;
+static std::thread threadt1;
+static std::thread threadt2;
+
+// Obtain the IP address of the UDP server.
+static constexpr const int MAX_STRING_LENGTH = 1024;
+std::string GetStringFromValueUtf8(napi_env env, napi_value value) {
+ std::string result;
+ char str[MAX_STRING_LENGTH] = {0};
+ size_t length = 0;
+ napi_get_value_string_utf8(env, value, str, MAX_STRING_LENGTH, &length);
+ if (length > 0) {
+ return result.append(str, length);
+ }
+ return result;
+}
+
+void HandleReadTunfd(FdInfo fdInfo) {
+ uint8_t buffer[BUFFER_SIZE] = {0};
+ while (threadRunF) {
+ int ret = read(fdInfo.tunFd, buffer, sizeof(buffer));
+ if (ret <= 0) {
+ if (errno != 11) {
+ NETMANAGER_VPN_LOGE("read tun device error: %{public}d, tunfd: %{public}d", errno, fdInfo.tunFd);
+ }
+ continue;
+ }
+
+ // Read data from the vNIC and send the data to the UDP server through the UDP tunnel.
+ NETMANAGER_VPN_LOGD("buffer: %{public}s, len: %{public}d", buffer, ret);
+ ret = sendto(fdInfo.tunnelFd, buffer, ret, 0, (struct sockaddr *)&fdInfo.serverAddr, sizeof(fdInfo.serverAddr));
+ if (ret <= 0) {
+ NETMANAGER_VPN_LOGE("send to server[%{public}s:%{public}d] failed, ret: %{public}d, error: %{public}s",
+ inet_ntoa(fdInfo.serverAddr.sin_addr), ntohs(fdInfo.serverAddr.sin_port), ret,
+ strerror(errno));
+ continue;
+ }
+ }
+}
+
+void HandleTcpReceived(FdInfo fdInfo) {
+ int addrlen = sizeof(struct sockaddr_in);
+ uint8_t buffer[BUFFER_SIZE] = {0};
+ while (threadRunF) {
+ int length = recvfrom(fdInfo.tunnelFd, buffer, sizeof(buffer), 0, (struct sockaddr *)&fdInfo.serverAddr,
+ (socklen_t *)&addrlen);
+ if (length < 0) {
+ if (errno != 11) {
+ NETMANAGER_VPN_LOGE("read tun device error: %{public}d, tunnelfd: %{public}d", errno, fdInfo.tunnelFd);
+ }
+ continue;
+ }
+
+ // Receive data from the UDP server and write the data to the vNIC.
+ NETMANAGER_VPN_LOGD("from [%{public}s:%{public}d] data: %{public}s, len: %{public}d",
+ inet_ntoa(fdInfo.serverAddr.sin_addr), ntohs(fdInfo.serverAddr.sin_port), buffer, length);
+ int ret = write(fdInfo.tunFd, buffer, length);
+ if (ret <= 0) {
+ NETMANAGER_VPN_LOGE("error Write To Tunfd, errno: %{public}d", errno);
+ }
+ }
+}
+
+static napi_value UdpConnect(napi_env env, napi_callback_info info) {
+ size_t argc = 2;
+ napi_value args[2] = {nullptr};
+ napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);
+
+ int32_t port = 0;
+ napi_get_value_int32(env, args[1], &port);
+ std::string ipAddr = GetStringFromValueUtf8(env, args[0]);
+
+ NETMANAGER_VPN_LOGI("ip: %{public}s port: %{public}d", ipAddr.c_str(), port);
+
+ // Establish a UDP tunnel.
+ int32_t sockFd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (sockFd == -1) {
+ NETMANAGER_VPN_LOGE("socket() error");
+ return 0;
+ }
+
+ struct timeval timeout = {1, 0};
+ setsockopt(sockFd, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(struct timeval));
+
+ memset(&fdInfo.serverAddr, 0, sizeof(fdInfo.serverAddr));
+ fdInfo.serverAddr.sin_family = AF_INET;
+ fdInfo.serverAddr.sin_addr.s_addr = inet_addr(ipAddr.c_str()); // server's IP addr
+ fdInfo.serverAddr.sin_port = htons(port); // port
+
+ NETMANAGER_VPN_LOGI("Connection successful");
+
+ napi_value tunnelFd;
+ napi_create_int32(env, sockFd, &tunnelFd);
+ return tunnelFd;
+}
+
+static napi_value StartVpn(napi_env env, napi_callback_info info) {
+ size_t argc = 2;
+ napi_value args[2] = {nullptr};
+ napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);
+
+ napi_get_value_int32(env, args[0], &fdInfo.tunFd);
+ napi_get_value_int32(env, args[1], &fdInfo.tunnelFd);
+
+ if (threadRunF) {
+ threadRunF = false;
+ threadt1.join();
+ threadt2.join();
+ }
+
+ // Start two threads. One is used to read data from the vNIC, and the other is used to receive data from the server.
+ threadRunF = true;
+ std::thread tt1(HandleReadTunfd, fdInfo);
+ std::thread tt2(HandleTcpReceived, fdInfo);
+
+ threadt1 = std::move(tt1);
+ threadt2 = std::move(tt2);
+
+ NETMANAGER_VPN_LOGI("StartVpn successful");
+
+ napi_value retValue;
+ napi_create_int32(env, 0, &retValue);
+ return retValue;
+}
+
+static napi_value StopVpn(napi_env env, napi_callback_info info) {
+ size_t argc = 1;
+ napi_value args[1] = {nullptr};
+ napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);
+
+ int32_t tunnelFd;
+ napi_get_value_int32(env, args[0], &tunnelFd);
+ if (tunnelFd) {
+ close(tunnelFd);
+ tunnelFd = 0;
+ }
+
+ // Stop the two threads.
+ if (threadRunF) {
+ threadRunF = false;
+ threadt1.join();
+ threadt2.join();
+ }
+
+ NETMANAGER_VPN_LOGI("StopVpn successful");
+
+ napi_value retValue;
+ napi_create_int32(env, 0, &retValue);
+ return retValue;
+}
+
+EXTERN_C_START
+static napi_value Init(napi_env env, napi_value exports) {
+ napi_property_descriptor desc[] = {
+ {"udpConnect", nullptr, UdpConnect, nullptr, nullptr, nullptr, napi_default, nullptr},
+ {"startVpn", nullptr, StartVpn, nullptr, nullptr, nullptr, napi_default, nullptr},
+ {"stopVpn", nullptr, StopVpn, nullptr, nullptr, nullptr, napi_default, nullptr},
+ };
+ napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
+ return exports;
+}
+EXTERN_C_END
+
+static napi_module demoModule = {
+ .nm_version = 1,
+ .nm_flags = 0,
+ .nm_filename = nullptr,
+ .nm_register_func = Init,
+ .nm_modname = "entry",
+ .nm_priv = ((void *)0),
+ .reserved = {0},
+};
+
+extern "C" __attribute__((constructor)) void RegisterEntryModule(void) {
+ napi_module_register(&demoModule);
+}
+```
diff --git a/en/application-dev/connectivity/socket-connection.md b/en/application-dev/connectivity/socket-connection.md
index 9dda8b4e4c0ac6931ea75ad706fef76c9fb3c0a3..fe8ab1f141e3525de46985ba113eee364adac723 100644
--- a/en/application-dev/connectivity/socket-connection.md
+++ b/en/application-dev/connectivity/socket-connection.md
@@ -1,6 +1,6 @@
# Socket Connection
-## Introduction
+## Overview
The Socket Connection module allows an application to transmit data over a socket connection through the TCP, UDP, or TLS protocol.
diff --git a/en/application-dev/connectivity/subscribe-remote-state.md b/en/application-dev/connectivity/subscribe-remote-state.md
index 5b21750ba8b56fefcb10a5fff653d7512765c279..d23385e44752cb0945217eddc74117202ca38c5f 100755
--- a/en/application-dev/connectivity/subscribe-remote-state.md
+++ b/en/application-dev/connectivity/subscribe-remote-state.md
@@ -1,5 +1,7 @@
# Subscribing to State Changes of a Remote Object
+## Overview
+
IPC/RPC allows you to subscribe to the state changes of a remote stub object. When the remote stub object dies, a death notification will be sent to your local proxy object. Such subscription and unsubscription are controlled by APIs. To be specific, you need to implement the **DeathRecipient** interface and the **onRemoteDied** API to clear resources. This callback is invoked when the process accommodating the remote stub object dies, or the device accommodating the remote stub object leaves the network. It is worth noting that these APIs should be called in the following order: The proxy object must first subscribe to death notifications of the stub object. If the stub object is in the normal state, the proxy object can cancel the subscription as required. If the process of the stub object exits or the device hosting the stub object goes offline, subsequent operations customized by the proxy object will be automatically triggered.
## When to Use
diff --git a/en/application-dev/connectivity/websocket-connection.md b/en/application-dev/connectivity/websocket-connection.md
index 4c373011c45be18183e4c622c3e7e35b97198a24..1b162256db5cad28aa50ca6989625f9191fb2257 100644
--- a/en/application-dev/connectivity/websocket-connection.md
+++ b/en/application-dev/connectivity/websocket-connection.md
@@ -1,6 +1,6 @@
# WebSocket Connection
-## When to Use
+## Overview
You can use WebSocket to establish a bidirectional connection between a server and a client. Before doing this, you need to use the **createWebSocket()** API to create a **WebSocket** object and then use the **connect()** API to connect to the server. If the connection is successful, the client will receive a callback of the **open** event. Then, the client can communicate with the server using the **send()** API. When the server sends a message to the client, the client will receive a callback of the **message** event. If the client no longer needs this connection, it can call the **close()** API to disconnect from the server. Then, the client will receive a callback of the **close** event.
diff --git a/en/application-dev/database/data-persistence-by-preferences.md b/en/application-dev/database/data-persistence-by-preferences.md
index e37c12369d59d2165220c8d8f5bbaa85029c37df..553050a55a585dc34e620623eb187a0365b8488e 100644
--- a/en/application-dev/database/data-persistence-by-preferences.md
+++ b/en/application-dev/database/data-persistence-by-preferences.md
@@ -68,7 +68,7 @@ The following table lists the APIs used for persisting user preference data. For
return;
}
console.info('Succeeded in getting preferences.');
- // Perform related data operations.
+ // Before performing related data operations, obtain a Preferences instance.
})
} catch (err) {
console.error(`Failed to get preferences. Code:${err.code},message:${err.message}`);
@@ -93,7 +93,7 @@ The following table lists the APIs used for persisting user preference data. For
return;
}
console.info('Succeeded in getting preferences.');
- // Perform related data operations.
+ // Before performing related data operations, obtain a Preferences instance.
})
} catch (err) {
console.error(`Failed to get preferences. Code is ${err.code},message:${err.message}`);
@@ -220,4 +220,4 @@ The following table lists the APIs used for persisting user preference data. For
} catch (err) {
console.error(`Failed to delete preferences. Code:${err.code}, message:${err.message}`);
}
- ```
+ ```
\ No newline at end of file
diff --git a/en/application-dev/database/data-sync-of-kv-store.md b/en/application-dev/database/data-sync-of-kv-store.md
index eb8994570f04b0d6690c2b91b1b1745602e980fb..b23dd91ed1a7b4ea0cd13f6d9b49de82e1821190 100644
--- a/en/application-dev/database/data-sync-of-kv-store.md
+++ b/en/application-dev/database/data-sync-of-kv-store.md
@@ -171,7 +171,7 @@ The following uses a single KV store as an example to describe how to implement
return;
}
console.info('Succeeded in getting KVStore.');
- // Perform related data operations.
+ // Before performing related data operations, obtain a KV store instance.
});
} catch (e) {
console.error(`An unexpected error occurred. Code:${e.code},message:${e.message}`);
@@ -275,4 +275,4 @@ The following uses a single KV store as an example to describe how to implement
}
}
});
- ```
+ ```
\ No newline at end of file
diff --git a/en/application-dev/dfx/Readme-EN.md b/en/application-dev/dfx/Readme-EN.md
index 5a1b6326bae1ecb94ef7fe8d9e4cfe2cdf2c6c56..c40f752d8f85e8894eb725965f50a7614dddef36 100644
--- a/en/application-dev/dfx/Readme-EN.md
+++ b/en/application-dev/dfx/Readme-EN.md
@@ -1,7 +1,6 @@
# DFX
- [Development of Application Event Logging](hiappevent-guidelines.md)
-- [Development of Performance Tracing](hitracemeter-guidelines.md)
- [Development of Distributed Call Chain Tracing](hitracechain-guidelines.md)
- [HiLog Development (Native)](hilog-guidelines.md)
- Performance Tracing
diff --git a/en/application-dev/dfx/appfreeze-guidelines.md b/en/application-dev/dfx/appfreeze-guidelines.md
index 05b52c4d8070386ec350701cefb2c6b63ef67d55..4984c95e215fe832f59abc3306bf777c6c313818 100644
--- a/en/application-dev/dfx/appfreeze-guidelines.md
+++ b/en/application-dev/dfx/appfreeze-guidelines.md
@@ -1,6 +1,6 @@
# Application Freeze (appfreeze) Log Analysis
-## Introduction
+## Overview
Application freeze (appfreeze) means that an application does not respond to user operations (for example, clicking) within a given period of time. OpenHarmony provides a mechanism for detecting appfreeze faults and generates appfreeze logs for fault analysis.
diff --git a/en/application-dev/dfx/apprecovery-guidelines.md b/en/application-dev/dfx/apprecovery-guidelines.md
index 284de5ca6d5f6027f2cce975a29b3259b2778021..9548404b3b359ad3f6fbe6778e0ddaeb374cc2ec 100644
--- a/en/application-dev/dfx/apprecovery-guidelines.md
+++ b/en/application-dev/dfx/apprecovery-guidelines.md
@@ -1,6 +1,6 @@
# Application Recovery Development
-## When to Use
+## Overview
During application running, some unexpected behaviors are inevitable. For example, unprocessed exceptions and errors are thrown, and the call or running constraints of the recovery framework are violated.
@@ -99,9 +99,12 @@ import AbilityConstant from '@ohos.app.ability.AbilityConstant'
- Define and register the [ErrorObserver](../reference/apis/js-apis-inner-application-errorObserver.md) callback. For details about its usage, see [errorManager](../reference/apis/js-apis-app-ability-errorManager.md).
```ts
- var registerId = -1;
- var callback = {
- onUnhandledException(errMsg) {
+ export let abilityWant : Want // file1
+
+ import * as G form "../file1"
+ let registerId = -1;
+ let callback: Callback = {
+ onUnhandledException(errMsg: string): void {
console.log(errMsg);
appRecovery.saveAppState();
appRecovery.restartApp();
@@ -112,7 +115,7 @@ import AbilityConstant from '@ohos.app.ability.AbilityConstant'
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
- globalThis.registerObserver = (() => {
+ G.registerObserver = (() => {
registerId = errorManager.on('error', callback);
})
@@ -138,13 +141,16 @@ After the callback triggers **appRecovery.saveAppState()**, **onSaveState(state,
After the callback triggers **appRecovery.restartApp()**, the application is restarted. After the restart, **onCreate(want, launchParam)** of **MainAbility** is called, and the saved data is in **parameters** of **want**.
```ts
+export let abilityWant : Want // file1
+
+import * as GlobalWant form "../file1"
storage: LocalStorage
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
- globalThis.abilityWant = want;
+ GlobalWant.abilityWant = want;
if (launchParam.launchReason == AbilityConstant.LaunchReason.APP_RECOVERY) {
this.storage = new LocalStorage();
- let recoveryData = want.parameters["myData"];
+ let recoveryData: string = want.parameters["myData"];
this.storage.setOrCreate("myData", recoveryData);
this.context.restoreWindowStage(this.storage);
}
@@ -154,12 +160,15 @@ onCreate(want, launchParam) {
- Unregister the **ErrorObserver** callback.
```ts
+export let abilityWant : Want // file1
+
+import * as G form "../file1"
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
- globalThis.unRegisterObserver = (() => {
- errorManager.off('error', registerId, (err) => {
+ G.unRegisterObserver = (() => {
+ errorManager.off(type: 'error', registerId: number, (err:Error) => {
console.error("[Demo] err:", err);
});
})
@@ -171,20 +180,22 @@ onWindowStageDestroy() {
This is triggered by the recovery framework. You do not need to register an **ErrorObserver** callback. You only need to implement **onSaveState** for application state saving and **onCreate** for data restore.
```ts
+export let abilityWant : Want // file1
+
+import * as GlobalWant form "../file1"
export default class MainAbility extends Ability {
- storage: LocalStorage
- onCreate(want, launchParam) {
+ onCreate(want: Want, launchParam:AbilityConstant.LaunchParam):void {
console.log("[Demo] MainAbility onCreate")
- globalThis.abilityWant = want;
+ GlobalWant.abilityWant = want;
if (launchParam.launchReason == AbilityConstant.LaunchReason.APP_RECOVERY) {
this.storage = new LocalStorage();
- let recoveryData = want.parameters["myData"];
- this.storage.setOrCreate("myData", recoveryData);
+ let recoveryData: string = want.parameters["myData"];
+ this.storage.setOrCreate("myData", recoveryData);
this.context.restoreWindowStage(this.storage);
}
}
- onSaveState(state, wantParams) {
+ onSaveState(state: AbilityConstant.StateType, wantParams: { [key: string]: Object }) : AbilityConstant.OnSaveResult{
// Ability has called to save app data
console.log("[Demo] MainAbility onSaveState")
wantParams["myData"] = "my1234567";
diff --git a/en/application-dev/dfx/cppcrash-guidelines.md b/en/application-dev/dfx/cppcrash-guidelines.md
index 4454422fe4f3aec6c781090a2e833ee103488dab..15136518788324e23ac46c8c8b5bba327c03ea7a 100644
--- a/en/application-dev/dfx/cppcrash-guidelines.md
+++ b/en/application-dev/dfx/cppcrash-guidelines.md
@@ -1,6 +1,6 @@
-# cppcrash Log Analysis
+# Process Crash (cppcrash) Log Analysis
-## Introduction
+## Overview
A process crash refers to a C/C++ runtime crash. The FaultLogger module of OpenHarmony provides capabilities such as process crash detection, log collection, log storage, and log reporting, helping you to locate faults more effectively.
@@ -23,7 +23,7 @@ Process crash detection is implemented based on the Linux signal mechanism. Curr
## Crash Log Collection
-Process crash log is the fault log managed together with the app freeze and JS application crash logs by the FaultLogger module. You can collect process crash logs in any of the following ways:
+Process crash log is a type of fault logs managed together with the app freeze and JS application crash logs by the FaultLogger module. You can collect process crash logs in any of the following ways:
### Collecting Logs by Using Shell
@@ -72,17 +72,14 @@ Thread name:crasher <- Abnormal thread
### Locating Faults Through Logs
-1. Determine the faulty module and fault type based on fault logs.
-
- Generally, you can identify the faulty module based on the crash process name and identify the crash cause based on the signal. Besides, you can restore the function call chain of the crash stack based on the method name in the stack.
-
- In the example, **SIGSEGV** is thrown by the Linux kernel because of access to an invalid memory address. The problem occurs in the **TriggerSegmentFaultException** function.
-
- In most scenarios, a crash is caused by the top layer of the crash stack, such as null pointer access and proactive program abort.
+- Determine the faulty module and fault type based on fault logs.
+ Generally, you can identify the faulty module based on the crash process name and identify the crash cause based on the signal. Besides, you can restore the function call chain of the crash stack based on the method name in the stack.\
+ In the example, **SIGSEGV** is thrown by the Linux kernel because of access to an invalid memory address. The problem occurs in the **TriggerSegmentFaultException** function.\
+ In most scenarios, a crash is caused by the top layer of the crash stack, such as null pointer access and proactive program abort.\
If the cause cannot be located through the call stack, you need to check for other faults, for example, memory corruption or stack overflow.
-2. Use the addr2line tool of Linux to parse the code line number to restore the call stack at the time of process crash.
+- Use the addr2line tool of Linux to parse the code line number to restore the call stack at the time of process crash.
When using the addr2line tool to parse the code line number of the crash stack, make sure that binary files with debugging information is used. Generally, such files are generated during version build or application build.
@@ -94,17 +91,17 @@ Thread name:crasher <- Abnormal thread
\code root directory\out\product\exe.unstripped
```
- You can run `apt-get install addr2line` to install the addr2line tool on Linux.
-
+ You can run `apt-get install addr2line` to install the addr2line tool on Linux.\
On On DevEco Studio, you can also use the llvm-addr2line tool archived in the SDK to parse code line numbers. The usage method is the same.
- The following example shows how to use the addr2line tool to parse the code line number based on the offset address:
+ The following example shows how to use the addr2line tool to parse the code line number based on the offset address.
+
+ **[product name]** indicates the device name.
```
- root:~/OpenHarmony/out/rk3568/exe.unstripped/hiviewdfx/faultloggerd$ addr2line -e crasher 0000332c
+ root:~/OpenHarmony/out/[product name]/exe.unstripped/hiviewdfx/faultloggerd$ addr2line -e crasher 0000332c
base/hiviewdfx/faultloggerd/tools/crasher/dfx_crasher.c:57
```
- In this example, the crash is caused by assignment of a value to an unwritable area. It is in code line 57 in the **dfx_crasher.c** file. You can modify it to avoid the crash.
-
+ In this example, the crash is caused by assignment of a value to an unwritable area. It is in code line 57 in the **dfx_crasher.c** file. You can modify it to avoid the crash.\
If the obtained code line number is seemingly incorrect, you can fine-tune the address (for example, subtract the address by 1) or disable some compilation optimization items. It is known that the obtained code line number may be incorrect when Link Time Optimization (LTO) is enabled.
diff --git a/en/application-dev/dfx/errormanager-guidelines.md b/en/application-dev/dfx/errormanager-guidelines.md
index 4679cfcfc78893590fe73eab770e49fc68a1a828..14d7735d731d0fb2eb3fc41f61de58f5de7f4e02 100644
--- a/en/application-dev/dfx/errormanager-guidelines.md
+++ b/en/application-dev/dfx/errormanager-guidelines.md
@@ -1,6 +1,6 @@
# Development of Error Manager
-## When to Use
+## Overview
If coding specification issues or errors exist in the code of an application, the application may encounter unexpected errors, for example, uncaught exceptions or application lifecycle timeouts, while it is running. In such a case, the application may exit unexpectedly. Error logs, however, are usually stored on users' local storage, making it inconvenient to locate faults. With the APIs provided by the **errorManager** module, your application will be able to report related errors and logs to your service platform for fault locating before it exits.
diff --git a/en/application-dev/dfx/hiappevent-guidelines.md b/en/application-dev/dfx/hiappevent-guidelines.md
index d21d4e3fa9e0fa0b795c82e7157cd6215eab5e0c..6b0f4dd1cb8ec36288514e3f8767770f4e30105b 100644
--- a/en/application-dev/dfx/hiappevent-guidelines.md
+++ b/en/application-dev/dfx/hiappevent-guidelines.md
@@ -1,6 +1,6 @@
# Development of Application Event Logging
-## Introduction
+## Overview
A traditional log system aggregates log information generated by all applications running on the entire device, making it difficult to identify key information in the log. Therefore, an effective logging mechanism is needed to evaluate mission-critical information, for example, number of visits, number of daily active users, user operation habits, and key factors that affect application usage.
diff --git a/en/application-dev/dfx/hilog-guidelines.md b/en/application-dev/dfx/hilog-guidelines.md
index 25b4a7f9cc5c92d9f20ed6582299d5dd65b937d0..45d46c01fb4c601241120ce9cf5d249bd0bc893f 100644
--- a/en/application-dev/dfx/hilog-guidelines.md
+++ b/en/application-dev/dfx/hilog-guidelines.md
@@ -1,6 +1,6 @@
# HiLog Development (Native)
-## Introduction
+## Overview
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.
diff --git a/en/application-dev/dfx/hitracechain-guidelines.md b/en/application-dev/dfx/hitracechain-guidelines.md
index affd260b0503f3c4f4c4b748d5911d94f7fef9e3..44e2da92dfbf985f27a275ac6e02e61a934d199e 100644
--- a/en/application-dev/dfx/hitracechain-guidelines.md
+++ b/en/application-dev/dfx/hitracechain-guidelines.md
@@ -1,6 +1,6 @@
# Development of Distributed Call Chain Tracing
-## Introduction
+## Overview
The hiTraceChain module provides APIs to implement call chain tracing throughout a service process. This can help you quickly obtain the run log for the call chain of a specified service process and locate faults in inter-device, inter-process, or inter-thread communications.
diff --git a/en/application-dev/dfx/hitracemeter-guidelines.md b/en/application-dev/dfx/hitracemeter-guidelines.md
index ed99e4e89d5b6fce3d5bd50ef8dedcfc32b04fb1..195aae4b2d98dd1ab950613c6c97ed07cfcfe98e 100644
--- a/en/application-dev/dfx/hitracemeter-guidelines.md
+++ b/en/application-dev/dfx/hitracemeter-guidelines.md
@@ -1,6 +1,6 @@
# Development of Performance Tracing (ArkTS)
-## Introduction
+## Overview
hiTraceMeter provides APIs for system performance tracing. You can call the APIs provided by the hiTraceMeter module in your own service logic to effectively track service processes and check the system performance.
@@ -21,7 +21,7 @@ hiTraceMeter provides APIs for system performance tracing. You can call the APIs
## Available APIs
-The performance tracing APIs are provided by the **hiTraceMeter** module. For details, see [API Reference](../reference/apis/js-apis-hitracemeter.md).
+The performance tracing APIs are provided by the **hiTraceMeter** module. For details, see [API Reference]( ../reference/apis/js-apis-hitracemeter.md).
**APIs for performance tracing**
@@ -35,60 +35,16 @@ The performance tracing APIs are provided by the **hiTraceMeter** module. For de
In this example, distributed call chain tracing begins when the application startup execution page is loaded and stops when the service usage is completed.
-1. Create a JS application project. In the displayed **Project** window, choose **entry** > **src** > **main** > **js** > **default** > **pages** > **index**, and double-click **index.js**. Add the code to implement performance tracing upon page loading. The sample code is as follows:
-
- ```js
- import hiTraceMeter from '@ohos.hiTraceMeter'
-
- export default {
- data: {
- title: ""
- },
- onInit() {
- this.title = this.$t('strings.world');
-
- // Start trace tasks with the same name concurrently.
- hiTraceMeter.startTrace("business", 1);
- // Keep the service process running.
- console.log(`business running`);
- hiTraceMeter.startTrace("business", 2); // Start the second trace task with the same name while the first task is still running. The tasks are running concurrently and therefore their taskId must be different.
- // Keep the service process running.
- console.log(`business running`);
- hiTraceMeter.finishTrace("business", 1);
- // Keep the service process running.
- console.log(`business running`);
- hiTraceMeter.finishTrace("business", 2);
-
- // Start trace tasks with the same name in serial mode.
- hiTraceMeter.startTrace("business", 1);
- // Keep the service process running.
- console.log(`business running`);
- hiTraceMeter.finishTrace("business", 1); // End the first trace task.
- // Keep the service process running.
- console.log(`business running`);
- hiTraceMeter.startTrace("business", 1); // Start the second trace task with the same name in serial mode.
- // Keep the service process running.
- console.log(`business running`);
-
- let traceCount = 3;
- hiTraceMeter.traceByValue("myTestCount", traceCount);
- traceCount = 4;
- hiTraceMeter.traceByValue("myTestCount", traceCount);
- hiTraceMeter.finishTrace("business", 1);
- }
- }
- ```
-
-2. Create an ArkTs application project. In the displayed **Project** window, choose **entry** > **src** > **main** > **ets** > **pages** > **index**, and double-click **index.js**. Add the code to implement performance tracing upon page loading. For example, if the name of the trace task is **HITRACE\_TAG\_APP**, the sample code is as follows:
-
+1. Create an ArkTS application project. In the displayed **Project** window, choose **entry** > **src** > **main** > **ets** > **pages** > **index**, and double-click **index.js**. Add the code to implement performance tracing upon page loading. For example, if the name of the trace task is **HITRACE\_TAG\_APP**, the sample code is as follows:
+
```ts
import hitrace from '@ohos.hiTraceMeter';
-
+
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
-
+
build() {
Row() {
Column() {
@@ -97,7 +53,7 @@ In this example, distributed call chain tracing begins when the application star
.fontWeight(FontWeight.Bold)
.onClick(() => {
this.message = 'Hello ArkUI';
-
+
// Start trace tasks with the same name concurrently.
hitrace.startTrace("HITRACE_TAG_APP", 1001);
// Keep the service process running.
@@ -107,7 +63,7 @@ In this example, distributed call chain tracing begins when the application star
hitrace.startTrace("HITRACE_TAG_APP", 1002);
// Keep the service process running.
console.log(`HITRACE_TAG_APP running`);
-
+
hitrace.finishTrace("HITRACE_TAG_APP", 1001);
hitrace.finishTrace("HITRACE_TAG_APP", 1002);
@@ -143,7 +99,7 @@ In this example, distributed call chain tracing begins when the application star
```
3. Click the run button on the application page. Then, run the following commands in sequence in shell:
-
+
```shell
hdc shell
hitrace --trace_begin app
diff --git a/en/application-dev/dfx/hitracemeter-native-guidelines.md b/en/application-dev/dfx/hitracemeter-native-guidelines.md
index bb0274f7c4077b016061430250e7a949cf826864..912ec1c5f87b6ebfdd6f14cb4da568e251501af2 100644
--- a/en/application-dev/dfx/hitracemeter-native-guidelines.md
+++ b/en/application-dev/dfx/hitracemeter-native-guidelines.md
@@ -1,6 +1,6 @@
# Development of Performance Tracing (Native)
-## Introduction
+## Overview
hiTraceMeter provides APIs for system performance tracing. You can call the APIs provided by the hiTraceMeter module in your own service logic to effectively track service processes and check the system performance.
> **NOTE**
diff --git a/en/application-dev/faqs/faqs-arkui-animation-interactive-event.md b/en/application-dev/faqs/faqs-arkui-animation-interactive-event.md
index 56c1f44dfd74cec442e94b6116a0bab8965cbc66..cc07a581e4fb9a271b566928e8a5c991185c42c8 100644
--- a/en/application-dev/faqs/faqs-arkui-animation-interactive-event.md
+++ b/en/application-dev/faqs/faqs-arkui-animation-interactive-event.md
@@ -36,10 +36,11 @@ You can use [attribute animation](../reference/arkui-ts/ts-animatorproperty.md)
Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
-**Solution**
+**Solution**
-- Add **focusable\(true\)** to the list item to enable it to obtain focus.
+ Use either of the following:
+- Add **focusable\(true\)** to the list item to enable it to obtain focus.
- Nest a focusable component, for example, **\**, at the outer layer of each item.
## Why is the click event not triggered for the focused component upon the press of the Enter key after keyboard navigation?
@@ -139,6 +140,8 @@ Currently, the menu is displayed when the bound component is clicked or long pre
Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
+**Solution**
+
Set the **focusable** attribute of the **\** component to **false**. In this way, the component is not focusable and therefore will not bring up the keyboard.
## How do I implement the slide up and slide down effect for page transition?
@@ -199,7 +202,7 @@ Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
**Symptom**
-Custom components A and B need to deliver the following effects: When custom component A, displayed at the bottom of the screen by default, is touched, it is hidden, and custom component B slides in from the bottom. When custom component B is touched, it is hidden, and custom component A slides in from the bottom.
+Custom components A and B need to deliver the following effects: When custom component A, displayed at the bottom of the screen by default, is touched, it is hidden, and custom component B slides in from the bottom; when custom component B is touched, it is hidden, and custom component A slides in from the bottom.
**Solution**
@@ -266,4 +269,4 @@ struct ComponentChild2 {
**Reference**
-[Transition Animation Within the Component](../ui/arkts-enter-exit-transition.md)
+[Enter/Exit Transition](../ui/arkts-enter-exit-transition.md)
diff --git a/en/application-dev/faqs/faqs-graphics.md b/en/application-dev/faqs/faqs-graphics.md
index 345cbf83c5b2976c810e78237cb2587eaa4b1404..4cc8b196d5b8210e2360a598c1b24fdc0edb891b 100644
--- a/en/application-dev/faqs/faqs-graphics.md
+++ b/en/application-dev/faqs/faqs-graphics.md
@@ -21,42 +21,6 @@ try {
}
```
-## How do I hide the status bar to get the immersive effect?
-
-Applicable to: OpenHarmony 3.2 Beta5 (API version 9)
-
-**Solution**
-
-1. Use **onWindowStageCreate** to obtain a **windowClass** object.
-
- ```
- onWindowStageCreate(windowStage) {
- // When the main window is created, set the main page for this ability.
- console.log("[Demo] MainAbility onWindowStageCreate")
- windowStage.getMainWindow((err, data) => {
- if (err.code) {
- console.error('Failed to obtain the main window.')
- return;
- }
- // Obtain a windowClass object.
- globalThis.windowClass = data;
- })
- }
- ```
-
-2. Enable the full-screen mode for the window and hide the status bar.
-
- ```
- globalThis.windowClass.setFullScreen(isFullScreen, (err, data) => {
- if (err.code) {
- console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err));
- return;
- }
- console.info('Succeeded in enabling the full-screen mode. Data: ' + JSON.stringify(data));
- });
- ```
-
-
## How do I obtain the window width and height?
Applicable to: OpenHarmony 3.2 Beta5 (API version 9, stage model)
diff --git a/en/application-dev/napi/Readme-EN.md b/en/application-dev/napi/Readme-EN.md
index 43049f368af41f388e6c618f3375d6a72c88d897..f2012a21898bb8c38e6b78e1dd65ab617bb6e0b5 100644
--- a/en/application-dev/napi/Readme-EN.md
+++ b/en/application-dev/napi/Readme-EN.md
@@ -18,3 +18,6 @@
- [Purgeable Memory Development](purgeable-memory-guidelines.md)
- Device Management
- [USB DDK Development](usb-ddk-guidelines.md)
+- Data Management
+ - [RelationalStore Development](native-relational-store-guidelines.md)
+
diff --git a/en/application-dev/napi/native-buffer-guidelines.md b/en/application-dev/napi/native-buffer-guidelines.md
index b45c43f77e6d63aac676327bc971d9eeb0609259..fae8927caa9563c9fd459906d9fb9ecf2e166297 100644
--- a/en/application-dev/napi/native-buffer-guidelines.md
+++ b/en/application-dev/napi/native-buffer-guidelines.md
@@ -26,6 +26,13 @@ For details about the APIs, see [native_buffer](../reference/native-apis/_o_h___
The following describes how to use the native APIs provided by **NativeBuffer** to create an **OH_NativeBuffer** instance, obtain memory properties, and map the corresponding ION memory to the process address space.
+**Adding Dynamic Link Libraries**
+
+Add the following library to **CMakeLists.txt**:
+```txt
+libnative_buffer.so
+```
+
**Header File**
```c++
#include
@@ -51,14 +58,14 @@ The following describes how to use the native APIs provided by **NativeBuffer**
if (ret != 0) {
std::cout << "OH_NativeBuffer_Map Failed" << std::endl;
}
-
- // Unmap the ION memory from the process address space when it is no longer needed.
+
+// Unmap the ION memory from the process address space when it is no longer needed.
ret = OH_NativeBuffer_Unmap(buffer);
if (ret != 0) {
std::cout << "OH_NativeBuffer_Unmap Failed" << std::endl;
}
```
-
+
3. Obtain the memory properties.
```c++
// Obtain the properties of the OH_NativeBuffer instance.
diff --git a/en/application-dev/napi/native-image-guidelines.md b/en/application-dev/napi/native-image-guidelines.md
index 10142f438059908cef4320b5d01e2029cf6cfe16..46518e0985b2b8ab8403456fced4d16f69b1fcb9 100644
--- a/en/application-dev/napi/native-image-guidelines.md
+++ b/en/application-dev/napi/native-image-guidelines.md
@@ -27,6 +27,17 @@ For details about the APIs, see [native_image](../reference/native-apis/_o_h___n
The following steps describe how to use the native APIs provided by **NativeImage** to create an **OH_NativeImage** instance as the consumer and update the data to a OpenGL external texture.
+**Adding Dynamic Link Libraries**
+
+Add the following libraries to **CMakeLists.txt**:
+```txt
+libEGL.so
+libGLESv3.so
+libnative_image.so
+libnative_window.so
+libnative_buffer.so
+```
+
**Header File**
```c++
#include
@@ -159,41 +170,48 @@ The following steps describe how to use the native APIs provided by **NativeImag
4. Write the produced content to a **NativeWindowBuffer** instance.
1. Obtain a NativeWindowBuffer instance from the NativeWindow instance.
- ```c++
- OHNativeWindowBuffer* buffer = nullptr;
- int fenceFd;
- // Obtain a NativeWindowBuffer instance by calling OH_NativeWindow_NativeWindowRequestBuffer.
- OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow, &buffer, &fenceFd);
- BufferHandle *handle = OH_NativeWindow_GetBufferHandleFromNative(buffer);
- int code = SET_BUFFER_GEOMETRY;
- int32_t width = 0x100;
- int32_t height = 0x100;
- ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, width, height);
- ```
- 3. Write the produced content to the **NativeWindowBuffer** instance.
- ```c++
- static uint32_t value = 0x00;
- value++;
- uint32_t *pixel = static_cast(handle->virAddr);
- for (uint32_t x = 0; x < width; x++) {
- for (uint32_t y = 0; y < height; y++) {
- *pixel++ = value;
- }
- }
- ```
- 4. Flush the **NativeWindowBuffer** to the **NativeWindow**.
- ```c++
- // Set the refresh region. If Rect in Region is a null pointer or rectNumber is 0, all contents in the NativeWindowBuffer are changed.
- Region region{nullptr, 0};
- // Flush the buffer to the consumer through OH_NativeWindow_NativeWindowFlushBuffer, for example, by displaying it on the screen.
- OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, buffer, fenceFd, region);
- ```
- 5. Destroy the **NativeWindow** instance when it is no longer needed.
- ```c++
- OH_NativeWindow_DestroyNativeWindow(nativeWindow);
- ```
-
+ ```c++
+ OHNativeWindowBuffer* buffer = nullptr;
+ int fenceFd;
+ // Obtain a NativeWindowBuffer instance by calling OH_NativeWindow_NativeWindowRequestBuffer.
+ OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow, &buffer, &fenceFd);
+
+ BufferHandle *handle = OH_NativeWindow_GetBufferHandleFromNative(buffer);
+ int code = SET_BUFFER_GEOMETRY;
+ int32_t width = 0x100;
+ int32_t height = 0x100;
+ ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, width, height);
+ ```
+
+ 2. Write the produced content to the **NativeWindowBuffer** instance.
+
+ ```c++
+ static uint32_t value = 0x00;
+ value++;
+ uint32_t *pixel = static_cast(handle->virAddr);
+ for (uint32_t x = 0; x < width; x++) {
+ for (uint32_t y = 0; y < height; y++) {
+ *pixel++ = value;
+ }
+ }
+ ```
+
+ 3. Flush the **NativeWindowBuffer** to the **NativeWindow**.
+
+ ```c++
+ // Set the refresh region. If Rect in Region is a null pointer or rectNumber is 0, all contents in the NativeWindowBuffer are changed.
+ Region region{nullptr, 0};
+ // Flush the buffer to the consumer through OH_NativeWindow_NativeWindowFlushBuffer, for example, by displaying it on the screen.
+ OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, buffer, fenceFd, region);
+ ```
+
+ 4. Destroy the **NativeWindow** instance when it is no longer needed.
+
+ ```c++
+ OH_NativeWindow_DestroyNativeWindow(nativeWindow);
+ ```
+
5. Update the content to the OpenGL texture.
```c++
// Update the content to the OpenGL texture.
diff --git a/en/application-dev/napi/native-relational-store-guidelines.md b/en/application-dev/napi/native-relational-store-guidelines.md
new file mode 100644
index 0000000000000000000000000000000000000000..b2f545c5c9989e1e1cf63e6a6ab0030b09bceed4
--- /dev/null
+++ b/en/application-dev/napi/native-relational-store-guidelines.md
@@ -0,0 +1,182 @@
+# RelationalStore Development Guide
+
+
+## When to Use
+
+RelationalStore provides a complete mechanism for local database management. It offers a series of interfaces for adding, deleting, modifying, and querying data in an RDB store. To satisfy different needs in complicated scenarios, RelationalStore also supports direct execution of SQL statements.
+
+
+## Basic concepts
+
+- **OH_Predicates**: A representation of the property or feature of a data entity, or the relationship between data entities. It is used to define operation conditions.
+
+- **OH_Cursor**: A set of query results, which allows access to the required data in flexible modes.
+
+
+## Restrictions
+
+- The default logging mode is Write Ahead Log (WAL), and the default flushing mode is **FULL** mode.
+
+- RelationalStore supports a maximum of four connection pools to manage read and write operations.
+
+- To ensure data accuracy, only one write operation is allowed at a time.
+
+- Once an application is uninstalled, related database files and temporary files on the device are automatically deleted.
+
+
+## Available APIs
+
+For details about the APIs, see [RDB](../reference/native-apis/_r_d_b.md).
+
+| API| Description|
+| -------- | -------- |
+| OH_Rdb_GetOrOpen(const OH_Rdb_Config *config, int *errCode) | Obtains an OH_Rdb_Store instance for RDB store operations.|
+| OH_Rdb_Execute(OH_Rdb_Store *store, const char *sql) | Executes an SQL statement that contains specified arguments but returns no value.|
+| OH_Rdb_Insert(OH_Rdb_Store *store, const char *table, OH_VBucket *valuesBucket) | Inserts a row of data into a table.|
+| OH_Rdb_Update(OH_Rdb_Store *store, OH_VBucket *valuesBucket, OH_Predicates *predicates); | Updates data in the RDB store based on the specified OH_Predicates instance.|
+| OH_Rdb_Delete(OH_Rdb_Store *store, OH_Predicates *predicates) | Deletes data from the RDB store based on the specified OH_Predicates instance.|
+| OH_Rdb_Query(OH_Rdb_Store *store, OH_Predicates *predicates, const char *const *columnNames, int length) | Queries data in the RDB store based on specified conditions.|
+| OH_Rdb_DeleteStore(const OH_Rdb_Config *config) | Deletes an RDB store.|
+
+
+## How to Develop
+
+1. Obtain the OH_Rdb_Store instance and create a database file.
+
+ Example:
+
+ ```c
+ // Create an OH_Rdb_Config object.
+ OH_Rdb_Config config;
+ // The path is the application sandbox path.
+ config.dataBaseDir = "xxx";
+ // Database file name.
+ config.storeName = "RdbTest.db";
+ // Application bundle name.
+ config.bundleName = "xxx";
+ // Module name.
+ config.moduleName = "xxx";
+ // Security level of the database file.
+ config.securityLevel = OH_Rdb_SecurityLevel::S1;
+ // Whether the database is encrypted.
+ config.isEncrypt = false;
+ // Memory size occupied by config.
+ config.selfSize = sizeof(OH_Rdb_Config);
+
+ int errCode = 0;
+ // Obtain the OH_Rdb_Store instance.
+ OH_Rdb_Store *store_ = OH_Rdb_GetOrOpen(&config, &errCode);
+ ```
+
+2. After obtaining the OH_Rdb_Store instance, call **OH_Rdb_Execute** to create a table and call **OH_Rdb_Insert** to insert data to the table created.
+
+ Example:
+
+ ```c
+ char createTableSql[] = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, "
+ "AGE INTEGER, SALARY REAL, CODES BLOB)";
+ // Create a table.
+ OH_Rdb_Execute(store_, createTableSql);
+
+ // Create a key-value pair instance.
+ OH_VBucket *valueBucket = OH_Rdb_CreateValuesBucket();
+ valueBucket->putText(valueBucket, "NAME", "Lisa");
+ valueBucket->putInt64(valueBucket, "AGE", 18);
+ valueBucket->putReal(valueBucket, "SALARY", 100.5);
+ uint8_t arr[] = {1, 2, 3, 4, 5};
+ int len = sizeof(arr) / sizeof(arr[0]);
+ valueBucket->putBlob(valueBucket, "CODES", arr, len);
+ // Insert data.
+ int rowId = OH_Rdb_Insert(store_, "EMPLOYEE", valueBucket);
+ // Destroy the KV pair instance.
+ valueBucket->destroy(valueBucket);
+ ```
+
+ > **NOTE**
+ >
+ > **RelationalStore** does not provide explicit flush operations for data persistence. **insert()** stores data in a file persistently.
+
+3. Modify or delete data based on the specified **Predicates** instance.
+
+ Call **OH_Rdb_Update** to modify data and call **OH_Rdb_Delete** to delete data.
+
+ Example:
+
+ ```c
+ // Modify data.
+ OH_VBucket *valueBucket = OH_Rdb_CreateValuesBucket();
+ valueBucket->putText(valueBucket, "NAME", "Rose");
+ valueBucket->putInt64(valueBucket, "AGE", 22);
+ valueBucket->putReal(valueBucket, "SALARY", 200.5);
+ uint8_t arr[] = {1, 2, 3, 4, 5};
+ int len = sizeof(arr) / sizeof(arr[0]);
+ valueBucket->putBlob(valueBucket, "CODES", arr, len);
+
+ OH_Predicates *predicates = OH_Rdb_CreatePredicates("EMPLOYEE");
+ OH_VObject *valueObject = OH_Rdb_CreateValueObject();
+ const char *name = "Lisa";
+ valueObject->putText(valueObject, name);
+ predicates->equalTo(predicates, "NAME", valueObject)->andOperate(predicates);
+ uint32_t count = 1;
+ double salary = 100.5;
+ valueObject->putDouble(valueObject, &salary, count);
+ predicates->equalTo(predicates, "SALARY", valueObject);
+
+ int changeRows = OH_Rdb_Update(store_, valueBucket, predicates);
+ valueObject->destroy(valueObject);
+ valueBucket->destroy(valueBucket);
+ predicates->destroy(predicates);
+ ```
+
+ ```c
+ // Delete data.
+ OH_Predicates *predicates = OH_Rdb_CreatePredicates("EMPLOYEE");
+ OH_VObject *valueObject = OH_Rdb_CreateValueObject();
+ const char *name = "Lisa";
+ valueObject->putText(valueObject, name);
+ predicates->equalTo(predicates, "NAME", valueObject);
+ int deleteRows = OH_Rdb_Delete(store_, predicates);
+ valueObject->destroy(valueObject);
+ predicates->destroy(predicates);
+ ```
+
+4. Query data based on the conditions specified by **Predicates**.
+
+ Call **OH_Rdb_Query** to query data. The data obtained is returned in a **OH_Cursor** object.
+
+ Example:
+
+ ```c
+ OH_Predicates *predicates = OH_Rdb_CreatePredicates("EMPLOYEE");
+
+ const char *columnNames[] = {"NAME", "AGE"};
+ int len = sizeof(columnNames) / sizeof(columnNames[0]);
+ OH_Cursor *cursor = OH_Rdb_Query(store_, predicates, columnNames, len);
+
+ int columnCount = 0;
+ cursor->getColumnCount(cursor, &columnCount);
+
+ // OH_Cursor is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
+ int64_t age;
+ while (cursor->goToNextRow(cursor) == OH_Rdb_ErrCode::RDB_OK) {
+ cursor->getInt64(cursor, 1, &age);
+ }
+
+ // Destroy the Predicates instance.
+ predicates->destroy(predicates);
+ // Destroy the result set.
+ cursor->destroy(cursor);
+ ```
+
+5. Delete the database.
+
+ Call **OH_Rdb_DeleteStore** to delete an RDB store and related database files.
+
+ Example:
+
+ ```c
+ // Close the database instance.
+ OH_Rdb_CloseStore(store_);
+ // Delete the database file.
+ OH_Rdb_DeleteStore(&config);
+ ```
diff --git a/en/application-dev/napi/native-vsync-guidelines.md b/en/application-dev/napi/native-vsync-guidelines.md
index 548a791e97ee75a1ee4ad83123893c5495181b59..f43495857483fc529ce03b565011a59e98fc07a7 100644
--- a/en/application-dev/napi/native-vsync-guidelines.md
+++ b/en/application-dev/napi/native-vsync-guidelines.md
@@ -6,12 +6,12 @@ The **NativeVSync** module is used to obtain virtual synchronization (VSync) sig
## Available APIs
-| API| Description:|
+| API| Description|
| -------- | -------- |
-| OH_NativeVSync_Create (const char \*name, unsigned int length) | Creates an **OH_NativeVSync** instance. A new **OH_NativeVSync** instance is created each time this function is called.|
-| OH_NativeVSync_Destroy (OH_NativeVSync \*nativeVsync) | Destroys an **OH_NativeVSync** instance.|
-| OH_NativeVSync_FrameCallback (long long timestamp, void \*data) | Sets a callback function. **timestamp** indicates the timestamp, and **data** indicates the input parameter of the callback function. |
-| OH_NativeVSync_RequestFrame (OH_NativeVSync \*nativeVsync, OH_NativeVSync_FrameCallback callback, void \*data) | Requests the next VSync signal. When the signal arrives, a callback function is invoked.|
+| OH_NativeVSync_Create (const char \*name, unsigned int length) | Creates an **OH_NativeVSync** instance. A new **OH_NativeVSync** instance is created each time this function is called.|
+| OH_NativeVSync_Destroy (OH_NativeVSync \*nativeVsync) | Destroys an **OH_NativeVSync** instance.|
+| OH_NativeVSync_FrameCallback (long long timestamp, void \*data) | Sets a callback function. **timestamp** indicates the timestamp, and **data** indicates the input parameter of the callback function.|
+| OH_NativeVSync_RequestFrame (OH_NativeVSync \*nativeVsync, OH_NativeVSync_FrameCallback callback, void \*data) | Requests the next VSync signal. When the signal arrives, a callback function is invoked.|
For details about the APIs, see [native_vsync](../reference/native-apis/_native_vsync.md).
@@ -19,6 +19,13 @@ For details about the APIs, see [native_vsync](../reference/native-apis/_native_
The following steps describe how to use the native APIs provided by **NativeVSync** to create and destroy an **OH_NativeVSync** instance and set the VSync callback function.
+**Adding Dynamic Link Libraries**
+
+Add the following library to **CMakeLists.txt**:
+```txt
+libnative_vsync.so
+```
+
**Header File**
```c++
#include
@@ -33,12 +40,12 @@ The following steps describe how to use the native APIs provided by **NativeVSyn
std::cout << "OnVSync: " << timestamp << std::endl;
}
OH_NativeVSync_FrameCallback callback = OnVSync; // The callback function must be of the OH_NativeVSync_FrameCallback type.
- ```
+ ```
2. Create an **OH_NativeVSync** instance.
```c++
char name[] = "hello_vsync";
OH_NativeVSync* nativeVSync = OH_NativeVSync_Create(name, strlen(name));
- ```
+ ```
3. Set the VSync callback function through the **OH_NativeVSync** instance.
```c++
diff --git a/en/application-dev/napi/native-window-guidelines.md b/en/application-dev/napi/native-window-guidelines.md
index f6f4e44b5edd8f40757105b4c050d4c9b2b0363d..5c5a62ab3d256689d1d467595797e3f2c605b679 100644
--- a/en/application-dev/napi/native-window-guidelines.md
+++ b/en/application-dev/napi/native-window-guidelines.md
@@ -11,11 +11,11 @@ The following scenarios are common for NativeWindow development:
## Available APIs
-| API| Description|
+| API| Description|
| -------- | -------- |
-| OH_NativeWindow_NativeWindowRequestBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*\*buffer, int \*fenceFd) | Requests an **OHNativeWindowBuffer** through an **OHNativeWindow** instance for content production.|
-| OH_NativeWindow_NativeWindowFlushBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*buffer, int fenceFd, Region region) | Flushes the **OHNativeWindowBuffer** filled with the content to the buffer queue through an **OHNativeWindow** instance for content consumption.|
-| OH_NativeWindow_NativeWindowHandleOpt (OHNativeWindow \*window, int code,...) | Sets or obtains the attributes of an **OHNativeWindow**, including the width, height, and content format.|
+| OH_NativeWindow_NativeWindowRequestBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*\*buffer, int \*fenceFd) | Requests an **OHNativeWindowBuffer** through an **OHNativeWindow** instance for content production.|
+| OH_NativeWindow_NativeWindowFlushBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*buffer, int fenceFd, Region region) | Flushes the **OHNativeWindowBuffer** filled with the content to the buffer queue through an **OHNativeWindow** instance for content consumption.|
+| OH_NativeWindow_NativeWindowHandleOpt (OHNativeWindow \*window, int code,...) | Sets or obtains the attributes of an **OHNativeWindow**, including the width, height, and content format.|
For details about the APIs, see [native_window](../reference/native-apis/_native_window.md).
@@ -37,7 +37,7 @@ libnative_window.so
#include
```
-1. Obtain an **OHNativeWindow** instance.
+1. Obtain an **OHNativeWindow** instance.
You can call the APIs provided by [OH_NativeXComponent_Callback](../reference/native-apis/_o_h___native_x_component___callback.md) to obtain an **OHNativeWindow** instance. An example code snippet is provided below. For details about how to use the **\**, see [XComponent Development](xcomponent-guidelines.md).
1. Add an **\** to the .ets file.
@@ -159,5 +159,3 @@ libnative_window.so
// munmap failed
}
```
-
-
\ No newline at end of file
diff --git a/en/application-dev/napi/neural-network-runtime-guidelines.md b/en/application-dev/napi/neural-network-runtime-guidelines.md
index 344ae4f1d623f67fcd3b093e8dec6653b806c4f2..974ccc5bafbfe7169034924ba27d0eb3c91606a8 100644
--- a/en/application-dev/napi/neural-network-runtime-guidelines.md
+++ b/en/application-dev/napi/neural-network-runtime-guidelines.md
@@ -1,4 +1,4 @@
-# Connecting the Neural Network Runtime to an AI Inference Framework
+# Development Guide for Connecting the Neural Network Runtime to an AI Inference Framework
## When to Use
@@ -19,8 +19,7 @@ The environment requirements for the Neural Network Runtime are as follows:
- Development environment: Ubuntu 18.04 or later.
- Access device: a standard device running OpenHarmony. The built-in hardware accelerator driver has been connected to the Neural Network Runtime through an HDI API.
-The Neural Network Runtime is opened to external systems through OpenHarmony Native APIs. Therefore, you need to use the Native development suite of the OpenHarmony to compile Neural Network Runtime applications.
-
+The Neural Network Runtime is opened to external systems through OpenHarmony Native APIs. Therefore, you need to use the Native development suite of the OpenHarmony to compile Neural Network Runtime applications.
### Environment Setup
@@ -33,7 +32,6 @@ unzip native-linux-{version number}.zip
```
The directory structure after decompression is as follows. The content in the directory may vary depending on version iteration. Use the Native APIs of the latest version.
-
```text
native/
─ ─ build // Cross-compilation toolchain
@@ -488,4 +486,4 @@ The development process of the Neural Network Runtime consists of three phases:
```shell
rm /data/local/tmp/*nncache
- ```
\ No newline at end of file
+ ```
diff --git a/en/application-dev/napi/vulkan-guidelines.md b/en/application-dev/napi/vulkan-guidelines.md
index e55b53cd38d44fb5d5a893cdbc21d175b9b0c8df..6ce31b8e1339633bcaa45f47637204f3b4ecef84 100644
--- a/en/application-dev/napi/vulkan-guidelines.md
+++ b/en/application-dev/napi/vulkan-guidelines.md
@@ -18,6 +18,15 @@ For details about the APIs, see [Vulkan](../reference/native-lib/third_party_vul
The following steps illustrate how to create a **VkSurfaceKHR** instance.
+**Adding Dynamic Link Libraries**
+
+Add the following libraries to **CMakeLists.txt**:
+```txt
+libace_ndk.z.so
+libnative_window.so
+libvulkan.so
+```
+
**Header File**
```c++
#include
diff --git a/en/application-dev/quick-start/arkts-appstorage.md b/en/application-dev/quick-start/arkts-appstorage.md
index 50cbcf6aa0854fc901eb6bbf80b41da7c990eaa1..c1ebb9c91252d5b75a96b837e6f07bd2f1053a56 100644
--- a/en/application-dev/quick-start/arkts-appstorage.md
+++ b/en/application-dev/quick-start/arkts-appstorage.md
@@ -23,8 +23,7 @@ Selected state attributes of AppStorage can be synced with different data source
As mentioned above, if you want to establish a binding between AppStorage and a custom component, you'll need the \@StorageProp and \@StorageLink decorators. Use \@StorageProp(key) or \@StorageLink(key) to decorate variables in the component, where **key** identifies the attribute in AppStorage.
-When a custom component is initialized, the \@StorageProp(key)/\@StorageLink(key) decorated variable is initialized with the value of the attribute with the given key in AppStorage. Local initialization is mandatory. If an attribute with the given key is missing from AppStorage, it will be added with the stated initializing value. (Whether the attribute with the given key exists in AppStorage depends on the application logic.)
-
+When a custom component is initialized, the \@StorageProp(key)/\@StorageLink(key) decorated variable is initialized with the value of the attribute with the given key in AppStorage. Whether the attribute with the given key exists in AppStorage depends on the application logic. This means that the attribute with the given key may be missing from AppStorage. In light of this, local initialization is mandatory for the \@StorageProp(key)/\@StorageLink(key) decorated variable.
By decorating a variable with \@StorageProp(key), a one-way data synchronization is established with the attribute with the given key in AppStorage. A local change can be made, but it will not be synchronized to AppStorage. An update to the attribute with the given key in AppStorage will overwrite local changes.
@@ -193,9 +192,85 @@ struct CompA {
}
```
-### Persistent Subscription and Callback
+### Unrecommended: Using @StorageLink to Implement Event Notification
+
+Compared with the common mechanism for event notification, the two-way synchronization mechanism of @StorageLink and AppStorage is far less cost efficient and therefore not recommended. This is because AppStorage stores UI-related data, and its changes will cause costly UI refresh.
+
+In the following example, any tap event in the **TapImage** component will trigger a change of the **tapIndex** attribute. As @StorageLink establishes a two-way data synchronization with AppStorage, the local change is synchronized to AppStorage. As a result, all visible custom components owning the **tapIndex** attribute bound to AppStorage are notified to refresh the UI.
+
+
+```ts
+// xxx.ets
+class ViewData {
+ title: string;
+ uri: Resource;
+ color: Color = Color.Black;
+
+ constructor(title: string, uri: Resource) {
+ this.title = title;
+ this.uri = uri
+ }
+}
+
+@Entry
+@Component
+struct Gallery2 {
+ dataList: Array = [new ViewData('flower', $r('app.media.icon')), new ViewData('OMG', $r('app.media.icon')), new ViewData('OMG', $r('app.media.icon'))]
+ scroller: Scroller = new Scroller()
+
+ build() {
+ Column() {
+ Grid(this.scroller) {
+ ForEach(this.dataList, (item: ViewData, index?: number) => {
+ GridItem() {
+ TapImage({
+ uri: item.uri,
+ index: index
+ })
+ }.aspectRatio(1)
+
+ }, (item: ViewData, index?: number) => {
+ return JSON.stringify(item) + index;
+ })
+ }.columnsTemplate('1fr 1fr')
+ }
+
+ }
+}
+
+@Component
+export struct TapImage {
+ @StorageLink('tapIndex') @Watch('onTapIndexChange') tapIndex: number = -1;
+ @State tapColor: Color = Color.Black;
+ private index: number;
+ private uri: Resource;
+
+ // Check whether the component is selected.
+ onTapIndexChange() {
+ if (this.tapIndex >= 0 && this.index === this.tapIndex) {
+ console.info(`tapindex: ${this.tapIndex}, index: ${this.index}, red`)
+ this.tapColor = Color.Red;
+ } else {
+ console.info(`tapindex: ${this.tapIndex}, index: ${this.index}, black`)
+ this.tapColor = Color.Black;
+ }
+ }
-The persistent subscription and callback can help reduce overhead and enhance code readability.
+ build() {
+ Column() {
+ Image(this.uri)
+ .objectFit(ImageFit.Cover)
+ .onClick(() => {
+ this.tapIndex = this.index;
+ })
+ .border({ width: 5, style: BorderStyle.Dotted, color: this.tapColor })
+ }
+
+ }
+}
+```
+
+To implement event notification with less overhead and higher code readability, use **emit** instead, with which you can subscribe to an event and receive event callback.
```ts
@@ -294,10 +369,9 @@ export struct TapImage {
}
```
-The following example uses the message mechanism to subscribe to events. Because this mechanism can result in a large number of nodes to listen for and a long implementation time, it is not recommended.
-
+The preceding notification logic is simple. It can be simplified into a ternary expression as follows:
-```ts
+```
// xxx.ets
class ViewData {
title: string;
@@ -338,22 +412,11 @@ struct Gallery2 {
@Component
export struct TapImage {
- @StorageLink('tapIndex') @Watch('onTapIndexChange') tapIndex: number = -1;
+ @StorageLink('tapIndex') tapIndex: number = -1;
@State tapColor: Color = Color.Black;
private index: number;
private uri: Resource;
- // Check whether the component is selected.
- onTapIndexChange() {
- if (this.tapIndex >= 0 && this.index === this.tapIndex) {
- console.info(`tapindex: ${this.tapIndex}, index: ${this.index}, red`)
- this.tapColor = Color.Red;
- } else {
- console.info(`tapindex: ${this.tapIndex}, index: ${this.index}, black`)
- this.tapColor = Color.Black;
- }
- }
-
build() {
Column() {
Image(this.uri)
@@ -361,14 +424,18 @@ export struct TapImage {
.onClick(() => {
this.tapIndex = this.index;
})
- .border({ width: 5, style: BorderStyle.Dotted, color: this.tapColor })
+ .border({
+ width: 5,
+ style: BorderStyle.Dotted,
+ color: (this.tapIndex >= 0 && this.index === this.tapIndex) ? Color.Red : Color.Black
+ })
}
-
}
}
```
+
## Restrictions
When using AppStorage together with [PersistentStorage](arkts-persiststorage.md) and [Environment](arkts-environment.md), pay attention to the following:
@@ -377,5 +444,5 @@ When using AppStorage together with [PersistentStorage](arkts-persiststorage.md)
- A call to **Environment.EnvProp()** after creating the attribute in AppStorage will fail. This is because AppStorage already has an attribute with the same name, and the environment variable will not be written into AppStorage. Therefore, you are advised not to use the preset environment variable name in AppStorage.
-- Changes to the variables decorated by state decorators will cause UI re-render. If the changes are for message communication, rather than for UI re-render, the emitter mode is recommended. For the example, see [Persistent Subscription and Callback](#persistent-subscription-and-callback).
+- Changes to the variables decorated by state decorators will cause UI re-render. If the changes are for message communication, rather than for UI re-render, the emitter mode is recommended. For the example, see [Unrecommended: Using @StorageLink to Implement Event Notification](#unrecommended-using-storagelink-to-implement-event-notification).
diff --git a/en/application-dev/quick-start/arkts-builder.md b/en/application-dev/quick-start/arkts-builder.md
index 80a262fcd97a0dcf6808bf8cdb84bf78849cb0e1..ab1c53b103db98c49fa42a21f69adff6ea32b86b 100644
--- a/en/application-dev/quick-start/arkts-builder.md
+++ b/en/application-dev/quick-start/arkts-builder.md
@@ -21,14 +21,14 @@ Syntax:
```ts
-@Builder myBuilderFunction({ ... })
+@Builder MyBuilderFunction({ ... })
```
Usage:
```ts
-this.myBuilderFunction({ ... })
+this.MyBuilderFunction({ ... })
```
- Defining one or more custom builder (\@Builder decorated) functions inside a custom component is allowed. Such a custom builder function can be considered as a private, special type of member functions of that component.
@@ -66,7 +66,7 @@ There are two types of parameter passing for custom builder functions: [by-value
- The parameter type must be the same as the declared parameter type. The **undefined** or **null** constants as well as expressions evaluating to these values are not allowed.
-- All parameters are immutable inside the custom builder function. If mutability and synchronization of the mutation is required, the custom builder should be replaced by a custom component with a [@Link](arkts-link.md) decorated variable.
+- All parameters are immutable inside the@Builder decorated function.
- The \@Builder function body follows the same [syntax rules](arkts-create-custom-components.md#build-function) as the **build** function.
diff --git a/en/application-dev/quick-start/arkts-create-custom-components.md b/en/application-dev/quick-start/arkts-create-custom-components.md
index 9548ad942cbd5ba3a24e4bcfe57ab71a0fb37043..45efde654b917c333e52d1f0d294282569622c45 100644
--- a/en/application-dev/quick-start/arkts-create-custom-components.md
+++ b/en/application-dev/quick-start/arkts-create-custom-components.md
@@ -70,8 +70,6 @@ To fully understand the preceding example, a knowledge of the following concepts
- [Universal Style of a Custom Component](#universal-style-of-a-custom-component)
-- [Custom Attribute Methods](#custom-attribute-methods)
-
## Basic Structure of a Custom Component
@@ -106,6 +104,8 @@ To fully understand the preceding example, a knowledge of the following concepts
> **NOTE**
>
> Since API version 9, this decorator is supported in ArkTS widgets.
+ >
+ > Since API version 10, the \@Entry decorator accepts an optional parameter of type [LocalStorage](arkts-localstorage.md) or type [EntryOptions](#entryoptions10).
```ts
@Entry
@@ -114,6 +114,23 @@ To fully understand the preceding example, a knowledge of the following concepts
}
```
+ ### EntryOptions10+
+
+ Describes the named route options.
+
+ | Name | Type | Mandatory| Description |
+ | ------ | ------ | ---- | ------------------------------------------------------------ |
+ | routeName | string | No| Name of the target named route.|
+ | storage | [LocalStorage](arkts-localstorage.md) | No| Storage of page-level UI state.|
+
+ ```ts
+ @Entry({ routeName : 'myPage' })
+ @Component
+ struct MyComponent {
+ }
+ ```
+
+
- \@Recycle: A custom component decorated with \@Recycle can be reused.
> **NOTE**
@@ -328,68 +345,4 @@ struct MyComponent {
>
> When ArkUI sets styles for custom components, an invisible container component is set for **MyComponent2**. These styles are set on the container component instead of the **\** component of **MyComponent2**. As seen from the rendering result, the red background color is not directly applied to the button. Instead, it is applied to the container component that is invisible to users where the button is located.
-
-## Custom Attribute Methods
-
-Custom components do not support custom attribute methods. You can use the Controller capability to implement custom APIs.
-
-
-```ts
-// Custom controller
-export class MyComponentController {
- item: MyComponent = null;
-
- setItem(item: MyComponent) {
- this.item = item;
- }
-
- changeText(value: string) {
- this.item.value = value;
- }
-}
-
-// Custom component
-@Component
-export default struct MyComponent {
- public controller: MyComponentController = null;
- @State value: string = 'Hello World';
-
- build() {
- Column() {
- Text(this.value)
- .fontSize(50)
- }
- }
-
- aboutToAppear() {
- if (this.controller)
- this.controller.setItem (this); // Link to the controller.
- }
-}
-
-// Processing logic
-@Entry
-@Component
-struct StyleExample {
- controller = new MyComponentController();
-
- build() {
- Column() {
- MyComponent({ controller: this.controller })
- }
- .onClick(() => {
- this.controller.changeText('Text');
- })
- }
-}
-```
-
-In the preceding example:
-
-1. The **aboutToAppear** method of the **MyComponent** child component passes the current **this** pointer to the **item** member variable of **MyComponentController**.
-
-2. The **StyleExample** parent component holds a **Controller** instance and with which calls the **changeText** API of **Controller**. That is, the value of the state variable **value** of **MyComponent** is changed through the **this** pointer of the **MyComponent** child component held by the controller.
-
-Through the encapsulation of the controller, **MyComponent** exposes the **changeText** API. All instances that hold the controller can call the **changeText** API to change the value of the **MyComponent** state variable **value**.
-
diff --git a/en/application-dev/quick-start/arkts-environment.md b/en/application-dev/quick-start/arkts-environment.md
index 2f0718290460508c4510acc298fa85c855bbec26..ac80bd54590b0dffdfa6b3bf82351d27f09917a1 100644
--- a/en/application-dev/quick-start/arkts-environment.md
+++ b/en/application-dev/quick-start/arkts-environment.md
@@ -15,12 +15,11 @@ Environment is a singleton object created by the ArkUI framework at application
- Use **Environment.EnvProp** to save the environment variables of the device to AppStorage.
```ts
- // Save the language code of the device to AppStorage. The default value is en.
- // Whenever its value changes in the device environment, it will update its value in AppStorage.
+ // Save languageCode to AppStorage. The default value is en.
Environment.EnvProp('languageCode', 'en');
```
-- To keep a component variable updated with changes in the device environment, this variable should be decorated with \@StorageProp.
+- Decorate the variables with \@StorageProp to link them with components.
```ts
@StorageProp('languageCode') lang : string = 'en';
@@ -29,6 +28,7 @@ Environment is a singleton object created by the ArkUI framework at application
The chain of updates is as follows: Environment > AppStorage > Component.
> **NOTE**
+>
> An \@StorageProp decorated variable can be locally modified, but the change will not be updated to AppStorage. This is because the environment variable parameters are read-only to the application.
@@ -69,3 +69,29 @@ if (lang.get() === 'en') {
console.info('Hello!');
}
```
+
+
+## Restrictions
+
+
+Environment can be called only when the [UIContext](../reference/apis/js-apis-arkui-UIContext.md#uicontext), which can be obtained through [runScopedTask](../reference/apis/js-apis-arkui-UIContext.md#runscopedtask), is specified. If Environment is called otherwise, no device environment data can be obtained.
+
+
+```ts
+// EntryAbility.ts
+import UIAbility from '@ohos.app.ability.UIAbility';
+import window from '@ohos.window';
+
+export default class EntryAbility extends UIAbility {
+ onWindowStageCreate(windowStage: window.WindowStage) {
+ windowStage.loadContent('pages/Index');
+ let window = windowStage.getMainWindow()
+ window.then(window => {
+ let uicontext = window.getUIContext()
+ uicontext.runScopedTask(() => {
+ Environment.EnvProp('languageCode', 'en');
+ })
+ })
+ }
+}
+```
diff --git a/en/application-dev/quick-start/arkts-localstorage.md b/en/application-dev/quick-start/arkts-localstorage.md
index 0116d2e18f9023d5769b6b0b67b561b41bb0e149..392dda8432319b5695c593de178c5193fcf2a976 100644
--- a/en/application-dev/quick-start/arkts-localstorage.md
+++ b/en/application-dev/quick-start/arkts-localstorage.md
@@ -36,7 +36,7 @@ LocalStorage provides two decorators based on the synchronization type of the co
## Restrictions
- Once created, the type of a named attribute cannot be changed. Subsequent calls to **Set** must set a value of same type.
-- LocalStorage provides page-level storage. The [GetShared](../reference/arkui-ts/ts-state-management.md#getshared9) API can only obtain the LocalStorage instance transferred through [windowStage.loadContent](../reference/apis/js-apis-window.md#loadcontent9) in the current stage. Otherwise, **undefined** is returned. Example: [Sharing a LocalStorage Instance from UIAbility to One or More Pages](#sharing-a-localstorage-instance-from-uiability-to-one-or-more-pages).
+- LocalStorage provides page-level storage. The [GetShared](../reference/arkui-ts/ts-state-management.md#getshared10) API can only obtain the LocalStorage instance passed through [windowStage.loadContent](../reference/apis/js-apis-window.md#loadcontent9) in the current stage. If the instance is not available, **undefined** is returned. For the example, see [Example of Sharing a LocalStorage Instance from UIAbility to One or More Pages](#example-of-sharing-a-localstorage-instance-from-uiability-to-one-or-more-pages).
## \@LocalStorageProp
@@ -300,9 +300,9 @@ struct CompA {
```
-### State Variable Synchronization Between Sibling Nodes
+### Example of Syncing State Variable Between Sibling Components
-This example shows how to use \@LocalStorageLink to create a two-way synchronization for the state between sibling nodes.
+This example shows how to use \@LocalStorageLink to create a two-way synchronization for the state between sibling components.
Check the changes in the **Parent** custom component.
@@ -377,7 +377,7 @@ Changes in the **Child** custom component:
```
-### Sharing a LocalStorage Instance from UIAbility to One or More Pages
+### Example of Sharing a LocalStorage Instance from UIAbility to One or More Pages
In the preceding examples, the LocalStorage instance is shared only in an \@Entry decorated component and its owning child component (a page). To enable a LocalStorage instance to be shared across pages, you can create a LocalStorage instance in the owning UIAbility and call windowStage.[loadContent](../reference/apis/js-apis-window.md#loadcontent9).
diff --git a/en/application-dev/quick-start/arkts-observed-and-objectlink.md b/en/application-dev/quick-start/arkts-observed-and-objectlink.md
index 61f1bd8ae476f5984405eed97fb127161bb131e2..a7e47fb63e57896158a6a03aaa6896bea7ac644f 100644
--- a/en/application-dev/quick-start/arkts-observed-and-objectlink.md
+++ b/en/application-dev/quick-start/arkts-observed-and-objectlink.md
@@ -162,6 +162,26 @@ class ClassB {
this.a = a;
}
}
+
+@Observed
+class ClassD {
+ public c: ClassC;
+
+ constructor(c: ClassC) {
+ this.c = c;
+ }
+}
+
+@Observed
+class ClassC extends ClassA {
+ public k: number;
+
+ constructor(k: number) {
+ // Invoke the parent class method to process k.
+ super(k);
+ this.k = k;
+ }
+}
```
@@ -169,60 +189,64 @@ class ClassB {
```ts
@Component
-struct ViewA {
- label: string = 'ViewA1';
- @ObjectLink a: ClassA;
+struct ViewC {
+ label: string = 'ViewC1';
+ @ObjectLink c: ClassC;
build() {
Row() {
- Button(`ViewA [${this.label}] this.a.c=${this.a.c} +1`)
- .onClick(() => {
- this.a.c += 1;
- })
- }
+ Column() {
+ Text(`ViewC [${this.label}] this.a.c = ${this.c.c}`)
+ .fontColor('#ffffffff')
+ .backgroundColor('#ff3fc4c4')
+ .height(50)
+ .borderRadius(25)
+ Button(`ViewC: this.c.c add 1`)
+ .backgroundColor('#ff7fcf58')
+ .onClick(() => {
+ this.c.c += 1;
+ console.log('this.c.c:' + this.c.c)
+ })
+ }
+ .width(300)
}
}
+}
@Entry
@Component
struct ViewB {
@State b: ClassB = new ClassB(new ClassA(0));
-
+ @State child : ClassD = new ClassD(new ClassC(0));
build() {
Column() {
- ViewA({ label: 'ViewA #1', a: this.b.a })
- ViewA({ label: 'ViewA #2', a: this.b.a })
-
- Button(`ViewB: this.b.a.c+= 1`)
- .onClick(() => {
- this.b.a.c += 1;
- })
- Button(`ViewB: this.b.a = new ClassA(0)`)
+ ViewC({ label: 'ViewC #3', c: this.child.c})
+ Button(`ViewC: this.child.c.c add 10`)
+ .backgroundColor('#ff7fcf58')
.onClick(() => {
- this.b.a = new ClassA(0);
- })
- Button(`ViewB: this.b = new ClassB(ClassA(0))`)
- .onClick(() => {
- this.b = new ClassB(new ClassA(0));
+ this.child.c.c += 10
+ console.log('this.child.c.c:' + this.child.c.c)
})
}
}
}
```
+The @Observed decorated **ClassC** class can observe changes in attributes inherited from the base class.
+
Event handlers in **ViewB**:
-- this.b.a = new ClassA(0) and this.b = new ClassB(new ClassA(0)): Change to the \@State decorated variable **b** and its attributes.
+- this.child.c = new ClassA(0) and this.b = new ClassB(new ClassA(0)): Change to the \@State decorated variable **b** and its attributes.
-- this.b.a.c = ... : Change at the second layer. Though [@State](arkts-state.md#observed-changes) cannot observe the change at the second layer, the change of an attribute of \@Observed decorated ClassA, which is attribute **c** in this example, can be observed by \@ObjectLink.
+- this.child.c.c = ... : Change at the second layer. Though [@State](arkts-state.md#observed-changes) cannot observe the change at the second layer, the change of an attribute of \@Observed decorated ClassA, which is attribute **c** in this example, can be observed by \@ObjectLink.
-Event handlers in **ViewA**:
+Event handle in **ViewC**:
-- this.a.c += 1: Changes to the \@ObjectLink decorated variable cause the button label to be updated. Unlike \@Prop, \@ObjectLink does not have a copy of its source. Instead, \@ObjectLink creates a reference to its source.
+- this.c.c += 1: Changes to the \@ObjectLink decorated variable **a** cause the button label to be updated. Unlike \@Prop, \@ObjectLink does not have a copy of its source. Instead, \@ObjectLink creates a reference to its source.
- The \@ObjectLink decorated variable is read-only. Assigning **this.a = new ClassA(...)** is not allowed. Once value assignment occurs, the reference to the data source is reset and the synchronization is interrupted.
@@ -297,7 +321,7 @@ struct ViewB {
2. ViewA({ label: ViewA this.arrA[first], a: this.arrA[0] }): The preceding update changes the first element in the array. Therefore, the **ViewA** component instance bound to **this.arrA[0]** is updated.
- this.arrA.push(new ClassA(0)): The change of this state variable triggers two updates with different effects.
- 1. ForEach: The newly added Class A object is unknown to the **ForEach** [itemGenerator](arkts-rendering-control-foreach.md#api-description). The item builder of **ForEach** will be executed to create a **View A** component instance.
+ 1. ForEach: The newly added **ClassA** object is unknown to the **ForEach** [itemGenerator](arkts-rendering-control-foreach.md#api-description). The item builder of **ForEach** will be executed to create a **ViewA** component instance.
2. ViewA({ label: ViewA this.arrA[last], a: this.arrA[this.arrA.length-1] }): The last item of the array is changed. As a result, the second **View A** component instance is changed. For **ViewA({ label: ViewA this.arrA[first], a: this.arrA[0] })**, a change to the array does not trigger a change to the array item, so the first **View A** component instance is not refreshed.
- this.arrA[Math.floor (this.arrA.length/2)].c: [@State](arkts-state.md#observed-changes) cannot observe changes at the second layer. However, as **ClassA** is decorated by \@Observed, the change of its attributes will be observed by \@ObjectLink.
diff --git a/en/application-dev/quick-start/arkts-persiststorage.md b/en/application-dev/quick-start/arkts-persiststorage.md
index 303402ac5a2dffe2537fa4b252a21fcfe31631ad..21c854c26557e5fcd5027623b0429b625d6c9c91 100644
--- a/en/application-dev/quick-start/arkts-persiststorage.md
+++ b/en/application-dev/quick-start/arkts-persiststorage.md
@@ -24,7 +24,7 @@ Persistence of data is a relatively slow operation. Applications should avoid th
The preceding situations may overload the change process of persisted data. As a result, the PersistentStorage implementation may limit the change frequency of persisted attributes.
-PersistentStorage is associated with UIContext and can be called to persist data only when [UIContext](../reference/apis/js-apis-arkui-UIContext.md#uicontext) is specified. The context can be identified in [runScopedTask](../reference/apis/js-apis-arkui-UIContext.md#runscopedtask).
+PersistentStorage can be called to persist data only when the [UIContext](../reference/apis/js-apis-arkui-UIContext.md#uicontext), which can be obtained through [runScopedTask](../reference/apis/js-apis-arkui-UIContext.md#runscopedtask), is specified.
## Application Scenarios
@@ -92,7 +92,7 @@ struct Index {
1. The state variable **\@StorageLink('aProp') aProp** is updated, triggering the **\** component to be re-rendered.
2. The two-way synchronization between the \@StorageLink decorated variable and AppStorage results in the change of the **\@StorageLink('aProp') aProp** being synchronized back to AppStorage.
3. The change of the **aProp** attribute in AppStorage triggers any other one-way or two-way bound variables to be updated. (In this example, there are no such other variables.)
- 4. Because the attribute corresponding to **aProp** has been persisted, the change of the **aProp** attribute in AppStorage triggers PersistentStorage to write the attribute and its changed value to the device disk.
+ 4. Because the attribute corresponding to **aProp** has been persisted, the change of the **aProp** attribute in AppStorage triggers PersistentStorage to write the attribute and its new value to the device disk.
- Subsequent application running:
1. **PersistentStorage.PersistProp('aProp', 47)** is called. A search for the **aProp** attribute on the PersistentStorage disk succeeds.
diff --git a/en/application-dev/quick-start/arkts-prop.md b/en/application-dev/quick-start/arkts-prop.md
index 968673943256251a8d35a842663d2976ee5b5019..9838e932ff4288d0ce385f50a89492136439b058 100644
--- a/en/application-dev/quick-start/arkts-prop.md
+++ b/en/application-dev/quick-start/arkts-prop.md
@@ -528,11 +528,11 @@ struct MyComponent {
}
Row() {
- Button('Click to change locally !').width(480).height(60).margin({ top: 10 })
+ Button('Click to change locally !').width(180).height(60).margin({ top: 10 })
.onClick(() => {
this.customCounter2++
})
- }.height(100).width(480)
+ }.height(100).width(180)
Row() {
Text(`Custom Local: ${this.customCounter2}`).width(90).height(40).fontColor('#FF0010')
@@ -563,7 +563,7 @@ struct MainProgram {
MyComponent({ customCounter: this.mainCounter })
// customCounter2 of the child component can also be initialized from the parent component. The value from the parent component overwrites the locally assigned value of customCounter2 during initialization.
MyComponent({ customCounter: this.mainCounter, customCounter2: this.mainCounter })
- }.width('40%')
+ }
}
}
}
diff --git a/en/application-dev/quick-start/arkts-rendering-control-foreach.md b/en/application-dev/quick-start/arkts-rendering-control-foreach.md
index 4c916bec86f9c9d22b9bdb60ca476f9cbdcd4846..dc6ae173f51df82fbc48f26df56368450fa6fa79 100644
--- a/en/application-dev/quick-start/arkts-rendering-control-foreach.md
+++ b/en/application-dev/quick-start/arkts-rendering-control-foreach.md
@@ -3,6 +3,9 @@
**ForEach** enables repeated content based on array-type data.
+> **NOTE**
+>
+> Since API version 9, this API is supported in ArkTS widgets.
## API Description
@@ -19,15 +22,15 @@ ForEach(
| Name | Type | Mandatory | Description |
| ------------- | ---------------------------------------- | ---- | ---------------------------------------- |
| arr | Array | Yes | An array, which can be empty, in which case no child component is created. The functions that return array-type values are also allowed, for example, **arr.slice (1, 3)**. The set functions cannot change any state variables including the array itself, such as **Array.splice**, **Array.sort**, and **Array.reverse**.|
-| itemGenerator | (item: any, index?: number) => void | Yes | A lambda function used to generate one or more child components for each data item in an array. Each component and its child component list must be contained in parentheses. **NOTE** - The type of the child component must be the one allowed inside the parent container component of **ForEach**. For example, a **\** child component is allowed only when the parent container component of **ForEach** is **\**. - The child build function is allowed to return an **if** or another **ForEach**. **ForEach** can be placed inside **if**. - The optional **index** parameter should only be specified in the function signature if used in its body.|
-| keyGenerator | (item: any, index?: number) => string | No | An anonymous function used to generate a unique and fixed key value for each data item in an array. This key-value generator is optional. However, for performance reasons, it is strongly recommended that the key-value generator be provided, so that the development framework can better identify array changes. For example, if no key-value generator is provided, a reverse of an array will result in rebuilding of all nodes in **ForEach**. **NOTE** - Two items inside the same array must never work out the same ID. - If **index** is not used, an item's ID must not change when the item's position within the array changes. However, if **index** is used, then the ID must change when the item is moved within the array. - When an item is replaced by a new one (with a different value), the ID of the replaced and the ID of the new item must be different. - When **index** is used in the build function, it should also be used in the ID generation function. - The ID generation function is not allowed to mutate any component state.|
+| itemGenerator | (item: any, index?: number) => void | Yes | A lambda function used to generate one or more child components for each data item in an array. Each component and its child component list must be contained in parentheses. **NOTE** - The type of the child component must be the one allowed inside the parent container component of **ForEach**. For example, a **\** child component is allowed only when the parent container component of **ForEach** is **\**. - The child build function is allowed to return an **if** or another **ForEach**. **ForEach** can be placed inside **if**. - The optional **index** parameter should only be specified in the function signature if used in its body.|
+| keyGenerator | (item: any, index?: number) => string | No | An anonymous function used to generate a unique and fixed key value for each data item in an array. This key-value generator is optional. However, for performance reasons, it is strongly recommended that the key-value generator be provided, so that the development framework can better identify array changes. For example, if no key-value generator is provided, a reverse of an array will result in rebuilding of all nodes in **ForEach**. **NOTE** - Two items inside the same array must never work out the same ID. - If **index** is not used, an item's ID must not change when the item's position within the array changes. However, if **index** is used, then the ID must change when the item is moved within the array. - When an item is replaced by a new one (with a different value), the ID of the replaced and the ID of the new item must be different. - When **index** is used in the build function, it should also be used in the ID generation function. - The ID generation function is not allowed to mutate any component state.|
## Restrictions
- **ForEach** must be used in container components.
-- The type of the child component must be the one allowed inside the parent container component of **ForEach**.
+- The type of the child component must be the one allowed inside the parent container component of **ForEach**.
- The **itemGenerator** function can contain an **if/else** statement, and an **if/else** statement can contain **ForEach**.
diff --git a/en/application-dev/quick-start/arkts-rendering-control-lazyforeach.md b/en/application-dev/quick-start/arkts-rendering-control-lazyforeach.md
index 95b6665c834a4bdf281b4712717e71f51659c112..30ca2da92bbe84a9f5dd5a7882afac9927c9913e 100644
--- a/en/application-dev/quick-start/arkts-rendering-control-lazyforeach.md
+++ b/en/application-dev/quick-start/arkts-rendering-control-lazyforeach.md
@@ -34,8 +34,8 @@ interface DataChangeListener {
| Name | Type | Mandatory | Description |
| ------------- | --------------------------------------- | ---- | ---------------------------------------- |
| dataSource | IDataSource | Yes | **LazyForEach** data source. You need to implement related APIs. |
-| itemGenerator | (item: any) => void | Yes | Child component generation function, which generates a child component for each data item in the array. **NOTE** The function body of **itemGenerator** must be included in braces {...}. **itemGenerator** can and must generate only one child component for each iteration. The **if** statement is allowed in **itemGenerator**, but you must ensure that each branch of the **if** statement creates a child component of the same type. **ForEach** and **LazyForEach** statements are not allowed in **itemGenerator**.|
-| keyGenerator | (item: any) => string | No | ID generation function, which generates a unique and fixed ID for each data item in the data source. This ID must remain unchanged for the data item even when the item is relocated in the array. When the item is replaced by a new item, the ID of the new item must be different from that of the replaced item. This ID generation function is optional. However, for performance reasons, it is strongly recommended that the ID generation function be provided, so that the framework can better identify array changes. For example, if no ID generation function is provided, a reverse of an array will result in rebuilding of all nodes in **LazyForEach**. **NOTE** The ID generated for each data item in the data source must be unique.|
+| itemGenerator | (item: any) => void | Yes | Child component generation function, which generates a child component for each data item in the array. **NOTE** The function body of **itemGenerator** must be included in braces {...}. **itemGenerator** can and must generate only one child component for each iteration. The **if** statement is allowed in **itemGenerator**, but you must ensure that each branch of the **if** statement creates a child component of the same type. **ForEach** and **LazyForEach** statements are not allowed in **itemGenerator**.|
+| keyGenerator | (item: any) => string | No | ID generation function, which generates a unique and fixed ID for each data item in the data source. This ID must remain unchanged for the data item even when the item is relocated in the array. When the item is replaced by a new item, the ID of the new item must be different from that of the replaced item. This ID generation function is optional. However, for performance reasons, it is strongly recommended that the ID generation function be provided, so that the framework can better identify array changes. For example, if no ID generation function is provided, a reverse of an array will result in rebuilding of all nodes in **LazyForEach**. **NOTE** The ID generated for each data item in the data source must be unique.|
## Description of IDataSource
@@ -52,10 +52,10 @@ interface IDataSource {
| Declaration | Parameter Type | Description |
| ---------------------------------------- | ------------------ | ------------------------------------- |
-| totalCount(): number | - | Obtains the total number of data records. |
-| getData(index: number): any | number | Obtains the data record corresponding to the specified index. **index**: index of the data record to obtain.|
-| registerDataChangeListener(listener:DataChangeListener): void | DataChangeListener | Registers a listener for data changes. **listener**: listener for data changes. |
-| unregisterDataChangeListener(listener:DataChangeListener): void | DataChangeListener | Deregisters the listener for data changes. **listener**: listener for data changes. |
+| totalCount(): number | - | Obtains the total number of data records. |
+| getData(index: number): any | number | Obtains the data record corresponding to the specified index. **index**: index of the data record to obtain.|
+| registerDataChangeListener(listener:DataChangeListener): void | DataChangeListener | Registers a listener for data changes. **listener**: listener for data changes. |
+| unregisterDataChangeListener(listener:DataChangeListener): void | DataChangeListener | Deregisters the listener for data changes. **listener**: listener for data changes. |
## Description of DataChangeListener
@@ -77,20 +77,20 @@ interface DataChangeListener {
| Declaration | Parameter Type | Description |
| ------------------------------------------------------------ | -------------------------------------- | ------------------------------------------------------------ |
-| onDataReloaded(): void | - | Invoked when all data is reloaded. |
-| onDataAdded(index: number):void(deprecated) | number | Invoked when data is added to the position indicated by the specified index. This API is deprecated since API version 8. You are advised to use **onDataAdd** instead. **index**: index of the position where data is added.|
-| onDataMoved(from: number, to: number): void(deprecated) | from: number, to: number | Invoked when data is moved. This API is deprecated since API version 8. You are advised to use **onDataMove** instead. **from**: original position of data; **to**: target position of data. **NOTE** The ID must remain unchanged before and after data movement. If the ID changes, APIs for deleting and adding data must be called.|
-| onDataDeleted(index: number):void(deprecated) | number | Invoked when data is deleted from the position indicated by the specified index. LazyForEach will update the displayed content accordingly. This API is deprecated since API version 8. You are advised to use **onDataDelete** instead. **index**: index of the position where data is deleted.|
-| onDataChanged(index: number): void(deprecated) | number | Invoked when data in the position indicated by the specified index is changed. This API is deprecated since API version 8. You are advised to use **onDataChange** instead. **index**: listener for data changes.|
-| onDataAdd(index: number): void8+ | number | Invoked when data is added to the position indicated by the specified index. **index**: index of the position where data is added.|
-| onDataMove(from: number, to: number): void8+ | from: number, to: number | Invoked when data is moved. **from**: original position of data; **to**: target position of data. **NOTE** The ID must remain unchanged before and after data movement. If the ID changes, APIs for deleting and adding data must be called.|
+| onDataReloaded(): void | - | Invoked when all data is reloaded. |
+| onDataAdd(index: number): void8+ | number | Invoked when data is added to the position indicated by the specified index. **index**: index of the position where data is added.|
+| onDataMove(from: number, to: number): void8+ | from: number, to: number | Invoked when data is moved. **from**: original position of data; **to**: target position of data. **NOTE** The ID must remain unchanged before and after data movement. If the ID changes, APIs for deleting and adding data must be called.|
| onDataDelete(index: number):void8+ | number | Invoked when data is deleted from the position indicated by the specified index. LazyForEach will update the displayed content accordingly. **index**: index of the position where data is deleted. **NOTE** Before **onDataDelete** is called, ensure that the corresponding data in **dataSource** has been deleted. Otherwise, undefined behavior will occur during page rendering.|
-| onDataChange(index: number): void8+ | number | Invoked when data in the position indicated by the specified index is changed. **index**: index of the position where data is changed.|
+| onDataChange(index: number): void8+ | number | Invoked when data in the position indicated by the specified index is changed. **index**: index of the position where data is changed.|
+| onDataAdded(index: number):void(deprecated) | number | Invoked when data is added to the position indicated by the specified index. This API is deprecated since API version 8. You are advised to use **onDataAdd** instead. **index**: index of the position where data is added.|
+| onDataMoved(from: number, to: number): void(deprecated) | from: number, to: number | Invoked when data is moved. This API is deprecated since API version 8. You are advised to use **onDataMove** instead. **from**: original position of data; **to**: target position of data. **NOTE** The ID must remain unchanged before and after data movement. If the ID changes, APIs for deleting and adding data must be called.|
+| onDataDeleted(index: number):void(deprecated) | number | Invoked when data is deleted from the position indicated by the specified index. LazyForEach will update the displayed content accordingly. This API is deprecated since API version 8. You are advised to use **onDataDelete** instead. **index**: index of the position where data is deleted.|
+| onDataChanged(index: number): void(deprecated) | number | Invoked when data in the position indicated by the specified index is changed. This API is deprecated since API version 8. You are advised to use **onDataChange** instead. **index**: listener for data changes.|
## Restrictions
-- **LazyForEach** must be used in the container component. Only the **\**, **\**, and **\** components support lazy loading (that is, only the visible part and a small amount of data before and after the visible part are loaded for caching). For other components, all data is loaded at the same time.
+- LazyForEach must be used in the container component. Only the [\](../reference/arkui-ts/ts-container-list.md), [\](../reference/arkui-ts/ts-container-grid.md), and [\](../reference/arkui-ts/ts-container-swiper.md) components support lazy loading (that is, only the visible part and a small amount of data before and after the visible part are loaded for caching). For other components, all data is loaded at the same time.
- **LazyForEach** must create one and only one child component in each iteration.
@@ -177,7 +177,7 @@ class BasicDataSource implements IDataSource {
}
class MyDataSource extends BasicDataSource {
- private dataArray: string[] = ['/path/image0', '/path/image1', '/path/image2', '/path/image3'];
+ private dataArray: string[] = [];
public totalCount(): number {
return this.dataArray.length;
@@ -201,6 +201,12 @@ class MyDataSource extends BasicDataSource {
@Entry
@Component
struct MyComponent {
+ aboutToAppear() {
+ for (var i = 100; i >= 80; i--) {
+ this.data.pushData(`Hello ${i}`)
+ }
+ }
+
private data: MyDataSource = new MyDataSource();
build() {
@@ -208,15 +214,17 @@ struct MyComponent {
LazyForEach(this.data, (item: string) => {
ListItem() {
Row() {
- Image(item).width('30%').height(50)
- Text(item).fontSize(20).margin({ left: 10 })
+ Text(item).fontSize(50)
+ .onAppear(() => {
+ console.info("appear:" + item)
+ })
}.margin({ left: 10, right: 10 })
}
.onClick(() => {
- this.data.pushData('/path/image' + this.data.totalCount());
+ this.data.pushData(`Hello ${this.data.totalCount()}`);
})
}, item => item)
- }
+ }.cachedCount(5)
}
}
```
diff --git a/en/application-dev/quick-start/arkts-state.md b/en/application-dev/quick-start/arkts-state.md
index be3260d6855bdb72a8e38fbaea31307117ec091b..ccbf348f847f61efc034d2a6347f7390d4b6f558 100644
--- a/en/application-dev/quick-start/arkts-state.md
+++ b/en/application-dev/quick-start/arkts-state.md
@@ -25,21 +25,21 @@ An @State decorated variable, like all other decorated variables in the declarat
## Rules of Use
-| \@State Decorator| Description |
-| ------------ | ---------------------------------------- |
-| Decorator parameters | None. |
-| Synchronization type | Does not synchronize with any type of variable in the parent component. |
-| Allowed variable types | Object, class, string, number, Boolean, enum, and array of these types. For details about the scenarios of nested types, see [Observed Changes](#observed-changes). The type must be specified. **any** is not supported. A combination of simple and complex types is not supported. The **undefined** and **null** values are not allowed. **NOTE** Avoid using this decorator to decorate the Date type, as doing so may lead to unexpected behavior of the application. The Length, ResourceStr, and ResourceColor types are a combination of simple and complex types and therefore not supported.|
-| Initial value for the decorated variable | Mandatory. |
+| \@State Decorator | Description |
+| ------------------ | ------------------------------------------------------------ |
+| Decorator parameters | None. |
+| Synchronization type | Does not synchronize with any type of variable in the parent component. |
+| Allowed variable types| Object, class, string, number, Boolean, enum, and array of these types. Date type. For details about the scenarios of supported types, see [Observed Changes](#observed-changes). The type must be specified. **any** is not supported. A combination of simple and complex types is not supported. The **undefined** and **null** values are not allowed. **NOTE** The Length, ResourceStr, and ResourceColor types are a combination of simple and complex types and therefore not supported.|
+| Initial value for the decorated variable| Local initialization is required. |
## Variable Transfer/Access Rules
-| Transfer/Access | Description |
-| --------- | ---------------------------------------- |
-| Initialization from the parent component | Optional. Initialization from the parent component or local initialization can be used. An \@State decorated variable can be initialized from a regular variable or an \@State, \@Link, \@Prop, \@Provide, \@Consume, \@ObjectLink, \@StorageLink, \@StorageProp, \@LocalStorageLink, or \@LocalStorageProp decorated variable in its parent component.|
-| Subnode initialization | Supported. An \@State decorated variable can be used to initialize a regular variable or \@State, \@Link, \@Prop, or \@Provide decorated variable in the child component.|
-| Access| Private, accessible only within the component. |
+| Transfer/Access | Description |
+| ------------------ | ------------------------------------------------------------ |
+| Initialization from the parent component | Optional. Initialization from the parent component or local initialization can be used. The initial value specified in the parent component will overwrite the one defined locally. An \@State decorated variable can be initialized from a regular variable or an \@State, \@Link, \@Prop, \@Provide, \@Consume, \@ObjectLink, \@StorageLink, \@StorageProp, \@LocalStorageLink, or \@LocalStorageProp decorated variable in its parent component.|
+| Subnode initialization | Supported. An \@State decorated variable can be used to initialize a regular variable or \@State, \@Link, \@Prop, or \@Provide decorated variable in the child component.|
+| Access| Private, accessible only within the component. |
**Figure 1** Initialization rule
@@ -153,6 +153,45 @@ Not all changes to state variables cause UI updates. Only changes that can be ob
this.title.push(new Model(12))
```
+- When the decorated variable is of the Date type, the overall value assignment of the Date object can be observed, and the following APIs can be called to update Date attributes: **setFullYear**, **setMonth**, **setDate**, **setHours**, **setMinutes**, **setSeconds**, **setMilliseconds**, **setTime**, **setUTCFullYear**, **setUTCMonth**, **setUTCDate**, **setUTCHours**, **setUTCMinutes**, **setUTCSeconds**, and **setUTCMilliseconds**.
+
+ ```ts
+ @Entry
+ @Component
+ struct DatePickerExample {
+ @State selectedDate: Date = new Date('2021-08-08')
+
+ build() {
+ Column() {
+ Button('set selectedDate to 2023-07-08')
+ .margin(10)
+ .onClick(() => {
+ this.selectedDate = new Date('2023-07-08')
+ })
+ Button('increase the year by 1')
+ .margin(10)
+ .onClick(() => {
+ this.selectedDate.setFullYear(this.selectedDate.getFullYear() + 1)
+ })
+ Button('increase the month by 1')
+ .margin(10)
+ .onClick(() => {
+ this.selectedDate.setMonth(this.selectedDate.getMonth() + 1)
+ })
+ Button('increase the day by 1')
+ .margin(10)
+ .onClick(() => {
+ this.selectedDate.setDate(this.selectedDate.getDate() + 1)
+ })
+ DatePicker({
+ start: new Date('1970-1-1'),
+ end: new Date('2100-1-1'),
+ selected: this.selectedDate
+ })
+ }.width('100%')
+ }
+ }
+ ```
### Framework Behavior
@@ -168,9 +207,9 @@ Not all changes to state variables cause UI updates. Only changes that can be ob
### Decorating Variables of Simple Types
-In this example, \@State is used to decorate the **count** variable of the simple type and turns it into a state variable. The change of **count** causes the update of the **\** component.
+In this example, \@State is used to decorate the **count** variable of the simple type, turning it into a state variable. The change of **count** causes the update of the **\** component.
-- When the state variable **count** changes, the framework searches for components that depend on this state variable, which include only the **\** component in this example.
+- When **count** changes, the framework searches for components bound to it, which include only the **\** component in this example.
- The framework executes the update method of the **\** component to implement on-demand update.
diff --git a/en/application-dev/quick-start/figures/chooseStageModel.png b/en/application-dev/quick-start/figures/chooseStageModel.png
index b7dd96b6b7c5d2afd241e0c6fd9ee91977692115..dffb66f40999c09e20edfa1b094aee8e62952f61 100644
Binary files a/en/application-dev/quick-start/figures/chooseStageModel.png and b/en/application-dev/quick-start/figures/chooseStageModel.png differ
diff --git a/en/application-dev/quick-start/figures/deleteRuntimeOS.png b/en/application-dev/quick-start/figures/deleteRuntimeOS.png
index 8087b03be057d646ae6e3348abae73c1e840b781..c75770635cb1bb3ab927968afe97664ff8c2ebde 100644
Binary files a/en/application-dev/quick-start/figures/deleteRuntimeOS.png and b/en/application-dev/quick-start/figures/deleteRuntimeOS.png differ
diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001364054489.png b/en/application-dev/quick-start/figures/en-us_image_0000001364054489.png
deleted file mode 100644
index bcc45efdddb87a39201661c5f6d3ccbce9bfd3e6..0000000000000000000000000000000000000000
Binary files a/en/application-dev/quick-start/figures/en-us_image_0000001364054489.png and /dev/null differ
diff --git a/en/application-dev/quick-start/figures/project.png b/en/application-dev/quick-start/figures/project.png
new file mode 100644
index 0000000000000000000000000000000000000000..e1f2db2da30489fa3c4b64587db203a2ef173533
Binary files /dev/null and b/en/application-dev/quick-start/figures/project.png differ
diff --git a/en/application-dev/quick-start/figures/secondPage.png b/en/application-dev/quick-start/figures/secondPage.png
index 2c08d85c610336a71b06407800603ed5c101606d..efca1a48d38136c2a09c3d36e6b4a8b54785cf70 100644
Binary files a/en/application-dev/quick-start/figures/secondPage.png and b/en/application-dev/quick-start/figures/secondPage.png differ
diff --git a/en/application-dev/quick-start/har-package.md b/en/application-dev/quick-start/har-package.md
index 4d54bb1a139eb2c42b3feab8fe3f5d20ce5d0b7d..1ba7b3402a34a40b7a01c7df261b9362852b55ff 100644
--- a/en/application-dev/quick-start/har-package.md
+++ b/en/application-dev/quick-start/har-package.md
@@ -2,7 +2,17 @@
A Harmony Archive (HAR) is a static shared package that can contain code, C++ libraries, resources, and configuration files. It enables modules and projects to share code related to ArkUI components, resources, and more. Unlike a Harmony Ability Package (HAP), a HAR cannot be independently installed on a device. Instead, it can be referenced only as the dependency of an application module.
## Creating a HAR Module
-You can [create a HAR module in DevEco Studio](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/creating_har_api9-0000001518082393-V3#section143510369612). To better protect your source code, enable obfuscation for the HAR module so that DevEco Studio compiles, obfuscates, and compresses code during HAR building. To enable obfuscation, open the **build-profile.json5** file of the HAR module and set **artifactType** to **obfuscation** as follows:
+You can [create a HAR module in DevEco Studio](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/creating_har_api9-0000001518082393-V3#section143510369612).
+
+To better protect your source code, enable obfuscation for the HAR module so that DevEco Studio compiles, obfuscates, and compresses code during HAR building.
+
+> **NOTE**
+>
+> Obfuscation is only available for ArkTS projects in the stage model.
+
+### Obfuscation in API Version 9
+
+In API version 9, obfuscation is disabled by default, and can be enabled by setting **artifactType** to **obfuscation** in the **build-profile.json5** file of the HAR module. The configuration is as follows:
```json
{
@@ -16,9 +26,43 @@ The value options of **artifactType** are as follows, with the default value bei
- **original**: Code is not obfuscated.
- **obfuscation**: Code is obfuscated using Uglify.
-> **NOTE**
->
-> Obfuscation is available only in the stage model. Therefore, if **artifactType** is set to **obfuscation**, **apiType** must be set to **stageMode**.
+### Obfuscation in API Version 10
+
+In API version 10, obfuscation is enabled by default, and can be set through the **enable** field under **ruleOptions** in the **build-profile.json5** file of the HAR module. The configuration is as follows:
+
+```json
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ },
+ "consumerFiles": [
+ "./consumer-rules.txt"
+ ]
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ }
+ ]
+}
+```
+### Adaptation Guide
+
+The **artifactType** field is forward compatible, and the original function is not affected. Yet, it is deprecated since API version 10, and you are advised to use the substitute as soon as possible.
## Precautions for HAR Development
- The HAR does not support the declaration of **abilities** and **extensionAbilities** in its configuration file.
@@ -95,7 +139,7 @@ To start with, [configure dependency](https://developer.harmonyos.com/cn/docs/do
### Reference ArkUI Components in the HAR
-After configuring the dependency on the HAR, you can reference ArkUI components exported from the HAR by using **import**. The sample code is as follows:
+After configuring the dependency on the HAR, you can reference ArkUI components exported from the HAR by using **import**. The code snippet is as follows:
```js
// entry/src/main/ets/pages/index.ets
import { MainPage } from "library"
diff --git a/en/application-dev/quick-start/start-with-ets-stage.md b/en/application-dev/quick-start/start-with-ets-stage.md
index 789f4c05e28730d4f2851fc507af6bc4a8af1d9b..2205e71621f27e3c779dbe27d4f0bca4efc9cbaf 100644
--- a/en/application-dev/quick-start/start-with-ets-stage.md
+++ b/en/application-dev/quick-start/start-with-ets-stage.md
@@ -1,11 +1,11 @@
# Building the First ArkTS Application in Stage Model
-> **NOTE**
->
-> To use ArkTS, your DevEco Studio must be V3.0.0.900 Beta3 or later.
->
-> In this document, DevEco Studio 4.0 Beta1 is used. You can download it [here](../../release-notes/OpenHarmony-v4.0-beta1.md#version-mapping).
+> **NOTE**
+>
+> To use ArkTS, your DevEco Studio must be V3.0.0.900 Beta3 or later.
+>
+> In this document, DevEco Studio 4.0 Beta2 is used. You can download it [here](../../release-notes/OpenHarmony-v4.0-beta2.md#version-mapping).
## Creating an ArkTS Project
@@ -21,16 +21,18 @@ The following describes how to create the OpenHarmony projects of API 10 and API

-3. On the project configuration page, set **Compile SDK** to **3.1.0(API 9** and retain the default values for other parameters.
+3. On the project configuration page, set **Compile SDK** to **3.1.0(API 9)** and retain the default values for other parameters.
+
+ The **Node** parameter sets the Node.js version to use for the project. You can use an existing version or download a new one.

> **NOTE**
>
> You can use the low-code development mode apart from the traditional coding approach.
- >
+ >
> On the low-code development pages, you can design your application UI in an efficient, intuitive manner, with a wide array of UI editing features.
- >
+ >
> To use the low-code development mode, turn on **Enable Super Visual** on the page shown above.
4. Click **Finish**. DevEco Studio will automatically generate the sample code and resources that match your project type. Wait until the project is created.
@@ -43,12 +45,13 @@ The following describes how to create the OpenHarmony projects of API 10 and API

-7. Delete the **runtimeOS** configuration from the **targets** field in all module-level **build-profile.json5** files.
+7. Delete the **runtimeOS** configuration from the **targets** field in the module-level **build-profile.json5** files.

8. Click **Sync Now** and wait until the synchronization is complete. A project of API version 10 is now created.
+
### Creating a Project of API Version 9
1. If you are opening DevEco Studio for the first time, click **Create Project**. If a project is already open, choose **File** > **New** > **Create Project** from the menu bar.
@@ -57,16 +60,18 @@ The following describes how to create the OpenHarmony projects of API 10 and API

-3. On the project configuration page, set **Compile SDK** to **3.1.0(API 9** and retain the default values for other parameters.
+3. On the project configuration page, set **Compile SDK** to **3.1.0(API 9)** and retain the default values for other parameters.
+
+ The **Node** parameter sets the Node.js version to use for the project. You can use an existing version or download a new one.

> **NOTE**
>
> You can use the low-code development mode apart from the traditional coding approach.
- >
+ >
> On the low-code development pages, you can design your application UI in an efficient, intuitive manner, with a wide array of UI editing features.
- >
+ >
> To use the low-code development mode, turn on **Enable Super Visual** on the page shown above.
4. Click **Finish**. DevEco Studio will automatically generate the sample code and resources that match your project type. Wait until the project is created.
@@ -78,11 +83,11 @@ The following describes how to create the OpenHarmony projects of API 10 and API
## ArkTS Project Directory Structure (Stage Model, API Version 10)
-
+
- **AppScope > app.json5**: application-level configuration information.
-- **entry**: OpenHarmony project module, which can be built into an OpenHarmony Ability Package ([HAP](../../glossary.md#hap)).
+- **entry**: OpenHarmony project module, which can be built into an ability package (HAP).
- **src > main > ets**: a collection of ArkTS source code.
- **src > main > ets > entryability**: entry to your application/service.
@@ -99,17 +104,18 @@ The following describes how to create the OpenHarmony projects of API 10 and API
- **oh_modules**: third-party library dependency information. For details about how to adapt a historical npm project to ohpm, see [Manually Migrating Historical Projects](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/project_overview-0000001053822398-V3#section108143331212).
-- **build-profile.json5**: application-level configuration options, including **signingConfigs** and **products**. The **runtimeOS** field in **products** indicates the runtime OS. Its default value is **HarmonyOS**. If you are developing an OpenHarmony application, change the value to **OpenHarmony**.
+- **build-profile.json5**: application-level configuration information, including the **signingConfigs** and **products** configuration. The **runtimeOS** field in **products** indicates the runtime OS. Its default value is **HarmonyOS**. If you are developing an OpenHarmony application, change the value to **OpenHarmony**.
- **hvigorfile.ts**: application-level build script.
+
## ArkTS Project Directory Structure (Stage Model, API Version 9)
-
+
- **AppScope > app.json5**: application-level configuration information.
-- **entry**: OpenHarmony project module, which can be built into an OpenHarmony Ability Package ([HAP](../../glossary.md#hap)).
+- **entry**: OpenHarmony project module, which can be built into an ability package (HAP).
- **src > main > ets**: a collection of ArkTS source code.
- **src > main > ets > entryability**: entry to your application/service.
@@ -267,7 +273,7 @@ You can implement page redirection through the [page router](../reference/apis/j
1. Implement redirection from the first page to the second page.
- In the **index.ets** file of the first page, bind the **onClick** event to the **Next** button so that clicking the button redirects the user to the second page. The sample code in the **Index.ets** file is shown below:
+ In the **Index.ets** file of the first page, bind the **onClick** event to the **Next** button so that clicking the button redirects the user to the second page. The sample code in the **Index.ets** file is shown below:
```ts
// Index.ets
diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md
index 4fc3fb5005d7ac0208b083be1a084bd5c66b4865..e1f64b915980aa23b9c1154f435a500a34922938 100644
--- a/en/application-dev/reference/apis/Readme-EN.md
+++ b/en/application-dev/reference/apis/Readme-EN.md
@@ -16,6 +16,8 @@
- [@ohos.app.ability.ServiceExtensionAbility (ServiceExtensionAbility)](js-apis-app-ability-serviceExtensionAbility.md)
- [@ohos.app.ability.StartOptions (StartOptions)](js-apis-app-ability-startOptions.md)
- [@ohos.app.ability.UIAbility (UIAbility)](js-apis-app-ability-uiAbility.md)
+ - [@ohos.app.ability.UIExtensionAbility (Base Class for ExtensionAbilities with UI)](js-apis-app-ability-uiExtensionAbility.md)
+ - [@ohos.app.ability.UIExtensionContentSession (UI Operation Class for ExtensionAbilities with UI)](js-apis-app-ability-uiExtensionContentSession.md)
- [@ohos.app.form.FormExtensionAbility (FormExtensionAbility)](js-apis-app-form-formExtensionAbility.md)
- [@ohos.application.DataShareExtensionAbility (DataShareExtensionAbility)](js-apis-application-dataShareExtensionAbility.md)
- [@ohos.application.StaticSubscriberExtensionAbility (StaticSubscriberExtensionAbility)](js-apis-application-staticSubscriberExtensionAbility.md)
@@ -42,6 +44,7 @@
- [@ohos.app.form.formBindingData (formBindingData)](js-apis-app-form-formBindingData.md)
- [@ohos.app.form.formHost (FormHost)](js-apis-app-form-formHost.md)
- [@ohos.app.form.formInfo (FormInfo)](js-apis-app-form-formInfo.md)
+ - [@ohos.app.form.formObserver (formObserver)](js-apis-app-form-formObserver.md)
- [@ohos.app.form.formProvider (FormProvider)](js-apis-app-form-formProvider.md)
- [@ohos.application.uriPermissionManager (URI Permission Management)](js-apis-uripermissionmanager.md)
- Both Models (To Be Deprecated Soon)
@@ -106,6 +109,7 @@
- [ProcessInformation](js-apis-inner-application-processInformation.md)
- [ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md)
- [UIAbilityContext](js-apis-inner-application-uiAbilityContext.md)
+ - [UIExtensionContext](js-apis-inner-application-uiExtensionContext.md)
- [shellCmdResult](js-apis-inner-application-shellCmdResult.md)
- [WindowExtensionContext](js-apis-inner-application-windowExtensionContext.md)
- wantAgent
@@ -198,6 +202,7 @@
- UI Page
- [@ohos.animator (Animator)](js-apis-animator.md)
- [@ohos.arkui.componentSnapshot (Component Snapshot)](js-apis-arkui-componentSnapshot.md)
+ - [@ohos.arkui.componentUtils (componentUtils)](js-apis-arkui-componentUtils.md)
- [@ohos.arkui.dragController (DragController)](js-apis-arkui-dragController.md)
- [@ohos.arkui.drawableDescriptor (DrawableDescriptor)](js-apis-arkui-drawableDescriptor.md)
- [@ohos.arkui.inspector (Layout Callback)](js-apis-arkui-inspector.md)
@@ -205,12 +210,13 @@
- [@ohos.curves (Interpolation Calculation)](js-apis-curve.md)
- [@ohos.font (Custom Font Registration)](js-apis-font.md)
- [@ohos.matrix4 (Matrix Transformation)](js-apis-matrix4.md)
+ - [@ohos.measure (Text Measurement)](js-apis-measure.md)
- [@ohos.mediaquery (Media Query)](js-apis-mediaquery.md)
- [@ohos.pluginComponent (PluginComponentManager)](js-apis-plugincomponent.md)
- [@ohos.promptAction (Prompt)](js-apis-promptAction.md)
- [@ohos.router (Page Routing)](js-apis-router.md)
- - [@ohos.measure (Text Measurement)](js-apis-measure.md)
- [@ohos.uiAppearance (UI Appearance)](js-apis-uiappearance.md)
+
- Graphics
- [@ohos.animation.windowAnimationManager (Window Animation Management)](js-apis-windowAnimationManager.md)
- [@ohos.application.WindowExtensionAbility (WindowExtensionAbility)](js-apis-application-windowExtensionAbility.md)
@@ -225,12 +231,15 @@
- [WebGL2](js-apis-webgl2.md)
- Multimedia
+ - [@ohos.app.ability.MediaControlExtensionAbility (ExtensionAbility for Media Playback Control)](js-apis-app-ability-MediaControlExtensionAbility.md)
- [@ohos.multimedia.audio (Audio Management)](js-apis-audio.md)
- [@ohos.multimedia.avsession (AVSession Management)](js-apis-avsession.md)
- [@ohos.multimedia.camera (Camera Management)](js-apis-camera.md)
- [@ohos.multimedia.image (Image Processing)](js-apis-image.md)
- [@ohos.multimedia.media (Media)](js-apis-media.md)
- [@ohos.multimedia.systemSoundManager (System Sound Management)](js-apis-systemSoundManager.md)
+ - application
+ - [MediaControlExtensionContext (ExtensionAbility Context for Media Playback Control)](js-apis-inner-application-MediaControlExtensionContext.md)
- multimedia
- [ringtonePlayer (Ringtone Player)](js-apis-inner-multimedia-ringtonePlayer.md)
@@ -313,20 +322,21 @@
- [@ohos.net.sharing (Network Sharing)](js-apis-net-sharing.md)
- [@ohos.net.socket (Socket Connection)](js-apis-socket.md)
- [@ohos.net.statistics (Traffic Management)](js-apis-net-statistics.md)
+ - [@ohos.net.vpn (VPN Management)](js-apis-net-vpn.md)
- [@ohos.net.webSocket (WebSocket Connection)](js-apis-webSocket.md)
- [@ohos.request (Upload and Download)](js-apis-request.md)
- Connectivity
- - [@ohos.bluetooth.a2dp (Bluetooth a2dp Module)(Recommended)](js-apis-bluetooth-a2dp.md)
- - [@ohos.bluetooth.access (Bluetooth access Module)(Recommended)](js-apis-bluetooth-access.md)
- - [@ohos.bluetooth.baseProfile (Bluetooth baseProfile Module)(Recommended)](js-apis-bluetooth-baseProfile.md)
- - [@ohos.bluetooth.ble (Bluetooth ble Module)(Recommended)](js-apis-bluetooth-ble.md)
- - [@ohos.bluetooth.connection (Bluetooth connection Module)(Recommended)](js-apis-bluetooth-connection.md)
- - [@ohos.bluetooth.constant (Bluetooth constant Module)(Recommended)](js-apis-bluetooth-constant.md)
- - [@ohos.bluetooth.hfp (Bluetooth hfp Module)(Recommended)](js-apis-bluetooth-hfp.md)
- - [@ohos.bluetooth.hid (Bluetooth hid Module)(Recommended)(js-apis-bluetooth-hid.md)
- - [@ohos.bluetooth.pan (Bluetooth pan Module)(Recommended)](js-apis-bluetooth-pan.md)
- - [@ohos.bluetooth.socket (Bluetooth socket Module)(Recommended)](js-apis-bluetooth-socket.md)
+ - [@ohos.bluetooth.a2dp (Bluetooth A2DP Module) (Recommended)](js-apis-bluetooth-a2dp.md)
+ - [@ohos.bluetooth.access (Bluetooth Access Module) (Recommended)](js-apis-bluetooth-access.md)
+ - [@ohos.bluetooth.baseProfile (Bluetooth baseProfile Module) (Recommended)](js-apis-bluetooth-baseProfile.md)
+ - [@ohos.bluetooth.ble (Bluetooth BLE Module) (Recommended)](js-apis-bluetooth-ble.md)
+ - [@ohos.bluetooth.connection (Bluetooth connection Module) (Recommended)](js-apis-bluetooth-connection.md)
+ - [@ohos.bluetooth.constant (Bluetooth constant Module) (Recommended)](js-apis-bluetooth-constant.md)
+ - [@ohos.bluetooth.hfp (Bluetooth hfp Module) (Recommended)](js-apis-bluetooth-hfp.md)
+ - [@ohos.bluetooth.hid (Bluetooth hid Module) (Recommended)](js-apis-bluetooth-hid.md)
+ - [@ohos.bluetooth.pan (Bluetooth pan Module) (Recommended)](js-apis-bluetooth-pan.md)
+ - [@ohos.bluetooth.socket (Bluetooth socket Module) (Recommended)](js-apis-bluetooth-socket.md)
- [@ohos.bluetooth (Bluetooth) (To Be Deprecated Soon)](js-apis-bluetooth.md)
- [@ohos.bluetoothManager (Bluetooth) (To Be Deprecated Soon)](js-apis-bluetoothManager.md)
- [@ohos.connectedTag (Active Tags)](js-apis-connectedTag.md)
@@ -385,6 +395,7 @@
- [@ohos.charger (Charging Type)](js-apis-charger.md)
- [@ohos.cooperate (Screen Hopping)](js-apis-devicestatus-cooperate.md)
- [@ohos.deviceAttest (Device Attestation)](js-apis-deviceAttest.md)
+ - [@ohos.deviceStatus.dragInteraction (Drag)](js-apis-devicestatus-draginteraction.md)
- [@ohos.deviceInfo (Device Information)](js-apis-device-info.md)
- [@ohos.distributedDeviceManager (Device Management)](js-apis-distributedDeviceManager.md)
- [@ohos.distributedHardware.deviceManager (Device Management)](js-apis-device-manager.md)
@@ -405,6 +416,7 @@
- [@ohos.multimodalInput.touchEvent (Touch Event)](js-apis-touchevent.md)
- [@ohos.multimodalInput.shortKey (Shortcut Key)](js-apis-shortKey.md)
- [@ohos.power (System Power Management)](js-apis-power.md)
+ - [@ohos.resourceschedule.deviceStandby (Device Standby)](js-apis-resourceschedule-deviceStandby.md)
- [@ohos.runningLock (Runninglock)](js-apis-runninglock.md)
- [@ohos.sensor (Sensor)](js-apis-sensor.md)
- [@ohos.settings (Data Item Settings)](js-apis-settings.md)
@@ -420,10 +432,9 @@
- Account Management
- [@ohos.account.appAccount (App Account Management)](js-apis-appAccount.md)
- - [@ohos.account.appAccount.AuthorizationExtensionAbility (App AuthorizationExtensionAbility)](js-apis-appAccount-authorizationExtensionAbility.md)
- [@ohos.account.distributedAccount (Distributed Account Management)](js-apis-distributed-account.md)
- [@ohos.account.osAccount (OS Account Management)](js-apis-osAccount.md)
-
+
- Customization
- [@ohos.configPolicy (Configuration Policy)](js-apis-configPolicy.md)
diff --git a/en/application-dev/reference/apis/js-apis-WorkSchedulerExtensionAbility.md b/en/application-dev/reference/apis/js-apis-WorkSchedulerExtensionAbility.md
index b717abf0ad082e4ea7586cc8713596a08e7b3740..de2f146c7226f3a1ef3d61dad588c84b6cc2a1ab 100644
--- a/en/application-dev/reference/apis/js-apis-WorkSchedulerExtensionAbility.md
+++ b/en/application-dev/reference/apis/js-apis-WorkSchedulerExtensionAbility.md
@@ -1,15 +1,13 @@
# @ohos.WorkSchedulerExtensionAbility (Deferred Task Scheduling Callbacks)
-The **WorkSchedulerExtensionAbility** module provides callbacks for deferred task scheduling.
-
-When developing an application, you can override the APIs of this module and add your own task logic to the APIs.
+The **WorkSchedulerExtensionAbility** module provides callbacks for deferred task scheduling. You can override the APIs provided by this module. When a deferred task is triggered, the system calls back the application through the APIs and processes the task logic in the callback.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+>
> - The APIs of this module can be used only in the stage model.
-
## Modules to Import
```ts
@@ -36,7 +34,7 @@ Called when the system starts scheduling the deferred task.
| Name | Type | Mandatory | Description |
| ---- | ---------------------------------------- | ---- | -------------- |
-| work | [workScheduler.WorkInfo](js-apis-resourceschedule-workScheduler.md#workinfo) | Yes | Target task.|
+| work | [workScheduler.WorkInfo](js-apis-resourceschedule-workScheduler.md#workinfo) | Yes | Deferred task that starts.|
**Example**
@@ -60,7 +58,7 @@ Called when the system stops scheduling the deferred task.
| Name | Type | Mandatory | Description |
| ---- | ---------------------------------------- | ---- | -------------- |
-| work | [workScheduler.WorkInfo](js-apis-resourceschedule-workScheduler.md#workinfo) | Yes | Target task.|
+| work | [workScheduler.WorkInfo](js-apis-resourceschedule-workScheduler.md#workinfo) | Yes | Deferred task that stops.|
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-animator.md b/en/application-dev/reference/apis/js-apis-animator.md
index 1818bfc13dd6859894cf122f96b2171d0ce70e47..829355f9eecdfd2ccc9a889a478a9c8c575ee52a 100644
--- a/en/application-dev/reference/apis/js-apis-animator.md
+++ b/en/application-dev/reference/apis/js-apis-animator.md
@@ -257,7 +257,7 @@ Defines animator options.
| Name | Type | Mandatory| Description |
| ---------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| duration | number | Yes | Duration for playing the animation, in milliseconds. |
-| easing | string | Yes | Animation interpolation curve. Only the following values are supported: **"linear"**: The animation speed keeps unchanged. **"ease"**: The animation starts slowly, accelerates, and then slows down towards the end. The cubic-bezier curve (0.25, 0.1, 0.25, 1.0) is used. **"ease-in"**: The animation starts at a low speed and then picks up speed until the end. The cubic-bezier curve (0.42, 0.0, 1.0, 1.0) is used. **"ease-out"**: The animation ends at a low speed. The cubic-bezier curve (0.0, 0.0, 0.58, 1.0) is used. **"ease-in-out"**: The animation starts and ends at a low speed. The cubic-bezier curve (0.42, 0.0, 0.58, 1.0) is used. **"fast-out-slow-in"**: The animation uses the standard cubic-bezier curve (0.4, 0.0, 0.2, 1.0). **"linear-out-slow-in"**: The animation uses the deceleration cubic-bezier curve (0.0, 0.0, 0.2, 1.0). **"friction"**: The animation uses the damping cubic-bezier curve (0.2, 0.0, 0.2, 1.0). **"extreme-deceleration"**: The animation uses the extreme deceleration cubic-bezier curve (0.0, 0.0, 0.0, 1.0). **"rhythm"**: The animation uses the rhythm cubic-bezier curve (0.7, 0.0, 0.2, 1.0). **"sharp"**: The animation uses the sharp cubic-bezier curve (0.33, 0.0, 0.67, 1.0). **"smooth"**: The animation uses the smooth cubic-bezier curve (0.4, 0.0, 0.4, 1.0). **cubic-bezier(x1, y1, x2, y2)**: The animation uses the defined cubic-bezier curve, where the value of the input parameters must range from 0 to 1. **steps(number, step-position)**: The animation uses a step curve. The **number** must be set and only an integer is supported. **step-position** is optional. It can be set to **start** or **end**. The default value is **end**.|
+| easing | string | Yes | Animation interpolation curve. Only the following values are supported: **"linear"**: The animation speed keeps unchanged. **"ease"**: The animation starts slowly, accelerates, and then slows down towards the end. The cubic-bezier curve (0.25, 0.1, 0.25, 1.0) is used. **"ease-in"**: The animation starts at a low speed and then picks up speed until the end. The cubic-bezier curve (0.42, 0.0, 1.0, 1.0) is used. **"ease-out"**: The animation ends at a low speed. The cubic-bezier curve (0.0, 0.0, 0.58, 1.0) is used. **"ease-in-out"**: The animation starts and ends at a low speed. The cubic-bezier curve (0.42, 0.0, 0.58, 1.0) is used. **"fast-out-slow-in"**: The animation uses the standard cubic-bezier curve (0.4, 0.0, 0.2, 1.0). **"linear-out-slow-in"**: The animation uses the deceleration cubic-bezier curve (0.0, 0.0, 0.2, 1.0). **"friction"**: The animation uses the damping cubic-bezier curve (0.2, 0.0, 0.2, 1.0). **"extreme-deceleration"**: The animation uses the extreme deceleration cubic-bezier curve (0.0, 0.0, 0.0, 1.0). **"rhythm"**: The animation uses the rhythm cubic-bezier curve (0.7, 0.0, 0.2, 1.0). **"sharp"**: The animation uses the sharp cubic-bezier curve (0.33, 0.0, 0.67, 1.0). **"smooth"**: The animation uses the smooth cubic-bezier curve (0.4, 0.0, 0.4, 1.0). **"cubic-bezier(x1,y1,x2,y2)"**: The animation uses the defined cubic bezier curve, where the value of **x1** and **x2** must range from 0 to 1. For example, **"cubic-bezier(0.42,0.0,0.58,1.0)"**. **"steps(number,step-position)"**: The animation uses a step curve. The **number** parameter is mandatory and must be set to a positive integer. The **step-position** parameter is optional and can be set to **start** or **end** (default value). For example, **"steps(3,start)"**.|
| delay | number | Yes | Animation delay duration, in milliseconds. Value **0** means that there is no delay. |
| fill | "none" \| "forwards" \| "backwards" \| "both" | Yes | State of the animated target after the animation is executed. **"none"**: No style is applied to the target before or after the animation is executed. **"forwards"**: The target keeps the state at the end of the animation (defined in the last key frame) after the animation is executed. **"backwards"**: The animation uses the value defined in the first key frame during the **animation-delay**. When **animation-direction** is set to **normal** or **alternate**, the value in the **from** key frame is used. When **animation-direction** is set to **reverse** or **alternate-reverse**, the value in the **to** key frame is used. **"both"**: The animation follows the **forwards** and **backwards** rules.|
| direction | "normal" \| "reverse" \| "alternate" \| "alternate-reverse" | Yes | Animation playback mode. **"normal"**: plays the animation in forward loop mode. **"reverse"**: plays the animation in reverse loop mode. **"alternate"**: plays the animation in alternating loop mode. When the animation is played for an odd number of times, the playback is in forward direction. When the animation is played for an even number of times, the playback is in reverse direction. **"alternate-reverse"**: plays the animation in reverse alternating loop mode. When the animation is played for an odd number of times, the playback is in reverse direction. When the animation is played for an even number of times, the playback is in forward direction.|
diff --git a/en/application-dev/reference/apis/js-apis-app-ability-MediaControlExtensionAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-MediaControlExtensionAbility.md
new file mode 100644
index 0000000000000000000000000000000000000000..6660aa2e1f10722a23fad1ea77d3df80109cf37e
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-app-ability-MediaControlExtensionAbility.md
@@ -0,0 +1,17 @@
+# @ohos.app.ability.MediaControlExtensionAbility (ExtensionAbility for Media Playback Control)
+
+The **MediaControlExtensionAbility** module, inherited from [UIExtensionAbility](js-apis-app-ability-uiExtensionAbility.md), provides ExtensionAbilities for media playback control. No APIs are added. During actual development, you need to implement the APIs in the parent class to use the lifecycle and capabilities of UIExtensionAbilities. You cannot directly call the base class.
+
+**System capability**: SystemCapability.Multimedia.AVSession.Core
+
+> **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.
+> - The APIs of this module can be used only in the stage model.
+> - The APIs provided by this module are system APIs.
+
+## Modules to Import
+
+```js
+import MediaControlExtensionAbility from @ohos.app.ability.MediaControlExtensionAbility;
+```
diff --git a/en/application-dev/reference/apis/js-apis-app-form-formHost.md b/en/application-dev/reference/apis/js-apis-app-form-formHost.md
index dcbbe55a2a8121406e275df03dae90a9390e390a..ebb7e1afd22c0200a7d722003728b2073e836a9d 100644
--- a/en/application-dev/reference/apis/js-apis-app-form-formHost.md
+++ b/en/application-dev/reference/apis/js-apis-app-form-formHost.md
@@ -1202,97 +1202,6 @@ try {
}
```
-## getRunningFormInfos10+
-
-getRunningFormInfos(callback: AsyncCallback<Array<formInfo.RunningFormInfo>>, hostBundleName?: string): void
-
-Obtains information about all non-temporary widgets running on the device. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ------ | ---- | ------- |
-| callback | AsyncCallback<Array<formInfo.RunningFormInfo>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained.|
-| hostBundleName | string | No| Name of the bundle that functions as the widget host. If this parameter is specified, only the information about the non-temporary widgets that are running under the widget host is returned. By default, information about all running non-temporary widgets on the device is returned.|
-
-**Error codes**
-
-For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
-
-| Error Code ID| Error Message|
-| -------- | -------- |
-| 16500050 | An IPC connection error happened. |
-| 16500060 | A service connection error happened, please try again later. |
-
-**Example**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-
-try {
- formHost.getRunningFormInfos((error, data) => {
- if (error) {
- console.error(`error, code: ${error.code}, message: ${error.message}`);
- } else {
- console.log('formHost getRunningFormInfos, data: ${JSON.stringify(data)}');
- }
- }, 'com.example.ohos.formjsdemo');
-} catch(error) {
- console.error(`catch error, code: ${error.code}, message: ${error.message}`);
-}
-```
-
-## getRunningFormInfos10+
-
-getRunningFormInfos(hostBundleName?: string): Promise<Array<formInfo.RunningFormInfo>>
-
-Obtains information about all non-temporary widgets running on the device. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ------ | ---- | ------- |
-| hostBundleName | string | No| Name of the bundle that functions as the widget host. If this parameter is specified, only the information about the non-temporary widgets that are running under the widget host is returned. By default, information about all running non-temporary widgets on the device is returned.|
-
-**Return value**
-
-| Type | Description |
-| :----------------------------------------------------------- | :---------------------------------- |
-| Promise<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Promise used to return the information obtained.|
-
-**Error codes**
-
-For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
-
-| Error Code ID| Error Message|
-| -------- | -------- |
-| 16500050 | An IPC connection error happened. |
-| 16500060 | A service connection error happened, please try again later. |
-
-**Example**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-
-try {
- formHost.getRunningFormInfos('com.example.ohos.formjsdemo').then((data) => {
- console.log('formHost getRunningFormInfos, data: ${JSON.stringify(data)}');
- }).catch((error) => {
- console.error(`error, code: ${error.code}, message: ${error.message}`);
- });
-} catch(error) {
- console.error(`catch error, code: ${error.code}, message: ${error.message}`);
-}
-```
-
## deleteInvalidForms
deleteInvalidForms(formIds: Array<string>, callback: AsyncCallback<number>): void
@@ -1585,140 +1494,6 @@ let callback = function(formId) {
formHost.off('formUninstall', callback);
```
-## on('formAdd')10+
-
- on(type: 'formAdd', observerCallback: Callback<formInfo.RunningFormInfo>, bundleName?: string): void
-
-Subscribes to widget addition events. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ------ | ---- | ------- |
-| type | string | Yes | Event type. The value **'formAdd'** indicates a widget addition event.|
-| callback | Callback<formInfo.RunningFormInfo> | Yes| Callback used to return **RunningFormInfo** of the new widget.|
-| bundleName | string | No| Name of the bundle that functions as the widget host. By default, widget addition events of all widget hosts are subscribed to.|
-
-**Example**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('a new form added, data: ${JSON.stringify(data)');
-}
-
-formHost.on('formAdd', callback);
-formHost.on('formAdd', callback, bundleName);
-```
-
-## off('formAdd')10+
-
- off(type: "formAdd", observerCallback?: Callback<formInfo.RunningFormInfo>, bundleName?: string): void
-
-Unsubscribes from widget addition events. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ------ | ---- | ------- |
-| type | string | Yes | Event type. The value **'formAdd'** indicates a widget addition event.|
-| callback | Callback<formInfo.RunningFormInfo> | No| Callback used to return **RunningFormInfo**. By default, all the subscriptions to the specified event are canceled. To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formAdd')**.|
-| bundleName | string | No| Name of the bundle that functions as the widget host. To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('formAdd')**. By default, the subscriptions for all the widget hosts are canceled.|
-
-**Example**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('a new form added, data: ${JSON.stringify(data)');
-}
-
-formHost.off('formAdd', callback);
-formHost.off('formAdd', callback, bundleName);
-```
-> **NOTE**
->
-> - **on('formAdd', callback)** and **off('formAdd', callback)** must be used in pairs.
-> - **on('formAdd', callback, bundleName)** and **off('formAdd', callback, bundleName)** must be used in pairs.
-> - To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**.
-
-## on('formRemove')10+
-
- on(type: 'formRemove', observerCallback: Callback<formInfo.RunningFormInfo>, bundleName?: string): void
-
-Subscribes to widget removal events. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ------ | ---- | ------- |
-| type | string | Yes | Event type. The value **'formRemove'** indicates a widget removal event.|
-| callback | Callback<formInfo.RunningFormInfo> | Yes| Callback used to return **RunningFormInfo** of the removed widget.|
-| bundleName | string | No| Name of the bundle that functions as the widget host. By default, widget removal events of all widget hosts are subscribed to.|
-
-**Example**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('a new form added, data: ${JSON.stringify(data)');
-}
-
-formHost.on('formRemove', callback);
-formHost.on('formRemove', callback, bundleName);
-```
-
-## off('formRemove')10+
-
-off(type: "formRemove", observerCallback?: Callback<formInfo.RunningFormInfo>, bundleName?: string): void
-
-Unsubscribes from widget removal events. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ------ | ---- | ------- |
-| type | string | Yes | Event type. The value **'formRemove'** indicates a widget removal event.|
-| callback | Callback<formInfo.RunningFormInfo> | No| Callback used to return **RunningFormInfo**. By default, all the subscriptions to the specified event are canceled. To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formRemove')**.|
-| bundleName | string | No| Name of the bundle that functions as the widget host. To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('formRemove')**. By default, the subscriptions for all the widget hosts are canceled.|
-
-**Example**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('a new form added, data: ${JSON.stringify(data)');
-}
-
-formHost.off('formRemove', callback);
-formHost.off('formRemove', callback, bundleName);
-```
-> **NOTE**
->
-> - **on('formRemove', callback)** and **off('formRemove', callback)** must be used in pairs.
-> - **on('formRemove', callback, bundleName)** and **off('formRemove', callback, bundleName)** must be used in pairs.
-> - To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**.
-
## notifyFormsVisible
notifyFormsVisible(formIds: Array<string>, isVisible: boolean, callback: AsyncCallback<void>): void
@@ -2225,352 +2000,3 @@ try {
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
-
-## getRunningFormInfosByFilter10+
-
-getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter): Promise<Array<formInfo.RunningFormInfo>>
-
-Obtains the information about widget hosts based on the widget provider information. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| ----------- | --------------- | ---- | -------------------------------- |
-| formProviderFilter | [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | Yes | Information about the widget provider.|
-
-**Return value**
-
-| Type | Description |
-| ------------------- | ------------------------- |
-| Promise<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md#RunningFormInfo)>> | Promise used to return the widget host information obtained.|
-
-**Error codes**
-
-For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
-
-| Error Code ID| Error Message|
-| -------- | -------- |
-| 201 | Permissions denied. |
-| 202 | The application is not a system application. |
-| 401 | If the input parameter is not valid parameter. |
-| 16500050 | An IPC connection error happened. |
-| 16500100 | Failed to obtain the configuration information. |
-| 16501000 | An internal functional error occurred. |
-
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-
-let formInstanceFilter = {
- bundleName: "com.example.formprovide",
- abilityName: "EntryFormAbility",
- formName: "widget",
- moduleName: "entry"
-}
-try {
- formHost.getRunningFormInfosByFilter(formInstanceFilter).then(data1 => {
- console.info('formHost getRunningFormInfosByFilter return err :');
- }).catch((error) => {
- console.error(`error, code: ${error.code}, message: ${error.message}`);
- });
-} catch(error) {
- console.error(`catch error, code: ${error.code}, message: ${error.message}`);
-}
-```
-
-## getRunningFormInfosByFilter10+
-
-getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, callback: AsyncCallback<Array<formInfo.RunningFormInfo>>): void
-
-Obtains the information about widget hosts based on the widget provider information. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| ----------- | --------------- | ---- | -------------------------------- |
-| formProviderFilter | [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | Yes | Information about the widget provider.|
-| callback | AsyncCallback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the result. If the widget host information is obtained, **error** is **undefined** and **data** is the information obtained; otherwise, **error** is an error object.|
-
-**Error codes**
-
-For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
-
-| Error Code ID| Error Message|
-| -------- | -------- |
-| 201 | Permissions denied. |
-| 202 | The application is not a system application. |
-| 401 | If the input parameter is not valid parameter. |
-| 16500050 | An IPC connection error happened. |
-| 16500100 | Failed to obtain the configuration information. |
-| 16501000 | An internal functional error occurred. |
-
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-
-let formInstanceFilter = {
- bundleName: "com.example.formprovide",
- abilityName: "EntryFormAbility",
- formName: "widget",
- moduleName: "entry"
-}
-try {
- formHost.getRunningFormInfosByFilter(formInstanceFilter,(error, data) => {
- if (error) {
- console.error(`error, code: ${error.code}, message: ${error.message}`);
- } else {
- console.log('formHost getRunningFormInfosByFilter, data: ${JSON.stringify(data)}');
- }
- });
-} catch(error) {
- console.error(`catch error, code: ${error.code}, message: ${error.message}`);
-}
-```
-
-## getRunningFormInfoById10+
-
-getRunningFormInfoById(formId: string): Promise<formInfo.RunningFormInfo>
-
-
-Obtains the information about widget hosts based on the widget ID. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| ----------- | --------------- | ---- | -------------------------------- |
-| formId | string | Yes | Widget ID.|
-
-**Return value**
-
-| Type | Description |
-| ------------------- | ------------------------- |
-| Promise<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)> | Promise used to return the widget host information obtained.|
-
-**Error codes**
-
-For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
-
-| Error Code ID| Error Message|
-| -------- | -------- |
-| 201 | Permissions denied. |
-| 202 | The application is not a system application. |
-| 401 | If the input parameter is not valid parameter. |
-| 16500050 | An IPC connection error happened. |
-| 16500100 | Failed to obtain the configuration information. |
-| 16501000 | An internal functional error occurred. |
-
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let formId = '12400633174999288';
-try {
- formHost.getRunningFormInfoById(formId).then(data1 => {
- console.info('formHost getRunningFormInfoById return err :');
- }).catch((error) => {
- console.error(`error, code: ${error.code}, message: ${error.message}`);
- });
-} catch(error) {
- console.error(`catch error, code: ${error.code}, message: ${error.message}`);
-}
-```
-
-## getRunningFormInfoById10+
-
-getRunningFormInfoById(formId: string, callback: AsyncCallback<formInfo.RunningFormInfo>): void
-
-Obtains the information about widget hosts based on the widget ID. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| ----------- | --------------- | ---- | -------------------------------- |
-| formId | string | Yes | Widget ID.|
-| callback | AsyncCallback<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)> | Yes| Callback used to return the result. If the widget host information is obtained, **error** is **undefined** and **data** is the information obtained; otherwise, **error** is an error object.|
-
-**Error codes**
-
-For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
-
-| Error Code ID| Error Message|
-| -------- | -------- |
-| 201 | Permissions denied. |
-| 202 | The application is not a system application. |
-| 401 | If the input parameter is not valid parameter. |
-| 16500050 | An IPC connection error happened. |
-| 16500100 | Failed to obtain the configuration information. |
-| 16501000 | An internal functional error occurred. |
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-
-let formId = '12400633174999288';
-try {
- formHost.getRunningFormInfoById(formId,(error, data) => {
- if (error) {
- console.error(`error, code: ${error.code}, message: ${error.message}`);
- } else {
- console.log('formHost getRunningFormInfoById, data: ${JSON.stringify(data)}');
- }
- });
-} catch(error) {
- console.error(`catch error, code: ${error.code}, message: ${error.message}`);
-}
-```
-
-## on('notifyVisible')10+
-
- on(type: 'notifyVisible', observerCallback: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>, bundleName?: string): void
-
-Subscribes to events indicating that a widget becomes visible.
-
-This event is triggered when **notifyVisibleForms** is called to make a widget visible.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | Yes | Event type. This value **'notifyVisible'** indicates a widget visibility event. |
-| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Yes | Callback used to return **RunningFormInfo** of the widget. |
-| bundleName | string | No | Name of the bundle that functions as the widget host, on which the widget visibility state changes are subscribed.|
-
-**Example**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('form change visibility, data: ${JSON.stringify(data)');
-}
-
-formHost.on('notifyVisible', callback);
-formHost.on('notifyVisible', callback, bundleName);
-```
-
-## off('notifyVisible')10+
-
- off(type: "notifyVisible", observerCallback?: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>, bundleName?: string): void
-
-Unsubscribes from events indicating that a widget becomes visible.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | Yes | Event type. This value **'notifyVisible'** indicates a widget visibility event.|
-| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | No | Callback registered during the subscription. By default, all the subscriptions to the specified event are canceled. To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('notifyVisible')**.|
-| bundleName | string | No | Name of the bundle that functions as the widget host, on which the widget visibility state changes are subscribed. To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('notifyVisible')**.|
-
-**Example**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('form change visibility, data: ${JSON.stringify(data)');
-}
-
-formHost.off('notifyVisible', callback);
-formHost.off('notifyVisible', callback, bundleName);
-```
-
-> **NOTE**
->
-> - **on('notifyVisible', callback)** and **off('notifyVisible', callback)** must be used in pairs.
-> - **on('notifyVisible', callback, bundleName)** and **off('notifyVisible', callback, bundleName)** must be used in pairs.
-> - To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**.
-
-
-
-## on('notifyInvisible')10+
-
- on(type: 'notifyInvisible', observerCallback: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>, bundleName?: string): void
-
-Subscribes to events indicating that a widget becomes invisible.
-
-This event is triggered when **notifyInvisibleForms** is called to make a widget invisible.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | Yes | Event type. This value **'notifyInvisible'** indicates a widget invisibility event. |
-| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Yes | Callback used to return **RunningFormInfo** of the widget. |
-| bundleName | string | No | Name of the bundle that functions as the widget host, on which the widget visibility state changes are subscribed.|
-
-**Example**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('form change invisibility, data: ${JSON.stringify(data)');
-}
-
-formHost.on('notifyInvisible', callback);
-formHost.on('notifyInvisible', callback, bundleName);
-```
-
-## off('notifyInvisible')10+
-
- off(type: "notifyInvisible", observerCallback?: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>, bundleName?: string): void
-
-Unsubscribes from events indicating that a widget becomes invisible.
-
-**Required permissions**: ohos.permission.REQUIRE_FORM
-
-**System capability**: SystemCapability.Ability.Form
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| type | string | Yes | Event type. This value **'notifyInvisible'** indicates a widget invisibility event. |
-| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | No | Callback registered during the subscription. By default, all the subscriptions to the specified event are canceled. To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('notifyInvisible')**.|
-| bundleName | string | No | Name of the bundle that functions as the widget host, on which the widget visibility state changes are subscribed. To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('notifyInvisible')**. |
-
-**Example**
-
-```ts
-import formHost from '@ohos.app.form.formHost';
-let bundleName = 'ohos.samples.FormApplication';
-let callback = function(data) {
- console.log('form change invisibility, data: ${JSON.stringify(data)');
-}
-
-formHost.off('notifyInvisible', callback);
-formHost.off('notifyInvisible', callback, bundleName);
-```
-
-> **NOTE**
->
-> - **on('notifyInvisible', callback)** and **off('notifyInvisible', callback)** must be used in pairs.
-> - **on('notifyInvisible', callback, bundleName)** and **off('notifyInvisible', callback, bundleName)** must be used in pairs.
-> - To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**.
diff --git a/en/application-dev/reference/apis/js-apis-app-form-formObserver.md b/en/application-dev/reference/apis/js-apis-app-form-formObserver.md
new file mode 100644
index 0000000000000000000000000000000000000000..cba38112d1de95f16d476a62e0ae2af863bdc427
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-app-form-formObserver.md
@@ -0,0 +1,699 @@
+# @ohos.app.form.formObserver (formObserver)
+
+The **formObserver** module provides APIs related to widget listeners. You can use the APIs to subscribe to and unsubscribe from widget addition, removal, and visibility change events, and obtain information about running widgets.
+
+> **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.
+> The APIs provided by this module are system APIs.
+
+## Modules to Import
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+```
+
+## on('formAdd')
+
+ on(type: 'formAdd', observerCallback: Callback<formInfo.RunningFormInfo>): void
+
+Subscribes to widget addition events. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------- |
+| type | string | Yes | Event type. The value **'formAdd'** indicates a widget addition event.|
+| callback | Callback<formInfo.RunningFormInfo> | Yes| Callback used to return **RunningFormInfo** of the widget.|
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let callback = function(data) {
+ console.log('a new form added, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('formAdd', callback);
+```
+
+## on('formAdd')
+
+ on(type: 'formAdd', bundleName: string, observerCallback: Callback<formInfo.RunningFormInfo>): void
+
+Subscribes to widget addition events for a given bundle that functions as the widget host. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------- |
+| type | string | Yes | Event type. The value **'formAdd'** indicates a widget addition event.|
+| bundleName | string | Yes| Name of the bundle that functions as the widget host. If no value is passed in, widget addition events of all widget hosts are subscribed to.|
+| callback | Callback<formInfo.RunningFormInfo> | Yes| Callback used to return **RunningFormInfo** of the widget.|
+
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('a new form added, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('formAdd', bundleName, callback);
+```
+
+## off('formAdd')
+
+ off(type: "formAdd", bundleName?: string, observerCallback?: Callback<formInfo.RunningFormInfo>): void
+
+Unsubscribes from widget addition events. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------- |
+| type | string | Yes | Event type. The value **'formAdd'** indicates a widget addition event.|
+| bundleName | string | No| Name of the bundle that functions as the widget host. To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('formAdd')**. If no value is passed in, the subscriptions for all the widget hosts are canceled. |
+| callback | Callback<formInfo.RunningFormInfo> | No| Callback used to return **RunningFormInfo** of the widget. If no value is passed in, all the subscriptions to the specified event are canceled. To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formAdd')**. |
+
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('a new form added, data: ${JSON.stringify(data)');
+}
+
+formObserver.off('formAdd', callback);
+formObserver.off('formAdd', bundleName, callback);
+```
+> **NOTE**
+> **on('formAdd', callback)** and **off('formAdd', callback)** must be used in pairs.
+> **on('formAdd', bundleName, callback)** and **off('formAdd', bundleName, callback)** must be used in pairs.
+> To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**.
+
+## on('formRemove')
+
+ on(type: 'formRemove', observerCallback: Callback<formInfo.RunningFormInfo>): void
+
+Subscribes to widget removal events. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------- |
+| type | string | Yes | Event type. The value **'formRemove'** indicates a widget removal event.|
+| callback | Callback<formInfo.RunningFormInfo> | Yes| Callback used to return **RunningFormInfo** of the widget.|
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let callback = function(data) {
+ console.log('form deleted, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('formRemove', callback);
+```
+
+## on('formRemove')
+
+ on(type: 'formRemove', bundleName: string, observerCallback: Callback<formInfo.RunningFormInfo>): void
+
+Subscribes to widget removal events for a given bundle, which functions as the widget host. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------- |
+| type | string | Yes | Event type. The value **'formRemove'** indicates a widget removal event.|
+| bundleName | string | Yes| Name of the bundle that functions as the widget host. If no value is passed in, widget removal events of all widget hosts are subscribed to.|
+| callback | Callback<formInfo.RunningFormInfo> | Yes| Callback used to return **RunningFormInfo** of the widget.|
+
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('form deleted, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('formRemove', bundleName, callback);
+```
+
+## off('formRemove')
+
+off(type: "formRemove", bundleName?: string, observerCallback?: Callback<formInfo.RunningFormInfo>): void
+
+Unsubscribes from widget removal events. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------- |
+| type | string | Yes | Event type. The value **'formRemove'** indicates a widget removal event.|
+| bundleName | string | No| Name of the bundle that functions as the widget host. To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('formRemove')**. If no value is passed in, the subscriptions for all the widget hosts are canceled. |
+| callback | Callback<formInfo.RunningFormInfo> | No| Callback used to return **RunningFormInfo** of the widget. If no value is passed in, all the subscriptions to the specified event are canceled. To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formRemove')**. |
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('a new form added, data: ${JSON.stringify(data)');
+}
+
+formObserver.off('formRemove', callback);
+formObserver.off('formRemove', bundleName, callback);
+```
+> **NOTE**
+> **on('formRemove', callback)** and **off('formRemove', callback)** must be used in pairs.
+> **on('formRemove', bundleName, callback)** and **off('formRemove', bundleName, callback)** must be used in pairs.
+> To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**.
+
+## on('notifyVisible')
+
+ on(type: 'notifyVisible', observerCallback: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>): void
+
+Subscribes to events indicating that a widget becomes visible.
+
+This event is triggered when **notifyVisibleForms** is called to make a widget visible.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | Yes | Event type. This value **'notifyVisible'** indicates a widget visibility event. |
+| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Yes | Callback used to return **RunningFormInfo** of the widget. |
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let callback = function(data) {
+ console.log('form change visibility, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('notifyVisible', callback);
+```
+
+## on('notifyVisible')
+
+ on(type: 'notifyVisible', bundleName: string, observerCallback: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>): void
+
+Subscribes to events indicating that a widget becomes visible for a given bundle, which functions as the widget host.
+
+This event is triggered when **notifyVisibleForms** is called to make a widget visible.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | Yes | Event type. This value **'notifyVisible'** indicates a widget visibility event. |
+| bundleName | string | Yes | Name of the bundle that functions as the widget host, on which the widget visibility state changes are subscribed.|
+| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Yes | Callback used to return **RunningFormInfo** of the widget. |
+
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('form change visibility, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('notifyVisible', bundleName, callback);
+```
+
+## off('notifyVisible')
+
+ off(type: "notifyVisible", bundleName?: string, observerCallback?: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>): void
+
+Unsubscribes from events indicating that a widget becomes visible.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | Yes | Event type. This value **'notifyVisible'** indicates a widget visibility event.|
+| bundleName | string | No | Name of the bundle that functions as the widget host, on which the widget visibility state changes are subscribed. To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('notifyVisible')**. |
+| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | No | Callback registered during the subscription. If no value is passed in, all the subscriptions to the specified event are canceled. To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('notifyVisible')**. |
+
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('form change visibility, data: ${JSON.stringify(data)');
+}
+
+formObserver.off('notifyVisible', callback);
+formObserver.off('notifyVisible', bundleName, callback);
+```
+
+> **NOTE**
+> **on('notifyVisible', callback)** and **off('notifyVisible', callback)** must be used in pairs.
+> **on('notifyVisible', bundleName, callback)** and **off('notifyVisible', bundleName, callback)** must be used in pairs.
+> To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**.
+
+## on('notifyInvisible')
+
+ on(type: 'notifyInvisible', observerCallback: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>): void
+
+Subscribes to events indicating that a widget becomes invisible.
+
+This event is triggered when **notifyInvisibleForms** is called to make a widget invisible.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | Yes | Event type. This value **'notifyInvisible'** indicates a widget invisibility event. |
+| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Yes | Callback used to return **RunningFormInfo** of the widget. |
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let callback = function(data) {
+ console.log('form change invisibility, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('notifyInvisible', callback);
+```
+
+
+## on('notifyInvisible')
+
+ on(type: 'notifyInvisible', bundleName: string, observerCallback: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>): void
+
+Subscribes to events indicating that a widget becomes invisible for a given bundle, which functions as the widget host.
+
+This event is triggered when **notifyInvisibleForms** is called to make a widget invisible.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | Yes | Event type. This value **'notifyInvisible'** indicates a widget invisibility event. |
+| bundleName | string | Yes | Name of the bundle that functions as the widget host, on which the widget visibility state changes are subscribed.|
+| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Yes | Callback used to return **RunningFormInfo** of the widget. |
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('form change invisibility, data: ${JSON.stringify(data)');
+}
+
+formObserver.on('notifyInvisible', bundleName, callback);
+```
+
+## off('notifyInvisible')
+
+ off(type: "notifyInvisible", bundleName?: string, observerCallback?: Callback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>>): void
+
+Unsubscribes from events indicating that a widget becomes invisible.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| type | string | Yes | Event type. This value **'notifyInvisible'** indicates a widget invisibility event. |
+| bundleName | string | No | Name of the bundle that functions as the widget host, on which the widget visibility state changes are subscribed. To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('notifyInvisible')**. |
+| callback | Callback <Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | No | Callback registered during the subscription. If no value is passed in, all the subscriptions to the specified event are canceled. To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('notifyInvisible')**. |
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let bundleName = 'ohos.samples.FormApplication';
+let callback = function(data) {
+ console.log('form change invisibility, data: ${JSON.stringify(data)');
+}
+
+formObserver.off('notifyInvisible', callback);
+formObserver.off('notifyInvisible', bundleName, callback);
+```
+
+> **NOTE**
+> **on('notifyInvisible', callback)** and **off('notifyInvisible', callback)** must be used in pairs.
+> **on('notifyInvisible', bundleName, callback)** and **off('notifyInvisible', bundleName, callback)** must be used in pairs.
+> To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**.
+
+
+## getRunningFormInfos
+
+getRunningFormInfos(callback: AsyncCallback<Array<formInfo.RunningFormInfo>>, hostBundleName?: string): void
+
+Obtains information about all non-temporary widgets running on the device. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------- |
+| callback | AsyncCallback<Array<formInfo.RunningFormInfo>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained.|
+| hostBundleName | string | No| Name of the bundle that functions as the widget host. If a value is passed in, only the information about the non-temporary widgets that are running under the widget host is returned. If no value is passed in, information about all running non-temporary widgets on the device is returned. |
+
+**Error codes**
+For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
+
+| ID| Error Message|
+| -------- | -------- |
+| 16500050 | An IPC connection error happened. |
+| 16500060 | A service connection error happened, please try again later. |
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+
+try {
+ formObserver.getRunningFormInfos((error, data) => {
+ if (error) {
+ console.error(`error, code: ${error.code}, message: ${error.message}`);
+ } else {
+ console.log('formObserver getRunningFormInfos, data: ${JSON.stringify(data)}');
+ }
+ }, 'com.example.ohos.formjsdemo');
+} catch(error) {
+ console.error(`catch error, code: ${error.code}, message: ${error.message}`);
+}
+```
+
+## getRunningFormInfos
+
+getRunningFormInfos(hostBundleName?: string): Promise<Array<formInfo.RunningFormInfo>>
+
+Obtains information about all non-temporary widgets running on the device. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------- |
+| hostBundleName | string | No| Name of the bundle that functions as the widget host. If a value is passed in, only the information about the non-temporary widgets that are running under the widget host is returned. If no value is passed in, information about all running non-temporary widgets on the device is returned. |
+
+**Return value**
+
+| Type | Description |
+| :----------------------------------------------------------- | :---------------------------------- |
+| Promise<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Promise used to return the information obtained.|
+
+**Error codes**
+For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
+
+| ID| Error Message|
+| -------- | -------- |
+| 16500050 | An IPC connection error happened. |
+| 16500060 | A service connection error happened, please try again later. |
+
+**Example**
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+
+try {
+ formObserver.getRunningFormInfos('com.example.ohos.formjsdemo').then((data) => {
+ console.log('formObserver getRunningFormInfos, data: ${JSON.stringify(data)}');
+ }).catch((error) => {
+ console.error(`error, code: ${error.code}, message: ${error.message}`);
+ });
+} catch(error) {
+ console.error(`catch error, code: ${error.code}, message: ${error.message}`);
+}
+```
+
+## getRunningFormInfosByFilter
+
+getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter): Promise<Array<formInfo.RunningFormInfo>>
+
+Obtains the information about widget hosts based on the widget provider information. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | --------------- | ---- | -------------------------------- |
+| formProviderFilter | [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | Yes | Information about the widget provider.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------------------- |
+| Promise<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md#RunningFormInfo)>> | Promise used to return the widget host information obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
+
+| ID| Error Message|
+| -------- | -------- |
+| 201 | Permissions denied. |
+| 202 | The application is not a system application. |
+| 401 | If the input parameter is not valid parameter. |
+| 16500050 | An IPC connection error happened. |
+| 16500100 | Failed to obtain the configuration information. |
+| 16501000 | An internal functional error occurred. |
+
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+
+let formInstanceFilter = {
+ bundleName: "com.example.formprovide",
+ abilityName: "EntryFormAbility",
+ formName: "widget",
+ moduleName: "entry"
+}
+try {
+ formObserver.getRunningFormInfosByFilter(formInstanceFilter).then(data1 => {
+ console.info('formObserver getRunningFormInfosByFilter return err :');
+ }).catch((error) => {
+ console.error(`error, code: ${error.code}, message: ${error.message}`);
+ });
+} catch(error) {
+ console.error(`catch error, code: ${error.code}, message: ${error.message}`);
+}
+```
+
+## getRunningFormInfosByFilter
+
+getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, callback: AsyncCallback<Array<formInfo.RunningFormInfo>>): void
+
+Obtains the information about widget hosts based on the widget provider information. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | --------------- | ---- | -------------------------------- |
+| formProviderFilter | [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | Yes | Information about the widget provider.|
+| callback | AsyncCallback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the result. If the widget host information is obtained, **error** is **undefined** and **data** is the information obtained; otherwise, **error** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
+
+| ID| Error Message|
+| -------- | -------- |
+| 201 | Permissions denied. |
+| 202 | The application is not a system application. |
+| 401 | If the input parameter is not valid parameter. |
+| 16500050 | An IPC connection error happened. |
+| 16500100 | Failed to obtain the configuration information. |
+| 16501000 | An internal functional error occurred. |
+
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+
+let formInstanceFilter = {
+ bundleName: "com.example.formprovide",
+ abilityName: "EntryFormAbility",
+ formName: "widget",
+ moduleName: "entry"
+}
+try {
+ formObserver.getRunningFormInfosByFilter(formInstanceFilter,(error, data) => {
+ if (error) {
+ console.error(`error, code: ${error.code}, message: ${error.message}`);
+ } else {
+ console.log('formObserver getRunningFormInfosByFilter, data: ${JSON.stringify(data)}');
+ }
+ });
+} catch(error) {
+ console.error(`catch error, code: ${error.code}, message: ${error.message}`);
+}
+```
+
+## getRunningFormInfoById
+
+getRunningFormInfoById(formId: string): Promise<formInfo.RunningFormInfo>
+
+
+Obtains the information about widget hosts based on the widget ID. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | --------------- | ---- | -------------------------------- |
+| formId | string | Yes | Widget ID.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------------------- |
+| Promise<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)> | Promise used to return the widget host information obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
+
+| ID| Error Message|
+| -------- | -------- |
+| 201 | Permissions denied. |
+| 202 | The application is not a system application. |
+| 401 | If the input parameter is not valid parameter. |
+| 16500050 | An IPC connection error happened. |
+| 16500100 | Failed to obtain the configuration information. |
+| 16501000 | An internal functional error occurred. |
+
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+let formId = '12400633174999288';
+try {
+ formObserver.getRunningFormInfoById(formId).then(data1 => {
+ console.info('formObserver getRunningFormInfoById return err :');
+ }).catch((error) => {
+ console.error(`error, code: ${error.code}, message: ${error.message}`);
+ });
+} catch(error) {
+ console.error(`catch error, code: ${error.code}, message: ${error.message}`);
+}
+```
+
+## getRunningFormInfoById
+
+getRunningFormInfoById(formId: string, callback: AsyncCallback<formInfo.RunningFormInfo>): void
+
+Obtains the information about widget hosts based on the widget provider information. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.OBSERVE_FORM_RUNNING
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | --------------- | ---- | -------------------------------- |
+| formId | string | Yes | Widget ID.|
+| callback | AsyncCallback<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)> | Yes| Callback used to return the result. If the widget host information is obtained, **error** is **undefined** and **data** is the information obtained; otherwise, **error** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
+
+| ID| Error Message|
+| -------- | -------- |
+| 201 | Permissions denied. |
+| 202 | The application is not a system application. |
+| 401 | If the input parameter is not valid parameter. |
+| 16500050 | An IPC connection error happened. |
+| 16500100 | Failed to obtain the configuration information. |
+| 16501000 | An internal functional error occurred. |
+
+```ts
+import formObserver from '@ohos.app.form.formObserver';
+
+let formId = '12400633174999288';
+try {
+ formObserver.getRunningFormInfoById(formId,(error, data) => {
+ if (error) {
+ console.error(`error, code: ${error.code}, message: ${error.message}`);
+ } else {
+ console.log('formObserver getRunningFormInfoById, data: ${JSON.stringify(data)}');
+ }
+ });
+} catch(error) {
+ console.error(`catch error, code: ${error.code}, message: ${error.message}`);
+}
+```
diff --git a/en/application-dev/reference/apis/js-apis-appAccount-authorizationExtensionAbility.md b/en/application-dev/reference/apis/js-apis-appAccount-authorizationExtensionAbility.md
deleted file mode 100644
index dd40fcecca457706871fa85fd8ed4dded9734d67..0000000000000000000000000000000000000000
--- a/en/application-dev/reference/apis/js-apis-appAccount-authorizationExtensionAbility.md
+++ /dev/null
@@ -1,70 +0,0 @@
-# @ohos.account.appAccount.AuthorizationExtensionAbility (App AuthorizationExtensionAbility)
-
-The **AuthorizationExtensionAbility** module provides APIs for implementing authorization to app accounts based on the ExtensionAbility framework.
-
-> **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.
-
-## Modules to Import
-
-```ts
-import AuthorizationExtensionAbility, { AuthorizationRequest, AuthorizationCallback } from '@ohos.account.appAccount.AuthorizationExtensionAbility';
-```
-
-## AuthorizationRequest
-
-Defines the app account authorization request.
-
-**System API**: This is a system API.
-
-**System capability**: SystemCapability.Account.AppAccount
-
-| Name | Type | Readable| Writable| Description |
-| --------- | ------------------------------- | ---- | ---- | ------------------------------------ |
-| callerUid | number | Yes | No | UID of the caller.|
-| parameters | [appAccount.AccountCapabilityRequest](js-apis-appAccount.md#accountcapabilityrequest10) | Yes | No | Service parameters.|
-
-## AuthorizationCallback
-
-Provides callbacks to be invoked during the app account authorization.
-
-**System API**: This is a system API.
-
-**System capability**: SystemCapability.Account.AppAccount
-
-| Name | Type | Readable| Writable| Description |
-| --------- | ------------------------------- | ---- | ---- | ------------------------------------ |
-| onResult | AsyncCallback<[appAccount.AccountCapabilityResponse](js-apis-appAccount.md#accountcapabilityresponse10), { [key: string]: object }> | Yes | No | Callback invoked to return the authorization result.|
-
-## AuthorizationExtensionAbility.onStartAuthorization
-
-onStartAuthorization(request: AuthorizationRequest, callback: AuthorizationCallback): void
-
-Called when an authorization request is received.
-
-**System API**: This is a system API.
-
-**System capability**: SystemCapability.Account.AppAccount
-
-**Parameters**
-
-| Name | Type | Mandatory | Description |
-| -------- | ---------------------------------------- | ---- | ----------------------- |
-| request | [AuthorizationRequest](#authorizationrequest) | Yes | Authorization request information.|
-| callback | [AuthorizationCallback](#authorizationcallback) | Yes | Authorization callback object.|
-
-**Example**
-
-```ts
-class MyAuthorizationExtensionAbility extends AuthorizationExtensionAbility {
- onStartAuthorization(request: AuthorizationRequest, callback: AuthorizationCallback) {
- console.log('onStartAuthorization, callerUid: ' + request.callerUid + ', parameters: ' + request.parameters);
- let response = {
- name: 'xxxx',
- scopes: ['xxx', 'xxx']
- };
- callback.onResult(null, response);
- }
-};
-```
diff --git a/en/application-dev/reference/apis/js-apis-arkui-UIContext.md b/en/application-dev/reference/apis/js-apis-arkui-UIContext.md
index 59d38206114407df5e3e220060274da684707cee..946463e335769b047494f0ed5b85ddbb911b3490 100644
--- a/en/application-dev/reference/apis/js-apis-arkui-UIContext.md
+++ b/en/application-dev/reference/apis/js-apis-arkui-UIContext.md
@@ -608,9 +608,9 @@ Obtains the size, position, translation, scaling, rotation, and affine matrix in
**Return value**
-| Type | Description |
-| ------------- | ------------------------------------------------------------ |
-| ComponentInfo | Size, position, translation, scaling, rotation, and affine matrix information of the component. |
+| Type | Description |
+| -------------------------------------------------------- | ------------------------------------------------ |
+| [ComponentInfo](js-apis-arkui-componentUtils.md#componentinfo) | Size, position, translation, scaling, rotation, and affine matrix information of the component.|
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-arkui-componentUtils.md b/en/application-dev/reference/apis/js-apis-arkui-componentUtils.md
new file mode 100644
index 0000000000000000000000000000000000000000..7dd3cbb5a41f2bb4b6cbb401cd6f90c0d77d39e9
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-arkui-componentUtils.md
@@ -0,0 +1,230 @@
+# @ohos.arkui.componentUtils (componentUtils)
+
+The **componentUtils** module provides API for obtaining the coordinates and size of the drawing area of a component.
+
+> **NOTE**
+>
+> The APIs of this module are supported since API version 10. Updates will be marked with a superscript to indicate their earliest API version.
+>
+> The functionality of this module depends on UI context. This means that the APIs of this module cannot be used where the UI context is unclear. For details, see [UIContext](./js-apis-arkui-UIContext.md#uicontext).
+>
+> Since API version 10, you can use the [getComponentUtils](./js-apis-arkui-UIContext.md#getcomponentutils) API in **UIContext** to obtain the **ComponentUtils** object associated with the current UI context. For this API to work correctly, call it after the notification indicating completion of component layout is received through [@ohos.arkui.inspector (layout callback)](js-apis-arkui-inspector.md).
+
+## Modules to Import
+
+```js
+import componentUtils from '@ohos.arkui.componentUtils'
+```
+## componentUtils.getRectangleById
+
+getRectangleById(id: string): ComponentInfo
+
+Obtains a **ComponentInfo** object based on the component ID.
+
+**System capability**: SystemCapability.ArkUI.ArkUI.Full
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ---------- |
+| id | string | Yes | Component ID.|
+
+**Return value**
+
+| Type | Description |
+| ------ | ---------- |
+| [ComponentInfo](#componentinfo) | **ComponentInfo** object, which provides the size, position, translation, scaling, rotation, and affine matrix information of the component.|
+
+**Example**
+
+```js
+let modePosition = componentUtils.getRectangleById("onClick");
+```
+
+## ComponentInfo
+
+**System capability**: SystemCapability.ArkUI.ArkUI.Full
+
+| Name | Type | Mandatory | Description |
+| ---------------|------------ | -----------------------------| -----------------------------|
+| size | [Size](#size) | Yes| Component size. |
+| localOffset | [Offset](#offset) | Yes| Offset of the component relative to the parent component. |
+| windowOffset | [Offset](#offset) | Yes| Offset of the component relative to the window. |
+| screenOffset | [Offset](#offset) | Yes| Offset of the component relative to the screen. |
+| translate | [TranslateResult](#translateresult) | Yes| Translation of the component. |
+| scale | [ScaleResult](#scaleresult) | Yes| Scaling of the component. |
+| rotate | [RotateResult](#rotateresult) | Yes| Rotation of the component. |
+| transform | [Matrix4Result](#matrix4result) | Yes| Affine matrix of the component, which is a 4x4 matrix object created based on the input parameter. |
+
+### Size
+
+**System capability**: SystemCapability.ArkUI.ArkUI.Full
+
+| Name | Type| Mandatory| Description |
+| -------- | ---- | ----------------------------------| ----------------------------------|
+| width | number | Yes| Component width. |
+| height | number | Yes| Component height. |
+
+### Offset
+
+**System capability**: SystemCapability.ArkUI.ArkUI.Full
+
+| Name | Type| Mandatory| Description |
+| --------| ---- | -----------------------------------| -----------------------------------|
+| x | number | Yes| X coordinate. |
+| y | number | Yes| Y coordinate. |
+
+### TranslateResult
+
+**System capability**: SystemCapability.ArkUI.ArkUI.Full
+
+| Name | Type| Mandatory| Description |
+| --------| ---- | -----------------------------------| -----------------------------------|
+| x | number | Yes| Translation distance along the x-axis. |
+| y | number | Yes| Translation distance along the y-axis. |
+| z | number | Yes| Translation distance along the z-axis. |
+
+### ScaleResult
+
+**System capability**: SystemCapability.ArkUI.ArkUI.Full
+
+| Name | Type| Mandatory| Description |
+| --------| ---- | -----------------------------------| -----------------------------------|
+| x | number | Yes| Scale factor along the x-axis. |
+| y | number | Yes| Scale factor along the y-axis. |
+| z | number | Yes| Scale factor along the z-axis. |
+| centerX | number | Yes| X coordinate of the center point. |
+| centerY | number | Yes| Y coordinate of the center point. |
+
+### RotateResult
+
+**System capability**: SystemCapability.ArkUI.ArkUI.Full
+
+| Name | Type| Mandatory| Description |
+| --------| ---- | -----------------------------------| -----------------------------------|
+| x | number | Yes| X coordinate of the rotation vector. |
+| y | number | Yes| Y coordinate of the rotation vector. |
+| z | number | Yes| Z coordinate of the rotation vector. |
+| angle | number | Yes| Rotation angle. |
+| centerX | number | Yes| X coordinate of the center point. |
+| centerY | number | Yes| Y coordinate of the center point. |
+
+### Matrix4Result
+
+**System capability**: SystemCapability.ArkUI.ArkUI.Full
+
+| Value Range | Description |
+| --------| -----------------------------------|
+| [number,number,number,number, number,number,number,number, number,number,number,number, number,number,number,number] | A number array whose length is 16 (4 x 4). For details, see **4 x 4 matrix description**.|
+
+**4 x 4 matrix description**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------------------------------------ |
+| m00 | number | Yes | Scale factor along the x-axis. Defaults to **1** for the identity matrix. |
+| m01 | number | Yes | The second value, which is affected by the rotation of the x, y, and z axes. |
+| m02 | number | Yes | The third value, which is affected by the rotation of the x, y, and z axes. |
+| m03 | number | Yes | Meaningless value. |
+| m10 | number | Yes | The fifth value, which is affected by the rotation of the x, y, and z axes. |
+| m11 | number | Yes | Scale factor along the y-axis. Defaults to **1** for the identity matrix. |
+| m12 | number | Yes | The seventh value, which is affected by the rotation of the x, y, and z axes. |
+| m13 | number | Yes | Meaningless value. |
+| m20 | number | Yes | The ninth value, which is affected by the rotation of the x, y, and z axes. |
+| m21 | number | Yes | The tenth value, which is affected by the rotation of the x, y, and z axes. |
+| m22 | number | Yes | Scale factor along the z-axis. Defaults to **1** for the identity matrix. |
+| m23 | number | Yes | Meaningless value. |
+| m30 | number | Yes | Translation value of the x-axis, in px. Defaults to **0** for the unit matrix.|
+| m31 | number | Yes | Translation value of the y-axis, in px. The default value is **0** for the identity matrix.|
+| m32 | number | Yes | Translation value of the z-axis, in px. The default value is **0** for the identity matrix.|
+| m33 | number | Yes | Valid in homogeneous coordinates, presenting the perspective projection effect. |
+
+**Example**
+
+ ```js
+import matrix4 from '@ohos.matrix4';
+import componentUtils from '@ohos.arkui.componentUtils';
+
+@Entry
+@Component
+struct Utils{
+ private getComponentRect(key) {
+ console.info("Mode Key: " + key);
+ let modePosition = componentUtils.getRectangleById(key);
+
+ let localOffsetWidth = modePosition.size.width;
+ let localOffsetHeight = modePosition.size.height;
+ let localOffsetX = modePosition.localOffset.x;
+ let localOffsetY = modePosition.localOffset.y;
+
+ let windowOffsetX = modePosition.windowOffset.x;
+ let windowOffsetY = modePosition.windowOffset.y;
+
+ let screenOffsetX = modePosition.screenOffset.x;
+ let screenOffsetY = modePosition.screenOffset.y;
+
+ let translateX = modePosition.translate.x;
+ let translateY = modePosition.translate.y;
+ let translateZ = modePosition.translate.z;
+
+ let scaleX = modePosition.scale.x;
+ let scaleY = modePosition.scale.y;
+ let scaleZ = modePosition.scale.z;
+ let scaleCenterX = modePosition.scale.centerX;
+ let scaleCenterY = modePosition.scale.centerY;
+
+ let rotateX = modePosition.rotate.x;
+ let rotateY = modePosition.rotate.y;
+ let rotateZ = modePosition.rotate.z;
+ let rotateCenterX = modePosition.rotate.centerX;
+ let rotateCenterY = modePosition.rotate.centerY;
+ let rotateAngle = modePosition.rotate.angle;
+
+ let Matrix4_1 = modePosition.transform[0];
+ let Matrix4_2 = modePosition.transform[1];
+ let Matrix4_3 = modePosition.transform[2];
+ let Matrix4_4 = modePosition.transform[3];
+ let Matrix4_5 = modePosition.transform[4];
+ let Matrix4_6 = modePosition.transform[5];
+ let Matrix4_7 = modePosition.transform[6];
+ let Matrix4_8 = modePosition.transform[7];
+ let Matrix4_9 = modePosition.transform[8];
+ let Matrix4_10 = modePosition.transform[9];
+ let Matrix4_11 = modePosition.transform[10];
+ let Matrix4_12 = modePosition.transform[11];
+ let Matrix4_13 = modePosition.transform[12];
+ let Matrix4_14 = modePosition.transform[13];
+ let Matrix4_15 = modePosition.transform[14];
+ let Matrix4_16 = modePosition.transform[15];
+ console.info("[getRectangleById] current component obj is: " + modePosition );
+ }
+ @State x: number = 120;
+ @State y: number = 10;
+ @State z: number = 100;
+ private matrix1 = matrix4.identity().translate({ x: this.x, y: this.y, z: this.z });
+ build() {
+ Column() {
+ Image($r("app.media.icon"))
+ .transform(this.matrix1)
+ .translate({ x: 100, y: 10, z: 50})
+ .scale({ x: 2, y: 0.5, z: 1 })
+ .rotate({
+ x: 1,
+ y: 1,
+ z: 1,
+ centerX: '50%',
+ centerY: '50%',
+ angle: 300
+ })
+ .width("40%")
+ .height(100)
+ .key("image_01")
+ Button() {
+ Text('getRectangleById').fontSize(40).fontWeight(FontWeight.Bold);
+ }.margin({ top: 20 })
+ .onClick(() => {
+ this.getComponentRect("image_01");
+ }).id('onClick');
+ }
+ }
+}
+ ```
diff --git a/en/application-dev/reference/apis/js-apis-bundleManager.md b/en/application-dev/reference/apis/js-apis-bundleManager.md
index 99e99255972ca0ae8a91b4fb55f4ae2387816b8d..61802e558ab82748cc27b12151669309599bd384 100644
--- a/en/application-dev/reference/apis/js-apis-bundleManager.md
+++ b/en/application-dev/reference/apis/js-apis-bundleManager.md
@@ -100,7 +100,7 @@ Enumerates the types of Extension abilities.
| Name| Value| Description|
|:----------------:|:---:|-----|
| FORM | 0 | [FormExtensionAbility](../../application-models/service-widget-overview.md): provides APIs for widget development.|
-| WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../../task-management/work-scheduler.md): enables applications to execute non-real-time tasks when the system is idle. |
+| WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../../task-management/work-scheduler.md): enables applications to execute non-real-time tasks when the system is idle.|
| INPUT_METHOD | 2 | [InputMethodExtensionAbility](js-apis-inputmethod-extension-ability.md): provides APIs for developing input method applications.|
| SERVICE | 3 | [ServiceExtensionAbility](../../application-models/serviceextensionability.md): enables applications to run in the background and provide services.|
| ACCESSIBILITY | 4 | [AccessibilityExtensionAbility](js-apis-application-accessibilityExtensionAbility.md): provides accessibility for access to and operations on the UI.|
@@ -116,7 +116,6 @@ Enumerates the types of Extension abilities.
| PRINT10+ | 15 | PrintExtensionAbility: provides APIs for printing images. Printing documents is not supported yet.|
| PUSH10+ | 17 | PushExtensionAbility: provides APIs for pushing scenario-specific messages. This ability is reserved.|
| DRIVER10+ | 18 | DriverExtensionAbility: provides APIs for the peripheral driver. This type of ability is not supported yet.|
-| APP_ACCOUNT_AUTHORIZATION10+ | 19 | [AuthorizationExtensionAbility](js-apis-appAccount-authorizationExtensionAbility.md): provides APIs to process authorization requests for application accounts and allow account authorization from a third-party (relative to the operating system vendor) ecosystem platform.|
| UNSPECIFIED | 255 | No type is specified. It is used together with **queryExtensionAbilityInfo** to query all types of Extension abilities.|
diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md
index cc36a78a7fa2c6f1e729b664bebf5269528c0bc6..8877fff44a94b34057a4daebb158fa8fd80dbe80 100644
--- a/en/application-dev/reference/apis/js-apis-camera.md
+++ b/en/application-dev/reference/apis/js-apis-camera.md
@@ -32,7 +32,7 @@ Obtains a **CameraManager** instance. This API returns the result synchronously.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -267,7 +267,7 @@ Creates a **CameraInput** instance with the specified **CameraDevice** object. T
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -311,7 +311,7 @@ Creates a **CameraInput** instance with the specified camera position and type.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -355,7 +355,7 @@ Creates a **PreviewOutput** instance. This API returns the result synchronously.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -397,7 +397,7 @@ Creates a **PhotoOutput** instance. This API returns the result synchronously.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -439,7 +439,7 @@ Creates a **VideoOutput** instance. This API returns the result synchronously.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -480,7 +480,7 @@ Creates a **MetadataOutput** instance. This API returns the result synchronously
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -515,7 +515,7 @@ Creates a **CaptureSession** instance. This API returns the result synchronously
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -606,7 +606,7 @@ Checks whether a camera supports prelaunch. This API is called in prior to **set
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -640,7 +640,7 @@ setPrelaunchConfig(prelaunchConfig: PrelaunchConfig): void
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -706,7 +706,7 @@ Creates a deferred **PreviewOutput** instance and adds it to the data stream ins
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -868,7 +868,7 @@ Opens this camera. This API uses an asynchronous callback to return the result.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -904,7 +904,7 @@ Opens this camera. This API uses a promise to return the result.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -938,7 +938,7 @@ Closes this camera. This API uses an asynchronous callback to return the result.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -972,7 +972,7 @@ Closes this camera. This API uses a promise to return the result.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1096,7 +1096,7 @@ Starts configuration for the session.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1129,7 +1129,7 @@ Commits the configuration for this **CaptureSession** instance. This API uses an
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1164,7 +1164,7 @@ Commits the configuration for this **CaptureSession** instance. This API uses a
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1204,7 +1204,7 @@ Adds a [CameraInput](#camerainput) instance to the session.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1244,7 +1244,7 @@ Removes a [CameraInput](#camerainput) instance from the session.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1284,7 +1284,7 @@ Adds a [CameraOutput](#cameraoutput) instance to the session.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1324,7 +1324,7 @@ Removes a [CameraOutput](#cameraoutput) instance from the session.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1358,7 +1358,7 @@ Starts this **CaptureSession**. This API uses an asynchronous callback to return
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1393,7 +1393,7 @@ Starts this **CaptureSession**. This API uses a promise to return the result.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1426,7 +1426,7 @@ Stops this **CaptureSession**. This API uses an asynchronous callback to return
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1460,7 +1460,7 @@ Stops this **CaptureSession**. This API uses a promise to return the result.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1492,7 +1492,7 @@ Releases this **CaptureSession**. This API uses an asynchronous callback to retu
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1526,7 +1526,7 @@ Releases this **CaptureSession**. This API uses a promise to return the result.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1558,7 +1558,7 @@ Checks whether the device has flash. This API uses an asynchronous callback to r
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1597,7 +1597,7 @@ Checks whether a flash mode is supported.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1641,7 +1641,7 @@ Before the setting, do the following checks:
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1674,7 +1674,7 @@ Obtains the flash mode in use.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1713,7 +1713,7 @@ Checks whether an exposure mode is supported.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1746,7 +1746,7 @@ Obtains the exposure mode in use.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1785,7 +1785,7 @@ Sets an exposure mode for the device.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1818,7 +1818,7 @@ Obtains the metering point of the device.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1859,7 +1859,7 @@ The coordinate system is based on the horizontal device direction with the devic
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1893,7 +1893,7 @@ Obtains the exposure compensation values of the device.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1928,7 +1928,7 @@ Before the setting, you are advised to use **[getExposureBiasRange](#getexposure
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -1962,7 +1962,7 @@ Obtains the exposure value in use.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2001,7 +2001,7 @@ Checks whether a focus mode is supported.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2042,7 +2042,7 @@ Before the setting, use **[isFocusModeSupported](#isfocusmodesupported)** to che
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2075,7 +2075,7 @@ Obtains the focus mode in use.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2116,7 +2116,7 @@ The coordinate system is based on the horizontal device direction with the devic
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2150,7 +2150,7 @@ Obtains the focal point of the device.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2183,7 +2183,7 @@ Obtains the focal length of the device.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2216,7 +2216,7 @@ Obtains the supported zoom ratio range.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2255,7 +2255,7 @@ Sets a zoom ratio, with a maximum precision of two decimal places.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2289,7 +2289,7 @@ Obtains the zoom ratio in use.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2328,7 +2328,7 @@ Checks whether the specified video stabilization mode is supported.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2361,7 +2361,7 @@ Obtains the video stabilization mode in use.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2400,7 +2400,7 @@ Sets a video stabilization mode for the device.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2487,7 +2487,7 @@ Starts to output preview streams. This API uses an asynchronous callback to retu
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2521,7 +2521,7 @@ Starts to output preview streams. This API uses a promise to return the result.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2603,7 +2603,7 @@ Releases output resources. This API uses an asynchronous callback to return the
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2637,7 +2637,7 @@ Releases output resources. This API uses a promise to return the result.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2740,7 +2740,7 @@ Adds a surface for delayed preview. This API can run after **session.commitConfi
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2836,7 +2836,7 @@ Captures a photo with the default shooting parameters. This API uses an asynchro
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2871,7 +2871,7 @@ Captures a photo with the default shooting parameters. This API uses a promise t
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2905,7 +2905,7 @@ Captures a photo with the specified shooting parameters. This API uses an asynch
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -2958,7 +2958,7 @@ Captures a photo with the specified shooting parameters. This API uses a promise
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -3023,7 +3023,7 @@ Releases output resources. This API uses an asynchronous callback to return the
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -3057,7 +3057,7 @@ Releases output resources. This API uses a promise to return the result.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -3187,7 +3187,7 @@ This API takes effect after **CaptureSession.addOutput** and **CaptureSession.ad
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -3233,7 +3233,7 @@ This API takes effect after **CaptureSession.addOutput** and **CaptureSession.ad
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -3356,7 +3356,7 @@ Starts video recording. This API uses an asynchronous callback to return the res
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -3391,7 +3391,7 @@ Starts video recording. This API uses a promise to return the result.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -3474,7 +3474,7 @@ Releases output resources. This API uses an asynchronous callback to return the
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -3508,7 +3508,7 @@ Releases output resources. This API uses a promise to return the result.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -3613,7 +3613,7 @@ Starts to output metadata. This API uses an asynchronous callback to return the
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
@@ -3648,7 +3648,7 @@ Starts to output metadata. This API uses a promise to return the result.
**Error codes**
-For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+For details about the error codes, see [Camera Error Codes](../errorcodes/errorcode-camera.md).
| ID | Error Message |
| --------------- | --------------- |
diff --git a/en/application-dev/reference/apis/js-apis-cert.md b/en/application-dev/reference/apis/js-apis-cert.md
index bd2479de2399427cab87c95afe13d1d71e4d5956..a8676acc561469bdb3c7ea89d7e28c195db290c2 100644
--- a/en/application-dev/reference/apis/js-apis-cert.md
+++ b/en/application-dev/reference/apis/js-apis-cert.md
@@ -553,12 +553,16 @@ cryptoCert.createX509Cert(encodingBlob, function (error, x509Cert) {
});
```
-### getSerialNumber
+### getSerialNumber(deprecated)
getSerialNumber() : number
Obtains the X.509 certificate serial number.
+> **NOTE**
+>
+> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [getCertSerialNumber](#getcertserialnumber10).
+
**System capability**: SystemCapability.Security.Cert
**Return value**
@@ -589,6 +593,48 @@ cryptoCert.createX509Cert(encodingBlob, function (error, x509Cert) {
});
```
+### getCertSerialNumber10+
+
+getCertSerialNumber() : bigint
+
+Obtains the X.509 certificate serial number.
+
+**System capability**: SystemCapability.Security.Cert
+
+**Return value**
+
+| Type | Description |
+| ------ | ------------------ |
+| bigint | X.509 certificate serial number obtained.|
+
+**Error codes**
+
+| ID| Error Message |
+| -------- | ------------------------------------------------- |
+| 19020002 | runtime error. |
+
+**Example**
+
+```js
+import cryptoCert from '@ohos.security.cert';
+
+// Certificate binary data, which must be set based on the service.
+let encodingData = null;
+let encodingBlob = {
+ data: encodingData,
+ // Set the encoding format, which can be FORMAT_PEM or FORMAT_DER.
+ encodingFormat: cryptoCert.EncodingFormat.FORMAT_PEM
+};
+cryptoCert.createX509Cert(encodingBlob, function (error, x509Cert) {
+ if (error != null) {
+ console.log("createX509Cert failed, errCode: " + error.code + ", errMsg: " + error.message);
+ } else {
+ console.log("createX509Cert success");
+ let serialNumber = x509Cert.getCertSerialNumber();
+ }
+});
+```
+
### getIssuerName
getIssuerName() : DataBlob
diff --git a/en/application-dev/reference/apis/js-apis-componentUtils.md b/en/application-dev/reference/apis/js-apis-componentUtils.md
deleted file mode 100644
index ed08051817ea9e1bf74c3f2377c507f597aacb9e..0000000000000000000000000000000000000000
--- a/en/application-dev/reference/apis/js-apis-componentUtils.md
+++ /dev/null
@@ -1,210 +0,0 @@
-# @ohos.componentUtils (componentUtils)
-
-The **componentUtils** module provides API for obtaining the coordinates and size of the drawing area of a component.
-
-> **NOTE**
->
-> The APIs of this module are supported since API version 10. Updates will be marked with a superscript to indicate their earliest API version.
->
-> The functionality of this module depends on UI context. This means that the APIs of this module cannot be used where the UI context is unclear. For details, see [UIContext](./js-apis-arkui-UIContext.md#uicontext).
->
-> Since API version 10, you can use the [getComponentUtils](./js-apis-arkui-UIContext.md#getcomponentutils) API in **UIContext** to obtain the **ComponentUtils** object associated with the current UI context. For this API to work correctly, call it after the notification indicating completion of component layout is received through [@ohos.arkui.inspector (layout callback)](js-apis-arkui-inspector.md).
-
-## Modules to Import
-
-```js
-import componentUtils from '@ohos.componentUtils'
-```
-## componentUtils.getRectangleById
-
-getRectangleById(id: string): ComponentInfo
-
-Obtains a **ComponentInfo** object based on the component ID.
-
-**System capability**: SystemCapability.ArkUI.ArkUI.Full
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ------ | ---- | ---------- |
-| id | string | Yes | Component ID.|
-
-**Return value**
-
-| Type | Description |
-| ------ | ---------- |
-| [ComponentInfo](#componentinfo) | **ComponentInfo** object, which provides the size, position, translation, scaling, rotation, and affine matrix information of the component.|
-
-**Example**
-
-```js
-let modePosition = componentUtils.getRectangleById("onClick");
-```
-
-## ComponentInfo
-
-| Name | Type | Description |
-| ---------------|------------ | -----------------------------|
-| size | [Size](#size) | Component size. |
-| localOffset | [Offset](#offset) | Offset of the component relative to the parent component. |
-| windowOffset | [Offset](#offset) | Offset of the component relative to the window. |
-| screenOffset | [Offset](#offset) | Offset of the component relative to the screen. |
-| translate | [TranslateResult](#translateresult) | Translation of the component. |
-| scale | [ScaleResult](#scaleresult) | Scaling of the component. |
-| rotate | [RotateResult](#rotateresult) | Rotation of the component. |
-| transform | [Matrix4Result](#matrix4result) | Affine matrix of the component, which is a 4x4 matrix object created based on the input parameter. |
-
-### Size
-
-| Name | Type| Description |
-| -------- | ---- | ----------------------------------|
-| width | number | Component width. |
-| height | number | Component height. |
-
-### Offset
-
-| Name | Type| Description |
-| --------| ---- | -----------------------------------|
-| x | number | X coordinate. |
-| y | number | Y coordinate. |
-
-### TranslateResult
-
-| Name | Type| Description |
-| --------| ---- | -----------------------------------|
-| x | number | Translation distance along the x-axis. |
-| y | number | Translation distance along the y-axis. |
-| z | number | Translation distance along the z-axis. |
-
-### ScaleResult
-
-| Name | Type| Description |
-| --------| ---- | -----------------------------------|
-| x | number | Scale factor along the x-axis. |
-| y | number | Scale factor along the y-axis. |
-| z | number | Scale factor along the z-axis. |
-| centerX | number | X coordinate of the center point. |
-| centerY | number | Y coordinate of the center point. |
-
-### RotateResult
-
-| Name | Type| Description |
-| --------| ---- | -----------------------------------|
-| x | number | X coordinate of the rotation vector. |
-| y | number | Y coordinate of the rotation vector. |
-| z | number | Z coordinate of the rotation vector. |
-| angle | number | Rotation angle. |
-| centerX | number | X coordinate of the center point. |
-| centerY | number | Y coordinate of the center point. |
-
-### Matrix4Result
-
-| Name | Type| Description |
-| --------| ---- | -----------------------------------|
-| number | number | Scale factor along the x-axis. Defaults to **1** for the identity matrix. |
-| number | number | The second value, which is affected by the rotation of the x, y, and z axes.|
-| number | number | The third value, which is affected by the rotation of the x, y, and z axes.|
-| number | number | Meaningless value. |
-| number | number | The fifth value, which is affected by the rotation of the x, y, and z axes.|
-| number | number | Scale factor along the y-axis. Defaults to **1** for the identity matrix. |
-| number | number | The seventh value, which is affected by the rotation of the x, y, and z axes.|
-| number | number | Meaningless value. |
-| number | number | The ninth value, which is affected by the rotation of the x, y, and z axes.|
-| number | number | The tenth value, which is affected by the rotation of the x, y, and z axes.|
-| number | number | Scale factor along the z-axis. Defaults to **1** for the identity matrix. |
-| number | number | Meaningless value. |
-| number | number | Translation distance along the x-axis. Defaults to **0** for the identity matrix. |
-| number | number | Translation distance along the y-axis. Defaults to **0** for the identity matrix.|
-| number | number | Translation distance along the z-axis. Defaults to **0** for the identity matrix.|
-| number | number | Valid in homogeneous coordinates, presenting the perspective projection effect. |
-
-**Example**
-
- ```js
-import matrix4 from '@ohos.matrix4';
-import componentUtils from '@ohos.componentUtils';
-
-@Entry
-@Component
-struct Utils{
- private getComponentRect(key) {
- console.info("Mode Key: " + key);
- let modePosition = componentUtils.getRectangleById(key);
-
- let localOffsetWidth = modePosition.size.width;
- let localOffsetHeight = modePosition.size.height;
- let localOffsetX = modePosition.localOffset.x;
- let localOffsetY = modePosition.localOffset.y;
-
- let windowOffsetX = modePosition.windowOffset.x;
- let windowOffsetY = modePosition.windowOffset.y;
-
- let screenOffsetX = modePosition.screenOffset.x;
- let screenOffsetY = modePosition.screenOffset.y;
-
- let translateX = modePosition.translate.x;
- let translateY = modePosition.translate.y;
- let translateZ = modePosition.translate.z;
-
- let scaleX = modePosition.scale.x;
- let scaleY = modePosition.scale.y;
- let scaleZ = modePosition.scale.z;
- let scaleCenterX = modePosition.scale.centerX;
- let scaleCenterY = modePosition.scale.centerY;
-
- let rotateX = modePosition.rotate.x;
- let rotateY = modePosition.rotate.y;
- let rotateZ = modePosition.rotate.z;
- let rotateCenterX = modePosition.rotate.centerX;
- let rotateCenterY = modePosition.rotate.centerY;
- let rotateAngle = modePosition.rotate.angle;
-
- let Matrix4_1 = modePosition.transform[0];
- let Matrix4_2 = modePosition.transform[1];
- let Matrix4_3 = modePosition.transform[2];
- let Matrix4_4 = modePosition.transform[3];
- let Matrix4_5 = modePosition.transform[4];
- let Matrix4_6 = modePosition.transform[5];
- let Matrix4_7 = modePosition.transform[6];
- let Matrix4_8 = modePosition.transform[7];
- let Matrix4_9 = modePosition.transform[8];
- let Matrix4_10 = modePosition.transform[9];
- let Matrix4_11 = modePosition.transform[10];
- let Matrix4_12 = modePosition.transform[11];
- let Matrix4_13 = modePosition.transform[12];
- let Matrix4_14 = modePosition.transform[13];
- let Matrix4_15 = modePosition.transform[14];
- let Matrix4_16 = modePosition.transform[15];
- console.info("[getRectangleById] current component obj is: " + modePosition );
- }
- @State x: number = 120;
- @State y: number = 10;
- @State z: number = 100;
- private matrix1 = matrix4.identity().translate({ x: this.x, y: this.y, z: this.z });
- build() {
- Column() {
- Image($r("app.media.icon"))
- .transform(this.matrix1)
- .translate({ x: 100, y: 10, z: 50})
- .scale({ x: 2, y: 0.5, z: 1 })
- .rotate({
- x: 1,
- y: 1,
- z: 1,
- centerX: '50%',
- centerY: '50%',
- angle: 300
- })
- .width("40%")
- .height(100)
- .key("image_01")
- Button() {
- Text('getRectangleById').fontSize(40).fontWeight(FontWeight.Bold);
- }.margin({ top: 20 })
- .onClick(() => {
- this.getComponentRect("image_01");
- }).id('onClick');
- }
- }
-}
- ```
diff --git a/en/application-dev/reference/apis/js-apis-curve.md b/en/application-dev/reference/apis/js-apis-curve.md
index 235f7014246488fcc9a4b6d936a4e5bf16faf52e..ffc902f8eda9f2a5d5d0c55a4f6b6ceeabc1c031 100644
--- a/en/application-dev/reference/apis/js-apis-curve.md
+++ b/en/application-dev/reference/apis/js-apis-curve.md
@@ -78,7 +78,7 @@ Creates a step curve.
| Name| Type | Mandatory| Description |
| ------ | ------- | ----| ------------------------------------------------------------ |
-| count | number | Yes | Number of steps. The value must be a positive integer. Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the value **0**.|
+| count | number | Yes | Number of steps. The value must be a positive integer. Value range: [1, +∞) **NOTE** A value less than 1 evaluates to the value **1**.|
| end | boolean | Yes | Whether jumping occurs when the interpolation ends. - **true**: Jumping occurs when the interpolation ends. - **false**: Jumping occurs when the interpolation starts.|
**Return value**
@@ -174,7 +174,7 @@ Creates a spring animation curve. If multiple spring animations are applied to t
| Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ----- |
| response | number | No | Duration of one complete oscillation. Default value: **0.55** Unit: second Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the default value **0.55**.|
-| dampingFraction | number | No | Damping coefficient. **0**: undamped. In this case, the spring oscillates forever. > 0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position. **1**: critically damped. > 1: overdamped. In this case, the spring approaches equilibrium gradually. Default value: **0.825** Unit: second Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the default value **0.55**.|
+| dampingFraction | number | No | Damping coefficient. **0**: undamped. In this case, the spring oscillates forever. > 0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position. **1**: critically damped. > 1: overdamped. In this case, the spring approaches equilibrium gradually. Default value: **0.825** Unit: second Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the default value **0.825**.|
| overlapDuration | number | No | Duration for animations to overlap, in seconds. When animations overlap, the **response** values of these animations will transit smoothly over this duration if they are different. Default value: **0** Unit: second Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the default value **0**. The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in [animation](../arkui-ts/ts-animatorproperty.md) or [animateTo](../arkui-ts/ts-explicit-animation.md). The time cannot be normalized. Therefore, the interpolation cannot be obtained using the **interpolate** function of the curve.|
@@ -209,7 +209,7 @@ Creates a responsive spring animation curve. It is a special case of [springMoti
| --------- | ------ | ---- | ----- |
| response | number | No | See **response** in **springMotion**. Default value: **0.15** Unit: second Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the default value **0.15**.|
| dampingFraction | number | No | See **dampingFraction** in **springMotion**. Default value: **0.86** Unit: second Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the default value **0.86**.|
-| overlapDuration | number | No | See **overlapDuration** in **springMotion**. Default value: **0.25** Unit: second Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the default value **0.25**. To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings. The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in [animation](../arkui-ts/ts-animatorproperty.md) or [animateTo](../arkui-ts/ts-explicit-animation.md). In addition, the interpolation cannot be obtained using the **interpolate** function of the curve. |
+| overlapDuration | number | No | See **overlapDuration** in **springMotion**. Default value: **0.25** Unit: second Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the default value **0.25**. To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings. The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in [animation](../arkui-ts/ts-animatorproperty.md) or [animateTo](../arkui-ts/ts-explicit-animation.md). In addition, the interpolation cannot be obtained using the **interpolate** function of the curve.|
**Return value**
@@ -237,16 +237,16 @@ Creates an interpolating spring curve animated from 0 to 1. The actual animation
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ----- |
-| velocity | number | Yes | Initial velocity. It is applied by external factors to the spring animation, designed to help ensure the smooth transition from the previous motion state. The velocity is the normalized velocity, and its value is equal to the actual velocity at the beginning of the animation divided by the animation attribute change value.|
-| mass | number | Yes | Mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position.|
-| stiffness | number | Yes | Stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position.|
-| damping | number | Yes | Damping. It is a pure number and has no real physical meaning. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude.|
+| velocity | number | Yes | Initial velocity. It is applied by external factors to the spring animation, designed to help ensure the smooth transition from the previous motion state. The velocity is the normalized velocity, and its value is equal to the actual velocity at the beginning of the animation divided by the animation attribute change value. Value range: (-∞, +∞)|
+| mass | number | Yes | Mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position. Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the value **1**.|
+| stiffness | number | Yes | Stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position. Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the value **1**.|
+| damping | number | Yes | Damping. It is a pure number and has no real physical meaning. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude. Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the value **1**.|
**Return value**
| Type | Description |
| ---------------------------------- | ---------------- |
-| [ICurve](#icurve)| Interpolation curve.|
+| [ICurve](#icurve)| Curve. **NOTE** The spring animation curve is physics-based. Its duration depends on the** interpolatingSpring** parameters, rather than the **duration** parameter in [animation](../arkui-ts/ts-animatorproperty.md) or [animateTo](../arkui-ts/ts-explicit-animation.md). The time cannot be normalized. Therefore, the interpolation cannot be obtained using the [interpolate](#interpolate9) function of the curve.|
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-data-cloudData.md b/en/application-dev/reference/apis/js-apis-data-cloudData.md
index 9be6e9f345455b73e01104101981d40e50c4b846..ea2aeae63b5e11dbfebc19b969724c493a93310f 100644
--- a/en/application-dev/reference/apis/js-apis-data-cloudData.md
+++ b/en/application-dev/reference/apis/js-apis-data-cloudData.md
@@ -16,7 +16,7 @@ This module provides the following common functions:
import cloudData from '@ohos.data.cloudData';
```
-## Action
+## ClearAction
Enumerates the actions to take to clear the downloaded cloud data locally.
@@ -347,9 +347,9 @@ try {
}
```
-### clean
+### clear
-static clean(accountId: string, appActions: {[bundleName: string]: Action}, callback: AsyncCallback<void>):void
+static clear(accountId: string, appActions: {[bundleName: string]: ClearAction}, callback: AsyncCallback<void>):void
Clears the cloud data locally. This API uses an asynchronous callback to return the result.
@@ -361,26 +361,26 @@ Clears the cloud data locally. This API uses an asynchronous callback to return
**Parameters**
-| Name | Type | Mandatory| Description |
-| ---------- | ----------------------------------------- | ---- | -------------------------------- |
-| accountId | string | Yes | ID of the cloud account. |
-| appActions | {[bundleName: string]: [Action](#action)} | Yes | Information about the application whose data is to be cleared and the action to take.|
-| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
+| Name | Type | Mandatory| Description |
+| ---------- | --------------------------------------------------- | ---- | -------------------------------- |
+| accountId | string | Yes | ID of the cloud account. |
+| appActions | {[bundleName: string]: [ClearAction](#clearaction)} | Yes | Information about the application whose data is to be cleared and the action to take.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
**Example**
```js
-let action = cloudData.Action;
+let action = cloudData.ClearAction;
let account = "test_id";
let bundleName1 = "test_bundleName1";
let bundleName2 = "test_bundleName2";
let appActions = { [bundleName1]: action.CLEAR_CLOUD_INFO, [bundleName2]: action.CLEAR_CLOUD_DATA_AND_INFO };
try {
- cloudData.Config.clean(account, appActions, function (err) {
+ cloudData.Config.clear(account, appActions, function (err) {
if (err === undefined) {
- console.info('Succeeding in cleaning cloud data');
+ console.info('Succeeding in clearing cloud data');
} else {
- console.error(`Failed to clean cloud data. Code: ${err.code}, message: ${err.message}`);
+ console.error(`Failed to clear cloud data. Code: ${err.code}, message: ${err.message}`);
}
});
} catch (error) {
@@ -388,9 +388,9 @@ try {
}
```
-### clean
+### clear
-static clean(accountId: string, appActions: {[bundleName: string]: Action}): Promise<void>
+static clear(accountId: string, appActions: {[bundleName: string]: ClearAction}): Promise<void>
Clears the cloud data locally. This API uses a promise to return the result.
@@ -402,10 +402,10 @@ Clears the cloud data locally. This API uses a promise to return the result.
**Parameters**
-| Name | Type | Mandatory| Description |
-| ---------- | ----------------------------------------- | ---- | -------------------------------- |
-| accountId | string | Yes | ID of the cloud account. |
-| appActions | {[bundleName: string]: [Action](#action)} | Yes | Information about the application whose data is to be cleared and the action to take.|
+| Name | Type | Mandatory| Description |
+| ---------- | --------------------------------------------------- | ---- | -------------------------------- |
+| accountId | string | Yes | ID of the cloud account. |
+| appActions | {[bundleName: string]: [ClearAction](#clearaction)} | Yes | Information about the application whose data is to be cleared and the action to take.|
**Return value**
@@ -416,16 +416,16 @@ Clears the cloud data locally. This API uses a promise to return the result.
**Example**
```js
-let action = cloudData.Action;
+let action = cloudData.ClearAction;
let account = "test_id";
let bundleName1 = "test_bundleName1";
let bundleName2 = "test_bundleName2";
let appActions = { [bundleName1]: action.CLEAR_CLOUD_INFO, [bundleName2]: action.CLEAR_CLOUD_DATA_AND_INFO };
try {
- cloudData.Config.clean(account, appActions).then(() => {
- console.info('Succeeding in cleaning cloud data');
+ cloudData.Config.clear(account, appActions).then(() => {
+ console.info('Succeeding in clearing cloud data');
}).catch((err) => {
- console.error(`Failed to clean cloud data. Code: ${err.code}, message: ${err.message}`);
+ console.error(`Failed to clear cloud data. Code: ${err.code}, message: ${err.message}`);
});
} catch (error) {
console.error(`An unexpected error occurred. Code: ${error.code}, message: ${error.message}`);
diff --git a/en/application-dev/reference/apis/js-apis-data-preferences.md b/en/application-dev/reference/apis/js-apis-data-preferences.md
index fb937559c7217c6d0429fb85ea0129d31c733492..bd89f5ba07d67232019b4e7b00ca9ae8c1ccdbdf 100644
--- a/en/application-dev/reference/apis/js-apis-data-preferences.md
+++ b/en/application-dev/reference/apis/js-apis-data-preferences.md
@@ -55,14 +55,14 @@ let preferences = null;
try {
data_preferences.getPreferences(context, 'mystore', function (err, val) {
if (err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
- return;
- }
- preferences = val;
- console.info("Obtained the preferences successfully.");
- })
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
+ return;
+ }
+ preferences = val;
+ console.info("Succeeded in getting preferences.");
+ })
} catch (err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
}
```
@@ -78,14 +78,14 @@ class EntryAbility extends UIAbility {
try {
data_preferences.getPreferences(this.context, 'mystore', function (err, val) {
if (err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
return;
}
preferences = val;
- console.info("Obtained the preferences successfully.");
+ console.info("Succeeded in getting preferences.");
})
} catch (err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
}
}
}
@@ -126,12 +126,12 @@ try {
let promise = data_preferences.getPreferences(context, 'mystore');
promise.then((object) => {
preferences = object;
- console.info("Obtained the preferences successfully.");
+ console.info("Succeeded in getting preferences.");
}).catch((err) => {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
}
```
@@ -148,12 +148,12 @@ class EntryAbility extends UIAbility {
let promise = data_preferences.getPreferences(this.context, 'mystore');
promise.then((object) => {
preferences = object;
- console.info("Obtained the preferences successfully.");
+ console.info("Succeeded in getting preferences.");
}).catch((err) => {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
}
}
}
@@ -195,16 +195,16 @@ let context = featureAbility.getContext();
let preferences = null;
try {
- data_preferences.getPreferences(context, {name: 'mystore'}, function (err, val) {
+ data_preferences.getPreferences(context, { name: 'mystore' }, function (err, val) {
if (err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
- return;
- }
- preferences = val;
- console.info("Obtained the preferences successfully.");
- })
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
+ return;
+ }
+ preferences = val;
+ console.info("Succeeded in getting preferences.");
+ })
} catch (err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
}
```
@@ -219,16 +219,16 @@ let preferences = null;
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
- data_preferences.getPreferences(this.context, {name: 'mystore', dataGroupId:'myId'}, function (err, val) {
+ data_preferences.getPreferences(this.context, { name: 'mystore', dataGroupId:'myId' }, function (err, val) {
if (err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
return;
}
preferences = val;
- console.info("Obtained the preferences successfully.");
+ console.info("Succeeded in getting preferences.");
})
} catch (err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
}
}
}
@@ -275,15 +275,15 @@ let context = featureAbility.getContext();
let preferences = null;
try {
- let promise = data_preferences.getPreferences(context, {name: 'mystore'});
+ let promise = data_preferences.getPreferences(context, { name: 'mystore' });
promise.then((object) => {
preferences = object;
- console.info("Obtained the preferences successfully.");
+ console.info("Succeeded in getting preferences.");
}).catch((err) => {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
}
```
@@ -297,15 +297,15 @@ let preferences = null;
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
- let promise = data_preferences.getPreferences(this.context, {name: 'mystore', dataGroupId:'myId'});
+ let promise = data_preferences.getPreferences(this.context, { name: 'mystore', dataGroupId:'myId' });
promise.then((object) => {
preferences = object;
- console.info("Obtained the preferences successfully.");
+ console.info("Succeeded in getting preferences.");
}).catch((err) => {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
}
}
}
@@ -350,13 +350,13 @@ let context = featureAbility.getContext();
try {
data_preferences.deletePreferences(context, 'mystore', function (err) {
if (err) {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
return;
}
- console.info("Deleted the preferences successfully." );
+ console.info("Succeeded in deleting preferences." );
})
} catch (err) {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
}
```
@@ -370,13 +370,13 @@ class EntryAbility extends UIAbility {
try {
data_preferences.deletePreferences(this.context, 'mystore', function (err) {
if (err) {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
return;
}
- console.info("Deleted the preferences successfully." );
+ console.info("Succeeded in deleting preferences." );
})
} catch (err) {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
}
}
}
@@ -425,12 +425,12 @@ let context = featureAbility.getContext();
try {
let promise = data_preferences.deletePreferences(context, 'mystore');
promise.then(() => {
- console.info("Deleted the preferences successfully.");
+ console.info("Succeeded in deleting preferences.");
}).catch((err) => {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
}
```
@@ -444,12 +444,12 @@ class EntryAbility extends UIAbility {
try{
let promise = data_preferences.deletePreferences(this.context, 'mystore');
promise.then(() => {
- console.info("Deleted the preferences successfully.");
+ console.info("Succeeded in deleting preferences.");
}).catch((err) => {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
}
}
}
@@ -493,15 +493,15 @@ import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
try {
- data_preferences.deletePreferences(context, {name: 'mystore'}, function (err) {
+ data_preferences.deletePreferences(context, { name: 'mystore' }, function (err) {
if (err) {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
return;
}
- console.info("Deleted the preferences successfully." );
+ console.info("Succeeded in deleting preferences." );
})
} catch (err) {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
}
```
@@ -513,15 +513,15 @@ import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
- data_preferences.deletePreferences(this.context, {name: 'mystore', dataGroupId:'myId'}, function (err) {
+ data_preferences.deletePreferences(this.context, { name: 'mystore', dataGroupId:'myId' }, function (err) {
if (err) {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
return;
}
- console.info("Deleted the preferences successfully." );
+ console.info("Succeeded in deleting preferences." );
})
} catch (err) {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
}
}
}
@@ -571,14 +571,14 @@ import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
try {
- let promise = data_preferences.deletePreferences(context, {name: 'mystore'});
+ let promise = data_preferences.deletePreferences(context, { name: 'mystore' });
promise.then(() => {
- console.info("Deleted the preferences successfully.");
+ console.info("Succeeded in deleting preferences.");
}).catch((err) => {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
}
```
@@ -590,14 +590,14 @@ import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try{
- let promise = data_preferences.deletePreferences(this.context, {name: 'mystore', dataGroupId:'myId'});
+ let promise = data_preferences.deletePreferences(this.context, { name: 'mystore', dataGroupId:'myId' });
promise.then(() => {
- console.info("Deleted the preferences successfully.");
+ console.info("Succeeded in deleting preferences.");
}).catch((err) => {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete preferences. code =" + err.code + ", message =" + err.message);
}
}
}
@@ -635,13 +635,13 @@ let context = featureAbility.getContext();
try {
data_preferences.removePreferencesFromCache(context, 'mystore', function (err) {
if (err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
return;
}
- console.info("Removed the preferences successfully.");
+ console.info("Succeeded in removing preferences.");
})
} catch (err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
}
```
@@ -655,13 +655,13 @@ class EntryAbility extends UIAbility {
try {
data_preferences.removePreferencesFromCache(this.context, 'mystore', function (err) {
if (err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
return;
}
- console.info("Removed the preferences successfully.");
+ console.info("Succeeded in removing preferences.");
})
} catch (err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
}
}
}
@@ -702,13 +702,13 @@ import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
try {
let promise = data_preferences.removePreferencesFromCache(context, 'mystore');
- promise.then(() => {
- console.info("Removed the preferences successfully.");
+ promise.then(() => {
+ console.info("Succeeded in removing preferences.");
}).catch((err) => {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
}
```
@@ -722,12 +722,12 @@ class EntryAbility extends UIAbility {
try {
let promise = data_preferences.removePreferencesFromCache(this.context, 'mystore');
promise.then(() => {
- console.info("Removed the preferences successfully.");
+ console.info("Succeeded in removing preferences.");
}).catch((err) => {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
}
}
}
@@ -737,7 +737,7 @@ class EntryAbility extends UIAbility {
removePreferencesFromCacheSync(context: Context, name: string): void
-Synchronously removes a **Preferences** instance from the cache.
+Removes a **Preferences** instance from the cache. This API returns the result synchronously.
After an application calls [getPreferences](#data_preferencesgetpreferences) for the first time to obtain a **Preferences** instance, the obtained **Preferences** instance is cached. When the application calls [getPreferences](#data_preferencesgetpreferences) again, the **Preferences** instance will be read from the cache instead of from the persistent file. After this API is called to remove the instance from the cache, calling **getPreferences** again will read data from the persistent file and create a new **Preferences** instance.
@@ -763,7 +763,7 @@ let context = featureAbility.getContext();
try {
data_preferences.removePreferencesFromCacheSync(context, 'mystore');
} catch(err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
}
```
@@ -777,7 +777,7 @@ class EntryAbility extends UIAbility {
try {
data_preferences.removePreferencesFromCacheSync(this.context, 'mystore');
} catch(err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
}
}
}
@@ -821,15 +821,15 @@ FA model:
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
try {
- data_preferences.removePreferencesFromCache(context, {name: 'mystore'}, function (err) {
+ data_preferences.removePreferencesFromCache(context, { name: 'mystore' }, function (err) {
if (err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
return;
}
- console.info("Removed the preferences successfully.");
+ console.info("Succeeded in removing preferences.");
})
} catch (err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
}
```
@@ -841,15 +841,15 @@ import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
- data_preferences.removePreferencesFromCache(this.context, {name: 'mystore', dataGroupId:'myId'}, function (err) {
+ data_preferences.removePreferencesFromCache(this.context, { name: 'mystore', dataGroupId:'myId' }, function (err) {
if (err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
return;
}
- console.info("Removed the preferences successfully.");
+ console.info("Succeeded in removing preferences.");
})
} catch (err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
}
}
}
@@ -898,14 +898,14 @@ FA model:
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
try {
- let promise = data_preferences.removePreferencesFromCache(context, {name: 'mystore'});
- promise.then(() => {
- console.info("Removed the preferences successfully.");
+ let promise = data_preferences.removePreferencesFromCache(context, { name: 'mystore' });
+ promise.then(() => {
+ console.info("Succeeded in removing preferences.");
}).catch((err) => {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
}
```
@@ -917,14 +917,18 @@ import UIAbility from '@ohos.app.ability.UIAbility';
class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
try {
- let promise = data_preferences.removePreferencesFromCache(this.context, {name: 'mystore', dataGroupId:'myId'});
+ let promise = data_preferences.removePreferencesFromCache(this.context, { name: 'mystore', dataGroupId:'myId' });
promise.then(() => {
- console.info("Removed the preferences successfully.");
+ console.info("Succeeded in removing preferences.");
}).catch((err) => {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ }
+ }
+}
+```
}
}
}
@@ -970,13 +974,13 @@ Obtains the value corresponding to the specified key from the cached **Preferenc
try {
preferences.get('startup', 'default', function (err, val) {
if (err) {
- console.info("Failed to obtain value of 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get value of 'startup'. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Obtained the value of 'startup' successfully. val: " + val);
})
} catch (err) {
- console.info("Failed to obtain value of 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get value of 'startup'. code =" + err.code + ", message =" + err.message);
}
```
@@ -1010,10 +1014,10 @@ try {
promise.then((data) => {
console.info("Got the value of 'startup'. Data: " + data);
}).catch((err) => {
- console.info("Failed to obtain value of 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get value of 'startup'. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to obtain value of 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get value of 'startup'. code =" + err.code + ", message =" + err.message);
}
```
@@ -1021,7 +1025,7 @@ try {
getSync(key: string, defValue: ValueType): ValueType
-Synchronously obtains the value corresponding to the specified key from the cached **Preferences** instance. If the value is null or is not of the default value type, **defValue** is returned.
+Obtains the value corresponding to the specified key from the cached **Preferences** instance. This API returns the result synchronously. If the value is null or is not of the default value type, **defValue** is returned.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
@@ -1043,9 +1047,9 @@ Synchronously obtains the value corresponding to the specified key from the cach
```js
try {
let value = preferences.getSync('startup', 'default');
- console.info("Obtained the value of 'startup'. Data: " + value);
+ console.info("Succeeded in getting value of 'startup'. Data: " + value);
} catch(err) {
- console.info("Failed to obtain value of 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get value of 'startup'. code =" + err.code + ", message =" + err.message);
}
```
@@ -1069,7 +1073,7 @@ Obtains all KV pairs from the cached **Preferences** instance. This API uses an
try {
preferences.getAll(function (err, value) {
if (err) {
- console.info("Failed to obtain all KV pairs. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get all key-values. code =" + err.code + ", message =" + err.message);
return;
}
let allKeys = Object.keys(value);
@@ -1077,7 +1081,7 @@ try {
console.info("getAll object = " + JSON.stringify(value));
})
} catch (err) {
- console.info("Failed to obtain all KV pairs. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get all key-values. code =" + err.code + ", message =" + err.message);
}
```
@@ -1106,10 +1110,10 @@ try {
console.info('getAll keys = ' + allKeys);
console.info("getAll object = " + JSON.stringify(value));
}).catch((err) => {
- console.info("Failed to obtain all KV pairs. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get all key-values. code =" + err.code + ", message =" + err.message);
})
} catch (err) {
- console.info("Failed to obtain all KV pairs. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get all key-values. code =" + err.code + ", message =" + err.message);
}
```
@@ -1117,7 +1121,7 @@ try {
getAllSync(): Object
-Obtains all KV pairs from the cached **Preferences** instance synchronously.
+Obtains all KV pairs from the cached **Preferences** instance. This API returns the result synchronously.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
@@ -1136,7 +1140,7 @@ try {
console.info('getAll keys = ' + allKeys);
console.info("getAll object = " + JSON.stringify(value));
} catch (err) {
- console.info("Failed to obtain all KV pairs. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get all key-values. code =" + err.code + ", message =" + err.message);
}
```
@@ -1162,13 +1166,13 @@ Writes data to the cached **Preferences** instance. This API uses an asynchronou
try {
preferences.put('startup', 'auto', function (err) {
if (err) {
- console.info("Failed to put the value of 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to put value of 'startup'. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Successfully put the value of 'startup'.");
})
} catch (err) {
- console.info("Failed to put the value of 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to put value of 'startup'. code =" + err.code + ", message =" + err.message);
}
```
@@ -1202,10 +1206,10 @@ try {
promise.then(() => {
console.info("Successfully put the value of 'startup'.");
}).catch((err) => {
- console.info("Failed to put the value of 'startup'. code =" + err.code +", message =" + err.message);
+ console.error("Failed to put value of 'startup'. code =" + err.code +", message =" + err.message);
})
} catch(err) {
- console.info("Failed to put the value of 'startup'. code =" + err.code +", message =" + err.message);
+ console.error("Failed to put value of 'startup'. code =" + err.code +", message =" + err.message);
}
```
@@ -1214,7 +1218,7 @@ try {
putSync(key: string, value: ValueType): void
-Synchronously writes data to the cached **Preferences** instance. You can use [flush](#flush) to persist the **Preferences** instance.
+Writes data to the cached **Preferences** instance. This API returns the result synchronously. You can use [flush](#flush) to persist the **Preferences** instance.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
@@ -1231,7 +1235,7 @@ Synchronously writes data to the cached **Preferences** instance. You can use [f
try {
preferences.putSync('startup', 'auto');
} catch(err) {
- console.info("Failed to put the value of 'startup'. code =" + err.code +", message =" + err.message);
+ console.error("Failed to put value of 'startup'. code =" + err.code +", message =" + err.message);
}
```
@@ -1257,7 +1261,7 @@ Checks whether the cached **Preferences** instance contains the KV pair of the g
try {
preferences.has('startup', function (err, val) {
if (err) {
- console.info("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
return;
}
if (val) {
@@ -1267,7 +1271,7 @@ try {
}
})
} catch (err) {
- console.info("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
}
```
@@ -1304,10 +1308,10 @@ try {
console.info("The key 'startup' is not contained.");
}
}).catch((err) => {
- console.info("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
}
```
@@ -1316,7 +1320,7 @@ try {
hasSync(key: string): boolean
-Synchronously checks whether the cached **Preferences** instance contains the KV pair of the given key.
+Checks whether the cached **Preferences** instance contains the KV pair of the given key. This API returns the result synchronously.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
@@ -1343,7 +1347,7 @@ try {
console.info("The key 'startup' is not contained.");
}
} catch(err) {
- console.info("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to check the key 'startup'. code =" + err.code + ", message =" + err.message);
}
```
@@ -1369,13 +1373,13 @@ Deletes a KV pair from the cached **Preferences** instance based on the specifie
try {
preferences.delete('startup', function (err) {
if (err) {
- console.info("Failed to delete the key 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete the key 'startup'. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Deleted the key 'startup'.");
})
} catch (err) {
- console.info("Failed to delete the key 'startup'. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to delete the key 'startup'. code =" + err.code + ", message =" + err.message);
}
```
@@ -1405,13 +1409,13 @@ Deletes a KV pair from the cached **Preferences** instance based on the specifie
```js
try {
let promise = preferences.delete('startup');
- promise.then(() => {
+ promise.then(() => {
console.info("Deleted the key 'startup'.");
}).catch((err) => {
- console.info("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message);
+ console.error("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message);
})
} catch(err) {
- console.info("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message);
+ console.error("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message);
}
```
@@ -1420,7 +1424,7 @@ try {
deleteSync(key: string): void
-Synchronously deletes a KV pair from the cached **Preferences** instance based on the specified key. You can use [flush](#flush) to persist the **Preferences** instance.
+Deletes a KV pair from the cached **Preferences** instance based on the specified key. This API returns the result synchronously. You can use [flush](#flush) to persist the **Preferences** instance.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
@@ -1436,7 +1440,7 @@ Synchronously deletes a KV pair from the cached **Preferences** instance based o
try {
preferences.deleteSync('startup');
} catch(err) {
- console.info("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message);
+ console.error("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message);
}
```
@@ -1461,13 +1465,13 @@ Flushes the data in the cached **Preferences** instance to the persistent file.
try {
preferences.flush(function (err) {
if (err) {
- console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to flush. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Successfully flushed data.");
})
} catch (err) {
- console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to flush. code =" + err.code + ", message =" + err.message);
}
```
@@ -1494,10 +1498,10 @@ try {
promise.then(() => {
console.info("Successfully flushed data.");
}).catch((err) => {
- console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to flush. code =" + err.code + ", message =" + err.message);
})
} catch (err) {
- console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to flush. code =" + err.code + ", message =" + err.message);
}
```
@@ -1520,15 +1524,15 @@ Clears all data in the cached **Preferences** instance. This API uses an asynchr
```js
try {
- preferences.clear(function (err) {
+ preferences.clear(function (err) {
if (err) {
- console.info("Failed to clear data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to clear. code =" + err.code + ", message =" + err.message);
return;
}
console.info("Successfully cleared data.");
})
} catch (err) {
- console.info("Failed to clear data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to clear. code =" + err.code + ", message =" + err.message);
}
```
@@ -1552,13 +1556,13 @@ Clears all data in the cached **Preferences** instance. This API uses a promise
```js
try {
let promise = preferences.clear();
- promise.then(() => {
- console.info("Successfully cleared data.");
+ promise.then(() => {
+ console.info("Successfully cleared data.");
}).catch((err) => {
- console.info("Failed to clear data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to clear. code =" + err.code + ", message =" + err.message);
})
} catch(err) {
- console.info("Failed to clear data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to clear. code =" + err.code + ", message =" + err.message);
}
```
@@ -1567,7 +1571,7 @@ try {
clearSync(): void
-Synchronously clears all data in the cached **Preferences** instance. You can use [flush](#flush) to persist the **Preferences** instance.
+Clears all data in the cached **Preferences** instance. This API returns the result synchronously. You can use [flush](#flush) to persist the **Preferences** instance.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
@@ -1577,7 +1581,7 @@ Synchronously clears all data in the cached **Preferences** instance. You can us
try {
preferences.clearSync();
} catch(err) {
- console.info("Failed to clear data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to clear. code =" + err.code + ", message =" + err.message);
}
```
@@ -1601,33 +1605,33 @@ Subscribes to data changes. A callback will be triggered to return the new value
```js
try {
- data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) {
- if (err) {
- console.info("Failed to obtain the preferences.");
- return;
- }
- let observer = function (key) {
- console.info("The key " + key + " changed.");
- }
- preferences.on('change', observer);
- preferences.put('startup', 'manual', function (err) {
- if (err) {
- console.info("Failed to put the value of 'startup'. Cause: " + err);
- return;
- }
- console.info("Successfully put the value of 'startup'.");
-
- preferences.flush(function (err) {
- if (err) {
- console.info("Failed to flush data. Cause: " + err);
- return;
- }
- console.info("Successfully flushed data.");
- })
- })
- })
+ data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) {
+ if (err) {
+ console.error("Failed to get preferences.");
+ return;
+ }
+ let observer = function (key) {
+ console.info("The key " + key + " changed.");
+ }
+ preferences.on('change', observer);
+ preferences.put('startup', 'manual', function (err) {
+ if (err) {
+ console.error("Failed to put the value of 'startup'. Cause: " + err);
+ return;
+ }
+ console.info("Successfully put the value of 'startup'.");
+
+ preferences.flush(function (err) {
+ if (err) {
+ console.error("Failed to flush. Cause: " + err);
+ return;
+ }
+ console.info("Successfully flushed data.");
+ })
+ })
+ })
} catch (err) {
- console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to flush. code =" + err.code + ", message =" + err.message);
}
```
@@ -1660,86 +1664,85 @@ For details about the error codes, see [User Preference Error Codes](../errorcod
```js
try {
- data_preferences.getPreferences(this.context, {name: 'mystore', dataGroupId:'myId'}, function (err, preferences) {
- if (err) {
- console.info("Failed to obtain the preferences.");
- return;
- }
- let observer = function (key) {
- console.info("The key " + key + " changed.");
- }
- preferences.on('multiProcessChange', observer);
- preferences.put('startup', 'manual', function (err) {
- if (err) {
- console.info("Failed to put the value of 'startup'. Cause: " + err);
- return;
- }
- console.info("Successfully put the value of 'startup'.");
-
- preferences.flush(function (err) {
- if (err) {
- console.info("Failed to flush data. Cause: " + err);
- return;
- }
- console.info("Successfully flushed data.");
- })
- })
- })
+ data_preferences.getPreferences(this.context, { name: 'mystore', dataGroupId:'myId' }, function (err, preferences) {
+ if (err) {
+ console.error("Failed to get preferences.");
+ return;
+ }
+ let observer = function (key) {
+ console.info("The key " + key + " changed.");
+ }
+ preferences.on('multiProcessChange', observer);
+ preferences.put('startup', 'manual', function (err) {
+ if (err) {
+ console.error("Failed to put the value of 'startup'. Cause: " + err);
+ return;
+ }
+ console.info("Successfully put the value of 'startup'.");
+
+ preferences.flush(function (err) {
+ if (err) {
+ console.error("Failed to flush. Cause: " + err);
+ return;
+ }
+ console.info("Successfully flushed data.");
+ })
+ })
+ })
} catch (err) {
- console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to flush. code =" + err.code + ", message =" + err.message);
}
```
**Example 2**
```js
-let preferences = null;
try {
data_preferences.getPreferences(this.context, { name: 'mystore' }, function (err, val) {
if (err) {
- console.info("Failed to obtain the preferences.");
+ console.error("Failed to get preferences.");
return;
}
preferences = val;
let observer = function (key) {
console.info("The key " + key + " changed.");
try {
- data_preferences.removePreferencesFromCache(context, { name: 'mystore' }, function (err) {
+ data_preferences.removePreferencesFromCache(this.context, { name: 'mystore' }, function (err) {
if (err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
return;
}
preferences = null;
- console.info("Removed the preferences successfully.");
+ console.info("Succeeded in removing preferences.");
})
} catch (err) {
- console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to remove preferences. code =" + err.code + ", message =" + err.message);
}
try {
- data_preferences.getPreferences(context, { name: 'mystore' }, function (err, val) {
+ data_preferences.getPreferences(this.context, { name: 'mystore' }, function (err, val) {
if (err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
return;
}
preferences = val;
- console.info("Obtained the preferences successfully.");
+ console.info("Succeeded in getting preferences.");
})
} catch (err) {
- console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to get preferences. code =" + err.code + ", message =" + err.message);
}
}
preferences.on('multiProcessChange', observer);
preferences.put('startup', 'manual', function (err) {
if (err) {
- console.info("Failed to put the value of 'startup'. Cause: " + err);
+ console.error("Failed to put the value of 'startup'. Cause: " + err);
return;
}
console.info("Successfully put the value of 'startup'.");
preferences.flush(function (err) {
if (err) {
- console.info("Failed to flush data. Cause: " + err);
+ console.error("Failed to flush. Cause: " + err);
return;
}
console.info("Successfully flushed data.");
@@ -1747,7 +1750,7 @@ try {
})
})
} catch (err) {
- console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to flush. code =" + err.code + ", message =" + err.message);
}
```
@@ -1772,7 +1775,7 @@ Unsubscribes from data changes.
try {
data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) {
if (err) {
- console.info("Failed to obtain the preferences.");
+ console.error("Failed to get preferences.");
return;
}
let observer = function (key) {
@@ -1781,14 +1784,14 @@ try {
preferences.on('change', observer);
preferences.put('startup', 'auto', function (err) {
if (err) {
- console.info("Failed to put the value of 'startup'. Cause: " + err);
+ console.error("Failed to put the value of 'startup'. Cause: " + err);
return;
}
console.info("Successfully put the value of 'startup'.");
preferences.flush(function (err) {
if (err) {
- console.info("Failed to flush data. Cause: " + err);
+ console.error("Failed to flush. Cause: " + err);
return;
}
console.info("Successfully flushed data.");
@@ -1797,7 +1800,7 @@ try {
})
})
} catch (err) {
- console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to flush. code =" + err.code + ", message =" + err.message);
}
```
@@ -1820,9 +1823,9 @@ Unsubscribes from inter-process data changes.
```js
try {
- data_preferences.getPreferences(this.context, {name: 'mystore', dataGroupId:'myId'}, function (err, preferences) {
+ data_preferences.getPreferences(this.context, { name: 'mystore', dataGroupId:'myId' }, function (err, preferences) {
if (err) {
- console.info("Failed to obtain the preferences.");
+ console.error("Failed to get preferences.");
return;
}
let observer = function (key) {
@@ -1831,14 +1834,14 @@ try {
preferences.on('multiProcessChange', observer);
preferences.put('startup', 'auto', function (err) {
if (err) {
- console.info("Failed to put the value of 'startup'. Cause: " + err);
+ console.error("Failed to put the value of 'startup'. Cause: " + err);
return;
}
console.info("Successfully put the value of 'startup'.");
preferences.flush(function (err) {
if (err) {
- console.info("Failed to flush data. Cause: " + err);
+ console.error("Failed to flush. Cause: " + err);
return;
}
console.info("Successfully flushed data.");
@@ -1847,7 +1850,7 @@ try {
})
})
} catch (err) {
- console.info("Failed to flush data. code =" + err.code + ", message =" + err.message);
+ console.error("Failed to flush. code =" + err.code + ", message =" + err.message);
}
```
## ValueType
diff --git a/en/application-dev/reference/apis/js-apis-devicestatus-draginteraction.md b/en/application-dev/reference/apis/js-apis-devicestatus-draginteraction.md
new file mode 100644
index 0000000000000000000000000000000000000000..01b50c8fc58606caf233a011df6e5bdc86eb2b80
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-devicestatus-draginteraction.md
@@ -0,0 +1,98 @@
+# @ohos. deviceStatus.dragInteraction (Drag)
+
+ The **dragInteraction** module provides the APIs to enable and disable listening for dragging status changes.
+
+> **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.
+>
+> - The APIs provided by this module are system APIs.
+
+## Modules to Import
+
+```js
+import dragInteraction from '@ohos.deviceStatus.dragInteraction'
+```
+
+## dragInteraction.on
+
+on(type: 'drag', callback: Callback<DragState>): void;
+
+Enables listening for dragging status changes.
+
+**System capability**: SystemCapability.Msdp.DeviceStatus.Drag
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------------- | ---- | ---------------------------- |
+| type | string | Yes | Event type. This field has a fixed value of **drag**.|
+| callback | Callback<[DragState](#dragstate)> | Yes | Callback used to return the dragging status.|
+
+**Example**
+
+```js
+try {
+ dragInteraction.on('drag', (data) => {
+ console.log(`Drag interaction event: ${JSON.stringify(data)}`);
+ });
+} catch (error) {
+ console.log(`Register failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
+}
+```
+
+## dragInteraction.off
+
+off(type: 'drag', callback?: Callback<DragState>): void;
+
+Disables listening for dragging status changes.
+
+**System capability**: SystemCapability.Msdp.DeviceStatus.Drag
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------- | ---- | ---------------------------- |
+| type | string | Yes | Event type. This field has a fixed value of **drag**.|
+| callback | Callback<[DragState](#dragstate)> | No | Callback to be unregistered. If this parameter is not specified, all callbacks registered by the current application will be unregistered.|
+
+**Example**
+
+```js
+// Unregister a single callback.
+function callback(event) {
+ console.log(`Drag interaction event: ${JSON.stringify(event)}`);
+ return false;
+}
+try {
+ dragInteraction.on('drag', callback);
+ dragInteraction.off("drag", callback);
+} catch (error) {
+ console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
+}
+```
+```js
+// Unregister all callbacks.
+function callback(event) {
+ console.log(`Drag interaction event: ${JSON.stringify(event)}`);
+ return false;
+}
+try {
+ dragInteraction.on('drag', callback);
+ dragInteraction.off("drag");
+} catch (error) {
+ console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
+}
+```
+
+## DragState
+
+Enumerates dragging states.
+
+**System capability**: SystemCapability.Msdp.DeviceStatus.Drag
+
+| Name | Value | Description |
+| -------- | ----------------- | ----------------- |
+| MSG_DRAG_STATE_START | 1 | Dragging starts.|
+| MSG_DRAG_STATE_STOP | 2 | Dragging is ended. |
+| MSG_DRAG_STATE_CANCEL | 3 | Dragging is canceled. |
diff --git a/en/application-dev/reference/apis/js-apis-distributedDeviceManager.md b/en/application-dev/reference/apis/js-apis-distributedDeviceManager.md
index 7e3d76ec2e872342400131c9d9ca87b916d5fcb1..e1b55f7e188ddb088fc8381101e8d63b95853664 100644
--- a/en/application-dev/reference/apis/js-apis-distributedDeviceManager.md
+++ b/en/application-dev/reference/apis/js-apis-distributedDeviceManager.md
@@ -13,7 +13,7 @@ Applications can call the APIs to:
> **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.
+> 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.
## Modules to Import
@@ -39,9 +39,9 @@ Creates a **DeviceManager** instance. The **DeviceManager** instance is the entr
**Return value**
- | Name | Description |
- | ------------------------------------------- | --------- |
- | [DeviceManager](#devicemanager) | **DeviceManager** instance created.|
+| Name | Description |
+| ------------------------------------------- | --------- |
+| [DeviceManager](#devicemanager) | **DeviceManager** instance created.|
**Example**
@@ -97,7 +97,7 @@ Represents the basic information about a distributed device.
| ---------------------- | ------------------------- | ---- | -------- |
| deviceId | string | Yes | Unique ID of the device. The value is the udid-hash (hash value of the UDID) and appid encrypted using SHA-256.|
| deviceName | string | Yes | Device name. |
-| deviceType | number | Yes | Device type. |
+| deviceType | string | Yes | Device type. |
| networkId | string | No | Network ID of the device. |
## DeviceStateChange
@@ -129,9 +129,9 @@ Obtains all trusted devices synchronously.
**Return value**
- | Name | Description |
- | ------------------------------------------- | --------- |
- | Array<[DeviceBasicInfo](#devicebasicinfo)> | List of trusted devices obtained.|
+| Name | Description |
+| ------------------------------------------- | --------- |
+| Array<[DeviceBasicInfo](#devicebasicinfo)> | List of trusted devices obtained.|
**Error codes**
@@ -163,9 +163,9 @@ Obtains all trusted devices. This API uses an asynchronous callback to return th
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | --------------------- |
- | callback | AsyncCallback<Array<[DeviceBasicInfo](#devicebasicinfo)>> | Yes | Callback invoked to return the list of trusted devices.|
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | --------------------- |
+| callback | AsyncCallback<Array<[DeviceBasicInfo](#devicebasicinfo)>> | Yes | Callback invoked to return the list of trusted devices.|
**Error codes**
@@ -203,9 +203,9 @@ Obtains all trusted devices. This API uses a promise to return the result.
**Return value**
- | Type | Description |
- | ---------------------------------------------------------- | ---------------------------------- |
- | Promise<Array<[DeviceBasicInfo](#devicebasicinfo)>> | Promise used to return the result.|
+| Type | Description |
+| ---------------------------------------------------------- | ---------------------------------- |
+| Promise<Array<[DeviceBasicInfo](#devicebasicinfo)>> | Promise used to return the result.|
**Error codes**
@@ -237,9 +237,9 @@ Obtains the network ID of the local device.
**Return value**
- | Name | Description |
- | ------------------------- | ---------------- |
- | string | Network ID of the local device obtained.|
+| Name | Description |
+| ------------------------- | ---------------- |
+| string | Network ID of the local device obtained.|
**Error codes**
@@ -272,9 +272,9 @@ Obtains the local device name.
**Return value**
- | Name | Description |
- | ------------------------- | ---------------- |
- | string | Name of the local device obtained.|
+| Name | Description |
+| ------------------------- | ---------------- |
+| string | Name of the local device obtained.|
**Error codes**
@@ -307,9 +307,9 @@ Obtains the local device type.
**Return value**
- | Name | Description |
- | ------------------------- | ---------------- |
- | number | Local device type obtained.|
+| Name | Description |
+| ------------------------- | ---------------- |
+| number | Local device type obtained.|
**Error codes**
@@ -342,9 +342,9 @@ Obtains the local device ID.
**Return value**
- | Name | Description |
- | ------------------------- | ---------------- |
- | string | Local device ID obtained.|
+| Name | Description |
+| ------------------------- | ---------------- |
+| string | Local device ID obtained.|
**Error codes**
@@ -377,15 +377,15 @@ Obtains the device name based on the network ID of the specified device.
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | --------- |
- | networkId| string | Yes | Network ID of the device.|
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | --------- |
+| networkId| string | Yes | Network ID of the device.|
**Return value**
- | Name | Description |
- | ------------------------- | ---------------- |
- | string | Device name obtained.|
+| Name | Description |
+| ------------------------- | ---------------- |
+| string | Device name obtained.|
**Error codes**
@@ -420,15 +420,15 @@ Obtains the device type based on the network ID of the specified device.
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | --------- |
- | networkId| string | Yes | Network ID of the device.|
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | --------- |
+| networkId| string | Yes | Network ID of the device.|
**Return value**
- | Name | Description |
- | ------------------------- | ---------------- |
- | number | Device type obtained.|
+| Name | Description |
+| ------------------------- | ---------------- |
+| number | Device type obtained.|
**Error codes**
@@ -463,10 +463,10 @@ Starts to discover devices nearby. The discovery process automatically stops whe
**Parameters**
- | Name | Type | Mandatory | Description |
- | ------------- | ------------------------------- | ---- | ----- |
- | discoverParam | {[key: string]: Object} | Yes | Identifier of the device to discover. It specifies the type of the target to discover. **discoverTargetType**: The default discovery target is device. The value is **1**.|
- | filterOptions | {[key: string]: Object} | No | Options for filtering discovered devices. The default value is **undefined**, which means to discover offline devices. The following **key** values are carried: **availableStatus(0-1)**: Discover trusted devices only. The value **0** indicates that the device is untrusted. - **0**: The device is offline. The client needs to call **bindTarget** to bind the device. - **1**: The device is online and can be connected. **discoverDistance(0-100)**: Discover devices within a certain distance (in cm) from the local device. **authenticationStatus(0-1)**: Discover devices based on the authentication status. - **0**: The device is not authenticated. - **1**: The device has been authenticated. **authorizationType(0-2)**: Discover devices based on the authorization type. - **0**: device authenticated by a temporarily agreed session key. - **1**: device authenticated by a key of the same account. - **2**: devices authenticated by a credential key of different accounts.|
+| Name | Type | Mandatory | Description |
+| ------------- | ------------------------------- | ---- | ----- |
+| discoverParam | {[key: string]: Object} | Yes | Identifier of the device to discover. It specifies the type of the target to discover. **discoverTargetType**: The default discovery target is device. The value is **1**.|
+| filterOptions | {[key: string]: Object} | No | Options for filtering discovered devices. The default value is **undefined**, which means to discover offline devices. The following **key** values are carried: **availableStatus(0-1)**: Discover trusted devices only. The value **0** indicates that the device is untrusted. - **0**: The device is offline. The client needs to call **bindTarget** to bind the device. - **1**: The device is online and can be connected. **discoverDistance(0-100)**: Discover devices within a certain distance (in cm) from the local device. **authenticationStatus(0-1)**: Discover devices based on the authentication status. - **0**: The device is not authenticated. - **1**: The device has been authenticated. **authorizationType(0-2)**: Discover devices based on the authorization type. - **0**: device authenticated by a temporarily agreed session key. - **1**: device authenticated by a key of the same account. - **2**: devices authenticated by a credential key of different accounts.|
**Error codes**
@@ -537,11 +537,11 @@ Binds a device.
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------- | --------------------------------------------------- | ----- | ------------ |
- | deviceId | string | Yes | Device ID. |
- | bindParam | {[key: string]: Object} | Yes | Authentication parameters. You can determine the key-value pair to be passed in. By default, the following **key** values are carried: **bindType**: binding type. - **1**: PIN. - **2**: QR code. - 3: NFC. - 4: No interaction. **targetPkgName**: bundle name of the target to bind. **appName**: application that attempts to bind the target. **appOperation**: reason for the application to bind the target. **customDescription**: detailed description of the operation. |
- | callback | AsyncCallback<{deviceId: string, }> | Yes | Callback invoked to return the authentication result.|
+| Name | Type | Mandatory | Description |
+| ---------- | --------------------------------------------------- | ----- | ------------ |
+| deviceId | string | Yes | Device ID. |
+| bindParam | {[key: string]: Object} | Yes | Authentication parameters. You can determine the key-value pair to be passed in. By default, the following **key** values are carried: **bindType**: binding type. - **1**: PIN. - **2**: QR code. - 3: NFC. - 4: No interaction. **targetPkgName**: bundle name of the target to bind. **appName**: application that attempts to bind the target. **appOperation**: reason for the application to bind the target. **customDescription**: detailed description of the operation. |
+| callback | AsyncCallback<{deviceId: string, }> | Yes | Callback invoked to return the authentication result.|
**Error codes**
@@ -589,9 +589,9 @@ Unbinds a device.
**Parameters**
- | Name | Type | Mandatory| Description |
- | -------- | ------------------------- | ---- | ---------- |
- | deviceId | string | Yes | Device ID.|
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| deviceId | string | Yes | Device ID.|
**Error codes**
@@ -626,10 +626,10 @@ Replies to the user's UI operation. This API can be used only by the PIN HAP of
**Parameters**
- | Name | Type | Mandatory | Description |
- | ------------- | --------------- | ---- | ------------------- |
- | action | number | Yes | User operation. |
- | actionResult | string | Yes | Operation result.|
+| Name | Type | Mandatory | Description |
+| ------------- | --------------- | ---- | ------------------- |
+| action | number | Yes | User operation. |
+| actionResult | string | Yes | Operation result.|
**Example**
@@ -664,10 +664,10 @@ Subscribes to the UI operation reply result.
**Parameters**
- | Name | Type | Mandatory| Description |
- | -------- | ------------------------------------ | ---- | ------------------------------ |
- | type | string | Yes | Event type to subscribe to. The value **replyResult** indicates the reply result of the UI operation.|
- | callback | Callback<{ param: string}> | Yes | Callback invoked to return the UI status. |
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------ | ---- | ------------------------------ |
+| type | string | Yes | Event type to subscribe to. The value **replyResult** indicates the reply result of the UI operation.|
+| callback | Callback<{ param: string}> | Yes | Callback invoked to return the UI status. |
**Example**
@@ -698,10 +698,10 @@ Unsubscribes from the UI operation reply result.
**Parameters**
- | Name | Type | Mandatory| Description |
- | -------- | ------------------------------------- | ---- | ------------------------------ |
- | type | string | Yes | Event type to unsubscribe from. The value **replyResult** indicates the reply result of the UI operation.|
- | callback | Callback<{ param: string}> | No | Callback for the UI status.|
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------- | ---- | ------------------------------ |
+| type | string | Yes | Event type to unsubscribe from. The value **replyResult** indicates the reply result of the UI operation.|
+| callback | Callback<{ param: string}> | No | Callback for the UI status.|
**Example**
@@ -725,10 +725,10 @@ Subscribes to changes in the device state.
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | ------------------------------ |
- | type | string | Yes | Event type. The value **'deviceStateChange'** indicates a device state change event.|
- | callback | Callback<{ action: [DeviceStateChange](#devicestatechange), device: [DeviceBasicInfo](#devicebasicinfo) }> | Yes | Callback invoked to return the device information and state. |
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ------------------------------ |
+| type | string | Yes | Event type. The value **'deviceStateChange'** indicates a device state change event.|
+| callback | Callback<{ action: [DeviceStateChange](#devicestatechange), device: [DeviceBasicInfo](#devicebasicinfo) }> | Yes | Callback invoked to return the device information and state. |
**Example**
@@ -754,10 +754,10 @@ Unsubscribes from changes in the device state.
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | --------------------------- |
- | type | string | Yes | Event type. The value **'deviceStateChange'** indicates a device state change event. |
- | callback | Callback<{ action: [deviceStateChange](#devicestatechange), device: [DeviceBasicInfo](#devicebasicinfo) }> | No | Callback for the device information and state.|
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | --------------------------- |
+| type | string | Yes | Event type. The value **'deviceStateChange'** indicates a device state change event. |
+| callback | Callback<{ action: [deviceStateChange](#devicestatechange), device: [DeviceBasicInfo](#devicebasicinfo) }> | No | Callback for the device information and state.|
**Example**
@@ -783,10 +783,10 @@ Subscribes to device discovery events.
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | -------------------------- |
- | type | string | Yes | Event type. The value **'discoverSuccess'** indicates an event of successful device discovery.|
- | callback | Callback<{ device: [DeviceBasicInfo](#devicebasicinfo) }> | Yes | Callback invoked to return a device discovery event. |
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | -------------------------- |
+| type | string | Yes | Event type. The value **'discoverSuccess'** indicates an event of successful device discovery.|
+| callback | Callback<{ device: [DeviceBasicInfo](#devicebasicinfo) }> | Yes | Callback invoked to return a device discovery event. |
**Example**
@@ -812,10 +812,10 @@ Unsubscribes from device discovery events.
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | --------------------------- |
- | type | string | Yes | Event type. The value **'discoverSuccess'** indicates a device discovery event. |
- | callback | Callback<{ device: [DeviceBasicInfo](#devicebasicinfo) }> | No | Callback for the device discovery event.|
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | --------------------------- |
+| type | string | Yes | Event type. The value **'discoverSuccess'** indicates a device discovery event. |
+| callback | Callback<{ device: [DeviceBasicInfo](#devicebasicinfo) }> | No | Callback for the device discovery event.|
**Example**
@@ -841,10 +841,10 @@ Subscribes to device name changes.
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | ------------------------------ |
- | type | string | Yes | Event type. The value **'deviceNameChange'** indicates a device name change event.|
- | callback | Callback<{ deviceName: string}> | Yes | Callback invoked to return the device name change. |
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ------------------------------ |
+| type | string | Yes | Event type. The value **'deviceNameChange'** indicates a device name change event.|
+| callback | Callback<{ deviceName: string}> | Yes | Callback invoked to return the device name change. |
**Example**
@@ -870,10 +870,10 @@ Unsubscribes from device name changes.
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | ------------------------------ |
- | type | string | Yes | Event type. The value **'deviceNameChange'** indicates a device name change event.|
- | callback | Callback<{ deviceName: string}> | No | Callback for the device name change. |
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ------------------------------ |
+| type | string | Yes | Event type. The value **'deviceNameChange'** indicates a device name change event.|
+| callback | Callback<{ deviceName: string}> | No | Callback for the device name change. |
**Example**
@@ -899,10 +899,10 @@ Subscribes to device discovery failures.
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | ------------------------------ |
- | type | string | Yes | Event type. The value **'discoverFailure'** indicates an event reported when device discovery fails.|
- | callback | Callback<{ reason: number }> | Yes | Callback invoked to return a device discovery failure. |
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ------------------------------ |
+| type | string | Yes | Event type. The value **'discoverFailure'** indicates an event reported when device discovery fails.|
+| callback | Callback<{ reason: number }> | Yes | Callback invoked to return a device discovery failure. |
**Example**
@@ -928,10 +928,10 @@ Unsubscribes from device discovery failures.
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | ----------------- |
- | type | string | Yes | Event type. The value **'discoverFailure'** indicates an event reported when device discovery fails. |
- | callback | Callback<{ reason: number }> | No | Callback for the device discovery failure.|
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ----------------- |
+| type | string | Yes | Event type. The value **'discoverFailure'** indicates an event reported when device discovery fails. |
+| callback | Callback<{ reason: number }> | No | Callback for the device discovery failure.|
**Example**
@@ -957,10 +957,10 @@ Subscribes to dead events of the **DeviceManager** service.
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ----------------------- | ---- | ---------------------------------------- |
- | type | string | Yes | Event type. The value **'serviceDie'** indicates an event reported when the **DeviceManager** service is terminated unexpectedly.|
- | callback | Callback<{}> | No | Callback invoked when a dead event of the **DeviceManager** service occurs. |
+| Name | Type | Mandatory | Description |
+| -------- | ----------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value **'serviceDie'** indicates an event reported when the **DeviceManager** service is terminated unexpectedly.|
+| callback | Callback<{}> | No | Callback invoked when a dead event of the **DeviceManager** service occurs. |
**Example**
@@ -986,10 +986,10 @@ Unsubscribes from dead events of the **DeviceManager** service.
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ----------------------- | ---- | ---------------------------------------- |
- | type | string | Yes | Event type. The value **'serviceDie'** indicates an event reported when the **DeviceManager** service is terminated unexpectedly.|
- | callback | Callback<{}> | No | Callback for the dead event of the **DeviceManager** service. |
+| Name | Type | Mandatory | Description |
+| -------- | ----------------------- | ---- | ---------------------------------------- |
+| type | string | Yes | Event type. The value **'serviceDie'** indicates an event reported when the **DeviceManager** service is terminated unexpectedly.|
+| callback | Callback<{}> | No | Callback for the dead event of the **DeviceManager** service. |
**Example**
@@ -1002,4 +1002,4 @@ Unsubscribes from dead events of the **DeviceManager** service.
console.error("serviceDie errCode:" + err.code + ",errMessage:" + err.message);
}
```
-
+
diff --git a/en/application-dev/reference/apis/js-apis-distributedMissionManager.md b/en/application-dev/reference/apis/js-apis-distributedMissionManager.md
index 93e460019144b0e321b1f39b4c41a37f9c908d37..ddc6fb296b8e88bd3866696cb7a0e409918c7745 100644
--- a/en/application-dev/reference/apis/js-apis-distributedMissionManager.md
+++ b/en/application-dev/reference/apis/js-apis-distributedMissionManager.md
@@ -1,6 +1,6 @@
# @ohos.distributedMissionManager (Distributed Mission Management)
-The **distributedMissionManager** module implements system mission management across devices. You can use the APIs provided by this module to register or deregister a mission status listener, start or stop synchronizing a remote mission list, and continue a mission on a remote device.
+The **distributedMissionManager** module implements mission management across devices. You can use the APIs provided by this module to register or deregister a mission status listener, start or stop synchronizing a remote mission list, and continue a mission on a remote device by mission ID or bundle name.
> **NOTE**
>
@@ -14,7 +14,6 @@ The **distributedMissionManager** module implements system mission management ac
import distributedMissionManager from '@ohos.distributedMissionManager'
```
-
## distributedMissionManager.registerMissionListener
registerMissionListener(parameter: MissionDeviceInfo, options: MissionCallback, callback: AsyncCallback<void>): void;
@@ -30,8 +29,8 @@ Registers a mission status listener. This API uses an asynchronous callback to r
| Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | --------- |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Information about the device to listen for.|
-| options | [MissionCallback](#missioncallback) | Yes | Callback to register. |
-| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+| options | [MissionCallback](#missioncallback) | Yes | Callback to register.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the listener is registered, **err** is **undefined**. Otherwise, **err** is an error object.|
**Example**
@@ -80,14 +79,14 @@ Registers a mission status listener. This API uses a promise to return the resul
| Name | Type | Mandatory | Description |
| --------- | ---------------------------------------- | ---- | -------- |
-| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Information about the device to listen for. |
+| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Information about the device to listen for. |
| options | MissionCallback | Yes | Callback to register.|
**Return value**
| Type | Description |
| ------------------- | ---------------- |
-| Promise<void> | Promise used to return the result.|
+| Promise<void> | Promise that returns no value.|
**Example**
@@ -123,7 +122,6 @@ Registers a mission status listener. This API uses a promise to return the resul
}
```
-
## distributedMissionManager.unRegisterMissionListener
unRegisterMissionListener(parameter: MissionDeviceInfo, callback: AsyncCallback<void>): void;
@@ -138,8 +136,8 @@ Deregisters a mission status listener. This API uses an asynchronous callback to
| Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | --------- |
-| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Information about the device to listen for. |
-| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Information about the device to listen for. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the listener is deregistered, **err** is **undefined**. Otherwise, **err** is an error object.|
**Example**
@@ -159,7 +157,6 @@ Deregisters a mission status listener. This API uses an asynchronous callback to
}
```
-
## distributedMissionManager.unRegisterMissionListener
unRegisterMissionListener(parameter: MissionDeviceInfo): Promise<void>
@@ -180,7 +177,7 @@ Deregisters a mission status listener. This API uses a promise to return the res
| Type | Description |
| ------------------- | ---------------- |
-| Promise<void> | Promise used to return the result.|
+| Promise<void> |Promise that returns no value.|
**Example**
@@ -215,7 +212,7 @@ Starts to synchronize the remote mission list. This API uses an asynchronous cal
| Name | Type | Mandatory | Description |
| --------- | ------------------------------------- | ---- | --------- |
| parameter | [MissionParameter](#missionparameter) | Yes | Parameters required for synchronization. |
-| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the synchronization is started, **err** is **undefined**. Otherwise, **err** is an error object.|
**Example**
@@ -257,7 +254,7 @@ Starts to synchronize the remote mission list. This API uses a promise to return
| Type | Description |
| ------------------- | ---------------- |
-| Promise<void> | Promise used to return the result.|
+| Promise<void> | Promise that returns no value.|
**Example**
@@ -294,7 +291,7 @@ Stops synchronizing the remote mission list. This API uses an asynchronous callb
| Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | --------- |
| parameter | [MissionDeviceInfo](#missiondeviceinfo) | Yes | Parameters required for synchronization. |
-| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the synchronization is stopped, **err** is **undefined**. Otherwise, **err** is an error object.|
**Example**
@@ -334,7 +331,7 @@ Stops synchronizing the remote mission list. This API uses a promise to return t
| Type | Description |
| ------------------- | ---------------- |
-| Promise<void> | Promise used to return the result.|
+| Promise<void> | Promise that returns no value.|
**Example**
@@ -358,7 +355,7 @@ Stops synchronizing the remote mission list. This API uses a promise to return t
continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback, callback: AsyncCallback<void>): void;
-Continues a mission on a remote device. This API uses an asynchronous callback to return the result.
+Continues a mission on a remote device, with the mission ID specified. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS and ohos.permission.DISTRIBUTED_DATASYNC
@@ -370,7 +367,7 @@ Continues a mission on a remote device. This API uses an asynchronous callback t
| --------- | --------------------------------------- | ---- | ----- |
| parameter | [ContinueDeviceInfo](js-apis-inner-application-continueDeviceInfo.md) | Yes | Parameters required for mission continuation.|
| options | [ContinueCallback](js-apis-inner-application-continueCallback.md) | Yes | Callback invoked when the mission continuation is complete.|
-| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the mission is continued, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
@@ -416,7 +413,7 @@ For details about the error codes, see [Distributed Scheduler Error Codes](../er
continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback): Promise<void>
-Continues a mission on a remote device. This API uses a promise to return the result.
+Continues a mission on a remote device, with the mission ID specified. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS and ohos.permission.DISTRIBUTED_DATASYNC
@@ -433,7 +430,7 @@ Continues a mission on a remote device. This API uses a promise to return the re
| Type | Description |
| ------------------- | ---------------- |
-| Promise<void> | Promise used to return the result.|
+| Promise<void> |Promise that returns no value.|
**Error codes**
@@ -490,7 +487,7 @@ Continues a mission on a remote device, with the bundle name specified. This API
| Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | ----- |
| parameter | [ContinueMissionInfo](./js-apis-inner-application-continueMissionInfo.md) | Yes | Parameters required for mission continuation.|
-| callback | AsyncCallback<void> | Yes | Callback invoked when the mission continuation is complete.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the mission is continued, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
@@ -546,7 +543,7 @@ Continues a mission on a remote device, with the bundle name specified. This API
| Type | Description |
| ------------------- | ---------------- |
-| Promise<void> | Promise used to return the result.|
+| Promise<void> | Promise that returns no value.|
**Error codes**
@@ -586,7 +583,7 @@ For details about the error codes, see [Distributed Scheduler Error Codes](../er
on(type: 'continueStateChange', callback: Callback<{ state: ContinueState, info: ContinuableInfo }>): void
-Registers a listener for the mission continuation state of the current application.
+Subscribes to continuation state change events of the current mission.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
@@ -596,8 +593,8 @@ Registers a listener for the mission continuation state of the current applicati
| Name | Type | Mandatory | Description |
| --------- | ---------------------------------------- | ---- | -------- |
-| type | string | Yes | Type of the listener. The value is fixed at **'continueStateChange'**. |
-| callback | Callback<{ state: [ContinueState](#continuestate10), info: [ContinuableInfo](./js-apis-inner-application-continuableInfo.md) }> | Yes | Callback used to return the mission continuation state and information. |
+| type | string | Yes | Event type. The value **'continueStateChange'** indicates the continuation state change event of the current mission. |
+| callback | Callback<{ state: [ContinueState](#continuestate10), info: [ContinuableInfo](./js-apis-inner-application-continuableInfo.md) }> | Yes | Callback used to return the continuation state and information of the current mission. |
**Example**
@@ -615,7 +612,7 @@ Registers a listener for the mission continuation state of the current applicati
off(type: 'continueStateChange', callback?: Callback<{ state: ContinueState, info: ContinuableInfo }>): void
-Deregisters a listener for the mission continuation state of the current application.
+Unsubscribes from continuation state change events of the current mission.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
@@ -625,8 +622,8 @@ Deregisters a listener for the mission continuation state of the current applica
| Name | Type | Mandatory | Description |
| --------- | ---------------------------------------- | ---- | -------- |
-| type | string | Yes | Type of the listener. The value is fixed at **'continueStateChange'**. |
-| callback | Callback<{ state: [ContinueState](#continuestate10), info: [ContinuableInfo](./js-apis-inner-application-continuableInfo.md) }> | No | Callback used for the listener to be deregistered. |
+| type | string | Yes | Event type. The value **'continueStateChange'** indicates the continuation state change event of the current mission. |
+| callback | Callback<{ state: [ContinueState](#continuestate10), info: [ContinuableInfo](./js-apis-inner-application-continuableInfo.md) }> | No | Callback used to return the continuation state and information of the current mission. If the callback is unspecified, all subscriptions to the specified event are canceled. |
**Example**
@@ -688,5 +685,5 @@ Enumerates the mission continuation states.
| Name | Value | Description |
| ------------- | --------- | ------------------------------------------------------------ |
-| ACTIVE | 0 | Mission continuation is activated for the current application. |
-| INACTIVE | 1 | Mission continuation is not activated for the current application. |
+| ACTIVE | 0 | Continuation is activated for the current mission. |
+| INACTIVE | 1 | Continuation is not activated for the current mission. |
diff --git a/en/application-dev/reference/apis/js-apis-enterprise-adminManager.md b/en/application-dev/reference/apis/js-apis-enterprise-adminManager.md
index 5732b77f4e588562bab5c38abd408a3ebbe06592..7a1cea98fb81351f799e7289d1a71b8d8b67c647 100644
--- a/en/application-dev/reference/apis/js-apis-enterprise-adminManager.md
+++ b/en/application-dev/reference/apis/js-apis-enterprise-adminManager.md
@@ -943,6 +943,102 @@ adminManager.unsubscribeManagedEvent(wantTemp, events).then(() => {
})
```
+## adminManager.authorizeAdmin10+
+
+authorizeAdmin(admin: Want, bundleName: string, callback: AsyncCallback<void>): void
+
+Authorizes the administrator rights to an application through the specified device administrator application. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----- | ----------------------------------- | ---- | ------- |
+| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
+| bundleName | string | Yes| Bundle name of the application to be authorized with the administrator rights.|
+| callback | AsyncCallback<void> | Yes| Callback invoked to return the result. If the operation 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).
+
+| ID| Error Message |
+| ------- | ----------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+| 9200009 | authorize permission to the application failed. |
+
+**Example**
+
+```js
+let wantTemp = {
+ bundleName: 'bundleName',
+ abilityName: 'abilityName',
+};
+let bundleName: string = "com.example.application";
+adminManager.authorizeAdmin(wantTemp, bundleName, (err) => {
+ if (err) {
+ console.error(`Failed to authorize permission to the application. Code: ${err.code}, message: ${err.message}`);
+ return;
+ }
+ console.info('Successfully authorized permission to the application');
+});
+```
+
+## adminManager.authorizeAdmin10+
+
+authorizeAdmin(admin: Want, bundleName: string): Promise<void>
+
+Authorizes the administrator rights to an application through the specified device administrator application. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----- | ----------------------------------- | ---- | ------- |
+| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
+| bundleName | string | Yes| Bundle name of the application to be authorized with the administrator rights.|
+
+**Return value**
+
+| Type | Description |
+| ----- | ----------------------------------- |
+| Promise<void> | Promise that returns no value. If the operation fails, an error object will be thrown.|
+
+**Error codes**
+
+For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
+
+| ID| Error Message |
+| ------- | ----------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+| 9200009 | authorize permission to the application failed. |
+
+**Example**
+
+```js
+let wantTemp = {
+ bundleName: 'bundleName',
+ abilityName: 'abilityName',
+};
+let bundleName: string = "com.example.application";
+adminManager.authorizeAdmin(wantTemp, bundleName).then(() => {
+}).catch((err) => {
+ console.error(`Failed to authorize permission to the application. Code: ${err.code}, message: ${err.message}`);
+})
+```
+
## EnterpriseInfo
Represents the enterprise information of a device administrator application.
diff --git a/en/application-dev/reference/apis/js-apis-file-fs.md b/en/application-dev/reference/apis/js-apis-file-fs.md
index 5effa68ff47127104f00d7d9113104470f027b91..3e783a185818183eb33d3419cf5bbb6f0d47cfa2 100644
--- a/en/application-dev/reference/apis/js-apis-file-fs.md
+++ b/en/application-dev/reference/apis/js-apis-file-fs.md
@@ -2687,7 +2687,7 @@ Represents detailed file information. Before calling any API of the **Stat()** c
| Name | Type | Readable | Writable | Description |
| ------ | ------ | ---- | ---- | ---------------------------------------- |
| ino | number | Yes | No | File ID. Different files on the same device have different **ino**s.| |
-| mode | number | Yes | No | File permissions. The meaning of each bit is as follows: - **0o400**: The owner has the read permission on a regular file or a directory entry. - **0o200**: The owner has the permission to write a regular file or create and delete a directory entry. - **0o100**: The owner has the permission to execute a regular file or search for the specified path in a directory. - **0o040**: The user group has the read permission on a regular file or a directory entry. - **0o020**: The user group has the permission to write a regular file or create and delete a directory entry. - **0o010**: The user group has the permission to execute a regular file or search for the specified path in a directory. - **0o004**: Other users have the permission to read a regular file or read a directory entry. - **0o002**: Other users have the permission to write a regular file or create and delete a directory entry. - **0o001**: Other users have the permission to execute a regular file or search for the specified path in a directory.|
+| mode | number | Yes | No | File permissions. The meaning of each bit is as follows: **NOTE** The following values are in octal format. The returned values are in decimal format. You need to convert the values. - **0o400**: The owner has the permission to read a regular file or a directory entry. - **0o200**: The owner has the permission to write a regular file or create and delete a directory entry. - **0o100**: The owner has the permission to execute a regular file or search for the specified path in a directory. - **0o040**: The user group has the permission to read a regular file or a directory entry. - **0o020**: The user group has the permission to write a regular file or create and delete a directory entry. - **0o010**: The user group has the permission to execute a regular file or search for the specified path in a directory. - **0o004**: Other users have the permission to read a regular file or a directory entry. - **0o002**: Other users have the permission to write a regular file or create and delete a directory entry. - **0o001**: Other users have the permission to execute a regular file or search for the specified path in a directory.|
| uid | number | Yes | No | ID of the file owner.|
| gid | number | Yes | No | ID of the user group of the file.|
| size | number | Yes | No | File size, in bytes. This parameter is valid only for regular files. |
diff --git a/en/application-dev/reference/apis/js-apis-font.md b/en/application-dev/reference/apis/js-apis-font.md
index f63ae0b839e472b9b6c11db6b6da4684507b11c6..6ed6b13fbe3c9e05d9fb0afb1c802770fe7044d1 100644
--- a/en/application-dev/reference/apis/js-apis-font.md
+++ b/en/application-dev/reference/apis/js-apis-font.md
@@ -54,7 +54,7 @@ struct FontExample {
// Both familyName and familySrc support the string type.
font.registerFont({
familyName: 'medium',
- familySrc: '/font/medium.ttf'
+ familySrc: '/font/medium.ttf' // The font file is at the same level as the pages directory.
})
// Both familyName and familySrc support the Resource type.
@@ -138,7 +138,7 @@ Obtains information about a system font based on the font name.
| ---------------- | ---------------------------- |
| FontInfo | Information about the system font. |
-## FontInfo
+## FontInfo10+
**System capability**: SystemCapability.ArkUI.ArkUI.Full
@@ -170,7 +170,7 @@ struct FontExample {
Column() {
Button("getFontByName")
.onClick(() => {
- this.fontInfo = font.getFontByName('HarmonyOS Sans Italic')
+ this.fontInfo = font.getFontByName('Sans Italic')
console.log("getFontByName(): path = " + this.fontInfo.path)
console.log("getFontByName(): postScriptName = " + this.fontInfo.postScriptName)
console.log("getFontByName(): fullName = " + this.fontInfo.fullName)
diff --git a/en/application-dev/reference/apis/js-apis-geoLocationManager.md b/en/application-dev/reference/apis/js-apis-geoLocationManager.md
index 263a1a525e0fa1dffcbd9e79703d2d359ac49dcc..647a3cb04a224a8ac0f0ca828ab79297f8d8ead8 100644
--- a/en/application-dev/reference/apis/js-apis-geoLocationManager.md
+++ b/en/application-dev/reference/apis/js-apis-geoLocationManager.md
@@ -53,7 +53,7 @@ Defines a reverse geocoding request.
| locale | string | Yes| Yes| Language used for the location description. **zh** indicates Chinese, and **en** indicates English.|
| latitude | number | Yes| Yes| Latitude information. A positive value indicates north latitude, and a negative value indicates south latitude. The value ranges from **-90** to **90**.|
| longitude | number | Yes| Yes| Longitude information. A positive value indicates east longitude , and a negative value indicates west longitude . The value ranges from **-180** to **180**.|
-| maxItems | number | Yes| Yes| Maximum number of location records to be returned. The value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
+| maxItems | number | Yes| Yes| Maximum number of location records to be returned. The specified value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
## GeoCodeRequest
@@ -66,7 +66,7 @@ Defines a geocoding request.
| -------- | -------- | -------- | -------- | -------- |
| locale | string | Yes| Yes| Language used for the location description. **zh** indicates Chinese, and **en** indicates English.|
| description | string | Yes| Yes| Location description, for example, **No. xx, xx Road, Pudong New District, Shanghai**.|
-| maxItems | number | Yes| Yes| Maximum number of location records to be returned. The value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
+| maxItems | number | Yes| Yes| Maximum number of location records to be returned. The specified value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
| minLatitude | number | Yes| Yes| Minimum latitude. This parameter is used with **minLongitude**, **maxLatitude**, and **maxLongitude** to specify the latitude and longitude ranges. The value ranges from **-90** to **90**.|
| minLongitude | number | Yes| Yes| Minimum longitude. The value ranges from **-180** to **180**.|
| maxLatitude | number | Yes| Yes| Maximum latitude. The value ranges from **-90** to **90**.|
@@ -98,7 +98,7 @@ Defines a geographic location.
| phoneNumber | string | Yes| No| Phone number.|
| addressUrl | string | Yes| No| Website URL.|
| descriptions | Array<string> | Yes| No| Additional descriptions.|
-| descriptionsSize | number | Yes| No| Total number of additional descriptions. The value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
+| descriptionsSize | number | Yes| No| Total number of additional descriptions. The specified value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
| isFromMock | Boolean | Yes| No| Whether the geographical name is from the mock reverse geocoding function. **System API**: This is a system API.|
@@ -110,11 +110,11 @@ Defines a location request.
| Name| Type| Readable|Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| priority | [LocationRequestPriority](#locationrequestpriority) | Yes| Yes| Priority of the location request. For details about the value range, see [LocationRequestPriority](#locationrequestpriority).|
-| scenario | [LocationRequestScenario](#locationrequestscenario) | Yes| Yes| Scenario of the location request. For details about the value range, see [LocationRequestScenario](#locationrequestscenario).|
-| timeInterval | number | Yes| Yes| Time interval at which location information is reported, in seconds. The value must be greater than **0**.|
-| distanceInterval | number | Yes| Yes| Distance interval at which location information is reported. The value must be greater than **0**, in meters.|
-| maxAccuracy | number | Yes| Yes| Location accuracy. This parameter is valid only when the precise location function is enabled, and is invalid when the approximate location function is enabled. The value must be greater than **0**.|
+| priority | [LocationRequestPriority](#locationrequestpriority) | Yes| Yes| Priority of the location request. This parameter is effective only when **scenario** is set to **UNSET**. If this parameter and **scenario** are set to **UNSET**, the attempt to initiate a location request will fail. For details about the value range, see [LocationRequestPriority](#locationrequestpriority).|
+| scenario | [LocationRequestScenario](#locationrequestscenario) | Yes| Yes| Scenario of the location request. The **priority** parameter is effective only when this parameter is set to **UNSET**. If this parameter and **priority** are set to **UNSET**, the attempt to initiate a location request will fail. For details about the value range, see [LocationRequestScenario](#locationrequestscenario).|
+| timeInterval | number | Yes| Yes| Time interval at which location information is reported, in seconds. The specified value must be greater than or equal to **0**. The default value is **1**.|
+| distanceInterval | number | Yes| Yes| Distance interval at which location information is reported, in meters. The specified value must be greater than or equal to **0**. The default value is **0**.|
+| maxAccuracy | number | Yes| Yes| Location accuracy, in meters. This parameter is valid only when the precise location function is enabled, and is invalid when the approximate location function is enabled. The specified value must be greater than or equal to **0**. The default value is **0**.|
## CurrentLocationRequest
@@ -125,10 +125,10 @@ Defines the current location request.
| Name| Type| Readable|Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| priority | [LocationRequestPriority](#locationrequestpriority) | Yes| Yes| Priority of the location request. For details about the value range, see [LocationRequestPriority](#locationrequestpriority).|
-| scenario | [LocationRequestScenario](#locationrequestscenario) | Yes| Yes| Scenario of the location request. For details about the value range, see [LocationRequestScenario](#locationrequestscenario).|
-| maxAccuracy | number | Yes| Yes| Location accuracy, in meters. This parameter is valid only when the precise location function is enabled, and is invalid when the approximate location function is enabled. The value must be greater than **0**.|
-| timeoutMs | number | Yes| Yes| Timeout duration, in milliseconds. The minimum value is **1000**. The value must be greater than or equal to **1000**.|
+| priority | [LocationRequestPriority](#locationrequestpriority) | Yes| Yes| Priority of the location request. This parameter is effective only when **scenario** is set to **UNSET**. If this parameter and **scenario** are set to **UNSET**, the attempt to initiate a location request will fail. For details about the value range, see [LocationRequestPriority](#locationrequestpriority).|
+| scenario | [LocationRequestScenario](#locationrequestscenario) | Yes| Yes| Scenario of the location request. The **priority** parameter is effective only when this parameter is set to **UNSET**. If this parameter and **priority** are set to **UNSET**, the attempt to initiate a location request will fail. For details about the value range, see [LocationRequestScenario](#locationrequestscenario).|
+| maxAccuracy | number | Yes| Yes| Location accuracy, in meters. This parameter is valid only when the precise location function is enabled, and is invalid when the approximate location function is enabled. The specified value must be greater than or equal to **0**. The default value is **0**.|
+| timeoutMs | number | Yes| Yes| Timeout duration, in milliseconds. The minimum value is **1000**. The specified value must be greater than or equal to **1000**.|
## SatelliteStatusInfo
@@ -139,23 +139,23 @@ Defines the satellite status information.
| Name| Type| Readable|Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| satellitesNumber | number | Yes| No| Number of satellites. The value must be greater than or equal to **0**.|
-| satelliteIds | Array<number> | Yes| No| Array of satellite IDs. The value must be greater than or equal to **0**.|
-| carrierToNoiseDensitys | Array<number> | Yes| No| Carrier-to-noise density ratio, that is, **cn0**. The value must be greater than **0**.|
+| satellitesNumber | number | Yes| No| Number of satellites. The specified value must be greater than or equal to **0**.|
+| satelliteIds | Array<number> | Yes| No| Array of satellite IDs. The specified value must be greater than or equal to **0**.|
+| carrierToNoiseDensitys | Array<number> | Yes| No| Carrier-to-noise density ratio, that is, **cn0**. The specified value must be greater than **0**.|
| altitudes | Array<number> | Yes| No| Satellite altitude angle information. The value ranges from **-90** to **90**, in degrees.|
| azimuths | Array<number> | Yes| No| Azimuth information. The value ranges from **0** to **360**, in degrees.|
-| carrierFrequencies | Array<number> | Yes| No| Carrier frequency. The value must be greater than or equal to **0**, in Hz.|
+| carrierFrequencies | Array<number> | Yes| No| Carrier frequency, in Hz. The specified value must be greater than or equal to **0**.|
## CachedGnssLocationsRequest
-Represents a request for reporting cached GNSS locations.
+Defines a request for reporting cached GNSS locations.
**System capability**: SystemCapability.Location.Location.Gnss
| Name| Type| Readable|Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| reportingPeriodSec | number | Yes| Yes| Interval for reporting the cached GNSS locations, in milliseconds. The value must be greater than **0**.|
+| reportingPeriodSec | number | Yes| Yes| Interval for reporting the cached GNSS locations, in milliseconds. The specified value must be greater than **0**.|
| wakeUpCacheQueueFull | boolean | Yes| Yes | **true**: reports the cached GNSS locations to the application when the cache queue is full. **false**: discards the cached GNSS locations when the cache queue is full.|
@@ -169,13 +169,13 @@ Defines a GNSS geofence. Currently, only circular geofences are supported.
| -------- | -------- | -------- | -------- | -------- |
| latitude | number | Yes| Yes|Latitude information. The value ranges from **-90** to **90**.|
| longitude | number | Yes|Yes| Longitude information. The value ranges from **-180** to **180**.|
-| radius | number | Yes|Yes| Radius of a circular geofence. The value must be greater than **0**, in meters.|
-| expiration | number | Yes|Yes| Expiration period of a geofence, in milliseconds. The value must be greater than **0**.|
+| radius | number | Yes|Yes| Radius of a circular geofence, in meters. The specified value must be greater than **0**.|
+| expiration | number | Yes|Yes| Expiration period of a geofence, in milliseconds. The specified value must be greater than **0**.|
## GeofenceRequest
-Represents a GNSS geofencing request.
+Defines a GNSS geofencing request.
**System capability**: SystemCapability.Location.Location.Geofence
@@ -214,17 +214,17 @@ Defines a location.
| direction | number | Yes| No| Direction information. The value ranges from **0** to **360**, in degrees.|
| timeSinceBoot | number | Yes| No| Location timestamp since boot.|
| additions | Array<string> | Yes| No| Additional description.|
-| additionSize | number | Yes| No| Number of additional descriptions. The value must be greater than or equal to **0**. |
+| additionSize | number | Yes| No| Number of additional descriptions. The specified value must be greater than or equal to **0**. |
| isFromMock | Boolean | Yes| No| Whether the location information is from the mock location function. **System API**: This is a system API.|
## ReverseGeocodingMockInfo
-Represents information of the mock reverse geocoding function.
+Defines the configuration of the mock reverse geocoding function.
**System capability**: SystemCapability.Location.Location.Core
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
| Name| Type| Readable|Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
@@ -234,21 +234,21 @@ Represents information of the mock reverse geocoding function.
## LocationMockConfig
-Represents the information of the mock location function.
+Defines the configuration of the mock location function.
**System capability**: SystemCapability.Location.Location.Core
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
| Name| Type| Readable|Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| timeInterval | number | Yes| Yes| Interval at which mock locations are reported, in seconds.|
+| timeInterval | number | Yes| Yes| Time interval at which mock locations are reported, in seconds.|
| locations | Array<[Location](#location)> | Yes| Yes| Array of mocked locations.|
## CountryCode
-Represents country code information.
+Defines the country code information.
**System capability**: SystemCapability.Location.Location.Core
@@ -258,6 +258,69 @@ Represents country code information.
| type | [CountryCodeType](#countrycodetype) | Yes| No| Country code source.|
+## LocatingRequiredDataConfig10+
+
+Defines the configuration for obtaining the required data of the location service.
+
+**System capability**: SystemCapability.Location.Location.Core
+
+**System API**: This is a system API.
+
+| Name| Type| Readable|Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| type | [LocatingRequiredDataType](#locatingrequireddatatype10) | Yes| Yes| Type of the required data.|
+| needStartScan | boolean | Yes| Yes| Whether to initiate scanning.|
+| scanInterval | number | Yes| Yes| Scanning interval, in milliseconds. The specified value must be greater than **0**. The default value is **10000**.|
+| scanTimeout | number | Yes| Yes| Scanning timeout interval, in milliseconds. The value ranges from **0** to **600000**. The default value is **10000**.|
+
+
+## LocatingRequiredData10+
+
+Defines the required data of the location service, including the Wi-Fi or Bluetooth scanning result. After obtaining the data, an application can use the data for services such as network positioning.
+
+**System capability**: SystemCapability.Location.Location.Core
+
+**System API**: This is a system API.
+
+| Name| Type| Readable|Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| wifiData | [WifiScanInfo](#wifiscaninfo10) | Yes| No| Wi-Fi scanning result.|
+| bluetoothData | [BluetoothScanInfo](#bluetoothscaninfo10) | Yes| No| Bluetooth scanning result.|
+
+
+## WifiScanInfo10+
+
+Defines the Wi-Fi scanning information, including the SSID, BSSID, and RSSI of the scanned Wi-Fi hotspot.
+
+**System capability**: SystemCapability.Location.Location.Core
+
+**System API**: This is a system API.
+
+| Name| Type| Readable|Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| ssid | string | Yes| No| Service set identifier (SSID) of a Wi-Fi hotspot, in UTF-8 format.|
+| bssid | string | Yes| No| Base station subsystem identifier (BSSID) of a Wi-Fi hotspot.|
+| rssi | number | Yes| No| Received signal strength indicator (RSSI) of a Wi-Fi hotspot, in dBm.|
+| frequency | number | Yes| No| Frequency of a Wi-Fi hotspot.|
+| timestamp | number | Yes| No| Scanning timestamp.|
+
+
+## BluetoothScanInfo10+
+
+Defines the Bluetooth scanning information.
+
+**System capability**: SystemCapability.Location.Location.Core
+
+**System API**: This is a system API.
+
+| Name| Type| Readable|Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| deviceName | string | Yes| No| Name of a Bluetooth device.|
+| macAddress | string | Yes| No| MAC address of a Bluetooth device.|
+| rssi | number | Yes| No| Signal strength of a Bluetooth device, in dBm.|
+| timestamp | number | Yes| No| Scanning timestamp.|
+
+
## LocationRequestPriority
Sets the priority of the location request.
@@ -294,7 +357,7 @@ Defines the privacy statement type.
**System capability**: SystemCapability.Location.Location.Core
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
| Name| Value| Description|
| -------- | -------- | -------- |
@@ -305,7 +368,7 @@ Defines the privacy statement type.
## CountryCodeType
-Represents the country code source type.
+Defines the country code source type.
**System capability**: SystemCapability.Location.Location.Core
@@ -317,11 +380,25 @@ Represents the country code source type.
| COUNTRY_CODE_FROM_NETWORK | 4 | Country code obtained from the cellular network registration information.|
+## LocatingRequiredDataType10+
+
+Defines the type of the required data of the location service.
+
+**System capability**: SystemCapability.Location.Location.Core
+
+**System API**: This is a system API.
+
+| Name| Value| Description|
+| -------- | -------- | -------- |
+| WIFI | 1 | Wi-Fi scanning information.|
+| BLUETOOTH | 2 | Bluetooth scanning information.|
+
+
## geoLocationManager.on('locationChange')
on(type: 'locationChange', request: LocationRequest, callback: Callback<Location>): void
-Registers a listener for location changes with a location request initiated.
+Subscribes to location change events with a location request initiated.
**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
@@ -331,13 +408,13 @@ Registers a listener for location changes with a location request initiated.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **locationChange** indicates a location change event.|
+ | type | string | Yes| Event type. The value **locationChange** indicates a location change.|
| request | [LocationRequest](#locationrequest) | Yes| Location request.|
- | callback | Callback<[Location](#location)> | Yes| Callback used to return the location change event.|
+ | callback | Callback<[Location](#location)> | Yes| Callback used to receive location change events.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -349,7 +426,7 @@ For details about the following error codes, see [Location Error Codes](../error
```ts
import geoLocationManager from '@ohos.geoLocationManager';
- let requestInfo = {'priority': 0x203, 'scenario': 0x300, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0};
+ let requestInfo = {'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, 'scenario': geoLocationManager.LocationRequestScenario.UNSET, 'timeInterval': 1, 'distanceInterval': 0, 'maxAccuracy': 0};
let locationChange = (location) => {
console.log('locationChanger: data: ' + JSON.stringify(location));
};
@@ -366,7 +443,7 @@ For details about the following error codes, see [Location Error Codes](../error
off(type: 'locationChange', callback?: Callback<Location>): void
-Unregisters the listener for location changes with the corresponding location request deleted.
+Unsubscribes from location change events with the corresponding location request deleted.
**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
@@ -376,12 +453,12 @@ Unregisters the listener for location changes with the corresponding location re
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **locationChange** indicates a location change event.|
+ | type | string | Yes| Event type. The value **locationChange** indicates a location change.|
| callback | Callback<[Location](#location)> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -393,7 +470,7 @@ For details about the following error codes, see [Location Error Codes](../error
```ts
import geoLocationManager from '@ohos.geoLocationManager';
- let requestInfo = {'priority': 0x203, 'scenario': 0x300, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0};
+ let requestInfo = {'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, 'scenario': geoLocationManager.LocationRequestScenario.UNSET, 'timeInterval': 1, 'distanceInterval': 0, 'maxAccuracy': 0};
let locationChange = (location) => {
console.log('locationChanger: data: ' + JSON.stringify(location));
};
@@ -410,7 +487,7 @@ For details about the following error codes, see [Location Error Codes](../error
on(type: 'locationEnabledChange', callback: Callback<boolean>): void
-Registers a listener for location service status change events.
+Subscribes to location service status change events.
**System capability**: SystemCapability.Location.Location.Core
@@ -418,12 +495,12 @@ Registers a listener for location service status change events.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **locationEnabledChange** indicates a location service status change event.|
- | callback | Callback<boolean> | Yes| Callback used to return the location service status change event.|
+ | type | string | Yes| Event type. The value **locationEnabledChange** indicates a location service status change.|
+ | callback | Callback<boolean> | Yes| Callback used to receive location service status change events.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -448,7 +525,7 @@ For details about the following error codes, see [Location Error Codes](../error
off(type: 'locationEnabledChange', callback?: Callback<boolean>): void;
-Unregisters the listener for location service status change events.
+Unsubscribes from location service status change events.
**System capability**: SystemCapability.Location.Location.Core
@@ -456,12 +533,12 @@ Unregisters the listener for location service status change events.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **locationEnabledChange** indicates a location service status change event.|
+ | type | string | Yes| Event type. The value **locationEnabledChange** indicates a location service status change.|
| callback | Callback<boolean> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -487,7 +564,7 @@ For details about the following error codes, see [Location Error Codes](../error
on(type: 'cachedGnssLocationsChange', request: CachedGnssLocationsRequest, callback: Callback<Array<Location>>): void;
-Registers a listener for cached GNSS location reports.
+Subscribes to cached GNSS location reports.
**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
@@ -499,11 +576,11 @@ Registers a listener for cached GNSS location reports.
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **cachedGnssLocationsChange** indicates reporting of cached GNSS locations.|
| request | [CachedGnssLocationsRequest](#cachedgnsslocationsrequest) | Yes| Request for reporting cached GNSS location.|
- | callback | Callback<boolean> | Yes| Callback used to return cached GNSS locations.|
+ | callback | Callback<boolean> | Yes| Callback used to receive cached GNSS locations.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -531,7 +608,7 @@ For details about the following error codes, see [Location Error Codes](../error
off(type: 'cachedGnssLocationsChange', callback?: Callback<Array<Location>>): void;
-Unregisters the listener for cached GNSS location reports.
+Unsubscribes from cached GNSS location reports.
**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
@@ -546,7 +623,7 @@ Unregisters the listener for cached GNSS location reports.
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -575,7 +652,7 @@ For details about the following error codes, see [Location Error Codes](../error
on(type: 'satelliteStatusChange', callback: Callback<SatelliteStatusInfo>): void;
-Registers a listener for GNSS satellite status change events.
+Subscribes to GNSS satellite status change events.
**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
@@ -585,12 +662,12 @@ Registers a listener for GNSS satellite status change events.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **satelliteStatusChange** indicates a GNSS satellite status change event.|
- | callback | Callback<[SatelliteStatusInfo](#satellitestatusinfo)> | Yes| Callback used to return GNSS satellite status changes.|
+ | type | string | Yes| Event type. The value **satelliteStatusChange** indicates a GNSS satellite status change.|
+ | callback | Callback<[SatelliteStatusInfo](#satellitestatusinfo)> | Yes| Callback used to receive GNSS satellite status change events.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -617,7 +694,7 @@ For details about the following error codes, see [Location Error Codes](../error
off(type: 'satelliteStatusChange', callback?: Callback<SatelliteStatusInfo>): void;
-Unregisters the listener for GNSS satellite status change events.
+Unsubscribes from GNSS satellite status change events.
**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
@@ -627,12 +704,12 @@ Unregisters the listener for GNSS satellite status change events.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **satelliteStatusChange** indicates a GNSS satellite status change event.|
+ | type | string | Yes| Event type. The value **satelliteStatusChange** indicates a GNSS satellite status change.|
| callback | Callback<[SatelliteStatusInfo](#satellitestatusinfo)> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -660,7 +737,7 @@ For details about the following error codes, see [Location Error Codes](../error
on(type: 'nmeaMessage', callback: Callback<string>): void;
-Registers a listener for GNSS NMEA message change events.
+Subscribes to GNSS NMEA message change events.
**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
@@ -670,12 +747,12 @@ Registers a listener for GNSS NMEA message change events.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **nmeaMessage** indicates a GNSS NMEA message change event.|
- | callback | Callback<string> | Yes| Callback used to return GNSS NMEA message changes.|
+ | type | string | Yes| Event type. The value **nmeaMessage** indicates a GNSS NMEA message change.|
+ | callback | Callback<string> | Yes| Callback used to receive GNSS NMEA message change events.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -703,7 +780,7 @@ For details about the following error codes, see [Location Error Codes](../error
off(type: 'nmeaMessage', callback?: Callback<string>): void;
-Unregisters the listener for GNSS NMEA message change events.
+Unsubscribes from GNSS NMEA message change events.
**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
@@ -713,12 +790,12 @@ Unregisters the listener for GNSS NMEA message change events.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **nmeaMessage** indicates a GNSS NMEA message change event.|
+ | type | string | Yes| Event type. The value **nmeaMessage** indicates a GNSS NMEA message change.|
| callback | Callback<string> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -747,7 +824,7 @@ For details about the following error codes, see [Location Error Codes](../error
on(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void;
-Registers a listener for status change events of the specified geofence.
+Subscribes to status change events of the specified geofence.
**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
@@ -757,13 +834,13 @@ Registers a listener for status change events of the specified geofence.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **gnssFenceStatusChange** indicates a geofence status change event.|
+ | type | string | Yes| Event type. The value **gnssFenceStatusChange** indicates a geofence status change.|
| request | [GeofenceRequest](#geofencerequest) | Yes| Geofencing request.|
- | want | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes| **WantAgent** used to return geofence (entrance or exit) events.|
+ | want | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes| **WantAgent** used to receive geofence (entrance or exit) events.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -805,7 +882,7 @@ For details about the following error codes, see [Location Error Codes](../error
off(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void;
-Unregisters the listener for status change events of the specified geofence.
+Unsubscribes from status change events of the specified geofence.
**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
@@ -815,13 +892,13 @@ Unregisters the listener for status change events of the specified geofence.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **gnssFenceStatusChange** indicates a geofence status change event.|
+ | type | string | Yes| Event type. The value **gnssFenceStatusChange** indicates a geofence status change.|
| request | [GeofenceRequest](#geofencerequest) | Yes| Geofencing request.|
- | want | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes| **WantAgent** used to return geofence (entrance or exit) events.|
+ | want | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes| **WantAgent** used to receive geofence (entrance or exit) events.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -864,7 +941,7 @@ For details about the following error codes, see [Location Error Codes](../error
on(type: 'countryCodeChange', callback: Callback<CountryCode>): void;
-Registers a listener for country code change events.
+Subscribes to country code change events.
**System capability**: SystemCapability.Location.Location.Core
@@ -872,12 +949,12 @@ Registers a listener for country code change events.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **countryCodeChange** indicates a country code change event.|
- | callback | Callback<[CountryCode](#countrycode)> | Yes| Callback used to return the country code change event.|
+ | type | string | Yes| Event type. The value **countryCodeChange** indicates a country code change.|
+ | callback | Callback<[CountryCode](#countrycode)> | Yes| Callback used to receive country code change events.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -905,7 +982,7 @@ For details about the following error codes, see [Location Error Codes](../error
off(type: 'countryCodeChange', callback?: Callback<CountryCode>): void;
-Unregisters the listener for country code change events.
+Unsubscribes from country code change events.
**System capability**: SystemCapability.Location.Location.Core
@@ -913,12 +990,12 @@ Unregisters the listener for country code change events.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **countryCodeChange** indicates a country code change event.|
+ | type | string | Yes| Event type. The value **countryCodeChange** indicates a country code change.|
| callback | Callback<[CountryCode](#countrycode)> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -942,6 +1019,89 @@ For details about the following error codes, see [Location Error Codes](../error
```
+## geoLocationManager.on('locatingRequiredDataChange')10+
+
+on(type: 'locatingRequiredDataChange', config: LocatingRequiredDataConfig, callback: Callback<Array<LocatingRequiredData>>): void;
+
+Subscribes to changes in the required data of the location service, including Wi-Fi and Bluetooth scanning information. An application can then determine whether to enable Wi-Fi and Bluetooth scanning based on the return result.
+
+**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
+
+**System capability**: SystemCapability.Location.Location.Core
+
+**System API**: This is a system API.
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Event type. The value **locatingRequiredDataChange** indicates a change in the required data of the location service.|
+ | config | [LocatingRequiredDataConfig](#locatingrequireddataconfig10) | Yes| Configuration for obtaining the required data of the location service.|
+ | callback | Callback<Array<[LocatingRequiredData](#locatingrequireddata10)>> | Yes| Callback used to receive the required data of the location service.|
+
+**Error codes**
+
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------------------- |
+|3301800 | Failed to start WiFi or Bluetooth scanning. |
+
+**Example**
+
+ ```ts
+ import geoLocationManager from '@ohos.geoLocationManager';
+ let callback = (code) => {
+ console.log('locatingRequiredDataChange: ' + JSON.stringify(code));
+ }
+ let config = {'type': 1, 'needStartScan': true, 'scanInterval': 10000};
+ try {
+ geoLocationManager.on('locatingRequiredDataChange', config, callback);
+ } catch (err) {
+ console.error("errCode:" + err.code + ",errMessage:" + err.message);
+ }
+ ```
+
+
+## geoLocationManager.off('locatingRequiredDataChange')10+
+
+off(type: 'locatingRequiredDataChange', callback?: Callback<Array<LocatingRequiredData>>): void;
+
+Unsubscribes from changes in the required data of the location service and stops Wi-Fi and Bluetooth scanning.
+
+**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
+
+**System capability**: SystemCapability.Location.Location.Core
+
+**System API**: This is a system API.
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Event type. The value **locatingRequiredDataChange** indicates a change in the required data of the location service.|
+ | callback | Callback<Array<[LocatingRequiredData](#locatingrequireddata10)>> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
+
+**Error codes**
+
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+
+**Example**
+
+ ```ts
+ import geoLocationManager from '@ohos.geoLocationManager';
+ let callback = (code) => {
+ console.log('locatingRequiredDataChange: ' + JSON.stringify(code));
+ }
+ let config = {'type': 1, 'needStartScan': true, 'scanInterval': 10000};
+ try {
+ geoLocationManager.on('locatingRequiredDataChange', config, callback);
+ geoLocationManager.off('locatingRequiredDataChange', callback);
+ } catch (err) {
+ console.error("errCode:" + err.code + ",errMessage:" + err.message);
+ }
+ ```
+
## geoLocationManager.getCurrentLocation
@@ -958,11 +1118,11 @@ Obtains the current location. This API uses an asynchronous callback to return t
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| request | [CurrentLocationRequest](#currentlocationrequest) | Yes| Location request.|
- | callback | AsyncCallback<[Location](#location)> | Yes| Callback used to return the current location.|
+ | callback | AsyncCallback<[Location](#location)> | Yes| Callback used to receive the current location.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -974,7 +1134,7 @@ For details about the following error codes, see [Location Error Codes](../error
```ts
import geoLocationManager from '@ohos.geoLocationManager';
- let requestInfo = {'priority': 0x203, 'scenario': 0x300,'maxAccuracy': 0};
+ let requestInfo = {'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, 'scenario': geoLocationManager.LocationRequestScenario.UNSET,'maxAccuracy': 0};
let locationChange = (err, location) => {
if (err) {
console.log('locationChanger: err=' + JSON.stringify(err));
@@ -1005,11 +1165,11 @@ Obtains the current location. This API uses an asynchronous callback to return t
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<[Location](#location)> | Yes| Callback used to return the current location.|
+ | callback | AsyncCallback<[Location](#location)> | Yes| Callback used to receive the current location.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1061,7 +1221,7 @@ Obtains the current location. This API uses a promise to return the result.
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1073,7 +1233,7 @@ For details about the following error codes, see [Location Error Codes](../error
```ts
import geoLocationManager from '@ohos.geoLocationManager';
- let requestInfo = {'priority': 0x203, 'scenario': 0x300,'maxAccuracy': 0};
+ let requestInfo = {'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, 'scenario': geoLocationManager.LocationRequestScenario.UNSET,'maxAccuracy': 0};
try {
geoLocationManager.getCurrentLocation(requestInfo).then((result) => {
console.log('current location: ' + JSON.stringify(result));
@@ -1105,7 +1265,7 @@ Obtains the last location.
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1141,7 +1301,7 @@ Checks whether the location service is enabled.
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1165,7 +1325,7 @@ enableLocation(callback: AsyncCallback<void>): void;
Enables the location service. This API uses an asynchronous callback to return the result.
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
**Required permissions**: ohos.permission.MANAGE_SECURE_SETTINGS
@@ -1175,11 +1335,11 @@ Enables the location service. This API uses an asynchronous callback to return t
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<void> | Yes| Callback used to return the error message.|
+ | callback | AsyncCallback<void> | Yes| Callback used to receive the error message.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1207,7 +1367,7 @@ enableLocation(): Promise<void>
Enables the location service. This API uses a promise to return the result.
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
**Required permissions**: ohos.permission.MANAGE_SECURE_SETTINGS
@@ -1221,7 +1381,7 @@ Enables the location service. This API uses a promise to return the result.
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1249,7 +1409,7 @@ disableLocation(): void;
Disables the location service.
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
**Required permissions**: ohos.permission.MANAGE_SECURE_SETTINGS
@@ -1257,7 +1417,7 @@ Disables the location service.
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1275,7 +1435,6 @@ For details about the following error codes, see [Location Error Codes](../error
```
-
## geoLocationManager.getAddressesFromLocation
getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void
@@ -1289,11 +1448,11 @@ Converts coordinates into geographic description through reverse geocoding. This
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| request | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes| Reverse geocoding request.|
- | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes| Callback used to return the reverse geocoding result.|
+ | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes| Callback used to receive the reverse geocoding result.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1342,7 +1501,7 @@ Converts coordinates into geographic description through reverse geocoding. This
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1380,11 +1539,11 @@ Converts geographic description into coordinates through geocoding. This API use
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| request | [GeoCodeRequest](#geocoderequest) | Yes| Geocoding request.|
- | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes| Callback used to return the geocoding result.|
+ | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes| Callback used to receive the geocoding result.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1433,7 +1592,7 @@ Converts geographic description into coordinates through geocoding. This API use
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1473,7 +1632,7 @@ Obtains the (reverse) geocoding service status.
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1505,11 +1664,11 @@ Obtains the number of cached GNSS locations.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<number> | Yes| Callback used to return the number of cached GNSS locations. |
+ | callback | AsyncCallback<number> | Yes| Callback used to receive the number of cached GNSS locations. |
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1553,7 +1712,7 @@ Obtains the number of cached GNSS locations.
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1591,11 +1750,11 @@ Obtains all cached GNSS locations and clears the GNSS cache queue.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<void> | Yes| Callback used to return the error message.|
+ | callback | AsyncCallback<void> | Yes| Callback used to receive the error message.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1633,11 +1792,11 @@ Obtains all cached GNSS locations and clears the GNSS cache queue.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | Promise<void> | void | NA | Promise used to return the error code.|
+ | Promise<void> | void | NA | Promise used to receive the error code.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1675,11 +1834,11 @@ Sends an extended command to the location subsystem.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| command | [LocationCommand](#locationcommand) | Yes| Extended command (string) to be sent.|
- | callback | AsyncCallback<void> | Yes| Callback used to return the error code.|
+ | callback | AsyncCallback<void> | Yes| Callback used to receive the error code.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1720,11 +1879,11 @@ Sends an extended command to the location subsystem.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | Promise<void> | void | NA | Promise used to return the error code.|
+ | Promise<void> | void | NA | Promise used to receive the error code.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1760,11 +1919,11 @@ Obtains the current country code.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<[CountryCode](#countrycode)> | Yes| Callback used to return the country code.|
+ | callback | AsyncCallback<[CountryCode](#countrycode)> | Yes| Callback used to receive the country code.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1802,11 +1961,11 @@ Obtains the current country code.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | Promise<[CountryCode](#countrycode)> | [CountryCode](#countrycode) | NA | Promise used to return the country code.|
+ | Promise<[CountryCode](#countrycode)> | [CountryCode](#countrycode) | NA | Promise used to receive the country code.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1839,11 +1998,11 @@ Enables the mock location function.
**System capability**: SystemCapability.Location.Location.Core
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1870,11 +2029,11 @@ Disables the mock location function.
**System capability**: SystemCapability.Location.Location.Core
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1903,7 +2062,7 @@ This API can be invoked only after [geoLocationManager.enableLocationMock](#geol
**System capability**: SystemCapability.Location.Location.Core
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
**Parameters**
@@ -1913,7 +2072,7 @@ This API can be invoked only after [geoLocationManager.enableLocationMock](#geol
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1949,11 +2108,11 @@ Enables the mock reverse geocoding function.
**System capability**: SystemCapability.Location.Location.Core
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -1979,11 +2138,11 @@ Disables the mock geocoding function.
**System capability**: SystemCapability.Location.Location.Core
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -2011,7 +2170,7 @@ This API can be invoked only after [geoLocationManager.enableReverseGeocodingMoc
**System capability**: SystemCapability.Location.Location.Core
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
**Parameters**
@@ -2021,7 +2180,7 @@ This API can be invoked only after [geoLocationManager.enableReverseGeocodingMoc
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -2053,7 +2212,7 @@ isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean;
Checks whether a user agrees with the privacy statement of the location service. This API can only be called by system applications.
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
**System capability**: SystemCapability.Location.Location.Core
@@ -2067,11 +2226,11 @@ Checks whether a user agrees with the privacy statement of the location service.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | boolean | boolean | NA | Callback used to return the result, which indicates whether the user agrees with the privacy statement.|
+ | boolean | boolean | NA | Whether the user agrees with the privacy statement.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -2095,7 +2254,7 @@ setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean)
Sets the user confirmation status for the privacy statement of the location service. This API can only be called by system applications.
-**System API**: This is a system API and cannot be called by third-party applications.
+**System API**: This is a system API.
**Required permissions**: ohos.permission.MANAGE_SECURE_SETTINGS
@@ -2106,11 +2265,11 @@ Sets the user confirmation status for the privacy statement of the location serv
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [LocationPrivacyType](#locationprivacytype) | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when the location service is enabled.|
- | isConfirmed | boolean | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.|
+ | isConfirmed | boolean | Yes| Whether the user agrees with the privacy statement.|
**Error codes**
-For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
@@ -2126,3 +2285,53 @@ For details about the following error codes, see [Location Error Codes](../error
console.error("errCode:" + err.code + ",errMessage:" + err.message);
}
```
+
+
+## geoLocationManager.getLocatingRequiredData10+
+
+getLocatingRequiredData(config: LocatingRequiredDataConfig): Promise<Array<LocatingRequiredData>>;
+
+Obtains the required data of the location service. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
+
+**System capability**: SystemCapability.Location.Location.Core
+
+**System API**: This is a system API.
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | config | [LocatingRequiredDataConfig](#locatingrequireddataconfig10) | Yes| Configuration for obtaining the required data of the location service.|
+
+**Return value**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | Promise<Array<[LocatingRequiredData](#locatingrequireddata10)>> | [LocatingRequiredData](#locatingrequireddata10) | NA | Promise used to receive the required data of the location service, such as the Wi-Fi and Bluetooth scanning information.|
+
+**Error codes**
+
+For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
+
+| ID| Error Message|
+| -------- | ---------------------------------------- |
+|3301800 | Failed to start WiFi or Bluetooth scanning. |
+
+**Example**
+
+ ```ts
+ import geoLocationManager from '@ohos.geoLocationManager';
+ let config = {'type': 1, 'needStartScan': true, 'scanInterval': 10000};
+ try {
+ geoLocationManager.getLocatingRequiredData(config).then((result) => {
+ console.log('getLocatingRequiredData return: ' + JSON.stringify(result));
+ })
+ .catch((error) => {
+ console.log('promise, getLocatingRequiredData: error=' + JSON.stringify(error));
+ });
+ } catch (err) {
+ console.error("errCode:" + err.code + ",errMessage:" + err.message);
+ }
+ ```
diff --git a/en/application-dev/reference/apis/js-apis-hiappevent.md b/en/application-dev/reference/apis/js-apis-hiappevent.md
index e2ff3f6fa98d46577475cdaa86222b0eb3522b1f..ed0fdfc9c2f1a1d9e58683f19d11f7d2e9194f48 100644
--- a/en/application-dev/reference/apis/js-apis-hiappevent.md
+++ b/en/application-dev/reference/apis/js-apis-hiappevent.md
@@ -4,7 +4,7 @@ The **hiAppEvent** module provides the application event logging functions, such
> **NOTE**
>
-> - The APIs provided by this module are deprecated since API version 9. You are advised to use [`@ohos.hiviewdfx.hiAppEvent`](js-apis-hiviewdfx-hiappevent.md) instead.
+> - The APIs provided by this module are deprecated since API version 9. You are advised to use [`@ohos.hiviewdfx.hiAppEvent`](js-apis-hiviewdfx-hiappevent.md).
> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
@@ -20,7 +20,7 @@ Before using application event logging, you need to understand the requirements
**Event Name**
-An event name is a string that contains a maximum of 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (\_).
+An event name is a string that contains a maximum of 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter or dollar sign ($) and cannot end with an underscore (_).
**Event Type**
@@ -30,8 +30,8 @@ An event type is an enumerated value of [EventType](#eventtype).
An event parameter is an object in key-value pair format, where the key is the parameter name and the value is the parameter value. The requirements are as follows:
-- A parameter name is a string that contains a maximum of 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (\_).
-- The parameter value can be of the string, number, boolean, or array type.
+- A parameter name is a string that contains a maximum of 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter or dollar sign ($) and cannot end with an underscore (_).
+- A parameter value can be of the string, number, boolean, or array type.
- If the parameter value is a string, its maximum length is 8*1024 characters. If this limit is exceeded, excess characters will be discarded.
- If the parameter value is a number, the value must be within the range of **Number.MIN_SAFE_INTEGER** to **Number.MAX_SAFE_INTEGER**. Otherwise, uncertain values may be generated.
- If the parameter value is an array, the elements in the array must be of the same type, which can only be string, number, or boolean. In addition, the number of elements must be less than 100. If this limit is exceeded, excess elements will be discarded.
@@ -156,12 +156,12 @@ Provides the configuration items for application event logging.
| Name | Type | Mandatory| Description |
| ---------- | ------- | ---- | ------------------------------------------------------------ |
| disable | boolean | No | Application event logging switch. The value **true** means to disable the application event logging function, and the value **false** means the opposite.|
-| maxStorage | string | No | Maximum size of the event file storage directory. The default value is 10M . If the specified size is exceeded, the oldest event logging files in the directory will be deleted to free up space.|
+| maxStorage | string | No | Maximum size of the event file storage directory. The default value is **10M**. If the specified size is exceeded, the oldest event logging files in the directory will be deleted to free up space.|
## EventType
-Enumerates event types.
+Enumerates the event types.
**System capability**: SystemCapability.HiviewDFX.HiAppEvent
diff --git a/en/application-dev/reference/apis/js-apis-hidebug.md b/en/application-dev/reference/apis/js-apis-hidebug.md
index 896cee276b582a87806745accf135f74a38c057a..7eee03067795a058c83cfaac77e97cb26fbb4dfe 100644
--- a/en/application-dev/reference/apis/js-apis-hidebug.md
+++ b/en/application-dev/reference/apis/js-apis-hidebug.md
@@ -175,23 +175,30 @@ Obtains system service information.
```js
import fs from '@ohos.file.fs'
import hidebug from '@ohos.hidebug'
-import featureAbility from '@ohos.ability.featureAbility'
-
-let context = featureAbility.getContext();
-context.getFilesDir().then((data) => {
- var path = data + "/serviceInfo.txt";
- console.info("output path: " + path);
- let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
- var serviceId = 10;
- var args = new Array("allInfo");
- try {
- hidebug.getServiceDump(serviceId, file.fd, args);
- } catch (error) {
- console.info(error.code);
- console.info(error.message);
- }
- fs.closeSync(file);
-})
+import common from '@ohos.app.ability.common'
+
+let applicationContext: common.Context;
+try {
+ applicationContext = this.context.getApplicationContext();
+} catch (error) {
+ console.info(error.code);
+ console.info(error.message);
+}
+
+var filesDir = applicationContext.filesDir;
+var path = filesDir + "/serviceInfo.txt";
+console.info("output path: " + path);
+let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
+var serviceId = 10;
+var args = new Array("allInfo");
+
+try {
+ hidebug.getServiceDump(serviceId, file.fd, args);
+} catch (error) {
+ console.info(error.code);
+ console.info(error.message);
+}
+fs.closeSync(file);
```
## hidebug.startJsCpuProfiling9+
diff --git a/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md b/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md
index 03cad26cfecb5295b611d48fbc9f69862895ddb0..41d5566ed0ffaa6a9327f3da04e2c92c6a31465b 100644
--- a/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md
+++ b/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md
@@ -122,10 +122,10 @@ Defines parameters for an **AppEventInfo** object.
| Name | Type | Mandatory| Description |
| --------- | ----------------------- | ---- | ------------------------------------------------------------ |
-| domain | string | Yes | Event domain. Event domain name, which is a string of up to 32 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_).|
-| name | string | Yes | Event name. Event name, which is a string of up to 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_).|
+| domain | string | Yes | Event domain. The value is a string of up to 32 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_).|
+| name | string | Yes | Event name. The value is a string of up to 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter or dollar sign ($) and cannot end with an underscore (_).|
| eventType | [EventType](#eventtype) | Yes | Event type. |
-| params | object | Yes | Event parameter object, which consists of a parameter name and a parameter value. The specifications are as follows: - The parameter name is a string of up to 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_). - The parameter value can be a string, number, boolean, or array. If the parameter value is a string, its maximum length is 8*1024 characters. If this limit is exceeded, excess characters will be discarded. If the parameter value is a number, the value must be within the range of **Number.MIN_SAFE_INTEGER** to **Number.MAX_SAFE_INTEGER**. Otherwise, uncertain values may be generated. If the parameter value is an array, the elements in the array must be of the same type, which can only be string, number, or boolean. In addition, the number of elements must be less than 100. If this limit is exceeded, excess elements will be discarded. - The maximum number of parameters is 32. If this limit is exceeded, excess parameters will be discarded.|
+| params | object | Yes | Event parameter object, which consists of a parameter name and a parameter value. The specifications are as follows: - The parameter name is a string of up to 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter or dollar sign ($) and cannot end with an underscore (_). - The parameter value can be a string, number, boolean, or array. If the parameter value is a string, its maximum length is 8*1024 characters. If this limit is exceeded, excess characters will be discarded. If the parameter value is a number, the value must be within the range of **Number.MIN_SAFE_INTEGER** to **Number.MAX_SAFE_INTEGER**. Otherwise, uncertain values may be generated. If the parameter value is an array, the elements in the array must be of the same type, which can only be string, number, or boolean. In addition, the number of elements must be less than 100. If this limit is exceeded, excess elements will be discarded. - The maximum number of parameters is 32. If this limit is exceeded, excess parameters will be discarded.|
## hiAppEvent.configure
@@ -436,7 +436,7 @@ hiAppEvent.clearData();
## EventType
-Enumerates event types.
+Enumerates the event types.
**System capability**: SystemCapability.HiviewDFX.HiAppEvent
diff --git a/en/application-dev/reference/apis/js-apis-http.md b/en/application-dev/reference/apis/js-apis-http.md
index 50069e993211374ce83715a18f42f6bae26d2895..6f8d2c742f12ebd5d32855d72548266abc308160 100644
--- a/en/application-dev/reference/apis/js-apis-http.md
+++ b/en/application-dev/reference/apis/js-apis-http.md
@@ -86,7 +86,7 @@ Creates an HTTP request. You can use this API to initiate or destroy an HTTP req
| Type | Description |
| :---------- | :----------------------------------------------------------- |
-| HttpRequest | An **HttpRequest** object, which contains the **request**, **request2**, **destroy**, **on**, or **off** method.|
+| HttpRequest | An **HttpRequest** object, which contains the **request**, **requestInStream**, **destroy**, **on**, or **off** method.|
**Example**
@@ -364,9 +364,9 @@ Destroys an HTTP request.
httpRequest.destroy();
```
-### request210+
+### requestInStream10+
-request2(url: string, callback: AsyncCallback\): void
+requestInStream(url: string, callback: AsyncCallback\): void
Initiates an HTTP request containing specified options to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
@@ -424,18 +424,18 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Example**
```js
-httpRequest.request2("EXAMPLE_URL", (err, data) => {
+httpRequest.requestInStream("EXAMPLE_URL", (err, data) => {
if (!err) {
- console.info("request2 OK! ResponseCode is " + JSON.stringify(data));
+ console.info("requestInStream OK! ResponseCode is " + JSON.stringify(data));
} else {
- console.info("request2 ERROR : err = " + JSON.stringify(err));
+ console.info("requestInStream ERROR : err = " + JSON.stringify(err));
}
})
```
-### request210+
+### requestInStream10+
-request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\): void
+requestInStream(url: string, options: HttpRequestOptions, callback: AsyncCallback\): void
Initiates an HTTP request containing specified options to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
@@ -494,7 +494,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Example**
```js
-httpRequest.request2("EXAMPLE_URL",
+httpRequest.requestInStream("EXAMPLE_URL",
{
method: http.RequestMethod.GET,
header: {
@@ -504,16 +504,16 @@ httpRequest.request2("EXAMPLE_URL",
connectTimeout: 60000
}, (err, data) => {
if (!err) {
- console.info("request2 OK! ResponseCode is " + JSON.stringify(data));
+ console.info("requestInStream OK! ResponseCode is " + JSON.stringify(data));
} else {
- console.info("request2 ERROR : err = " + JSON.stringify(err));
+ console.info("requestInStream ERROR : err = " + JSON.stringify(err));
}
})
```
-### request210+
+### requestInStream10+
-request2(url: string, options? : HttpRequestOptions): Promise\
+requestInStream(url: string, options? : HttpRequestOptions): Promise\
Initiates an HTTP request containing specified options to a given URL. This API uses a promise to return the result, which is a streaming response.
@@ -577,7 +577,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Example**
```js
-let promise = httpRequest.request2("EXAMPLE_URL", {
+let promise = httpRequest.requestInStream("EXAMPLE_URL", {
method: http.RequestMethod.GET,
connectTimeout: 60000,
readTimeout: 60000,
@@ -586,9 +586,9 @@ let promise = httpRequest.request2("EXAMPLE_URL", {
}
});
promise.then((data) => {
- console.info("request2 OK!" + JSON.stringify(data));
+ console.info("requestInStream OK!" + JSON.stringify(data));
}).catch((err) => {
- console.info("request2 ERROR : err = " + JSON.stringify(err));
+ console.info("requestInStream ERROR : err = " + JSON.stringify(err));
});
```
@@ -815,9 +815,9 @@ Unregisters the observer for events indicating completion of receiving HTTP stre
httpRequest.off('dataEnd');
```
-### on('dataProgress')10+
+### on('dataReceiveProgress')10+
-on(type: 'dataProgress', callback: Callback\<{ receiveSize: number, totalSize: number }\>): void
+on(type: 'dataReceiveProgress', callback: Callback\<{ receiveSize: number, totalSize: number }\>): void
Registers an observer for events indicating progress of receiving HTTP streaming responses.
@@ -830,20 +830,20 @@ Registers an observer for events indicating progress of receiving HTTP streaming
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | --------------------------------- |
-| type | string | Yes | Event type. The value is **dataProgress**.|
+| type | string | Yes | Event type. The value is **dataReceiveProgress**.|
| callback | AsyncCallback\<{ receiveSize: number, totalSize: number }\> | Yes | Callback used to return the result. - **receiveSize**: number of received bytes. - **totalSize**: total number of bytes to be received.|
**Example**
```js
-httpRequest.on('dataProgress', (data) => {
- console.info('dataProgress:' + JSON.stringify(data));
+httpRequest.on('dataReceiveProgress', (data) => {
+ console.info('dataReceiveProgress:' + JSON.stringify(data));
});
```
-### off('dataProgress')10+
+### off('dataReceiveProgress')10+
-off(type: 'dataProgress', callback?: Callback\<{ receiveSize: number, totalSize: number }\>): void
+off(type: 'dataReceiveProgress', callback?: Callback\<{ receiveSize: number, totalSize: number }\>): void
Unregisters the observer for events indicating progress of receiving HTTP streaming responses.
@@ -856,13 +856,13 @@ Unregisters the observer for events indicating progress of receiving HTTP stream
| Name | Type | Mandatory| Description |
| -------- | ------------------ | ---- | -------------------------------------- |
-| type | string | Yes | Event type. The value is **dataProgress**.|
+| type | string | Yes | Event type. The value is **dataReceiveProgress**.|
| callback | Callback\<{ receiveSize: number, totalSize: number }\> | No | Callback used to return the result. |
**Example**
```js
-httpRequest.off('dataProgress');
+httpRequest.off('dataReceiveProgress');
```
## HttpRequestOptions6+
diff --git a/en/application-dev/reference/apis/js-apis-inner-application-MediaControlExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-MediaControlExtensionContext.md
new file mode 100644
index 0000000000000000000000000000000000000000..8bddcb5adb58f3968494957ae8fd494fbe5c7467
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-inner-application-MediaControlExtensionContext.md
@@ -0,0 +1,11 @@
+# MediaControlExtensionContext (ExtensionAbility Context for Media Playback Control)
+
+**MediaControlExtensionContext**, inherited from [UIExtensionContext](js-apis-inner-application-uiExtensionContext.md), provides the context environment for [MediaControlExtensionAbility](js-apis-app-ability-MediaControlExtensionAbility.md). It provides MediaControlExtensionAbility-related configuration and APIs for operating the MediaControlExtensionAbility. For example, you can use the APIs to start a MediaControlExtensionAbility.
+
+**System capability**: SystemCapability.Multimedia.AVSession.Core
+
+> **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.
+> - The APIs of this module can be used only in the stage model.
+> - The APIs provided by this module are system APIs.
diff --git a/en/application-dev/reference/apis/js-apis-matrix4.md b/en/application-dev/reference/apis/js-apis-matrix4.md
index 67864b311bd4fbf30b87e17abb84db12e24889be..7aea13609e2d96615d36668eddbd275960916133 100644
--- a/en/application-dev/reference/apis/js-apis-matrix4.md
+++ b/en/application-dev/reference/apis/js-apis-matrix4.md
@@ -27,7 +27,7 @@ Matrix constructor, which is used to create a 4 x 4 matrix by using the input pa
| Name| Type | Mandatory| Description |
| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| option | [number,number,number,number, number,number,number,number, number,number,number,number, number,number,number,number] | Yes | A number array whose length is 16 (4 x 4). For details, see **Description of a 4 x 4 matrix**. Default value: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] |
+| option | [number,number,number,number, number,number,number,number, number,number,number,number, number,number,number,number] | Yes | A number array whose length is 16 (4 x 4). For details, see **4 x 4 matrix description**. Default value: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] |
**Return value**
@@ -35,7 +35,7 @@ Matrix constructor, which is used to create a 4 x 4 matrix by using the input pa
| --------------------------------- | ---------------------------- |
| [Matrix4Transit](#matrix4transit) | 4 x 4 matrix object created based on the input parameter.|
-**Description of a 4 x 4 matrix**
+**4 x 4 matrix description**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | -------------------- |
@@ -150,6 +150,7 @@ import matrix4 from '@ohos.matrix4'
@Component
struct Test {
private matrix1 = matrix4.identity().translate({ x: 100 })
+ // Perform the scale operation on the copy matrix of matrix1, which does not affect matrix1.
private matrix2 = this.matrix1.copy().scale({ x: 2 })
build() {
@@ -305,7 +306,7 @@ This API is deprecated since API version 10.
combine(options: Matrix4Transit): Matrix4Transit
-Combines the effects of two matrices to generate a new matrix object.
+Combines the effects of two matrices to generate a new matrix object. The original matrix that calls this API will be changed.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
@@ -330,8 +331,8 @@ import matrix4 from '@ohos.matrix4'
@Entry
@Component
struct Test {
- private matrix1 = matrix4.identity().translate({ x: 200 }).copy()
- private matrix2 = matrix4.identity().scale({ x: 2 }).copy()
+ private matrix1 = matrix4.identity().translate({ x: 200 })
+ private matrix2 = matrix4.identity().scale({ x: 2 })
build() {
Column() {
@@ -342,7 +343,7 @@ struct Test {
.margin({ top: 50 })
// Translate the x-axis by 200px, and then scale it twice to obtain the resultant matrix.
Image($r("app.media.icon"))
- .transform(this.matrix1.combine(this.matrix2))
+ .transform(this.matrix1.copy().combine(this.matrix2))
.width("40%")
.height(100)
.margin({ top: 50 })
@@ -358,7 +359,7 @@ struct Test {
invert(): Matrix4Transit
-Inverts this matrix object.
+Inverts this matrix object. The original matrix that calls this API will be changed.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
@@ -374,7 +375,7 @@ Inverts this matrix object.
import matrix4 from '@ohos.matrix4'
// The effect of matrix 1 (width scaled up by 2x) is opposite to that of matrix 2 (width scaled down by 2x).
let matrix1 = matrix4.identity().scale({ x: 2 })
-let matrix2 = matrix1.invert()
+let matrix2 = matrix1.copy().invert()
@Entry
@Component
@@ -401,7 +402,7 @@ struct Tests {
translate(options: TranslateOption): Matrix4Transit
-Translates this matrix object along the x, y, and z axes.
+Translates this matrix object along the x, y, and z axes. The original matrix that calls this API will be changed.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
@@ -446,7 +447,7 @@ struct Test {
scale(options: ScaleOption): Matrix4Transit
-Scales this matrix object along the x, y, and z axes.
+Scales this matrix object along the x, y, and z axes. The original matrix that calls this API will be changed.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
@@ -490,7 +491,7 @@ struct Test {
rotate(options: RotateOption): Matrix4Transit
-Rotates this matrix object along the x, y, and z axes.
+Rotates this matrix object along the x, y, and z axes. The original matrix that calls this API will be changed.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
@@ -604,9 +605,9 @@ struct Test {
| Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ------------------------------------------------------------ |
-| x | number | No | Scaling multiple along the x-axis. If the value is greater than 1, the image is scaled up along the x-axis. If the value is less than 1, the image is scaled down along the x-axis. Default value: **1** Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the default value.|
-| y | number | No | Scaling multiple along the y-axis. If the value is greater than 1, the image is scaled up along the y-axis. If the value is less than 1, the image is scaled down along the y-axis. Default value: **1** Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the default value.|
-| z | number | No | Scaling multiple along the z-axis. If the value is greater than 1, the image is scaled up along the z-axis. If the value is less than 1, the image is scaled down along the z-axis. Default value: **1** Value range: [0, +∞) **NOTE** A value less than 0 evaluates to the default value.|
+| x | number | No | Scaling multiple along the x-axis. x > 1: The image is scaled up along the x-axis. 0 < x < 1: The image is scaled down along the x-axis. x < 0: The image is scaled in the reverse direction of the x-axis. Default value: **1** Value range: (-∞, +∞)|
+| y | number | No | Scaling multiple along the y-axis. y > 1: The image is scaled up along the y-axis. 0 < y < 1: The image is scaled down along the y-axis. y < 0: The image is scaled in the reverse direction of the y-axis. Default value: **1** Value range: (-∞, +∞)|
+| z | number | No | Scaling multiple along the z-axis. z > 1: The image is scaled up along the z-axis. 0 < z < 1: The image is scaled down along the z-axis. z < 0: The image is scaled in the reverse direction of the z-axis. Default value: **1** Value range: (-∞, +∞)|
| centerX | number | No | X coordinate of the center point. Default value: **0** Value range: (-∞, +∞) |
| centerY | number | No | Y coordinate of the center point. Default value: **0** Value range: (-∞, +∞) |
@@ -616,9 +617,9 @@ struct Test {
| Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ------------------------------------------------------- |
-| x | number | No | X coordinate of the rotation axis vector. Default value: **1** Value range: (-∞, +∞)|
-| y | number | No | Y coordinate of the rotation axis vector. Default value: **1** Value range: (-∞, +∞)|
-| z | number | No | Z coordinate of the rotation axis vector. Default value: **1** Value range: (-∞, +∞)|
+| x | number | No | X coordinate of the rotation axis vector. Default value: **0** Value range: (-∞, +∞)|
+| y | number | No | Y coordinate of the rotation axis vector. Default value: **0** Value range: (-∞, +∞)|
+| z | number | No | Z coordinate of the rotation axis vector. Default value: **0** Value range: (-∞, +∞) **NOTE** The rotation axis vector is valid only when at least one of **x**, **y**, and **z** is not 0.|
| angle | number | No | Rotation angle. Default value: **0** |
| centerX | number | No | X coordinate of the center point. Default value: **0** |
| centerY | number | No | Y coordinate of the center point. Default value: **0** |
diff --git a/en/application-dev/reference/apis/js-apis-measure.md b/en/application-dev/reference/apis/js-apis-measure.md
index 4b0eac439ab60844ca48f768ed768126b01d64da..3b379749cfe0fc234959acdd1da2da2632cd1ee8 100644
--- a/en/application-dev/reference/apis/js-apis-measure.md
+++ b/en/application-dev/reference/apis/js-apis-measure.md
@@ -116,7 +116,7 @@ Provides attributes of the measured text.
| constraintWidth10+ | number \| string \| [Resource](../arkui-ts/ts-types.md#resource) | No | Layout width of the measured text. The default unit is vp. |
| fontSize | number \| string \| [Resource](../arkui-ts/ts-types.md#resource) | No | Font size of the measured text. If the value is of the number type, the unit fp is used. Default value: **16fp** **NOTE** The value cannot be a percentage. |
| fontStyle | number \| [FontStyle](../arkui-ts/ts-appendix-enums.md#fontstyle) | No | Font style of the measured text. Default value: **FontStyle.Normal** |
-| fontWeight | number \| string \| [FontWeight](../arkui-ts/ts-appendix-enums.md#fontweight) | No | Font width of the measured text. For the number type, the value ranges from 100 to 900, at an interval of 100. The default value is **400**. A larger value indicates a heavier font weight. The string type supports only the string of the number type, for example, **400**, **"bold"**, **"bolder"**, **"lighter"**, **"regular"**, and **"medium"**, which correspond to the enumerated values in **FontWeight**. Default value: **FontWeight.Normal**|
+| fontWeight | number \| string \| [FontWeight](../arkui-ts/ts-appendix-enums.md#fontweight) | No | Font width of the measured text. For the number type, the value ranges from 100 to 900, at an interval of 100. A larger value indicates a heavier font weight. The default value is **400**. For the string type, only strings of the number type are supported, for example, **400**, **"bold"**, **"bolder"**, **"lighter"**, **"regular"**, and **"medium"**, which correspond to the enumerated values in **FontWeight**. Default value: **FontWeight.Normal**|
| fontFamily | string \| [Resource](../arkui-ts/ts-types.md#resource) | No | Font family of the measured text. Default value: **'HarmonyOS Sans'** Only the default font is supported.|
| letterSpacing | number \| string | No | Letter spacing of the measured text.|
| textAlign10+ | number \| [TextAlign](../arkui-ts/ts-appendix-enums.md#textalign) | No | Horizontal alignment mode of the measured text. Default value: **TextAlign.Start**|
diff --git a/en/application-dev/reference/apis/js-apis-medialibrary.md b/en/application-dev/reference/apis/js-apis-medialibrary.md
index 6edbbc62092208dec500e6e9e540209e3cd8272a..247f7fe55d79701c01435ae36bf63c7a505338e9 100644
--- a/en/application-dev/reference/apis/js-apis-medialibrary.md
+++ b/en/application-dev/reference/apis/js-apis-medialibrary.md
@@ -20,7 +20,7 @@ Obtains a **MediaLibrary** instance, which is used to access and modify personal
This API can be used only in the stage model.
> **NOTE**
-> This API is deprecated since API Version 9. Use [getPhotoAccessHelper](js-apis-photoAccessHelper.md#photoaccesshelpergetphotoaccesshelper) instead.
+> This API is deprecated since API version 9. Use [getPhotoAccessHelper](js-apis-photoAccessHelper.md#photoaccesshelpergetphotoaccesshelper) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -62,7 +62,7 @@ Obtains a **MediaLibrary** instance, which is used to access and modify personal
This API can be used only in the FA model.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+> This API is deprecated since API version 9. There is no substitute API.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -88,8 +88,8 @@ Obtains file assets (also called files). This API uses an asynchronous callback
> **NOTE**
>
-> - This API is deprecated since API Version 9. Use [getAssets](js-apis-photoAccessHelper.md#getassets) instead.
-> - From API version 10, the albums represented by physical directories are replaced by logical albums, which allows multiple files in an album and presence of a file in multiple albums. This design, however, makes **parent**, **albumId**, **albumUri**, and **albumName** incompatible. They cannot be used as parameters of **MediaFetchOptions** in **getFileAssets()**. For details, see [changelogs-mediaLibrary.md](../../../release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-mediaLibrary.md).
+> - This API is deprecated since API version 9. Use [getAssets](js-apis-photoAccessHelper.md#getassets) instead.
+> - From API version 10, the albums represented by physical directories are replaced by logical albums, which allow multiple files in an album and presence of a file in multiple albums. This design, however, makes **parent**, **albumId**, **albumUri**, and **albumName** incompatible. They cannot be used as parameters of **MediaFetchOptions** in **getFileAssets()**. For details, see [changelogs-mediaLibrary.md](../../../release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-mediaLibrary.md).
**Required permissions**: ohos.permission.READ_MEDIA
@@ -161,8 +161,8 @@ Obtains file assets. This API uses a promise to return the result.
> **NOTE**
>
-> - This API is deprecated since API Version 9. Use [getAssets](js-apis-photoAccessHelper.md#getassets-1) instead.
-> - From API version 10, the albums represented by physical directories are replaced by logical albums, which allows multiple files in an album and presence of a file in multiple albums. This design, however, makes **parent**, **albumId**, **albumUri**, and **albumName** incompatible. They cannot be used as parameters of **MediaFetchOptions** in **getFileAssets()**. For details, see [changelogs-mediaLibrary.md](../../../release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-mediaLibrary.md).
+> - This API is deprecated since API version 9. Use [getAssets](js-apis-photoAccessHelper.md#getassets-1) instead.
+> - From API version 10, the albums represented by physical directories are replaced by logical albums, which allow multiple files in an album and presence of a file in multiple albums. This design, however, makes **parent**, **albumId**, **albumUri**, and **albumName** incompatible. They cannot be used as parameters of **MediaFetchOptions** in **getFileAssets()**. For details, see [changelogs-mediaLibrary.md](../../../release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-mediaLibrary.md).
**Required permissions**: ohos.permission.READ_MEDIA
@@ -234,7 +234,8 @@ on(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'
Subscribes to the media library changes. This API uses a callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [registerChange](js-apis-photoAccessHelper.md#registerchange) instead.
+>
+> This API is deprecated since API version 9. Use [registerChange](js-apis-photoAccessHelper.md#registerchange) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -260,7 +261,8 @@ off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange
Unsubscribes from the media library changes. This API uses a callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [unRegisterChange](js-apis-photoAccessHelper.md#unregisterchange) instead.
+>
+> This API is deprecated since API version 9. Use [unRegisterChange](js-apis-photoAccessHelper.md#unregisterchange) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -287,7 +289,7 @@ Creates a media asset. This API uses an asynchronous callback to return the resu
> **NOTE**
>
-> - This API is deprecated since API Version 9. Use [createAsset](js-apis-photoAccessHelper.md#createasset) instead.
+> - This API is deprecated since API version 9. Use [createAsset](js-apis-photoAccessHelper.md#createasset) instead.
> - From the SDK of API version 10, **relativePath** is no longer associated with an album. After a file is created, the last-level directory of **relativePath** is not displayed. For details, see [changelogs-mediaLibrary.md](../../../release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-mediaLibrary.md).
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
@@ -329,7 +331,7 @@ Creates a media asset. This API uses a promise to return the result.
> **NOTE**
>
-> - This API is deprecated since API Version 9. Use [createAsset](js-apis-photoAccessHelper.md#createasset-1) instead.
+> - This API is deprecated since API version 9. Use [createAsset](js-apis-photoAccessHelper.md#createasset-1) instead.
> - From the SDK of API version 10, **relativePath** is no longer associated with an album. After a file is created, the last-level directory of **relativePath** is not displayed. For details, see [changelogs-mediaLibrary.md](../../../release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-mediaLibrary.md).
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
@@ -375,7 +377,8 @@ Deletes a file asset. This API uses a promise to return the result.
Before calling this API, call [FileAsset.trash](#trash8) to move the file to the trash. Otherwise, the file fails to be deleted.
> **NOTE**
-> This API is deprecated since API Version 9. Use [deleteAssets](js-apis-photoAccessHelper.md#deleteassets-3) instead.
+>
+> This API is deprecated since API version 9. Use [deleteAssets](js-apis-photoAccessHelper.md#deleteassets-3) instead.
**System API**: This is a system API.
@@ -429,7 +432,8 @@ Deletes a file asset. This API uses an asynchronous callback to return the resul
Before calling this API, call [FileAsset.trash](#trash8) to move the file to the trash. Otherwise, the file fails to be deleted.
> **NOTE**
-> This API is deprecated since API Version 9. Use [deleteAssets](js-apis-photoAccessHelper.md#deleteassets-2) instead.
+>
+> This API is deprecated since API version 9. Use [deleteAssets](js-apis-photoAccessHelper.md#deleteassets-2) instead.
**System API**: This is a system API.
@@ -478,7 +482,8 @@ getPublicDirectory(type: DirectoryType, callback: AsyncCallback<string>):
Obtains a user directory. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -509,7 +514,8 @@ getPublicDirectory(type: DirectoryType): Promise<string>
Obtains a user directory. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -550,7 +556,7 @@ Obtains albums. This API uses an asynchronous callback to return the result.
> **NOTE**
>
-> - This API is deprecated since API Version 9. Use [getAlbums](js-apis-photoAccessHelper.md#getalbums) instead.
+> - This API is deprecated since API version 9. Use [getAlbums](js-apis-photoAccessHelper.md#getalbums) instead.
> - From the SDK of API version 10, **relativePath** is no longer associated with an album. Therefore, **relativePath** cannot be used as a search criterion in **getAlbums**. Currently, only **Camera** and **ScreenShots** albums are supported. For more details, see [changelogs-mediaLibrary.md](../../../release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-mediaLibrary.md).
**Required permissions**: ohos.permission.READ_MEDIA
@@ -590,7 +596,7 @@ Obtains albums. This API uses a promise to return the result.
> **NOTE**
>
-> - This API is deprecated since API Version 9. Use [getAlbums](js-apis-photoAccessHelper.md#getalbums-2) instead.
+> - This API is deprecated since API version 9. Use [getAlbums](js-apis-photoAccessHelper.md#getalbums-2) instead.
> - From the SDK of API version 10, **relativePath** is no longer associated with an album. Therefore, **relativePath** cannot be used as a search criterion in **getAlbums**. Currently, only **Camera** and **ScreenShots** albums are supported. For more details, see [changelogs-mediaLibrary.md](../../../release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-mediaLibrary.md).
**Required permissions**: ohos.permission.READ_MEDIA
@@ -633,7 +639,8 @@ Releases this **MediaLibrary** instance.
Call this API when you no longer need to use the APIs in the **MediaLibrary** instance.
> **NOTE**
-> This API is deprecated since API Version 9. Use [release](js-apis-photoAccessHelper.md#release) instead.
+>
+> This API is deprecated since API version 9. Use [release](js-apis-photoAccessHelper.md#release) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -659,7 +666,7 @@ Releases this **MediaLibrary** instance.
Call this API when you no longer need to use the APIs in the **MediaLibrary** instance.
> **NOTE**
-> This API is deprecated since API Version 9. Use [release](js-apis-photoAccessHelper.md#release-1) instead.
+> This API is deprecated since API version 9. Use [release](js-apis-photoAccessHelper.md#release-1) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -684,7 +691,7 @@ Stores a media asset. This API uses an asynchronous callback to return the URI o
> **NOTE**
>
> - This API is supported since API version 6 and can be used only in the FA model.
-> - This API is deprecated since API Version 9. Use [save](js-apis-file-picker.md#save-1) instead.
+> - This API is deprecated since API version 9. Use [save](js-apis-file-picker.md#save-1) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -722,7 +729,7 @@ Stores a media asset. This API uses a promise to return the URI of the media ass
> **NOTE**
>
> - This API is supported since API version 6 and can be used only in the FA model.
-> - This API is deprecated since API Version 9. Use [save](js-apis-file-picker.md#save) instead.
+> - This API is deprecated since API version 9. Use [save](js-apis-file-picker.md#save) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -758,12 +765,12 @@ mediaLibrary.getMediaLibrary().storeMediaAsset(option).then((value) => {
startImagePreview(images: Array<string>, index: number, callback: AsyncCallback<void>): void
-Starts image preview, with the first image to preview specified. This API can be used to preview local images whose URIs start with **datashare://** or online images whose URIs start with **https://**. It uses an asynchronous callback to return the result.
+Starts image preview, with the first image to preview specified. This API can be used to preview a local image with the specified index (**file://**) or all online images (**https://**). It uses an asynchronous callback to return the result.
> **NOTE**
>
> - This API is supported since API version 6 and can be used only in the FA model.
-> - This API is deprecated since API Version 9. You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\** component can be used to render and display local and online images.
+> - This API is deprecated since API version 9. You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\** component can be used to render and display local and online images.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -771,7 +778,7 @@ Starts image preview, with the first image to preview specified. This API can be
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ---------------------------------------- |
-| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **'https://'** or **'datashare://'**.|
+| images | Array<string> | Yes | Images to preview. You can preview a local image (**file://**) or all online images (**https://**).|
| index | number | Yes | Index of the first image to preview. |
| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
@@ -802,12 +809,12 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, index, (error) => {
startImagePreview(images: Array<string>, callback: AsyncCallback<void>): void
-Starts image preview. This API can be used to preview local images whose URIs start with **datashare://** or online images whose URIs start with **https://**. It uses an asynchronous callback to return the result.
+Starts image preview. This API can be used to preview the first local image (**file://**) or all online images (**https://**). It uses an asynchronous callback to return the result.
> **NOTE**
>
> - This API is supported since API version 6 and can be used only in the FA model.
-> - This API is deprecated since API Version 9. You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\** component can be used to render and display local and online images.
+> - This API is deprecated since API version 9. You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\** component can be used to render and display local and online images.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -815,7 +822,7 @@ Starts image preview. This API can be used to preview local images whose URIs st
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ---------------------------------------- |
-| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **'https://'** or **'datashare://'**.|
+| images | Array<string> | Yes | Images to preview. You can preview a local image (**file://**) or all online images (**https://**).|
| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
**Example**
@@ -844,12 +851,12 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, (error) => {
startImagePreview(images: Array<string>, index?: number): Promise<void>
-Starts image preview, with the first image to preview specified. This API can be used to preview local images whose URIs start with **datashare://** or online images whose URIs start with **https://**. It uses a promise to return the execution result.
+Starts image preview, with the first image to preview specified. This API can be used to preview a local image with the specified index (**file://**) or all online images (**https://**). It uses a promise to return the execution result.
> **NOTE**
>
> - This API is supported since API version 6 and can be used only in the FA model.
-> - This API is deprecated since API Version 9. You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\** component can be used to render and display local and online images.
+> - This API is deprecated since API version 9. You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\** component can be used to render and display local and online images.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -857,7 +864,7 @@ Starts image preview, with the first image to preview specified. This API can be
| Name | Type | Mandatory | Description |
| ------ | ------------------- | ---- | ---------------------------------------- |
-| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **'https://'** or **'datashare://'**.|
+| images | Array<string> | Yes | Images to preview. You can preview a local image (**file://**) or all online images (**https://**).|
| index | number | No | Index of the first image to preview. If this parameter is not specified, the default value **0** is used. |
**Return value**
@@ -896,7 +903,7 @@ Starts media selection. This API uses an asynchronous callback to return the URI
> **NOTE**
>
> - This API is supported since API version 6 and can be used only in the FA model.
-> - This API is deprecated since API Version 9. Use [select](js-apis-file-picker.md#select-1) instead.
+> - This API is deprecated since API version 9. Use [select](js-apis-file-picker.md#select-1) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -933,7 +940,7 @@ Starts media selection. This API uses a promise to return the URIs of the select
> **NOTE**
>
> - This API is supported since API version 6 and can be used only in the FA model.
-> - This API is deprecated since API Version 9. Use [select](js-apis-file-picker.md#select) instead.
+> - This API is deprecated since API version 9. Use [select](js-apis-file-picker.md#select) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -971,7 +978,8 @@ getActivePeers(): Promise\>;
Obtains information about online peer devices. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**System API**: This is a system API.
@@ -1008,7 +1016,8 @@ getActivePeers(callback: AsyncCallback\>): void;
Obtains information about online peer devices. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**System API**: This is a system API.
@@ -1043,7 +1052,8 @@ getAllPeers(): Promise\>;
Obtains information about all peer devices. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**System API**: This is a system API.
@@ -1080,7 +1090,8 @@ getAllPeers(callback: AsyncCallback\>): void;
Obtains information about all peer devices. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**System API**: This is a system API.
@@ -1116,7 +1127,7 @@ Provides APIs for encapsulating file asset attributes.
>
> - The system attempts to parse the file content if the file is an audio or video file. The actual field values will be restored from the passed values during scanning on some devices.
> - Some devices may not support the modification of **orientation**. You are advised to use [ModifyImageProperty](js-apis-image.md#modifyimageproperty9) of the **image** module.
-> - This API is deprecated since API Version 9. Use [PhotoAsset](js-apis-photoAccessHelper.md#photoasset) instead.
+> - This API is deprecated since API version 9. Use [PhotoAsset](js-apis-photoAccessHelper.md#photoasset) instead.
### Attributes
@@ -1153,7 +1164,8 @@ isDirectory(callback: AsyncCallback<boolean>): void
Checks whether this file asset is a directory. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**Required permissions**: ohos.permission.READ_MEDIA
@@ -1196,7 +1208,8 @@ isDirectory():Promise<boolean>
Checks whether this file asset is a directory. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**Required permissions**: ohos.permission.READ_MEDIA
@@ -1238,7 +1251,7 @@ Commits the modification on the file metadata to the database. This API uses an
> **NOTE**
>
-> - This API is deprecated since API Version 9. Use [commitModify](js-apis-photoAccessHelper.md#commitmodify) instead.
+> - This API is deprecated since API version 9. Use [commitModify](js-apis-photoAccessHelper.md#commitmodify) instead.
> - Since the SDK of API version 10, **audio** does not have the **orientation** attribute. Therefore, the **orientation** attribute of the audio resource cannot be modified by **commitModify()**. For details, see [changelogs-mediaLibrary.md](../../../release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-mediaLibrary.md).
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
@@ -1280,7 +1293,7 @@ Commits the modification on the file asset to the database. This API uses a prom
> **NOTE**
>
-> - This API is deprecated since API Version 9. Use [commitModify](js-apis-photoAccessHelper.md#commitmodify-1) instead.
+> - This API is deprecated since API version 9. Use [commitModify](js-apis-photoAccessHelper.md#commitmodify-1) instead.
> Since the SDK of API version 10, **audio** does not have the **orientation** attribute. Therefore, the **orientation** attribute of the audio resource cannot be modified by **commitModify()**. For details, see [changelogs-mediaLibrary.md](../../../release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-mediaLibrary.md).
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
@@ -1319,9 +1332,11 @@ open(mode: string, callback: AsyncCallback<number>): void
Opens this file asset. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [open](js-apis-photoAccessHelper.md#open) instead.
-
-**NOTE** If a file is opened in 'w' mode, the returned file descriptor (FD) cannot be used to read the file. However, due to the implementation differences of file systems, some user-mode files opened in 'w' mode can be read by using FD. To perform the read or write operation on a file by using FD, you are advised to open the file in 'rw' mode. The write operations are mutually exclusive. After a write operation is complete, you must call **close** to close the file.
+>
+> - This API is deprecated since API version 9. Use [open](js-apis-photoAccessHelper.md#open) instead.
+>
+> - If a file is opened in 'w' mode, the returned file descriptor (FD) cannot be used to read the file. However, due to the implementation differences of file systems, some user-mode files opened in 'w' mode can be read by using FD. To perform the read or write operation on a file by using FD, you are advised to open the file in 'rw' mode.
+> - The write operations are mutually exclusive. After a write operation is complete, you must call **close** to close the file.
**Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA
@@ -1359,9 +1374,10 @@ open(mode: string): Promise<number>
Opens this file asset. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [open](js-apis-photoAccessHelper.md#open-1) instead.
-
-**NOTE** If a file is opened in 'w' mode, the returned FD cannot be used to read the file. However, due to the implementation differences of file systems, some user-mode files opened in 'w' mode can be read by using FD. To perform the read or write operation on a file by using FD, you are advised to open the file in 'rw' mode. The write operations are mutually exclusive. After a write operation is complete, you must call **close** to close the file.
+>
+> - This API is deprecated since API version 9. Use [open](js-apis-photoAccessHelper.md#open-1) instead.
+> - If a file is opened in 'w' mode, the returned FD cannot be used to read the file. However, due to the implementation differences of file systems, some user-mode files opened in 'w' mode can be read by using FD. To perform the read or write operation on a file by using FD, you are advised to open the file in 'rw' mode.
+> - The write operations are mutually exclusive. After a write operation is complete, you must call **close** to close the file.
**Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA
@@ -1402,7 +1418,8 @@ close(fd: number, callback: AsyncCallback<void>): void
Closes a file. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [close](js-apis-photoAccessHelper.md#close) instead.
+>
+> This API is deprecated since API version 9. Use [close](js-apis-photoAccessHelper.md#close) instead.
**Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA
@@ -1451,7 +1468,8 @@ close(fd: number): Promise<void>
Closes a file. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [close](js-apis-photoAccessHelper.md#close-1) instead.
+>
+> This API is deprecated since API version 9. Use [close](js-apis-photoAccessHelper.md#close-1) instead.
**Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA
@@ -1503,7 +1521,8 @@ getThumbnail(callback: AsyncCallback<image.PixelMap>): void
Obtains the thumbnail of this file asset. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [close](js-apis-photoAccessHelper.md#getThumbnail) instead.
+>
+> This API is deprecated since API version 9. Use [close](js-apis-photoAccessHelper.md#getThumbnail) instead.
**Required permissions**: ohos.permission.READ_MEDIA
@@ -1546,7 +1565,8 @@ getThumbnail(size: Size, callback: AsyncCallback<image.PixelMap>): void
Obtains the file thumbnail of the given size. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [close](js-apis-photoAccessHelper.md#getThumbnail-1) instead.
+>
+> This API is deprecated since API version 9. Use [close](js-apis-photoAccessHelper.md#getThumbnail-1) instead.
**Required permissions**: ohos.permission.READ_MEDIA
@@ -1591,7 +1611,8 @@ getThumbnail(size?: Size): Promise<image.PixelMap>
Obtains the file thumbnail of the given size. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [close](js-apis-photoAccessHelper.md#getThumbnail-2) instead.
+>
+> This API is deprecated since API version 9. Use [close](js-apis-photoAccessHelper.md#getThumbnail-2) instead.
**Required permissions**: ohos.permission.READ_MEDIA
@@ -1639,7 +1660,8 @@ favorite(isFavorite: boolean, callback: AsyncCallback<void>): void
Favorites or unfavorites this file asset. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [setFavorite](js-apis-photoAccessHelper.md#setfavorite) instead.
+>
+> This API is deprecated since API version 9. Use [setFavorite](js-apis-photoAccessHelper.md#setfavorite) instead.
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
@@ -1683,7 +1705,8 @@ favorite(isFavorite: boolean): Promise<void>
Favorites or unfavorites this file asset. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [setFavorite](js-apis-photoAccessHelper.md#setfavorite-1) instead.
+>
+> This API is deprecated since API version 9. Use [setFavorite](js-apis-photoAccessHelper.md#setfavorite-1) instead.
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
@@ -1730,7 +1753,8 @@ isFavorite(callback: AsyncCallback<boolean>): void
Checks whether this file asset is favorited. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**Required permissions**: ohos.permission.READ_MEDIA
@@ -1773,7 +1797,8 @@ isFavorite():Promise<boolean>
Checks whether this file asset is favorited. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**Required permissions**: ohos.permission.READ_MEDIA
@@ -1816,7 +1841,8 @@ Moves this file asset to the trash. This API uses an asynchronous callback to re
Files in the trash are not actually deleted. You can set **isTrash** to **false** to restore the files from the trash.
> **NOTE**
-> This API is deprecated since API Version 9. Use [deleteAssets](js-apis-photoAccessHelper.md#deleteAssets) instead.
+>
+> This API is deprecated since API version 9. Use [deleteAssets](js-apis-photoAccessHelper.md#deleteAssets) instead.
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
@@ -1862,7 +1888,8 @@ Moves this file asset to the trash. This API uses a promise to return the result
Files in the trash are not actually deleted. You can set **isTrash** to **false** to restore the files from the trash.
> **NOTE**
-> This API is deprecated since API Version 9. Use [deleteAssets](js-apis-photoAccessHelper.md#deleteAssets-1) instead.
+>
+> This API is deprecated since API version 9. Use [deleteAssets](js-apis-photoAccessHelper.md#deleteAssets-1) instead.
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
@@ -1909,7 +1936,8 @@ isTrash(callback: AsyncCallback<boolean>): void
Checks whether this file asset is in the trash. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**Required permissions**: ohos.permission.READ_MEDIA
@@ -1952,7 +1980,8 @@ isTrash():Promise<boolean>
Checks whether this file asset is in the trash. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**Required permissions**: ohos.permission.READ_MEDIA
@@ -1991,7 +2020,8 @@ async function example() {
Provides APIs to manage the file retrieval result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [FetchResult](js-apis-photoAccessHelper.md#fetchresult) instead.
+>
+> This API is deprecated since API version 9. Use [FetchResult](js-apis-photoAccessHelper.md#fetchresult) instead.
### getCount7+
@@ -2000,7 +2030,8 @@ getCount(): number
Obtains the total number of files in the result set.
> **NOTE**
-> This API is deprecated since API Version 9. Use [getCount](js-apis-photoAccessHelper.md#getcount) instead.
+>
+> This API is deprecated since API version 9. Use [getCount](js-apis-photoAccessHelper.md#getcount) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2035,7 +2066,8 @@ isAfterLast(): boolean
Checks whether the cursor is in the last row of the result set.
> **NOTE**
-> This API is deprecated since API Version 9. Use [isAfterLast](js-apis-photoAccessHelper.md#isafterlast) instead.
+>
+> This API is deprecated since API version 9. Use [isAfterLast](js-apis-photoAccessHelper.md#isafterlast) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2078,7 +2110,8 @@ close(): void
Releases and invalidates this **FetchFileResult** instance. After this instance is released, the APIs in this instance cannot be invoked.
> **NOTE**
-> This API is deprecated since API Version 9. Use [close](js-apis-photoAccessHelper.md#close) instead.
+>
+> This API is deprecated since API version 9. Use [close](js-apis-photoAccessHelper.md#close) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2105,7 +2138,8 @@ getFirstObject(callback: AsyncCallback<FileAsset>): void
Obtains the first file asset in the result set. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [getFirstObject](js-apis-photoAccessHelper.md#getfirstobject) instead.
+>
+> This API is deprecated since API version 9. Use [getFirstObject](js-apis-photoAccessHelper.md#getfirstobject) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2145,7 +2179,8 @@ getFirstObject(): Promise<FileAsset>
Obtains the first file asset in the result set. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [getFirstObject](js-apis-photoAccessHelper.md#getfirstobject-1) instead.
+>
+> This API is deprecated since API version 9. Use [getFirstObject](js-apis-photoAccessHelper.md#getfirstobject-1) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2185,7 +2220,7 @@ Obtains the next file asset in the result set. This API uses an asynchronous cal
> **NOTE**
>
> - Before using this API, you must use [getFirstObject](#getfirstobject7) to obtain the first file asset and then use [isAfterLast](#isafterlast7) to check that the cursor does not point to the last file asset in the result set.
-> - This API is deprecated since API Version 9. Use [getNextObject](js-apis-photoAccessHelper.md#getnextobject) instead.
+> - This API is deprecated since API version 9. Use [getNextObject](js-apis-photoAccessHelper.md#getnextobject) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2232,7 +2267,7 @@ Obtains the next file asset in the result set. This API uses a promise to return
> **NOTE**
>
> - Before using this API, you must use [getFirstObject](#getfirstobject7) to obtain the first file asset and then use [isAfterLast](#isafterlast7) to check that the cursor does not point to the last file asset in the result set.
-> - This API is deprecated since API Version 9. Use [getNextObject](js-apis-photoAccessHelper.md#getnextobject-1) instead.
+> - This API is deprecated since API version 9. Use [getNextObject](js-apis-photoAccessHelper.md#getnextobject-1) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2274,7 +2309,8 @@ getLastObject(callback: AsyncCallback<FileAsset>): void
Obtains the last file asset in the result set. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [getLastObject](js-apis-photoAccessHelper.md#getlastobject) instead.
+>
+> This API is deprecated since API version 9. Use [getLastObject](js-apis-photoAccessHelper.md#getlastobject) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2314,7 +2350,8 @@ getLastObject(): Promise<FileAsset>
Obtains the last file asset in the result set. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [getLastObject](js-apis-photoAccessHelper.md#getlastobject-1) instead.
+>
+> This API is deprecated since API version 9. Use [getLastObject](js-apis-photoAccessHelper.md#getlastobject-1) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2352,7 +2389,8 @@ getPositionObject(index: number, callback: AsyncCallback<FileAsset>): void
Obtains a file asset with the specified index in the result set. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [getObjectByPosition](js-apis-photoAccessHelper.md#getobjectbyposition) instead.
+>
+> This API is deprecated since API version 9. Use [getObjectByPosition](js-apis-photoAccessHelper.md#getobjectbyposition) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2393,7 +2431,8 @@ getPositionObject(index: number): Promise<FileAsset>
Obtains a file asset with the specified index in the result set. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [getObjectByPosition](js-apis-photoAccessHelper.md#getobjectbyposition-1) instead.
+>
+> This API is deprecated since API version 9. Use [getObjectByPosition](js-apis-photoAccessHelper.md#getobjectbyposition-1) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2437,7 +2476,8 @@ getAllObject(callback: AsyncCallback<Array<FileAsset>>): void
Obtains all the file assets in the result set. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [getAllObjects](js-apis-photoAccessHelper.md#getallobjects) instead.
+>
+> This API is deprecated since API version 9. Use [getAllObjects](js-apis-photoAccessHelper.md#getallobjects) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2479,7 +2519,8 @@ getAllObject(): Promise<Array<FileAsset>>
Obtains all the file assets in the result set. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [getAllObjects](js-apis-photoAccessHelper.md#getallobjects-1) instead.
+>
+> This API is deprecated since API version 9. Use [getAllObjects](js-apis-photoAccessHelper.md#getallobjects-1) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2517,7 +2558,8 @@ async function example() {
Provides APIs to manage albums.
> **NOTE**
-> This API is deprecated since API Version 9. Use [Album](js-apis-photoAccessHelper.md#album) instead.
+>
+> This API is deprecated since API version 9. Use [Album](js-apis-photoAccessHelper.md#album) instead.
### Attributes
@@ -2540,7 +2582,8 @@ commitModify(callback: AsyncCallback<void>): void
Commits the modification on the album attributes to the database.
> **NOTE**
-> This API is deprecated since API Version 9. Use [commitModify](js-apis-photoAccessHelper.md#commitmodify-2) instead.
+>
+> This API is deprecated since API version 9. Use [commitModify](js-apis-photoAccessHelper.md#commitmodify-2) instead.
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
@@ -2581,7 +2624,8 @@ commitModify(): Promise<void>
Commits the modification on the album attributes to the database.
> **NOTE**
-> This API is deprecated since API Version 9. Use [commitModify](js-apis-photoAccessHelper.md#commitmodify-3) instead.
+>
+> This API is deprecated since API version 9. Use [commitModify](js-apis-photoAccessHelper.md#commitmodify-3) instead.
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
@@ -2620,7 +2664,8 @@ getFileAssets(callback: AsyncCallback<FetchFileResult>): void
Obtains the file assets in this album. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [getAssets](js-apis-photoAccessHelper.md#getassets) instead.
+>
+> This API is deprecated since API version 9. Use [getAssets](js-apis-photoAccessHelper.md#getassets) instead.
**Required permissions**: ohos.permission.READ_MEDIA
@@ -2664,7 +2709,8 @@ getFileAssets(options: MediaFetchOptions, callback: AsyncCallback<FetchFileRe
Obtains the file assets in this album based on specified conditions. This API uses an asynchronous callback to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [getAssets](js-apis-photoAccessHelper.md#getassets) instead.
+>
+> This API is deprecated since API version 9. Use [getAssets](js-apis-photoAccessHelper.md#getassets) instead.
**Required permissions**: ohos.permission.READ_MEDIA
@@ -2713,7 +2759,8 @@ async function example() {
Obtains the file assets in this album based on specified conditions. This API uses a promise to return the result.
> **NOTE**
-> This API is deprecated since API Version 9. Use [getAssets](js-apis-photoAccessHelper.md#getassets-1) instead.
+>
+> This API is deprecated since API version 9. Use [getAssets](js-apis-photoAccessHelper.md#getassets-1) instead.
**Required permissions**: ohos.permission.READ_MEDIA
@@ -2763,7 +2810,8 @@ async function example() {
Defines information about a registered device.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**System API**: This is a system API.
@@ -2781,7 +2829,8 @@ Defines information about a registered device.
Enumerates media types.
> **NOTE**
-> This API is deprecated since API Version 9. Use [PhotoType](js-apis-photoAccessHelper.md#phototype) instead.
+>
+> This API is deprecated since API version 9. Use [PhotoType](js-apis-photoAccessHelper.md#phototype) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2799,7 +2848,7 @@ Enumerates key file information.
> **NOTE**
>
> - The **bucket_id** field may change after file rename or movement. Therefore, you must obtain the field again before using it.
-> - This API is deprecated since API Version 9. Use [PhotoKeys](js-apis-photoAccessHelper.md#photokeys) instead.
+> - This API is deprecated since API version 9. Use [PhotoKeys](js-apis-photoAccessHelper.md#photokeys) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2830,7 +2879,8 @@ Enumerates key file information.
Enumerates directory types.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2848,7 +2898,8 @@ Enumerates directory types.
Enumerates the device types.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**System API**: This is a system API.
@@ -2869,15 +2920,16 @@ Enumerates the device types.
Defines the options for fetching media files.
> **NOTE**
-> This API is deprecated since API Version 9. Use [FetchOptions](js-apis-photoAccessHelper.md#fetchoptions) instead.
+>
+> This API is deprecated since API version 9. Use [FetchOptions](js-apis-photoAccessHelper.md#fetchoptions) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
| Name | Type | Readable| Writable| Description |
| ----------------------- | ------------------- | ---- | ---- | ------------------------------------------------------------ |
-| selections | string | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey8) are used as the column names when files are fetched. Example: selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?', |
+| selections | string | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey8) are used as the column names when files are fetched. Example: selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?', |
| selectionArgs | Array<string> | Yes | Yes | Values of the conditions specified in **selections**. Example: selectionArgs: [mediaLibrary.MediaType.IMAGE.toString(), mediaLibrary.MediaType.VIDEO.toString()], |
-| order | string | Yes | Yes | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example: Ascending: order: mediaLibrary.FileKey.DATE_ADDED + ' ASC' Descending: order: mediaLibrary.FileKey.DATE_ADDED + ' DESC'|
+| order | string | Yes | Yes | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example: Ascending: order: mediaLibrary.FileKey.DATE_ADDED + ' ASC' Descending: order: mediaLibrary.FileKey.DATE_ADDED + ' DESC' |
| uri8+ | string | Yes | Yes | URI of the file. |
| networkId8+ | string | Yes | Yes | Network ID of the registered device. |
| extendArgs8+ | string | Yes | Yes | Extended parameters for fetching the files. Currently, no extended parameters are available. |
@@ -2887,7 +2939,8 @@ Defines the options for fetching media files.
Defines the image size.
> **NOTE**
-> This API is deprecated since API Version 9. Use [image.Size](js-apis-image.md#size) instead.
+>
+> This API is deprecated since API version 9. Use [image.Size](js-apis-image.md#size) instead.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
@@ -2901,26 +2954,28 @@ Defines the image size.
Defines the media asset option.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
| Name | Type | Readable| Writable| Description |
| ------------ | ------ | ---- | ---- | ------------------------------------------------------------ |
| src | string | Yes | Yes | Application sandbox oath of the local file. |
-| mimeType | string | Yes | Yes | Multipurpose Internet Mail Extensions (MIME) type of the media. The value can be 'image/\*', 'video/\*', 'audio/\*' or 'file\*'.|
-| relativePath | string | Yes | Yes | Custom path of media assets, for example, **Pictures/**. If this parameter is unspecified, media assets are stored in the default path. Default path of images: **'Pictures/'** Default path of videos: **'Videos/'** Default path of audios: **'Audios/'** Default path of documents: **'Documents/'**|
+| mimeType | string | Yes | Yes | Multipurpose Internet Mail Extensions (MIME) type of the media. The value can be 'image/\*', 'video/\*', 'audio/\*' or 'file/*'. |
+| relativePath | string | Yes | Yes | Customized path of media assets, for example, **Pictures/**. If this parameter is unspecified, the default paths of media assets are as follows: Default path of images: **'Pictures/'** Default path of videos: **'Videos/'** Default path of audio files: **'Audios/'** Default path of documents: **'Documents/'** |
## MediaSelectOption
Defines the media selection option.
> **NOTE**
-> This API is deprecated since API Version 9. There is no substitute API.
+>
+> This API is deprecated since API version 9. There is no substitute API.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
| Name | Type | Readable| Writable| Description |
| ----- | ------ | ---- | ---- | -------------------- |
| type | 'image' | 'video' | 'media' | Yes | Yes | Media type, which can be **image**, **media**, or **video**. Currently, only **media** is supported.|
-| count | number | Yes | Yes | Maximum number of media assets that can be selected. The value starts from 1, which indicates that one media asset can be selected. |
+| count | number | Yes | Yes | Maximum number of media assets that can be selected. The value **1** means to select only one media asset; the value greater than **1** means to select multiple media assets. |
diff --git a/en/application-dev/reference/apis/js-apis-net-connection.md b/en/application-dev/reference/apis/js-apis-net-connection.md
index 0bd9b716421a85fdc2e28582d2799ced24b12109..0dc717e3b5f35c05502cad7e898740c383e67077 100644
--- a/en/application-dev/reference/apis/js-apis-net-connection.md
+++ b/en/application-dev/reference/apis/js-apis-net-connection.md
@@ -158,7 +158,7 @@ Obtains the global HTTP proxy configuration of the network. This API uses an asy
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
-| callback | AsyncCallback\<[HttpProxy](#httpproxy)> | Yes | Callback used to return the result. If the global HTTP proxy configuration of the network is obtained successfully, **error** is **undefined** and **data** is the global HTTP proxy configuration. Otherwise, **error** is an error object.|
+| callback | AsyncCallback\<[HttpProxy](#httpproxy10)> | Yes | Callback used to return the result. If the global HTTP proxy configuration of the network is obtained successfully, **error** is **undefined** and **data** is the global HTTP proxy configuration. Otherwise, **error** is an error object.|
**Error codes**
@@ -192,7 +192,7 @@ Obtains the global HTTP proxy configuration of the network. This API uses a prom
| Type | Description |
| --------------------------------- | ------------------------------------- |
-| Promise\<[HttpProxy](#httpproxy)> | Promise used to return the result.|
+| Promise\<[HttpProxy](#httpproxy10)> | Promise used to return the result.|
**Error codes**
@@ -229,7 +229,7 @@ Sets the global HTTP proxy configuration of the network. This API uses an asynch
| Name | Type | Mandatory| Description |
| --------- | ----------------------- | ---- | ------------------------------------------------------------ |
-| httpProxy | [HttpProxy](#httpproxy) | Yes | Global HTTP proxy configuration of the network. |
+| httpProxy | [HttpProxy](#httpproxy10) | Yes | Global HTTP proxy configuration of the network. |
| callback | AsyncCallback\ | Yes | Callback used to return the result. If the global HTTP proxy configuration of the network is set successfully, **error** is **undefined**. Otherwise, **error** is an error object.|
**Error codes**
@@ -274,7 +274,7 @@ Sets the global HTTP proxy configuration of the network. This API uses a promise
| Name | Type | Mandatory| Description |
| --------- | ------------------------------------------------------------ | ---- | ---------------- |
-| httpProxy | [HttpProxy](#httpproxy) | Yes | Global HTTP proxy configuration of the network.|
+| httpProxy | [HttpProxy](#httpproxy10) | Yes | Global HTTP proxy configuration of the network.|
**Return value**
@@ -324,7 +324,7 @@ This API uses an asynchronous callback to return the result.
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
-| callback | AsyncCallback<[HttpProxy](#httpproxy)> | Yes | Callback used to return the result. If the global HTTP proxy configuration of the network is obtained successfully, **error** is **undefined** and **data** is the global HTTP proxy configuration. Otherwise, **error** is an error object.|
+| callback | AsyncCallback<[HttpProxy](#httpproxy10)> | Yes | Callback used to return the result. If the global HTTP proxy configuration of the network is obtained successfully, **error** is **undefined** and **data** is the global HTTP proxy configuration. Otherwise, **error** is an error object.|
**Error codes**
@@ -347,7 +347,7 @@ connection.getDefaultHttpProxy((error, data) => {
getDefaultHttpProxy(): Promise\;
Obtains the default proxy configuration of the network.
-If the global proxy is set, the global proxy configuration is returned. If [setAppNet](#connectionsetappnet) is used to bind the application to the network specified by [NetHandle](#nethandle), the proxy configuration of this network is returned. In other cases, the HTTP proxy configuration of the default network is returned.
+If the global proxy is set, the global HTTP proxy configuration is returned. If [setAppNet](#connectionsetappnet) is used to bind the application to the network specified by [NetHandle](#nethandle), the HTTP proxy configuration of this network is returned. In other cases, the HTTP proxy configuration of the default network is returned.
This API uses a promise to return the result.
**System capability**: SystemCapability.Communication.NetManager.Core
@@ -356,7 +356,7 @@ This API uses a promise to return the result.
| Type | Description |
| -------------------------------- | ----------------------------------------- |
-| Promise<[HttpProxy](#httpproxy)> | Promise used to return the result.|
+| Promise<[HttpProxy](#httpproxy10)> | Promise used to return the result.|
**Error codes**
diff --git a/en/application-dev/reference/apis/js-apis-net-ethernet.md b/en/application-dev/reference/apis/js-apis-net-ethernet.md
index 21fdb44e402a4a0cb4a6f39d883522ab84513217..e7aae4ef5ef646af82499c8d3fdfd2bfd53cf905 100644
--- a/en/application-dev/reference/apis/js-apis-net-ethernet.md
+++ b/en/application-dev/reference/apis/js-apis-net-ethernet.md
@@ -486,7 +486,7 @@ Defines the network configuration for the Ethernet connection.
| gateway | string | Yes| Gateway of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in DHCP mode.|
| netMask | string | Yes| Subnet mask of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in DHCP mode.|
| dnsServers | string | Yes| DNS server addresses of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode. Multiple addresses are separated by commas (,).|
-| httpProxy10+ | [HttpProxy](js-apis-net-connection.md#httpproxy) | No| HTTP proxy of the Ethernet connection. By default, no proxy is configured.|
+| httpProxy10+ | [HttpProxy](js-apis-net-connection.md#httpproxy10) | No| HTTP proxy of the Ethernet connection. By default, no proxy is configured.|
## IPSetMode9+
diff --git a/en/application-dev/reference/apis/js-apis-net-policy.md b/en/application-dev/reference/apis/js-apis-net-policy.md
index 295332057ba4042e12ff1c0009efe8a54acec759..1c1bb3adecc5c67136b722cbc9de1eacdf87f462 100644
--- a/en/application-dev/reference/apis/js-apis-net-policy.md
+++ b/en/application-dev/reference/apis/js-apis-net-policy.md
@@ -89,9 +89,11 @@ Specifies whether background applications are allowed to access the network. Thi
**Example**
```js
-policy.setBackgroundAllowed(true).then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.setBackgroundAllowed(true).then(() => {
+ console.log("setBackgroundAllowed success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.isBackgroundAllowed10+
@@ -164,10 +166,11 @@ Checks whether the current application is allowed to access the network when run
**Example**
```js
-policy.isBackgroundAllowed().then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.isBackgroundAllowed().then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.setPolicyByUid10+
@@ -248,9 +251,11 @@ Sets the metered network access policy for the application specified by a given
**Example**
```js
-policy.setPolicyByUid(11111, policy.NetUidPolicy.NET_POLICY_NONE).then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.setPolicyByUid(11111, policy.NetUidPolicy.NET_POLICY_NONE).then(() => {
+ console.log("setPolicyByUid success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.getPolicyByUid10+
@@ -329,10 +334,11 @@ Obtains the network access policy for the application specified by a given UID.
**Example**
```js
-policy.getPolicyByUid(11111).then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.getPolicyByUid(11111).then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.getUidsByPolicy10+
@@ -412,10 +418,11 @@ Obtains all UIDs that match the specified network policy. This API uses a promis
**Example**
```js
-policy.getUidsByPolicy(11111).then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.getUidsByPolicy(11111).then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.getNetQuotaPolicies10+
@@ -487,11 +494,11 @@ Obtains the network quota policies. This API uses a promise to return the result
**Example**
```js
-policy.getNetQuotaPolicies().then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
-
+policy.getNetQuotaPolicies().then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.setNetQuotaPolicies10+
@@ -608,9 +615,11 @@ let netquotapolicy = {
netQuotaPolicyList.push(netquotapolicy);
-policy.setNetQuotaPolicies(netQuotaPolicyList).then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.setNetQuotaPolicies(netQuotaPolicyList).then(() => {
+ console.log("setNetQuotaPolicies success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.isUidNetAllowed10+
@@ -692,10 +701,11 @@ Checks whether the application specified by a given UID is allowed to access a m
**Example**
```js
-policy.isUidNetAllowed(11111, true).then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.isUidNetAllowed(11111, true).then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.isUidNetAllowed10+
@@ -777,10 +787,11 @@ Checks whether the application specified by a given UID is allowed to access the
**Example**
```js
-policy.isUidNetAllowed(11111, 'wlan0').then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.isUidNetAllowed(11111, 'wlan0').then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.setDeviceIdleTrustlist10+
@@ -861,9 +872,11 @@ Adds applications specified by given UIDs to the device idle allowlist. This API
**Example**
```js
-policy.setDeviceIdleTrustlist([11111,22222], true).then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.setDeviceIdleTrustlist([11111,22222], true).then(() => {
+ console.log("setDeviceIdleTrustlist success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.getDeviceIdleTrustlist10+
@@ -934,10 +947,11 @@ Obtains the UIDs of applications that are on the device idle allowlist. This API
**Example**
```js
-policy.getDeviceIdleTrustlist().then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.getDeviceIdleTrustlist().then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.getBackgroundPolicyByUid10+
@@ -1017,10 +1031,11 @@ Obtains the background network policy for the application specified by a given U
**Example**
```js
-policy.getBackgroundPolicyByUid(11111).then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.getBackgroundPolicyByUid(11111).then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.resetPolicies10+
@@ -1099,9 +1114,11 @@ Restores all the policies (cellular network, background network, firewall, and a
**Example**
```js
-policy.resetPolicies('1').then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.resetPolicies('1').then(() => {
+ console.log("resetPolicies success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.updateRemindPolicy10+
@@ -1186,9 +1203,11 @@ Updates a reminder policy. This API uses a promise to return the result.
```js
import connection from '@ohos.net.connection';
-policy.updateRemindPolicy(connection.NetBearType.BEARER_CELLULAR, '1', policy.RemindType.REMIND_TYPE_WARNING).then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.updateRemindPolicy(connection.NetBearType.BEARER_CELLULAR, '1', policy.RemindType.REMIND_TYPE_WARNING).then(() => {
+ console.log("updateRemindPolicy success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.setPowerSaveTrustlist10+
@@ -1269,9 +1288,11 @@ Sets whether to add the application specified by a given UID to the power-saving
**Example**
```js
-policy.setPowerSaveTrustlist([11111,22222], true).then(function (error) {
- console.log(JSON.stringify(error))
-})
+policy.setPowerSaveTrustlist([11111,22222], true).then(() => {
+ console.log("setPowerSaveTrustlist success");
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.getPowerSaveTrustlist10+
@@ -1343,10 +1364,11 @@ Obtains the UID array of applications that are on the device idle allowlist. Thi
**Example**
```js
-policy.getPowerSaveTrustlist().then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
+policy.getPowerSaveTrustlist().then((data) => {
+ console.log(JSON.stringify(data));
+}).catch(error => {
+ console.log(JSON.stringify(error));
+});
```
## policy.on
diff --git a/en/application-dev/reference/apis/js-apis-net-vpn.md b/en/application-dev/reference/apis/js-apis-net-vpn.md
new file mode 100644
index 0000000000000000000000000000000000000000..9fbca9235ee22b561d8ed5f414ac37be7454767f
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-net-vpn.md
@@ -0,0 +1,406 @@
+# @ohos.net.vpn (VPN Management)
+
+The **vpn** module implements virtual private network (VPN) management, such as starting and stopping a VPN.
+
+> **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.
+
+## Modules to Import
+
+```js
+import vpn from '@ohos.net.vpn';
+```
+
+## vpn.createVpnConnection
+
+createVpnConnection(context: AbilityContext): VpnConnection
+
+Creates a VPN connection.
+
+**System capability**: SystemCapability.Communication.NetManager.Vpn
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
+| context | [AbilityContext](js-apis-inner-application-uiAbilityContext.md#uiabilitycontext) | Yes | Specified context. |
+
+**Return value**
+
+| Type | Description |
+| :--------------------------------- | :---------------------- |
+| [VpnConnection](#vpnconnection) | VPN connection object.|
+
+**Error codes**
+
+For details about the error codes, see [VPN Error Codes](../errorcodes/errorcode-net-vpn.md).
+
+| ID| Error Message |
+| ------- | ----------------------------- |
+| 401 | Parameter error. |
+
+**Example**
+Stage model:
+
+```ts
+// Obtain the context.
+import UIAbility from '@ohos.app.ability.UIAbility';
+class EntryAbility extends UIAbility {
+ onWindowStageCreate(windowStage){
+ globalThis.context = this.context;
+ }
+}
+let context = globalThis.context;
+VpnConnection = vpn.createVpnConnection(context);
+console.info("vpn onInit: " + JSON.stringify(VpnConnection));
+```
+
+## VpnConnection
+
+Defines a VPN connection object. Before calling **VpnConnection** APIs, you need to create a VPN connection object by calling [vpn.createVpnConnection](#vpncreatevpnconnection).
+
+### setUp
+
+setUp(config: VpnConfig, callback: AsyncCallback\): void
+
+Creates a VPN based on the specified configuration. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.MANAGE_VPN
+
+**System capability**: SystemCapability.Communication.NetManager.Vpn
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
+| config | [VpnConfig](#vpnconfig) | Yes | VPN configuration. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result. If a VPN is created successfully, **error** is **undefined** and **data** is the file descriptor of the vNIC. Otherwise, **error** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [VPN Error Codes](../errorcodes/errorcode-net-vpn.md).
+
+| ID| Error Message |
+| ------- | ----------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 2200001 | Invalid parameter value. |
+| 2200002 | Operation failed. Cannot connect to service. |
+| 2200003 | System internal error. |
+| 2203001 | VPN creation denied, please check the user type. |
+| 2203002 | VPN exist already, please execute destroy first. |
+
+**Example**
+
+```js
+ let config = {
+ addresses: [{
+ address: {
+ address: "10.0.0.5",
+ family: 1
+ },
+ prefixLength: 24,
+ }],
+ routes: [],
+ mtu: 1400,
+ dnsAddresses:[
+ "114.114.114.114"
+ ],
+ trustedApplications:[],
+ blockedApplications:[]
+ }
+ VpnConnection.setUp(config, (error, data) => {
+ console.info(JSON.stringify(error));
+ console.info("tunfd: " + JSON.stringify(data));
+ })
+```
+
+### setUp
+
+setUp(config: VpnConfig): Promise\
+
+Creates a VPN based on the specified configuration. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.MANAGE_VPN
+
+**System capability**: SystemCapability.Communication.NetManager.Vpn
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
+| config | [VpnConfig](#vpnconfig) | Yes | VPN configuration. |
+
+**Return value**
+
+| Type | Description |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | The obtaining result is returned in Promise format. The file descriptor fd of the specified virtual network adapter is returned.|
+
+**Error codes**
+
+For details about the error codes, see [VPN Error Codes](../errorcodes/errorcode-net-vpn.md).
+
+| ID| Error Message |
+| ------- | ----------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 2200001 | Invalid parameter value. |
+| 2200002 | Operation failed. Cannot connect to service. |
+| 2200003 | System internal error. |
+| 2203001 | VPN creation denied, please check the user type. |
+| 2203002 | VPN exist already, please execute destroy first. |
+
+**Example**
+
+```js
+ let config = {
+ addresses: [{
+ address: {
+ address: "10.0.0.5",
+ family: 1
+ },
+ prefixLength: 24,
+ }],
+ routes: [],
+ mtu: 1400,
+ dnsAddresses:[
+ "114.114.114.114"
+ ],
+ trustedApplications:[],
+ blockedApplications:[]
+ }
+ VpnConnection.setUp(config).then((data) => {
+ console.info(TAG + "setUp success, tunfd: " + JSON.stringify(data))
+ }).catch(err => {
+ console.info(TAG + "setUp fail" + JSON.stringify(err))
+ })
+```
+
+### protect
+
+protect(socketFd: number, callback: AsyncCallback\): void
+
+Protects sockets against a VPN connection. The data sent through sockets is directly transmitted over the physical network and therefore the traffic does not traverse through the VPN. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.MANAGE_VPN
+
+**System capability**: SystemCapability.Communication.NetManager.Vpn
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
+| socketFd | number | Yes | Socket file descriptor. It can be obtained through [getSocketFd](js-apis-socket.md#getsocketfd10). |
+| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **error** is **undefined**. If the operation fails, an error message is returned.|
+
+**Error codes**
+
+For details about the error codes, see [VPN Error Codes](../errorcodes/errorcode-net-vpn.md).
+
+| ID| Error Message |
+| ------- | ----------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 2200001 | Invalid parameter value. |
+| 2200002 | Operation failed. Cannot connect to service. |
+| 2200003 | System internal error. |
+| 2203004 | Invalid socket file descriptor. |
+
+**Example**
+
+```js
+ import socket from "@ohos.net.socket";
+ var tcp = socket.constructTCPSocketInstance();
+ tcp.bind({
+ address: "0.0.0.0",
+ family: 1
+ })
+ let connectAddress = {
+ address: "192.168.1.11",
+ port: 8888,
+ family: 1
+ };
+ tcp.connect({
+ address: connectAddress, timeout: 6000
+ })
+ tcp.getSocketFd().then((tunnelfd) => {
+ console.info("tunenlfd: " + tunnelfd);
+ VpnConnection.protect(tunnelfd, (error) => {
+ console.info(JSON.stringify(error));
+ })
+ })
+```
+
+### protect
+
+protect(socketFd: number): Promise\
+
+Protects sockets against a VPN connection. The data sent through sockets is directly transmitted over the physical network and therefore traffic does not traverse through the VPN. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.MANAGE_VPN
+
+**System capability**: SystemCapability.Communication.NetManager.Vpn
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
+| socketFd | number | Yes | Socket file descriptor. It can be obtained through [getSocketFd](js-apis-socket.md#getsocketfd10-1). |
+
+**Return value**
+
+| Type | Description |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | Promise used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.|
+
+**Error codes**
+
+For details about the error codes, see [VPN Error Codes](../errorcodes/errorcode-net-vpn.md).
+
+| ID| Error Message |
+| ------- | ----------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 2200001 | Invalid parameter value. |
+| 2200002 | Operation failed. Cannot connect to service. |
+| 2200003 | System internal error. |
+| 2203004 | Invalid socket file descriptor. |
+
+**Example**
+
+```js
+ import socket from "@ohos.net.socket";
+ var tcp = socket.constructTCPSocketInstance();
+ tcp.bind({
+ address: "0.0.0.0",
+ family: 1
+ })
+ let connectAddress = {
+ address: "192.168.1.11",
+ port: 8888,
+ family: 1
+ };
+ tcp.connect({
+ address: connectAddress, timeout: 6000
+ })
+ tcp.getSocketFd().then((tunnelfd) => {
+ console.info("tunenlfd: " + tunnelfd);
+ VpnConnection.protect(tunnelfd).then(() => {
+ console.info("protect success.")
+ }).catch(err => {
+ console.info("protect fail" + JSON.stringify(err))
+ })
+ })
+```
+
+### destroy
+
+destroy(callback: AsyncCallback\): void
+
+Destroys a VPN. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.MANAGE_VPN
+
+**System capability**: SystemCapability.Communication.NetManager.Vpn
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
+| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **error** is **undefined**. If the operation fails, an error message is returned.|
+
+**Error codes**
+
+For details about the error codes, see [VPN Error Codes](../errorcodes/errorcode-net-vpn.md).
+
+| ID| Error Message |
+| ------- | ----------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 2200002 | Operation failed. Cannot connect to service. |
+| 2200003 | System internal error. |
+
+**Example**
+
+```js
+ VpnConnection.destroy((error) => {
+ console.info(JSON.stringify(error));
+ })
+```
+
+### destroy
+
+destroy(): Promise\
+
+Destroys a VPN. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.MANAGE_VPN
+
+**System capability**: SystemCapability.Communication.NetManager.Vpn
+
+**Return value**
+
+| Type | Description |
+| --------------------------------- | ------------------------------------- |
+| Promise\ | Promise used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.|
+
+**Error codes**
+
+For details about the error codes, see [VPN Error Codes](../errorcodes/errorcode-net-vpn.md).
+
+| ID| Error Message |
+| ------- | ----------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 2200002 | Operation failed. Cannot connect to service. |
+| 2200003 | System internal error. |
+
+**Example**
+
+```js
+ VpnConnection.destroy().then(() => {
+ console.info("destroy success.")
+ }).catch(err => {
+ console.info("destroy fail" + JSON.stringify(err))
+ });
+```
+
+## VpnConfig
+
+Defines the VPN configuration.
+
+**System API**: This is a system API.
+
+**System capability**: SystemCapability.Communication.NetManager.Vpn
+
+| Name| Type| Mandatory| Description|
+| ------- | ------ | -- |------------------------------ |
+| addresses | Array\<[LinkAddress](js-apis-net-connection.md#linkaddress8)\> | Yes| IP address of the vNIC.|
+| routes | Array\<[RouteInfo](js-apis-net-connection.md#routeinfo8)\> | No| Route information of the vNIC.|
+| dnsAddresses | Array\ | No| IP address of the DNS server.|
+| searchDomains | Array\ | No| List of DNS search domains.|
+| mtu | number | No| Maximum transmission unit (MTU), in bytes.|
+| isIPv4Accepted | boolean | No| Whether IPv4 is supported. The default value is **true**.|
+| isIPv6Accepted | boolean | No| Whether IPv6 is supported. The default value is **false**.|
+| isLegacy | boolean | No| Whether the built-in VPN is supported. The default value is **false**.|
+| isBlocking | boolean | No| Whether the blocking mode is used. The default value is **false**.|
+| trustedApplications | Array\ | No| List of trusted applications, which are represented by bundle names of the string type.|
+| blockedApplications | Array\ | No| List of blocked applications, which are represented by bundle names of the string type.|
diff --git a/en/application-dev/reference/apis/js-apis-nfcTag.md b/en/application-dev/reference/apis/js-apis-nfcTag.md
index 9aeadd303e320824c99d7eb58148274bbb537e9b..07e68bebed8fd58bbf29a1bb6d800b8a5710821c 100644
--- a/en/application-dev/reference/apis/js-apis-nfcTag.md
+++ b/en/application-dev/reference/apis/js-apis-nfcTag.md
@@ -23,20 +23,18 @@ Before developing applications related to tag read and write, you must declare N
// Add the nfc tag action.
"ohos.nfc.tag.action.TAG_FOUND"
+ ],
+ "uris": [
+ {
+ "type":"tag-tech/NfcA"
+ },
+ {
+ "type":"tag-tech/IsoDep"
+ }
+ // Add other technology if neccessary,
+ // such as NfcB, NfcF, NfcV, Ndef, MifareClassic, MifareUL, and NdefFormatable.
]
}
- ],
- "metadata": [
- {
- "name": "tag-tech",
- "value": "NfcA"
- },
- {
- "name": "tag-tech",
- "value": "IsoDep"
- }
- // Add other technologies,
- // such as NfcB, NfcF, NfcV, Ndef, MifareClassic, MifareUL, and NdefFormatable.
]
}
],
@@ -49,13 +47,11 @@ Before developing applications related to tag read and write, you must declare N
}
}
```
-> **CAUTION**
+> **CAUTION**
>
> - The **actions** field is mandatory. It must be **ohos.nfc.tag.action.TAG_FOUND** and cannot be changed.
-> - The **name** field under **metadata** is mandatory. It must be **tag-tech** and cannot be changed.
-> - The **value** field under **metadata** is mandatory. It can be **NfcA**, **NfcB**, **NfcF**, **NfcV**, **IsoDep**, **Ndef**, **MifareClassic**, **MifareUL**, **NdefFormatable** or any of their combinations. Incorrect settings of this field will cause a parsing failure.
+> - The **type** field under **uris** must start with **tag-tech/**, followed by NfcA, NfcB, NfcF, NfcV, IsoDep, Ndef, MifareClassic, MifareUL, or NdefFormatable. If there are multiple types, enter them in different lines. Incorrect settings of this field will cause a parsing failure.
> - The **name** field under **requestPermissions** is mandatory. It must be **ohos.permission.NFC_TAG** and cannot be changed.
-
## **Modules to Import**
```js
@@ -528,8 +524,16 @@ import tag from '@ohos.nfc.tag';
let elementName = null;
let discTech = [tag.NFC_A, tag.NFC_B]; // replace with the tech(s) that is needed by foreground ability
-function foregroundCb(tagInfo: any) {
- console.log("foreground callback: tag found tagInfo = ", JSON.stringify(tagInfo));
+
+function foregroundCb(err, taginfo) {
+ if (!err) {
+ console.log("foreground callback: tag found tagInfo = ", JSON.stringify(tagInfo));
+ } else {
+ console.log("foreground callback err: " + err.message);
+ return;
+ }
+ // other Operations of taginfo
+
}
export default class MainAbility extends UIAbility {
@@ -885,7 +889,7 @@ Enumerates the tag technology types.
| **Name** | **Value**| **Description** |
| ---------------------------- | ------ | --------------------------- |
| NFC_A | 1 | NFC-A (ISO 14443-3A). |
-| NFC_B | 2 | NFC-B (ISO 14443-3B).|
+| NFC_B | 2 | NFC-B (ISO 14443-3B). |
| ISO_DEP | 3 | ISO-DEP (ISO 14443-4).|
| NFC_F | 4 | NFC-F (JIS 6319-4). |
| NFC_V | 5 | NFC-V (ISO 15693). |
diff --git a/en/application-dev/reference/apis/js-apis-notification.md b/en/application-dev/reference/apis/js-apis-notification.md
index 646f07fc4d30ec6ad4585eacd840a99954b34973..5ab31338dad186152b29dab25f05f1175822902a 100644
--- a/en/application-dev/reference/apis/js-apis-notification.md
+++ b/en/application-dev/reference/apis/js-apis-notification.md
@@ -4,7 +4,7 @@ The **Notification** module provides notification management capabilities, cover
> **NOTE**
>
-> The initial APIs of this module are supported since API version 7. 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 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. This module is deprecated since API version 9.
>
> Notification subscription and unsubscription APIs are available only to system applications.
@@ -1460,7 +1460,7 @@ Removes a notification for a specified bundle. This API uses an asynchronous cal
| --------------- | ----------------------------------| ---- | -------------------- |
| bundle | [BundleOption](#bundleoptiondeprecated) | Yes | Bundle information of the application. |
| notificationKey | [NotificationKey](#notificationkeydeprecated) | Yes | Notification key. |
-| reason | [RemoveReason](#removereason9-deprecated) | Yes | Indicates the reason for deleting a notification. |
+| reason | [RemoveReason](#removereason-deprecated) | Yes | Reason for deleting a notification. |
| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Example**
@@ -1502,7 +1502,7 @@ Removes a notification for a specified bundle. This API uses a promise to return
| --------------- | --------------- | ---- | ---------- |
| bundle | [BundleOption](#bundleoptiondeprecated) | Yes | Bundle information of the application.|
| notificationKey | [NotificationKey](#notificationkeydeprecated) | Yes | Notification key. |
-| reason | [RemoveReason](#removereason9-deprecated) | Yes | Reason for deleting the notification. |
+| reason | [RemoveReason](#removereason-deprecated) | Yes | Reason for deleting the notification. |
**Example**
@@ -1536,8 +1536,8 @@ Removes a notification for a specified bundle. This API uses an asynchronous cal
| Name | Type | Mandatory| Description |
| -------- | --------------------- | ---- | -------------------- |
-| hashCode | string | Yes | Unique notification ID. It is the **hashCode** in the [NotificationRequest](#notificationrequest) object of [SubscribeCallbackData](#subscribecallbackdata) of the [onConsume](js-apis-inner-notification-notificationSubscriber.md#onconsume) callback. |
-| reason | [RemoveReason](#removereason9-deprecated) | Yes | Indicates the reason for deleting a notification. |
+| hashCode | string | Yes | Unique notification ID. It is the **hashCode** in the [NotificationRequest](#notificationrequest) object of [SubscribeCallbackData](#subscribecallbackdata) of the [onConsume](js-apis-inner-notification-notificationSubscriber.md#onconsume) callback.|
+| reason | [RemoveReason](#removereason-deprecated) | Yes | Reason for deleting a notification. |
| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Example**
@@ -1573,7 +1573,7 @@ Removes a notification for a specified bundle. This API uses a promise to return
| Name | Type | Mandatory| Description |
| -------- | ---------- | ---- | ---------- |
| hashCode | string | Yes | Unique notification ID.|
-| reason | [RemoveReason](#removereason9-deprecated) | Yes | Reason for deleting the notification. |
+| reason | [RemoveReason](#removereason-deprecated) | Yes | Reason for deleting the notification. |
**Example**
@@ -2872,10 +2872,10 @@ Notification.getDeviceRemindType().then((data) => {
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [notificationManager.BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) instead.
-| Name | Type | Read-only| Mandatory| Description |
-| ------ | ------ |---- | --- | ------ |
-| bundle | string | No | Yes | Bundle information of the application.|
-| uid | number | No | No | User ID.|
+| Name | Type | Mandatory| Description |
+| ------ | ------ | --- | ------ |
+| bundle | string | Yes | Bundle information of the application.|
+| uid | number | No | User ID.|
## NotificationKeydeprecated
@@ -3059,7 +3059,7 @@ Describes the notification request.
| classification | string | Yes | Yes | Notification category. **System API**: This is a system API and cannot be called by third-party applications. |
| groupName8+ | string | Yes | Yes | Notification group name. |
| template8+ | [NotificationTemplate](#notificationtemplate8) | Yes | Yes | Notification template. |
-| isRemoveAllowed8+ | boolean | Yes | No | Whether the notification can be removed. **System API**: This is a system API and cannot be called by third-party applications. |
+| isRemoveAllowed10+ | boolean | Yes | No | Whether the notification can be removed. **System API**: This is a system API and cannot be called by third-party applications. |
| source8+ | number | Yes | No | Notification source. **System API**: This is a system API and cannot be called by third-party applications. |
| distributedOption8+ | [DistributedOptions](#distributedoptions8) | Yes | Yes | Distributed notification options. |
| deviceId8+ | string | Yes | No | Device ID of the notification source. **System API**: This is a system API and cannot be called by third-party applications. |
@@ -3203,7 +3203,7 @@ Provides the notification user input.
| TYPE_CONTINUOUS | 1 | Continuous notification. |
| TYPE_TIMER | 2 | Timed notification. |
-## RemoveReason9+ deprecated
+## RemoveReason deprecated
**System capability**: SystemCapability.Notification.Notification
@@ -3211,9 +3211,9 @@ Provides the notification user input.
> **NOTE**
>
-> This API is supported since API version 9 and deprecated since API version 9. You are advised to use [notificationManager.RemoveReason](js-apis-notificationSubscribe.md#removereason) instead.
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [notificationManager.RemoveReason](js-apis-notificationSubscribe.md#removereason) instead.
| Name | Value | Description |
| -------------------- | --- | -------------------- |
-| CLICK_REASON_REMOVE9+ | 1 | The notification is removed after a click on it. |
-| CANCEL_REASON_REMOVE9+ | 2 | The notification is removed by the user. |
+| CLICK_REASON_REMOVE | 1 | The notification is removed after a click on it. |
+| CANCEL_REASON_REMOVE | 2 | The notification is removed by the user. |
diff --git a/en/application-dev/reference/apis/js-apis-notificationSubscribe.md b/en/application-dev/reference/apis/js-apis-notificationSubscribe.md
index 1ca3f7833aadfde7058e24f8231d0e0360d82122..10a7091a75c1e9354921fe46bdbc1ce4bccb1a2e 100644
--- a/en/application-dev/reference/apis/js-apis-notificationSubscribe.md
+++ b/en/application-dev/reference/apis/js-apis-notificationSubscribe.md
@@ -443,6 +443,90 @@ notificationSubscribe.remove(hashCode, reason).then(() => {
console.info("remove success");
});
```
+## NotificationSubscribe.remove
+
+remove(hashCodes: Array\, reason: RemoveReason, callback: AsyncCallback\): void
+
+Removes specified notifications. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Notification.Notification
+
+**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+|-----------|-------------------------------| ---- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| hashCodes | Array\ | Yes | Array of unique notification IDs. It is the **hashCode** in the [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) object of [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata) of the [onConsume](js-apis-inner-notification-notificationSubscriber.md#onConsume) callback.|
+| reason | [RemoveReason](#removereason) | Yes | Reason for removing the notification. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+
+**Error codes**
+
+For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
+
+| ID| Error Message |
+| -------- | ----------------------------------- |
+| 1600001 | Internal error. |
+| 1600002 | Marshalling or unmarshalling error. |
+| 1600003 | Failed to connect service. |
+
+**Example**
+
+```js
+let hashCodes = ['hashCode1', 'hashCode2'];
+
+function removeCallback(err) {
+ if (err) {
+ console.error(`remove failed, code is ${err.code}, message is ${err.message}`);
+ } else {
+ console.info("remove success");
+ }
+}
+let reason = notificationSubscribe.RemoveReason.CANCEL_REASON_REMOVE;
+notificationSubscribe.remove(hashCodes, reason, removeCallback);
+```
+
+## NotificationSubscribe.remove
+
+remove(hashCodes: Array\, reason: RemoveReason): Promise\
+
+Removes specified notifications. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Notification.Notification
+
+**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+|-----------|-------------------------------| ---- |-------------|
+| hashCodes | Array\ | Yes | Array of unique notification IDs.|
+| reason | [RemoveReason](#removereason) | Yes | Reason for removing the notification. |
+
+**Error codes**
+
+For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
+
+| ID| Error Message |
+| -------- | ----------------------------------- |
+| 1600001 | Internal error. |
+| 1600002 | Marshalling or unmarshalling error. |
+| 1600003 | Failed to connect service. |
+
+**Example**
+
+```js
+let hashCodes = ['hashCode1','hashCode2'];
+let reason = notificationSubscribe.RemoveReason.CLICK_REASON_REMOVE;
+notificationSubscribe.remove(hashCodes, reason).then(() => {
+ console.info("remove success");
+});
+```
## NotificationSubscribe.removeAll
diff --git a/en/application-dev/reference/apis/js-apis-photoAccessHelper.md b/en/application-dev/reference/apis/js-apis-photoAccessHelper.md
index 808334727bbbf917dad8a7f801bcc7896ad12ee3..aae05347c5a05bdcb5e6bcae488fe53fa89602f4 100644
--- a/en/application-dev/reference/apis/js-apis-photoAccessHelper.md
+++ b/en/application-dev/reference/apis/js-apis-photoAccessHelper.md
@@ -1275,6 +1275,151 @@ async function example() {
}
```
+### getPhotoIndex
+
+getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions, callback: AsyncCallback<number>): void
+
+Obtains the index of an image or video in an album. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_IMAGEVIDEO
+
+**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| photoUri | string | Yes | URI of the media asset whose index is to be obtained.|
+| albumUri | string | Yes | Album URI, which can be an empty string. If it is an empty string, all the media assets in the Gallery are obtained by default. |
+| options | [FetchOptions](#fetchoptions) | Yes | Fetch options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search conditions or sorting modes are set, the API cannot be called successfully. |
+
+**Return value**
+
+| Type | Description |
+| --------------------------------------- | ----------------- |
+| AsyncCallback<number>| Promise used to return the index obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Universal Error Codes](../errorcodes/errorcode-universal.md).
+
+| ID| Error Message|
+| -------- | ---------------------------------------- |
+| 401 | if parameter is invalid. |
+
+**Example**
+
+```ts
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+
+async function example() {
+ console.info('getPhotoIndexDemo');
+ let predicatesForGetAsset = new dataSharePredicates.DataSharePredicates();
+ let fetchOp = {
+ fetchColumns: [],
+ predicates: predicatesForGetAsset
+ };
+ //Obtain the uri of the album
+ let albumFetchResult = await helper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.FAVORITE, fetchOp);
+ let album = await albumFetchResult.getFirstObject();
+
+ let predicates = new dataSharePredicates.DataSharePredicates();
+ predicates.orderByAsc("add_modified");
+ let fetchOptions = {
+ fetchColumns: [],
+ predicates: predicates
+ };
+ let photoFetchResult = await album.getAssets(fetchOptions);
+ let expectIndex = 1;
+ //Obtain the uri of the second file
+ let photoAsset = await photoFetchResult.getObjectByPosition(expectIndex);
+
+ photoAccessHelper.getPhotoIndex(photoAsset.uri, album.albumUri, fetchOptions, (err, index) => {
+ try {
+ if (err == undefined) {
+ console.info(`getPhotoIndex successfully and index is : ${index}`);
+ } else {
+ console.info(`getPhotoIndex failed;`);
+ }
+ } catch (error) {
+ console.info(`getPhotoIndex failed; error: ${error}`);
+ }
+ }
+}
+```
+
+### getPhotoIndex
+
+getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions): Promise<number>
+
+Obtains the index of an image or video in an album. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_IMAGEVIDEO
+
+**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| photoUri | string | Yes | URI of the media asset whose index is to be obtained.|
+| albumUri | string | Yes | Album URI, which can be an empty string. If it is an empty string, all the media assets in the Gallery are obtained by default. |
+| options | [FetchOptions](#fetchoptions) | Yes | Fetch options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search conditions or sorting modes are set, the API cannot be called successfully. |
+
+**Return value**
+
+| Type | Description |
+| --------------------------------------- | ----------------- |
+| Promise<number>| Promise used to return the index obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Universal Error Codes](../errorcodes/errorcode-universal.md).
+
+| ID| Error Message|
+| -------- | ---------------------------------------- |
+| 401 | if parameter is invalid. |
+
+**Example**
+
+```ts
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+
+async function example() {
+ console.info('getPhotoIndexDemo');
+ let predicatesForGetAsset = new dataSharePredicates.DataSharePredicates();
+ let fetchOp = {
+ fetchColumns: [],
+ predicates: predicatesForGetAsset
+ };
+ //Obtain the uri of the album
+ let albumFetchResult = await helper.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.FAVORITE, fetchOp);
+ let album = await albumFetchResult.getFirstObject();
+
+ let predicates = new dataSharePredicates.DataSharePredicates();
+ predicates.orderByAsc("add_modified");
+ let fetchOptions = {
+ fetchColumns: [],
+ predicates: predicates
+ };
+ let photoFetchResult = await album.getAssets(fetchOptions);
+ let expectIndex = 1;
+ //Obtain the uri of the second file
+ let photoAsset = await photoFetchResult.getObjectByPosition(expectIndex);
+
+ photoAccessHelper.getPhotoIndex(photoAsset.uri, album.albumUri, fetchOptions)
+ .then((index) => {
+ console.info(`getPhotoIndex successfully and index is : ${index}`);
+ }).catch((err) => {
+ console.info(`getPhotoIndex failed; error: ${err}`);
+ })
+}
+```
+
### release
release(callback: AsyncCallback<void>): void
@@ -1360,7 +1505,7 @@ Provides APIs for encapsulating file asset attributes.
| Name | Type | Readable| Writable| Description |
| ------------------------- | ------------------------ | ---- | ---- | ------------------------------------------------------ |
-| uri | string | Yes | No | File asset URI, for example, **file://media/image/2**. |
+| uri | string | Yes | No | File asset URI, for example, **file://media/Photo/1/IMG_datetime_0001/displayName.jpg**. |
| photoType | [PhotoType](#phototype) | Yes | No | Type of the file. |
| displayName | string | Yes | No | File name, including the file name extension, to display. |
@@ -2243,6 +2388,282 @@ async function example() {
}
```
+### getExif10+
+
+getExif(): Promise<string>
+
+Obtains a JSON string consisting of the EXIF tags of this JPG image. This API uses a promise to return the result.
+
+**CAUTION** This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and **js-apis-photoAccessHelper.md**. These two fields must be passed in via **fetchColumns**.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_IMAGEVIDEO
+
+**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
+
+**Return value**
+
+| Type | Description |
+| --------------------------------------- | ----------------- |
+| Promise<string> | Callback invoked to return the JSON string obtained.|
+
+**Supported EXIF tags**
+
+For details about the EXIF tags, see [image.PropertyKey](js-apis-image.md#propertykey7).
+
+| Key Value | Description |
+| --------------------------------------- | ----------------- |
+| BitsPerSample | Number of bits per pixel.|
+| Orientation | Image orientation.|
+| ImageLength | Image length.|
+| ImageWidth | Image width.|
+| GPSLatitude | GPS latitude of the image.|
+| GPSLongitude | GPS longitude of the image.|
+| GPSLatitudeRef | Longitude reference, for example, W or E.|
+| GPSLongitudeRef | Latitude reference, for example, N or S.|
+| DateTimeOriginal | Shooting time.|
+| ExposureTime | Exposure time.|
+| SceneType | Shooting scene type.|
+| ISOSpeedRatings | ISO sensitivity or speed.|
+| FNumber | f-number.|
+| DateTime | Date and time when the image was last modified.|
+| GPSTimeStamp | GPS timestamp.|
+| GPSDateStamp | GPS date stamp.|
+| ImageDescription | Image description.|
+| Make | Camera vendor.|
+| Model | Model.|
+| PhotoMode | Photo mode.|
+| SensitivityType | Sensitivity type.|
+| StandardOutputSensitivity | Standard output sensitivity.|
+| RecommendedExposureIndex | Recommended exposure index.|
+| ApertureValue | Aperture value.|
+| MeteringMode | Metering mode.|
+| LightSource | Light source.|
+| Flash | Flash status.|
+| FocalLength | Focal length.|
+| UserComment | User comment.|
+| PixelXDimension | Pixel X dimension.|
+| PixelYDimension | Pixel Y dimension.|
+| WhiteBalance | White balance.|
+| FocalLengthIn35mmFilm | Focal length in 35 mm film.|
+| ExposureBiasValue | Exposure compensation.|
+
+**Example**
+
+```ts
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+
+async function example() {
+ try {
+ console.info('getExifDemo');
+ let predicates = new dataSharePredicates.DataSharePredicates();
+ let fetchOptions = {
+ fetchColumns: [ 'all_exif', photoKeys.USER_COMMENT],
+ predicates: predicates
+ };
+ let fetchResult = await phAccessHelper.getAssets(fetchOptions);
+ let fileAsset = await fetchResult.getFirstObject();
+ let exifMessage = await fileAsset.getExif();
+ let userCommentKey = 'UserComment';
+ let userComment = JSON.stringify(JSON.parse(exifMessage), [userCommentKey]);
+ fetchResult.close();
+ } catch (err) {
+ console.error('getExifDemoCallback failed with error: ' + err);
+ }
+}
+```
+
+### getExif10+
+
+getExif(callback: AsyncCallback<string>): void
+
+Obtains a JSON string consisting of the EXIF tags of this JPG image. This API uses an asynchronous callback to return the result.
+
+**CAUTION** This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and **ImageVideoKey.USER_COMMENT**. These two fields must be passed in via **fetchColumns**.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_IMAGEVIDEO
+
+**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| callback | AsyncCallback<string> | Yes | Callback invoked to return the JSON string obtained.|
+
+**Supported EXIF tags**
+
+For details about the EXIF tags, see [image.PropertyKey](js-apis-image.md#propertykey7).
+
+| Key Value | Description |
+| --------------------------------------- | ----------------- |
+| BitsPerSample | Number of bits per pixel.|
+| Orientation | Image orientation.|
+| ImageLength | Image length.|
+| ImageWidth | Image width.|
+| GPSLatitude | GPS latitude of the image.|
+| GPSLongitude | GPS longitude of the image.|
+| GPSLatitudeRef | Longitude reference, for example, W or E.|
+| GPSLongitudeRef | Latitude reference, for example, N or S.|
+| DateTimeOriginal | Shooting time.|
+| ExposureTime | Exposure time.|
+| SceneType | Shooting scene type.|
+| ISOSpeedRatings | ISO sensitivity or speed.|
+| FNumber | f-number.|
+| DateTime | Date and time when the image was last modified.|
+| GPSTimeStamp | GPS timestamp.|
+| GPSDateStamp | GPS date stamp.|
+| ImageDescription | Image description.|
+| Make | Camera vendor.|
+| Model | Model.|
+| PhotoMode | Photo mode.|
+| SensitivityType | Sensitivity type.|
+| StandardOutputSensitivity | Standard output sensitivity.|
+| RecommendedExposureIndex | Recommended exposure index.|
+| ApertureValue | Aperture value.|
+| MeteringMode | Metering mode.|
+| LightSource | Light source.|
+| Flash | Flash status.|
+| FocalLength | Focal length.|
+| UserComment | User comment.|
+| PixelXDimension | Pixel X dimension.|
+| PixelYDimension | Pixel Y dimension.|
+| WhiteBalance | White balance.|
+| FocalLengthIn35mmFilm | Focal length in 35 mm film.|
+| ExposureBiasValue | Exposure compensation.|
+
+**Example**
+
+```ts
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+
+async function example() {
+ try {
+ console.info('getExifDemo');
+ let predicates = new dataSharePredicates.DataSharePredicates();
+ let fetchOptions = {
+ fetchColumns: [ 'all_exif', photoKeys.USER_COMMENT],
+ predicates: predicates
+ };
+ let fetchResult = await phAccessHelper.getAssets(fetchOptions);
+ let fileAsset = await fetchResult.getFirstObject();
+ let userCommentKey = 'UserComment';
+ fileAsset.getExif((err, exifMessage) => {
+ if (exifMessage != undefined) {
+ let userComment = JSON.stringify(JSON.parse(exifMessage), [userCommentKey]);
+ } else {
+ console.error('getExif failed, message = ', err);
+ }
+ });
+ fetchResult.close();
+ } catch (err) {
+ console.error('getExifDemoCallback failed with error: ' + err);
+ }
+}
+```
+
+### setUserComment10+
+
+setUserComment(userComment: string): Promise<void>
+
+Sets user comment information of an image or video. This API uses a promise to return the result.
+
+**NOTE** This API can be used to modify the comment information of only images or videos.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
+
+**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| userComment | string | Yes | User comment information to set, which cannot exceed 140 characters.|
+
+**Return value**
+
+| Type | Description |
+| --------------------------------------- | ----------------- |
+|Promise<void> | Promise that returns no value.|
+
+**Example**
+
+```ts
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+
+async function example() {
+ try {
+ console.info('setUserCommentDemo')
+ let predicates = new dataSharePredicates.DataSharePredicates();
+ let fetchOptions = {
+ fetchColumns: [],
+ predicates: predicates
+ };
+ let fetchResult = await phAccessHelper.getAssets(fetchOptions);
+ let fileAsset = await fetchResult.getFirstObject();
+ let userComment = 'test_set_user_comment';
+ await fileAsset.setUserComment(userComment);
+ } catch (err) {
+ console.error('setUserCommentDemoCallback failed with error: ' + err);
+ }
+}
+```
+
+### setUserComment10+
+
+setUserComment(userComment: string, callback: AsyncCallback<void>): void
+
+Sets user comment information of an image or video. This API uses an asynchronous callback to return the result.
+
+**NOTE** This API can be used to modify the comment information of only images or videos.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
+
+**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| userComment | string | Yes | User comment information to set, which cannot exceed 140 characters.|
+| callback | AsyncCallback<void> | Yes | Callback that returns no value.|
+
+**Example**
+
+```ts
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+
+async function example() {
+ try {
+ console.info('setUserCommentDemo')
+ let predicates = new dataSharePredicates.DataSharePredicates();
+ let fetchOptions = {
+ fetchColumns: [],
+ predicates: predicates
+ };
+ let fetchResult = await phAccessHelper.getAssets(fetchOptions);
+ let fileAsset = await fetchResult.getFirstObject();
+ let userComment = 'test_set_user_comment';
+ fileAsset.setUserComment(userComment, (err) => {
+ if (err === undefined) {
+ console.info('setUserComment successfully');
+ } else {
+ console.error('setUserComment failed with error: ' + err);
+ }
+ });
+ } catch (err) {
+ console.error('setUserCommentDemoCallback failed with error: ' + err);
+ }
+}
+```
+
## FetchResult
Provides APIs to manage the file retrieval result.
@@ -3726,6 +4147,7 @@ Defines the key information about an image or video file.
| DATE_TRASHED | 'date_trashed' | Date when the file was deleted. The value is the number of seconds between the time when the file is deleted and January 1, 1970. **System API**: This is a system API. |
| HIDDEN | 'hidden' | Whether the file is hidden. **System API**: This is a system API. |
| CAMERA_SHOT_KEY | 'camera_shot_key' | Key for the Untra Snamshot feature, which allows the camera to take photos or record videos with the screen off. (This parameter is available only for the system camera, and the key value is defined by the system camera.) **System API**: This is a system API. |
+| USER_COMMENT10+ | 'user_comment' | User comment information. **System API**: This is a system API. |
## AlbumKeys
diff --git a/en/application-dev/reference/apis/js-apis-reminderAgentManager.md b/en/application-dev/reference/apis/js-apis-reminderAgentManager.md
index 644759435975c722de9fd274b704ecd01804d2fd..de1e1e04ddfc51d5e24ef783f022ab2f400f09dc 100644
--- a/en/application-dev/reference/apis/js-apis-reminderAgentManager.md
+++ b/en/application-dev/reference/apis/js-apis-reminderAgentManager.md
@@ -1,8 +1,6 @@
-# @ohos.reminderAgentManager (reminderAgentManager)
+# @ohos.reminderAgentManager (Agent-Powered Reminders)
-The **reminderAgentManager** module provides APIs for publishing scheduled reminders through the reminder agent.
-
-You can use the APIs to create scheduled reminders for countdown timers, calendar events, and alarm clocks. When the created reminders are published, the timing and pop-up notification functions of your application will be taken over by the reminder agent in the background when your application is frozen or exits.
+The **reminderAgentManager** module provides APIs related to agent-powered reminders. When your application is frozen or exits, the timing and notification functions of your application will be taken over by a system service running in the background. You can use the APIs to create scheduled reminders for countdown timers, calendar events, and alarm clocks.
> **NOTE**
>
@@ -15,12 +13,15 @@ You can use the APIs to create scheduled reminders for countdown timers, calenda
import reminderAgentManager from'@ohos.reminderAgentManager';
```
-
## reminderAgentManager.publishReminder
publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback\): void
-Publishes a reminder through the reminder agent. This API uses an asynchronous callback to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8).
+Publishes a reminder. This API uses an asynchronous callback to return the result.
+
+> **NOTE**
+>
+> This API can be called only after the [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8) permission is obtained.
**Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER
@@ -28,10 +29,10 @@ Publishes a reminder through the reminder agent. This API uses an asynchronous c
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | reminderReq | [ReminderRequest](#reminderrequest) | Yes| Reminder to be published.|
- | callback | AsyncCallback\ | Yes| Callback used to return the published reminder's ID.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| reminderReq | [ReminderRequest](#reminderrequest) | Yes| Request used for publishing the reminder.|
+| callback | AsyncCallback\ | Yes| Callback used to return the published reminder's ID.|
**Error codes**
@@ -62,26 +63,29 @@ try {
};
```
-
## reminderAgentManager.publishReminder
publishReminder(reminderReq: ReminderRequest): Promise\
-Publishes a reminder through the reminder agent. This API uses a promise to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8).
+Publishes a reminder. This API uses a promise to return the result.
+
+> **NOTE**
+>
+> This API can be called only after the [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8) permission is obtained.
**Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER
**System capability**: SystemCapability.Notification.ReminderAgent
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | reminderReq | [ReminderRequest](#reminderrequest) | Yes| Reminder to be published.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| reminderReq | [ReminderRequest](#reminderrequest) | Yes| Request used for publishing the reminder.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Promise\ | Promise used to return the published reminder's ID.|
+| Type| Description|
+| -------- | -------- |
+| Promise\ | Promise used to return the published reminder's ID.|
**Error codes**
@@ -115,7 +119,7 @@ try {
cancelReminder(reminderId: number, callback: AsyncCallback\): void
-Cancels the reminder with the specified ID. This API uses an asynchronous callback to return the cancellation result.
+Cancels a reminder published. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -124,7 +128,7 @@ Cancels the reminder with the specified ID. This API uses an asynchronous callba
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderId | number | Yes| ID of the reminder to cancel.|
-| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result. If the reminder is canceled, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
@@ -151,12 +155,11 @@ try {
};
```
-
## reminderAgentManager.cancelReminder
cancelReminder(reminderId: number): Promise\
-Cancels the reminder with the specified ID. This API uses a promise to return the cancellation result.
+Cancels a reminder published. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -170,7 +173,7 @@ Cancels the reminder with the specified ID. This API uses a promise to return th
| Type| Description|
| -------- | -------- |
-| Promise\ | Promise used to return the result.|
+| Promise\ | Promise that returns no value.|
**Error codes**
@@ -199,8 +202,7 @@ try {
getValidReminders(callback: AsyncCallback>): void
-
-Obtains all valid (not yet expired) reminders set by the current application. This API uses an asynchronous callback to return the reminders.
+Obtains all valid (not yet expired) reminders set by the current application. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -208,7 +210,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback\> | Yes| Asynchronous callback used to return an array of all valid reminders set by the current application.|
+| callback | AsyncCallback\> | Yes| Callback used to return all the valid reminders.|
**Error codes**
@@ -259,7 +261,7 @@ try {
getValidReminders(): Promise\>
-Obtains all valid (not yet expired) reminders set by the current application. This API uses a promise to return the reminders.
+Obtains all valid (not yet expired) reminders set by the current application. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -267,7 +269,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th
| Type| Description|
| -------- | -------- |
-| Promise\> | Promise used to return an array of all valid reminders set by the current application.|
+| Promise\> | Promise used to return all the valid reminders.|
**Error codes**
@@ -312,12 +314,11 @@ try {
};
```
-
## reminderAgentManager.cancelAllReminders
cancelAllReminders(callback: AsyncCallback\): void
-Cancels all reminders set by the current application. This API uses an asynchronous callback to return the cancellation result.
+Cancels all reminders set by the current application. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -325,7 +326,7 @@ Cancels all reminders set by the current application. This API uses an asynchron
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result. If all the reminders are canceled, **err** is **undefined**. Otherwise, **err** is an error object. |
**Error codes**
@@ -351,12 +352,11 @@ try {
};
```
-
## reminderAgentManager.cancelAllReminders
cancelAllReminders(): Promise\
-Cancels all reminders set by the current application. This API uses a promise to return the cancellation result.
+Cancels all reminders set by the current application. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -364,7 +364,7 @@ Cancels all reminders set by the current application. This API uses a promise to
| Type| Description|
| -------- | -------- |
-| Promise\ | Promise used to return the result.|
+| Promise\ | Promise that returns no value.|
**Error codes**
@@ -401,8 +401,8 @@ Adds a notification slot. This API uses an asynchronous callback to return the r
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot, whose type can be set.|
-| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot. Only the type can be set.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result. If the notification slot is added, **err** is **undefined**. Otherwise, **err** is an error object.|
**Example**
@@ -438,13 +438,13 @@ Adds a notification slot. This API uses a promise to return the result.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot, whose type can be set.|
+| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot. Only the type can be set.|
**Return value**
| Type| Description|
| -------- | -------- |
-| Promise\ | Promise used to return the result.|
+| Promise\ | Promise that returns no value.|
**Example**
@@ -470,7 +470,7 @@ try {
removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback\): void
-Removes a notification slot of a specified type. This API uses an asynchronous callback to return the result.
+Removes a notification slot. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -479,7 +479,7 @@ Removes a notification slot of a specified type. This API uses an asynchronous c
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the notification slot to remove.|
-| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result. If the notification slot is removed, **err** is **undefined**. Otherwise, **err** is an error object.|
**Example**
@@ -504,7 +504,7 @@ try {
removeNotificationSlot(slotType: notification.SlotType): Promise\
-Removes a notification slot of a specified type. This API uses a promise to return the result.
+Removes a notification slot. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -518,7 +518,7 @@ Removes a notification slot of a specified type. This API uses a promise to retu
| Type| Description|
| -------- | -------- |
-| Promise\ | Promise used to return the result.|
+| Promise\ | Promise that returns no value.|
**Example**
@@ -538,7 +538,7 @@ try {
## ActionButtonType
-Enumerates button types.
+Enumerates the button types.
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -551,7 +551,7 @@ Enumerates button types.
## ReminderType
-Enumerates reminder types.
+Enumerates the reminder types.
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -564,8 +564,7 @@ Enumerates reminder types.
## ActionButton
-Defines a button displayed for the reminder in the notification panel.
-
+Defines the button on the reminder displayed.
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -573,7 +572,7 @@ Defines a button displayed for the reminder in the notification panel.
| -------- | -------- | -------- | -------- |
| title | string | Yes| Text on the button.|
| type | [ActionButtonType](#actionbuttontype) | Yes| Button type.|
-| wantAgent10+ | [WantAgent](#wantagent) | No| Ability information that is displayed after the button is clicked. **System API**: This is a system API and cannot be called by third-party applications.|
+| wantAgent10+ | [WantAgent](#wantagent) | No| Information about the ability that is displayed after the button is clicked. **System API**: This is a system API and cannot be called by third-party applications.|
## WantAgent
@@ -592,19 +591,19 @@ Defines the information about the redirected-to ability.
## MaxScreenWantAgent
-Provides the information about the target package and ability to start automatically when the reminder is displayed in full-screen mode. This API is reserved.
+Provides the information about the ability that is started automatically and displayed in full-screen mode when the reminder arrives. This API is reserved.
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| pkgName | string | Yes| Name of the package that is automatically started when the reminder arrives and the device is not in use.|
-| abilityName | string | Yes| Name of the ability that is automatically started when the reminder arrives and the device is not in use.|
+| pkgName | string | Yes| Name of the target package. (If the device is in use, only a notification banner is displayed.)|
+| abilityName | string | Yes| Name of the target ability. (If the device is in use, only a notification banner is displayed.)|
## ReminderRequest
-Defines the reminder to publish.
+Defines the request for publishing a reminder.
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -613,7 +612,7 @@ Defines the reminder to publish.
| reminderType | [ReminderType](#remindertype) | Yes| Type of the reminder.|
| actionButton | [ActionButton](#actionbutton) | No| Buttons displayed for the reminder in the notification panel. - For common applications, a maximum of two buttons are supported. - For system applications, a maximum of two buttons are supported in API version 9, and a maximum of three buttons are supported in API version 10 and later versions.|
| wantAgent | [WantAgent](#wantagent) | No| Information about the ability that is redirected to when the reminder is clicked.|
-| maxScreenWantAgent | [MaxScreenWantAgent](#maxscreenwantagent) | No| Information about the ability that is automatically started when the reminder arrives. If the device is in use, a notification will be displayed.|
+| maxScreenWantAgent | [MaxScreenWantAgent](#maxscreenwantagent) | No| Information about the ability that is started automatically and displayed in full-screen mode when the reminder arrives. If the device is in use, only a notification banner is displayed. This API is reserved.|
| ringDuration | number | No| Ringing duration, in seconds. The default value is **1**.|
| snoozeTimes | number | No| Number of reminder snooze times. The default value is **0**.|
| timeInterval | number | No| Reminder snooze interval, in seconds. The minimum value is 5 minutes.|
@@ -623,8 +622,8 @@ Defines the reminder to publish.
| snoozeContent | string | No| Content to be displayed when the reminder is snoozing.|
| notificationId | number | No| Notification ID used by the reminder. If there are reminders with the same notification ID, the later one will overwrite the earlier one.|
| slotType | [notification.SlotType](js-apis-notificationManager.md#slottype) | No| Type of the slot used by the reminder.|
-| tapDismissed10+ | boolean | No| Whether the notification is automatically cleared. The value is the same as that of [NotificationRequest.tapDismissed](js-apis-inner-notification-notificationRequest.md#notificationrequest).|
-| autoDeletedTime10+ | number | No| Time when the notification is automatically cleared. The value is the same as that of [NotificationRequest.autoDeletedTime](js-apis-inner-notification-notificationRequest.md#notificationrequest).|
+| tapDismissed10+ | boolean | No| Whether the reminder is automatically cleared. For details, see [NotificationRequest.tapDismissed](js-apis-inner-notification-notificationRequest.md#notificationrequest). |
+| autoDeletedTime10+ | number | No| Time when the reminder is automatically cleared. For details, see [NotificationRequest.autoDeletedTime](js-apis-inner-notification-notificationRequest.md#notificationrequest).|
## ReminderRequestCalendar
diff --git a/en/application-dev/reference/apis/js-apis-request.md b/en/application-dev/reference/apis/js-apis-request.md
index f2eb1a5fff829317cf67affa7980deaee7c67158..9acb13cab11b2ff8458554a3bf32f67fab291f75 100644
--- a/en/application-dev/reference/apis/js-apis-request.md
+++ b/en/application-dev/reference/apis/js-apis-request.md
@@ -286,6 +286,10 @@ on(type: 'progress', callback:(uploadedSize: number, totalSize: number) => vo
Subscribes to upload progress events. This API uses a callback to return the result synchronously.
+> **NOTE**
+>
+> To maintain a balance between power consumption and performance, this API cannot be called when the application is running in the background.
+
**Required permissions**: ohos.permission.INTERNET
**System capability**: SystemCapability.MiscServices.Upload
@@ -851,6 +855,10 @@ on(type: 'progress', callback:(receivedSize: number, totalSize: number) => vo
Subscribes to download progress events. This API uses a callback to return the result synchronously.
+> **NOTE**
+>
+> To maintain a balance between power consumption and performance, this API cannot be called when the application is running in the background.
+
**Required permissions**: ohos.permission.INTERNET
**System capability**: SystemCapability.MiscServices.Download
diff --git a/en/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md b/en/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md
index d61b8272edee9b2b522139a9976df17027be98a5..99eb42bd5720fa12a833abcc030b45d02c7aefaf 100644
--- a/en/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md
+++ b/en/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md
@@ -1,16 +1,9 @@
# @ohos.resourceschedule.backgroundTaskManager (Background Task Management)
-The **BackgroundTaskManager** module provides APIs to manage background tasks.
-
-If a service needs to be continued when the application or service module is running in the background (not visible to users), the application or service module can request a transient task to delay the suspension or a continuous task to prevent the suspension.
-
-If an application has a task that needs to be continued when the application is switched to the background and can be completed within a short period of time, the application can request a transient task. For example, if a user chooses to clear junk files in the **Files** application and exits the application, the application can request a transient task to complete the cleanup.
-
-If an application has a service that can be intuitively perceived by users and needs to run in the background for a long period of time (for example, music playback in the background), the application can request a continuous task.
-
-If a privileged system application needs to use certain system resources (for example, it wants to receive common events when suspended), it can request efficiency resources.
+The **backgroundTaskManager** module provides APIs to request background tasks. You can use the APIs to request transient tasks, continuous tasks, or efficiency resources to prevent the application process from being terminated or suspended when your application is switched to the background.
> **NOTE**
+>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
@@ -24,9 +17,11 @@ import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'
requestSuspendDelay(reason: string, callback: Callback<void>): DelaySuspendInfo
-Requests delayed suspension after the application switches to the background.
+Requests a transient task.
-The default duration of delayed suspension is 3 minutes when the battery level is higher than or equal to the broadcast low battery level and 1 minute when the battery level is lower than the broadcast low battery level.
+> **NOTE**
+>
+> The maximum duration of a transient task is 3 minutes in normal cases. In the case of a [low battery](js-apis-battery-info.md), the maximum duration is decreased to 1 minute.
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
@@ -34,14 +29,14 @@ The default duration of delayed suspension is 3 minutes when the battery level i
| Name | Type | Mandatory | Description |
| -------- | -------------------- | ---- | ------------------------------ |
-| reason | string | Yes | Reason for delayed transition to the suspended state. |
-| callback | Callback<void> | Yes | Invoked when a delay is about to time out. Generally, this callback is used to notify the application 6 seconds before the delay times out.|
+| reason | string | Yes | Reason for requesting the transient task. |
+| callback | Callback<void> | Yes | Callback used to notify the application that the transient task is about to time out. Generally, the callback is invoked 6 seconds before the timeout.|
**Return value**
| Type | Description |
| ------------------------------------- | --------- |
-| [DelaySuspendInfo](#delaysuspendinfo) | Information about the suspension delay.|
+| [DelaySuspendInfo](#delaysuspendinfo) | Information about the transient task.|
**Error codes**
@@ -80,7 +75,7 @@ For details about the error codes, see [backgroundTaskManager Error Codes](../er
getRemainingDelayTime(requestId: number, callback: AsyncCallback<number>): void
-Obtains the remaining duration before the application is suspended. This API uses an asynchronous callback to return the result.
+Obtains the remaining time of a transient task. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
@@ -88,8 +83,8 @@ Obtains the remaining duration before the application is suspended. This API use
| Name | Type | Mandatory | Description |
| --------- | --------------------------- | ---- | ---------------------------------------- |
-| requestId | number | Yes | ID of the suspension delay request. |
-| callback | AsyncCallback<number> | Yes | Callback used to return the remaining duration before the application is suspended, in milliseconds.|
+| requestId | number | Yes | Request ID of the transient task. |
+| callback | AsyncCallback<number> | Yes | Callback used to return the remaining time, in milliseconds.|
**Error codes**
@@ -129,9 +124,7 @@ For details about the error codes, see [backgroundTaskManager Error Codes](../er
getRemainingDelayTime(requestId: number): Promise<number>
-Obtains the remaining duration before the application is suspended. This API uses a promise to return the result.
-
-
+Obtains the remaining time of a transient task. This API uses a promise to return the result.
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
@@ -139,13 +132,13 @@ Obtains the remaining duration before the application is suspended. This API use
| Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ---------- |
-| requestId | number | Yes | ID of the suspension delay request.|
+| requestId | number | Yes | Request ID of the transient task.|
**Return value**
| Type | Description |
| --------------------- | ---------------------------------------- |
-| Promise<number> | Promise used to return the remaining duration before the application is suspended, in milliseconds.|
+| Promise<number> | Promise used to return the remaining time, in milliseconds.|
**Error codes**
@@ -182,7 +175,7 @@ For details about the error codes, see [backgroundTaskManager Error Codes](../er
cancelSuspendDelay(requestId: number): void
-Cancels the suspension delay.
+Cancels a transient task.
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
@@ -190,7 +183,7 @@ Cancels the suspension delay.
| Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ---------- |
-| requestId | number | Yes | ID of the suspension delay request.|
+| requestId | number | Yes | Request ID of the transient task.|
**Error codes**
@@ -218,12 +211,11 @@ For details about the error codes, see [backgroundTaskManager Error Codes](../er
}
```
-
## backgroundTaskManager.startBackgroundRunning
startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback<void>): void
-Requests a continuous task from the system. This API uses an asynchronous callback to return the result.
+Requests a continuous task. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.KEEP_BACKGROUND_RUNNING
@@ -234,9 +226,9 @@ Requests a continuous task from the system. This API uses an asynchronous callba
| Name | Type | Mandatory | Description |
| --------- | ---------------------------------- | ---- | ---------------------------------------- |
| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
-| bgMode | [BackgroundMode](#backgroundmode) | Yes | Background mode requested. |
-| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. |
-| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+| bgMode | [BackgroundMode](#backgroundmode) | Yes | Continuous task mode. |
+| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameters, which are used to specify the target page that is redirected to when a continuous task notification is clicked. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the continuous task is requested, **err** is **undefined**. Otherwise, **err** is an error object. |
**Error codes**
@@ -301,7 +293,7 @@ export default class EntryAbility extends UIAbility {
startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise<void>
-Requests a continuous task from the system. This API uses a promise to return the result.
+Requests a continuous task. This API uses a promise to return the result.
**Required permissions**: ohos.permission.KEEP_BACKGROUND_RUNNING
@@ -312,14 +304,14 @@ Requests a continuous task from the system. This API uses a promise to return th
| Name | Type | Mandatory | Description |
| --------- | ---------------------------------- | ---- | ---------------------------------------- |
| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
-| bgMode | [BackgroundMode](#backgroundmode) | Yes | Background mode requested. |
-| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. |
+| bgMode | [BackgroundMode](#backgroundmode) | Yes | Continuous task mode. |
+| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameters, which are used to specify the target page that is redirected to when a continuous task notification is clicked. |
**Return value**
| Type | Description |
| -------------- | ---------------- |
-| Promise\ | Promise used to return the result.|
+| Promise\ | Promise that returns no value.|
**Error codes**
@@ -380,7 +372,7 @@ export default class EntryAbility extends UIAbility {
stopBackgroundRunning(context: Context, callback: AsyncCallback<void>): void
-Requests to cancel a continuous task. This API uses an asynchronous callback to return the result.
+Cancels a continuous task. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
@@ -389,7 +381,7 @@ Requests to cancel a continuous task. This API uses an asynchronous callback to
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ---------------------------------------- |
| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
-| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the continuous task is canceled, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
@@ -434,9 +426,7 @@ export default class EntryAbility extends UIAbility {
stopBackgroundRunning(context: Context): Promise<void>
-Requests to cancel a continuous task. This API uses a promise to return the result.
-
-
+Cancels a continuous task. This API uses a promise to return the result.
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
@@ -450,7 +440,7 @@ Requests to cancel a continuous task. This API uses a promise to return the resu
| Type | Description |
| -------------- | ---------------- |
-| Promise\ | Promise used to return the result.|
+| Promise\ | Promise that returns no value.|
**Error codes**
@@ -489,10 +479,9 @@ export default class EntryAbility extends UIAbility {
## backgroundTaskManager.applyEfficiencyResources
-applyEfficiencyResources(request: [EfficiencyResourcesRequest](#efficiencyresourcesrequest)): void
+applyEfficiencyResources(request: EfficiencyResourcesRequest): void
-Requests efficiency resources from the system.
-A process and its application can request the same type of resources at the same time, for example, CPU resources. When the application releases the resources, the same type of resources requested by the process are also released.
+Requests efficiency resources.
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
@@ -502,7 +491,7 @@ A process and its application can request the same type of resources at the same
| Name | Type | Mandatory | Description |
| ------- | ------- | ---- | ---------------------------------------- |
-| request | [EfficiencyResourcesRequest](#efficiencyresourcesrequest) | Yes | Necessary information carried in the request, including the resource type and timeout interval. For details, see [EfficiencyResourcesRequest](#efficiencyresourcesrequest).|
+| request | [EfficiencyResourcesRequest](#efficiencyresourcesrequest) | Yes | Necessary information carried in the request, including the resource type and timeout interval.|
**Error codes**
@@ -542,7 +531,7 @@ try {
resetAllEfficiencyResources(): void
-Releases all resources that have been requested.
+Releases all efficiency resources.
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
@@ -574,18 +563,19 @@ try {
## DelaySuspendInfo
-Provides the information about the suspension delay.
+Defines the information about the transient task.
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
| Name | Type | Mandatory | Description |
| --------------- | ------ | ---- | ---------------------------------------- |
-| requestId | number | Yes | ID of the suspension delay request. |
-| actualDelayTime | number | Yes | Actual suspension delay duration of the application, in milliseconds. The default duration is 180000 when the battery level is higher than or equal to the broadcast low battery level and 60000 when the battery level is lower than the broadcast low battery level.|
-
+| requestId | number | Yes | Request ID of the transient task. |
+| actualDelayTime | number | Yes | Actual duration of the transient task that the application requests, in milliseconds. The maximum duration of a transient task is 3 minutes in normal cases. In the case of a [low battery](js-apis-battery-info.md), the maximum duration is decreased to 1 minute.|
## BackgroundMode
+Enumerates the continuous task modes.
+
**System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
| Name | Value | Description |
@@ -596,9 +586,9 @@ Provides the information about the suspension delay.
| LOCATION | 4 | Positioning and navigation. |
| BLUETOOTH_INTERACTION | 5 | Bluetooth-related task. |
| MULTI_DEVICE_CONNECTION | 6 | Multi-device connection. |
-| WIFI_INTERACTION | 7 | WLAN-related (system API).|
-| VOIP | 8 | Audio and video calls (system API). |
-| TASK_KEEPING | 9 | Computing task (effective only for specific devices). |
+| WIFI_INTERACTION | 7 | WLAN-related. **System API**: This is a system API.|
+| VOIP | 8 |Audio and video calls. **System API**: This is a system API.|
+| TASK_KEEPING | 9 | Computing task (for specific devices only). |
## EfficiencyResourcesRequest
@@ -611,10 +601,10 @@ Describes the parameters for requesting efficiency resources.
| Name | Type | Mandatory | Description |
| --------------- | ------ | ---- | ---------------------------------------- |
| resourceTypes | number | Yes | Type of the resource to request. |
-| isApply | boolean | Yes | Whether the request is used to apply for resources. The value **true** means that the request is used to apply for resources, and **false** means that the request is used to release resources. |
+| isApply | boolean | Yes | Whether the request is used to apply for resources. The value **true** means that the request is used to apply for resources, and **false** means that the request is used to release resources.|
| timeOut | number | Yes | Duration for which the resource will be used, in milliseconds. |
-| isPersist | boolean | No | Whether the resource is permanently held. If the value is **true**, **timeOut** is invalid. |
-| isProcess | boolean | No | Whether the request is initiated by a process. The value **true** means that the request is initiated by a process, and **false** means that the request is initiated by an application. |
+| isPersist | boolean | No | Whether the resource is permanently held. The default value is **false**. The value **true** means that the resource is permanently held, and **false** means the resource is held within a given period of time.|
+| isProcess | boolean | No | Whether the request is initiated by a process. The default value is **false**. The value **true** means that the request is initiated by a process, and **false** means that the request is initiated by an application. |
| reason | string | Yes | Reason for requesting the resource. |
## ResourceType
@@ -627,12 +617,12 @@ Enumerates the efficiency resource types.
| Name | Value | Description |
| ----------------------- | ---- | --------------------- |
-| CPU | 1 | CPU resources, which prevent the application from being suspended. |
-| COMMON_EVENT | 2 | Common events are not proxied when the application is suspended.|
-| TIMER | 4 | System timers are not proxied when the application is suspended.|
-| WORK_SCHEDULER | 8 | Work Scheduler uses a loose control policy by default. For details about the constraints on the Work Scheduler usage, see [Constraints](../../task-management/work-scheduler.md#constraints).|
-| BLUETOOTH | 16 | Bluetooth resources are not proxied when the application is suspended.|
-| GPS | 32 | GPS resources are not proxied when the application is suspended.|
-| AUDIO | 64 | Audio resources are not proxied when the application is suspended.|
+| CPU | 1 | CPU resource. Such type of resource prevents an application from being suspended. |
+| COMMON_EVENT | 2 | Common event resource. Such type of resource ensures that an application in the suspended state can receive common events.|
+| TIMER | 4 | Timer resource. Such type of resource ensures that an application in the suspended state can be woken up by system timers.|
+| WORK_SCHEDULER | 8 | Deferred task resource. Such type of resource provides a loose control policy for an application.|
+| BLUETOOTH | 16 | Bluetooth resource. Such type of resource ensures that an application in the suspended state can be woken up by Bluetooth-related events.|
+| GPS | 32 | GPS resource. Such type of resource ensures that an application in the suspended state can be woken up by GPS-related events.|
+| AUDIO | 64 | Audio resource. Such type of resource prevents an application from being suspended when the application has an audio being played.|
| RUNNING_LOCK10+ | 128 | RUNNING_LOCK resources are not proxied when the application is suspended.|
| SENSOR10+ | 256 | Sensor callbacks are not intercepted.|
diff --git a/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md b/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md
index 85c085f6fb9ef65fb711aecbfe3610ab3d17f5d9..5fad64915cde48a0fe0150e83f1661bc0abb1aaa 100644
--- a/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md
+++ b/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md
@@ -1,15 +1,12 @@
# @ohos.resourceschedule.workScheduler (Deferred Task Scheduling)
-The **workScheduler** module provides the APIs for registering, canceling, and querying deferred tasks.
-
-The system schedules and executes deferred tasks at an appropriate time, subject to the storage space, power consumption, temperature, and more.
+The **workScheduler** module provides the APIs for registering, canceling, and querying deferred tasks. You can use the APIs to register tasks that do not have high requirements on real-time performance as deferred tasks. The system schedules and executes the deferred tasks at an appropriate time, subject to the storage space, power consumption, and more.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+>
> - The APIs of this module can be used only in the stage model.
-> - For details about the constraints on deferred task scheduling, see [Constraints](../../task-management/work-scheduler.md#constraints).
-
## Modules to Import
@@ -18,9 +15,10 @@ import workScheduler from '@ohos.resourceschedule.workScheduler';
```
## workScheduler.startWork
+
startWork(work: WorkInfo): void
-Instructs the WorkSchedulerService to add a task to the execution queue.
+Starts a deferred task.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
@@ -28,7 +26,7 @@ Instructs the WorkSchedulerService to add a task to the execution queue.
| Name | Type | Mandatory | Description |
| ---- | --------------------- | ---- | -------------- |
-| work | [WorkInfo](#workinfo) | Yes | Task to be added to the execution queue.|
+| work | [WorkInfo](#workinfo) | Yes | Deferred task to start.|
**Error codes**
@@ -42,7 +40,6 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
| 9700004 | Check workInfo failed. |
| 9700005 | StartWork failed. |
-
**Example**
```js
@@ -69,9 +66,10 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
```
## workScheduler.stopWork
+
stopWork(work: WorkInfo, needCancel?: boolean): void
-Instructs the WorkSchedulerService to stop a task.
+Stops a deferred task.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
@@ -79,8 +77,8 @@ Instructs the WorkSchedulerService to stop a task.
| Name | Type | Mandatory | Description |
| ---------- | --------------------- | ---- | ---------- |
-| work | [WorkInfo](#workinfo) | Yes | Task to stop. |
-| needCancel | boolean | No | Whether to cancel the task. The default value is **false**.|
+| work | [WorkInfo](#workinfo) | Yes | Deferred task to stop.|
+| needCancel | boolean | No | Whether to clear the task while stopping it. The value **true** means to clear the task while stopping it, and **false** means to stop the task only. The default value is **false**.|
**Error codes**
@@ -119,9 +117,10 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
```
## workScheduler.getWorkStatus
+
getWorkStatus(workId: number, callback : AsyncCallback\): void
-Obtains the latest task status. This API uses an asynchronous callback to return the result.
+Obtains the information a deferred task. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
@@ -129,8 +128,8 @@ Obtains the latest task status. This API uses an asynchronous callback to return
| Name | Type | Mandatory | Description |
| -------- | ------------------------------------- | ---- | ---------------------------------------- |
-| workId | number | Yes | Task ID. |
-| callback | AsyncCallback\<[WorkInfo](#workinfo)> | Yes | Callback used to return the result. If the specified task ID is valid, the task status obtained from the WorkSchedulerService is returned. Otherwise, an exception is thrown.|
+| workId | number | Yes | ID of the deferred task. |
+| callback | AsyncCallback\<[WorkInfo](#workinfo)> | Yes | Callback used to return the result. If **workId** is valid, the task information obtained from WorkSchedulerService is returned. Otherwise, an exception is thrown.|
**Error codes**
@@ -162,9 +161,10 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
```
## workScheduler.getWorkStatus
+
getWorkStatus(workId: number): Promise\
-Obtains the latest task status. This API uses a promise to return the result.
+Obtains the information a deferred task. This API uses a promise to return the result.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
@@ -172,13 +172,13 @@ Obtains the latest task status. This API uses a promise to return the result.
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | -------- |
-| workId | number | Yes | Task ID.|
+| workId | number | Yes | ID of the deferred task.|
**Return value**
| Type | Description |
| ------------------------------- | ---------------------------------------- |
-| Promise\<[WorkInfo](#workinfo)> | Promise used to return the result. If the specified task ID is valid, the task status obtained from the WorkSchedulerService is returned. Otherwise, an exception is thrown.|
+| Promise\<[WorkInfo](#workinfo)> | Promise used to return the result. If **workId** is valid, the task information obtained from WorkSchedulerService is returned.|
**Error codes**
@@ -208,9 +208,10 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
```
## workScheduler.obtainAllWorks
+
obtainAllWorks(callback : AsyncCallback\): Array\
-Obtains all tasks associated with the application. This API uses an asynchronous callback to return the result.
+Obtains all the deferred tasks. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
@@ -218,13 +219,13 @@ Obtains all tasks associated with the application. This API uses an asynchronous
| Name | Type | Mandatory | Description |
| -------- | -------------------- | ---- | ------------------------------- |
-| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result. If all the deferred tasks are obtained, **err** is **undefined**. Otherwise, **err** is an error object.|
**Return value**
| Type | Description |
| ----------------------------- | --------------- |
-| Array\<[WorkInfo](#workinfo)> | All tasks associated with the application.|
+| Array\<[WorkInfo](#workinfo)> | All the deferred tasks.|
**Error codes**
@@ -253,9 +254,10 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
```
## workScheduler.obtainAllWorks
+
obtainAllWorks(): Promise\>
-Obtains all tasks associated with the application. This API uses a promise to return the result.
+Obtains all the deferred tasks. This API uses a promise to return the result.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
@@ -263,7 +265,7 @@ Obtains all tasks associated with the application. This API uses a promise to re
| Type | Description |
| -------------------------------------- | ------------------------------ |
-| Promise> | Promise used to return all tasks associated with the application.|
+| Promise> | Promise used to return all the deferred tasks.|
**Error codes**
@@ -290,9 +292,10 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
```
## workScheduler.stopAndClearWorks
+
stopAndClearWorks(): void
-Stops and cancels all tasks associated with the application.
+Stops and clears all the deferred tasks.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
@@ -318,6 +321,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
```
## workScheduler.isLastWorkTimeOut
+
isLastWorkTimeOut(workId: number, callback : AsyncCallback\): boolean
Checks whether the last execution of a task timed out. This API uses an asynchronous callback to return the result.
@@ -328,14 +332,14 @@ Checks whether the last execution of a task timed out. This API uses an asynchro
| Name | Type | Mandatory | Description |
| -------- | -------------------- | ---- | ---------------------------------------- |
-| workId | number | Yes | Task ID. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+| workId | number | Yes | ID of the deferred task. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Return value**
| Type | Description |
| ------- | ---------------------------------------- |
-| boolean | Returns **true** if the last execution of the task timed out; returns **false** otherwise.|
+| boolean | The value **true** means that the last execution of the specified task times out, and **false** means the opposite.|
**Error codes**
@@ -365,6 +369,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
```
## workScheduler.isLastWorkTimeOut
+
isLastWorkTimeOut(workId: number): Promise\
Checks whether the last execution of a task timed out. This API uses a promise to return the result.
@@ -375,13 +380,13 @@ Checks whether the last execution of a task timed out. This API uses a promise t
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | -------- |
-| workId | number | Yes | Task ID.|
+| workId | number | Yes | ID of the deferred task.|
**Return value**
| Type | Description |
| ----------------- | ---------------------------------------- |
-| Promise\ | Promise used to return the result. If the last execution of the task timed out, **true** is returned. Otherwise, **false** is returned.|
+| Promise\ | Promise used to return the result. The value **true** means that the last execution of the specified task times out, and **false** means the opposite.|
**Error codes**
@@ -411,31 +416,33 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
```
## WorkInfo
-Provides detailed information about the task. For details about the constraints on setting the **WorkInfo** parameter, see [Constraints](../../task-management/work-scheduler.md#constraints).
+
+Defines the information about the deferred task.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
| Name | Type | Mandatory | Description |
| --------------- | --------------------------------- | ---- | ---------------- |
-| workId | number | Yes | Task ID. |
+| workId | number | Yes | ID of the deferred task. |
| bundleName | string | Yes | Bundle name of the application that requests the task. |
| abilityName | string | Yes | Name of the component to be notified by a deferred task scheduling callback.|
| networkType | [NetworkType](#networktype) | No | Network type. |
-| isCharging | boolean | No | Whether the device is charging. |
+| isCharging | boolean | No | Whether the device needs to enter the charging state to trigger deferred task scheduling. The value **true** means that the device needs to enter the charging state to trigger deferred task scheduling, and **false** means the opposite.|
| chargerType | [ChargingType](#chargingtype) | No | Charging type. |
-| batteryLevel | number | No | Battery level. |
+| batteryLevel | number | No | Battery level. |
| batteryStatus | [BatteryStatus](#batterystatus) | No | Battery status. |
| storageRequest | [StorageRequest](#storagerequest) | No | Storage status. |
-| isRepeat | boolean | No | Whether the task is repeated. |
+| isRepeat | boolean | No | Whether the task is repeated. The value** true** means that the task is repeated, and **false** means the opposite.|
| repeatCycleTime | number | No | Repeat interval. |
| repeatCount | number | No | Number of repeat times. |
-| isPersisted | boolean | No | Whether to enable persistent storage for the task. |
-| isDeepIdle | boolean | No | Whether the device needs to enter the idle state. |
-| idleWaitTime | number | No | Time to wait in the idle state. |
-| parameters | {[key: string]: number \| string \| boolean} | No | Carried parameters. |
+| isPersisted | boolean | No | Whether to enable persistent storage for the task. The value **true** means to enable persistent storage for the task, and **false** means the opposite.|
+| isDeepIdle | boolean | No | Whether the device needs to enter the idle state to trigger deferred task scheduling. The value **true** means that the device needs to enter the idle state to trigger deferred task scheduling, and **false** means the opposite. |
+| idleWaitTime | number | No | Time to wait in the idle state before triggering deferred task scheduling. |
+| parameters | [key: string]: number \| string \| boolean | No | Carried parameters.|
## NetworkType
-Enumerates the network types that can trigger task scheduling.
+
+Enumerates the network types that can trigger deferred task scheduling.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
@@ -449,7 +456,8 @@ Enumerates the network types that can trigger task scheduling.
| NETWORK_TYPE_ETHERNET | 5 | Ethernet. |
## ChargingType
-Enumerates the charging types that can trigger task scheduling.
+
+Enumerates the charging types that can trigger deferred task scheduling.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
@@ -461,7 +469,8 @@ Enumerates the charging types that can trigger task scheduling.
| CHARGING_PLUGGED_WIRELESS | 3 | Wireless charging. |
## BatteryStatus
-Enumerates the battery states that can trigger task scheduling.
+
+Enumerates the battery statuses that can trigger deferred task scheduling.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
@@ -472,7 +481,8 @@ Enumerates the battery states that can trigger task scheduling.
| BATTERY_STATUS_LOW_OR_OKAY | 2 | The battery level is restored from low to normal, or a low battery alert is displayed.|
## StorageRequest
-Enumerates the storage states that can trigger task scheduling.
+
+Enumerates the storage statuses that can trigger deferred task scheduling.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
@@ -480,4 +490,4 @@ Enumerates the storage states that can trigger task scheduling.
| ------------------------- | ---- | ------------------------------ |
| STORAGE_LEVEL_LOW | 0 | The storage space is insufficient. |
| STORAGE_LEVEL_OKAY | 1 | The storage space is restored from insufficient to normal. |
-| STORAGE_LEVEL_LOW_OR_OKAY | 2 | The storage space is restored from insufficient to normal, or the storage space is insufficient.|
+| STORAGE_LEVEL_LOW_OR_OKAY | 2 | The storage space is insufficient, or the storage space is restored from insufficient to normal.|
diff --git a/en/application-dev/reference/apis/js-apis-secureElement.md b/en/application-dev/reference/apis/js-apis-secureElement.md
index 4314ea817608a8e26cdb5d0fa45aa01b64297227..daa96f217bdcc86ffcd76fde5b8a7d08b2a3a966 100644
--- a/en/application-dev/reference/apis/js-apis-secureElement.md
+++ b/en/application-dev/reference/apis/js-apis-secureElement.md
@@ -66,7 +66,7 @@ try {
if (state == secureElement.ServiceState.DISCONNECTED) {
console.log("Service state is Disconnected");
} else {
- console.log.("Service state is Connected");
+ console.log("Service state is Connected");
}
});
} catch (e) {
@@ -114,7 +114,6 @@ try {
try {
nfcOmaReaderList = nfcSEService.getReaders();
if (nfcOmaReaderList != null && nfcOmaReaderList.length > 0) {
- nfcOmaReader = this.nfcOmaReaderList[0];
console.log("get reader successfully");
} else {
console.log("get reader failed");
@@ -205,7 +204,6 @@ import secureElement from '@ohos.secureElement';
let nfcSEService = null;
-this.result = "version: "
try {
// refer to newSEService for this.nfcSEService
console.log("version: " + nfcSEService.getVersion());
@@ -349,7 +347,7 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m
```js
import secureElement from '@ohos.secureElement';
-nfcOmaReader = null;
+let nfcOmaReader = null;
try {
// refer to SEService.getReaders for this.nfcOmaReader
@@ -584,10 +582,11 @@ import secureElement from '@ohos.secureElement';
let nfcOmaSession = null;
let nfcOmaChannel = null;
+let aidArray = [720, 1080];
try {
// See Reader.openSession for this.nfcOmaSession.
- let getPromise = nfcOmaSession.openBasicChannel(this.aidArray);
+ let getPromise = nfcOmaSession.openBasicChannel(aidArray);
getPromise.then((channel) => {
nfcOmaChannel = channel;
console.log("openBasicChannel1 get channel successfully");
@@ -737,7 +736,6 @@ For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.m
```js
import secureElement from '@ohos.secureElement';
-
let nfcOmaSession = null;
let nfcOmaChannel = null;
let aidArray = [720, 1080];
@@ -915,8 +913,9 @@ if (nfcOmaSession) {
}).catch ((err) => {
console.log("openLogicChannel3 exception");
})
-} catch (e) {
- console.log("openLogicChannel3 exception:" + e.message);
+ } catch (e) {
+ console.log("openLogicChannel3 exception:" + e.message);
+ }
}
```
diff --git a/en/application-dev/reference/apis/js-apis-sim.md b/en/application-dev/reference/apis/js-apis-sim.md
index fb3aa7540b8383f983436c0d713e09346ad6aa3e..cbc5ed086fff519da5b5c959304afeeac6f442d5 100644
--- a/en/application-dev/reference/apis/js-apis-sim.md
+++ b/en/application-dev/reference/apis/js-apis-sim.md
@@ -2732,7 +2732,7 @@ Obtains the MSISDN of the SIM card in the specified slot. This API uses an async
**System API**: This is a system API.
-**Required permission**: ohos.permission.GET_TELEPHONY_STATE
+**Required permission**: ohos.permission.GET_PHONE_NUMBERS
**System capability**: SystemCapability.Telephony.CoreService
@@ -2775,7 +2775,7 @@ Obtains the MSISDN of the SIM card in the specified slot. This API uses a promis
**System API**: This is a system API.
-**Required permission**: ohos.permission.GET_TELEPHONY_STATE
+**Required permission**: ohos.permission.GET_PHONE_NUMBERS
**System capability**: SystemCapability.Telephony.CoreService
diff --git a/en/application-dev/reference/apis/js-apis-sms.md b/en/application-dev/reference/apis/js-apis-sms.md
index 41a3fe10bbda7d00fc5aa588ed75072a702971bb..302ef980536e7e06d5ae6b8c8fee250085e13105 100644
--- a/en/application-dev/reference/apis/js-apis-sms.md
+++ b/en/application-dev/reference/apis/js-apis-sms.md
@@ -195,7 +195,7 @@ let destinationHost = '+861xxxxxxxxxx';
let serviceCenter = '+861xxxxxxxxxx';
let destinationPort = 1000;
let options = {slotId, content, destinationHost, serviceCenter, destinationPort, sendCallback, deliveryCallback};
-sms.sendMessage(options, (err) => {
+sms.sendShortMessage(options, (err) => {
console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -1341,7 +1341,7 @@ sms.isImsSmsSupported(slotId, (err, data) => {
isImsSmsSupported\(slotId: number\): Promise\
-This API uses an asynchronous callback to return the result. This API uses a promise to return the result.
+Checks whether SMS is supported on IMS. This API uses a promise to return the result.
**System API**: This is a system API.
diff --git a/en/application-dev/reference/apis/js-apis-socket.md b/en/application-dev/reference/apis/js-apis-socket.md
index 76c7829cf8fdadad378305ba795212ac10f621ea..f193ed010e3b0eb1ba6a87fad70f81b19bf9b732 100644
--- a/en/application-dev/reference/apis/js-apis-socket.md
+++ b/en/application-dev/reference/apis/js-apis-socket.md
@@ -1691,7 +1691,7 @@ listen(address: NetAddress, callback: AsyncCallback\): void
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. The server listens to and accepts TCP socket connections established over the socket. Multiple threads are used to process client data concurrently. This API uses an asynchronous callback to return the result.
-> **NOTE**
+> **NOTE**
> The server uses this API to perform the **bind**, **listen**, and **accept** operations. If the **bind** operation fails, the system randomly allocates a port number.
**Required permissions**: ohos.permission.INTERNET
@@ -1736,7 +1736,7 @@ listen(address: NetAddress): Promise\
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. The server listens to and accepts TCP socket connections established over the socket. Multiple threads are used to process client data concurrently. This API uses a promise to return the result.
-> **NOTE**
+> **NOTE**
> The server uses this API to perform the **bind**, **listen**, and **accept** operations. If the **bind** operation fails, the system randomly allocates a port number.
**Required permissions**: ohos.permission.INTERNET
diff --git a/en/application-dev/reference/apis/js-apis-system-app.md b/en/application-dev/reference/apis/js-apis-system-app.md
index e0acf1c2ba47df2555dd9812d655e1fb15f777e7..6fd13771f56ef275b03f71d0f5a6118c74e04106 100644
--- a/en/application-dev/reference/apis/js-apis-system-app.md
+++ b/en/application-dev/reference/apis/js-apis-system-app.md
@@ -2,9 +2,7 @@
> **NOTE**
>
-> - The APIs of this module are no longer maintained since API version 7. You are advised to use the new APIs.
->
-> - The initial APIs of this module are supported since API version 3. 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 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -14,14 +12,15 @@
import app from '@system.app'
```
+## App
-## app.getInfo
+### getInfo
-getInfo(): AppResponse
+static getInfo(): AppResponse
Obtains the declared information in the **config.json** file of an application.
-You are advised to use [@ohos.bundle](js-apis-Bundle.md) since API version 7.
+This API is deprecated since API version 9. You are advised to use [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo) instead.
**System capability**: SystemCapability.ArkUI.ArkUI.Lite
@@ -42,9 +41,9 @@ export default {
}
```
-## app.terminate
+### terminate
-terminate(): void
+static terminate(): void
Terminates the current ability.
@@ -61,37 +60,9 @@ export default {
}
}
```
-## app.requestFullWindow
+### setImageCacheCount7+
-requestFullWindow(options?: RequestFullWindowOptions): void
-
-Requests the application to run in full window. You can call this API when the FA runs in a non-full window, for example, semi-modal FA. This API is invalid for an application already in full-window mode.
-
-You are advised to use [@ohos.window](js-apis-window.md) since API version 7.
-
-**System capability**: SystemCapability.ArkUI.ArkUI.Full
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| options | [RequestFullWindowOptions](#requestfullwindowoptions) | No| Duration for transition from the non-full window to the full window, in milliseconds. By default, the value is in direct proportion to the distance between the non-full window and the full window.|
-
-**Example**
-
-```ts
-export default {
- requestFullWindow() {
- app.requestFullWindow({
- duration: 200
- })
- }
-}
-```
-
-## app.setImageCacheCount7+
-
-setImageCacheCount(value: number): void
+static setImageCacheCount(value: number): void
Sets the maximum number of decoded images that can be cached in the memory to speed up the loading of images from the same sources. If the input parameter is not set, the default value **0** is used, indicating that images are not cached. The built-in Least Recently Used (LRU) policy is used for caching. If the maximum number is exceeded, the images that have not been updated for the longest time will be removed. You are advised to set the parameter based on the application memory requirements. If the number of images is too large, the memory usage may be too high.
@@ -120,9 +91,9 @@ export default {
}
```
-## app.setImageRawDataCacheSize7+
+### setImageRawDataCacheSize7+
-setImageRawDataCacheSize(value: number): void
+static setImageRawDataCacheSize(value: number): void
Sets the maximum size (in bytes) of the image data cached in the memory before decoding to speed up the loading of images from the same sources. If the input parameter is not set, the default value **0** is used, indicating that images are not cached. The LRU policy is used for caching. If the maximum size is exceeded, the images that have not been updated for the longest time will be removed. You are advised to set the parameter based on the application memory requirements. If the image cache is too large, the memory usage may be too high.
@@ -152,9 +123,9 @@ export default {
}
```
-## app.setImageFileCacheSize7+
+### setImageFileCacheSize7+
-setImageFileCacheSize(value: number): void
+static setImageFileCacheSize(value: number): void
Sets the maximum size of the image file cache (in bytes) to speed up the loading of images from the same sources, especially online image sources and thumbnails. If the input parameter is not set, the default value 100 MB is used. The LRU policy is used for caching. If the maximum size is exceeded, the images that have not been updated for the longest time will be removed. You are advised to set the parameter based on the application memory requirements. If the image cache is too large, the disk usage may be too high.
@@ -184,32 +155,60 @@ export default {
}
```
-## AppResponse
+### ScreenOnVisible(deprecated)
-Defines the application response information.
+static screenOnVisible(options?: ScreenOnVisibleOptions): void
-**System capability**: The items in the table below require different system capabilities. For details, see the table.
+Defines whether to keep the application visible when the screen is woken up.
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- |-------- |
-| appID6+ | string | Yes| Bundle name of an application. It uniquely identifies the application. **System capability**: SystemCapability.ArkUI.ArkUI.Full|
-| appName | string | Yes| Application name. **System capability**: SystemCapability.ArkUI.ArkUI.Lite|
-| versionName | string | Yes| Application version name. **System capability**: SystemCapability.ArkUI.ArkUI.Lite|
-| versionCode | number | Yes| Application version number. **System capability**: SystemCapability.ArkUI.ArkUI.Lite|
+This API is deprecated since API Version 8.
-## ScreenOnVisible(deprecated)
+**System capability**: SystemCapability.ArkUI.ArkUI.Full
-screenOnVisible(options?: ScreenOnVisibleOptions): void
+| Name | Type | Mandatory| Description |
+| ------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ |
+| options | [ScreenOnVisibleOptions](#screenonvisibleoptions) | No | With keep-alive, the system is prevented from returning to the home screen when the screen is locked, so that the application is visible when the screen is woken up.|
-Defines whether to keep the application visible when the screen is woken up.
+### requestFullWindow(deprecated)
-This API is deprecated since API Version 8.
+static requestFullWindow(options?: RequestFullWindowOptions): void
+
+Requests the application to run in full window. You can call this API when the FA runs in a non-full window, for example, semi-modal FA. This API is invalid for an application already in full-window mode.
+
+You are advised to use [@ohos.window](js-apis-window.md) since API version 7.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------- | ----------------------------------------------------- | ---- | ------------------------------------------------------------ |
+| options | [RequestFullWindowOptions](#requestfullwindowoptions) | No | Duration for transition from the non-full window to the full window, in milliseconds. By default, the value is in direct proportion to the distance between the non-full window and the full window.|
+
+**Example**
+
+```ts
+export default {
+ requestFullWindow() {
+ app.requestFullWindow({
+ duration: 200
+ })
+ }
+}
+```
+
+## AppResponse
+
+Defines the application response information.
+
+**System capability**: The items in the table below require different system capabilities. For details, see the table.
+
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- |-------- |
-| options | ScreenOnVisibleOptions | No| With keep-alive, the system is prevented from returning to the home screen when the screen is locked, so that the application is visible when the screen is woken up. |
+| appID6+ | string | Yes| Bundle name of an application. It uniquely identifies the application. **System capability**: SystemCapability.ArkUI.ArkUI.Full|
+| appName | string | Yes| Application name. **System capability**: SystemCapability.ArkUI.ArkUI.Lite|
+| versionName | string | Yes| Application version name. **System capability**: SystemCapability.ArkUI.ArkUI.Lite|
+| versionCode | number | Yes| Application version number. **System capability**: SystemCapability.ArkUI.ArkUI.Lite|
## ScreenOnVisibleOptions
diff --git a/en/application-dev/reference/apis/js-apis-system-prompt.md b/en/application-dev/reference/apis/js-apis-system-prompt.md
index 831a8acabb7735d67f119370155e13d1bf929ce0..6afc8a7634a31eb590d8ed9170372e7755db1e01 100644
--- a/en/application-dev/reference/apis/js-apis-system-prompt.md
+++ b/en/application-dev/reference/apis/js-apis-system-prompt.md
@@ -4,7 +4,7 @@ The **PromptAction** module provides APIs for creating and showing toasts, dialo
> **NOTE**
>
-> - The APIs of this module are no longer maintained since API version 8. You are advised to use [`@ohos.prompt`](js-apis-prompt.md) instead.
+> - The APIs of this module are deprecated since API version 8. You are advised to use [@ohos.promptAction](js-apis-promptAction.md) instead.
>
>
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
diff --git a/en/application-dev/reference/apis/js-apis-userFileManager.md b/en/application-dev/reference/apis/js-apis-userFileManager.md
index d3732ddaf19e0014dc9f77681241253b37aa91eb..ba865a7568afeae0feb7dfbf84f080652b9dc726 100644
--- a/en/application-dev/reference/apis/js-apis-userFileManager.md
+++ b/en/application-dev/reference/apis/js-apis-userFileManager.md
@@ -1393,6 +1393,151 @@ async function example() {
}
```
+### getPhotoIndex10+
+
+getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions, callback: AsyncCallback<number>): void
+
+Obtains the index of an image or video in an album. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_IMAGEVIDEO
+
+**System capability**: SystemCapability.FileManagement.UserFileManager.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| photoUri | string | Yes | URI of the media asset whose index is to be obtained.|
+| albumUri | string | Yes | Album URI, which can be an empty string. If it is an empty string, all the media assets in the Gallery are obtained by default. |
+| options | [FetchOptions](#fetchoptions) | Yes | Fetch options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search conditions or sorting modes are set, the API cannot be called successfully. |
+
+**Return value**
+
+| Type | Description |
+| --------------------------------------- | ----------------- |
+| AsyncCallback<number>| Callback invoked to return the index obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Universal Error Codes](../errorcodes/errorcode-universal.md).
+
+| ID| Error Message|
+| -------- | ---------------------------------------- |
+| 401 | if parameter is invalid. |
+
+**Example**
+
+```ts
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+
+async function example() {
+ console.info('getPhotoIndexDemo');
+ let predicatesForGetAsset = new dataSharePredicates.DataSharePredicates();
+ let fetchOp = {
+ fetchColumns: [],
+ predicates: predicatesForGetAsset
+ };
+ //Obtain the uri of the album
+ let albumFetchResult = await mgr.getAlbums(userFileManager.AlbumType.SYSTEM, userFileManager.AlbumSubtype.FAVORITE, fetchOp);
+ let album = await albumFetchResult.getFirstObject();
+
+ let predicates = new dataSharePredicates.DataSharePredicates();
+ predicates.orderByAsc("add_modified");
+ let fetchOptions = {
+ fetchColumns: [],
+ predicates: predicates
+ };
+ let photoFetchResult = await album.getPhotoAssets(fetchOptions);
+ let expectIndex = 1;
+ //Obtain the uri of the second file
+ let photoAsset = await photoFetchResult.getPositionObject(expectIndex);
+
+ mgr.getPhotoIndex(photoAsset.uri, album.albumUri, fetchOptions, (err, index) => {
+ try {
+ if (err == undefined) {
+ console.info(`getPhotoIndex successfully and index is : ${index}`);
+ } else {
+ console.info(`getPhotoIndex failed;`);
+ }
+ } catch (error) {
+ console.info(`getPhotoIndex failed; error: ${error}`);
+ }
+ }
+}
+```
+
+### getPhotoIndex10+
+
+getPhotoIndex(photoUri: string, albumUri: string, options: FetchOptions): Promise<number>
+
+Obtains the index of an image or video in an album. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_IMAGEVIDEO
+
+**System capability**: SystemCapability.FileManagement.UserFileManager.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| photoUri | string | Yes | URI of the media asset whose index is to be obtained.|
+| albumUri | string | Yes | Album URI, which can be an empty string. If it is an empty string, all the media assets in the Gallery are obtained by default. |
+| options | [FetchOptions](#fetchoptions) | Yes | Fetch options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search conditions or sorting modes are set, the API cannot be called successfully. |
+
+**Return value**
+
+| Type | Description |
+| --------------------------------------- | ----------------- |
+| Promise<number>| Promise used to return the index obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Universal Error Codes](../errorcodes/errorcode-universal.md).
+
+| ID| Error Message|
+| -------- | ---------------------------------------- |
+| 401 | if parameter is invalid. |
+
+**Example**
+
+```ts
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+
+async function example() {
+ console.info('getPhotoIndexDemo');
+ let predicatesForGetAsset = new dataSharePredicates.DataSharePredicates();
+ let fetchOp = {
+ fetchColumns: [],
+ predicates: predicatesForGetAsset
+ };
+ //Obtain the uri of the album
+ let albumFetchResult = await mgr.getAlbums(userFileManager.AlbumType.SYSTEM, userFileManager.AlbumSubtype.FAVORITE, fetchOp);
+ let album = await albumFetchResult.getFirstObject();
+
+ let predicates = new dataSharePredicates.DataSharePredicates();
+ predicates.orderByAsc("add_modified");
+ let fetchOptions = {
+ fetchColumns: [],
+ predicates: predicates
+ };
+ let photoFetchResult = await album.getPhotoAssets(fetchOptions);
+ let expectIndex = 1;
+ //Obtain the uri of the second file
+ let photoAsset = await photoFetchResult.getPositionObject(expectIndex);
+
+ mgr.getPhotoIndex(photoAsset.uri, album.albumUri, fetchOptions)
+ .then((index) => {
+ console.info(`getPhotoIndex successfully and index is : ${index}`);
+ }).catch((err) => {
+ console.info(`getPhotoIndex failed; error: ${err}`);
+ })
+}
+```
+
### release
release(callback: AsyncCallback<void>): void
@@ -1684,7 +1829,7 @@ Provides APIs for encapsulating file asset attributes.
| Name | Type | Readable| Writable| Description |
| ------------------------- | ------------------------ | ---- | ---- | ------------------------------------------------------ |
-| uri | string | Yes | No | File asset URI, for example, **file://media/image/2**. |
+| uri | string | Yes | No | File asset URI, for example, **file://media/Photo/1/IMG_datetime_0001/displayName.jpg**. |
| fileType | [FileType](#filetype) | Yes | No | Type of the file. |
| displayName | string | Yes | Yes | File name, including the file name extension, to display. |
@@ -2350,6 +2495,282 @@ async function example() {
}
```
+### getExif10+
+
+getExif(): Promise<string>
+
+Obtains a JSON string consisting of the exchangeable image file format (EXIF) tags of this JPG image. This API uses a promise to return the result.
+
+**CAUTION** This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and **ImageVideoKey.USER_COMMENT**. These two fields must be passed in via **fetchColumns**.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_IMAGEVIDEO
+
+**System capability**: SystemCapability.FileManagement.UserFileManager.Core
+
+**Return value**
+
+| Type | Description |
+| --------------------------------------- | ----------------- |
+| Promise<string> | Promise used to return the JSON string obtained.|
+
+**Supported EXIF tags**
+
+For details about the EXIF tags, see [image.PropertyKey](js-apis-image.md#propertykey7).
+
+| Key Value | Description |
+| --------------------------------------- | ----------------- |
+| BitsPerSample | Number of bits per pixel.|
+| Orientation | Image orientation.|
+| ImageLength | Image length.|
+| ImageWidth | Image width.|
+| GPSLatitude | GPS latitude of the image.|
+| GPSLongitude | GPS longitude of the image.|
+| GPSLatitudeRef | Longitude reference, for example, W or E.|
+| GPSLongitudeRef | Latitude reference, for example, N or S.|
+| DateTimeOriginal | Shooting time.|
+| ExposureTime | Exposure time.|
+| SceneType | Shooting scene type.|
+| ISOSpeedRatings | ISO sensitivity or speed.|
+| FNumber | f-number.|
+| DateTime | Date and time when the image was last modified.|
+| GPSTimeStamp | GPS timestamp.|
+| GPSDateStamp | GPS date stamp.|
+| ImageDescription | Image description.|
+| Make | Camera vendor.|
+| Model | Model.|
+| PhotoMode | Photo mode.|
+| SensitivityType | Sensitivity type.|
+| StandardOutputSensitivity | Standard output sensitivity.|
+| RecommendedExposureIndex | Recommended exposure index.|
+| ApertureValue | Aperture value.|
+| MeteringMode | Metering mode.|
+| LightSource | Light source.|
+| Flash | Flash status.|
+| FocalLength | Focal length.|
+| UserComment | User comment.|
+| PixelXDimension | Pixel X dimension.|
+| PixelYDimension | Pixel Y dimension.|
+| WhiteBalance | White balance.|
+| FocalLengthIn35mmFilm | Focal length in 35 mm film.|
+| ExposureBiasValue | Exposure compensation.|
+
+**Example**
+
+```ts
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+
+async function example() {
+ try {
+ console.info('getExifDemo');
+ let predicates = new dataSharePredicates.DataSharePredicates();
+ let fetchOptions = {
+ fetchColumns: [ 'all_exif', ImageVideoKey.USER_COMMENT],
+ predicates: predicates
+ };
+ let fetchResult = await mgr.getPhotoAssets(fetchOptions);
+ let fileAsset = await fetchResult.getFirstObject();
+ let exifMessage = await fileAsset.getExif();
+ let userCommentKey = 'UserComment';
+ let userComment = JSON.stringify(JSON.parse(exifMessage), [userCommentKey]);
+ fetchResult.close();
+ } catch (err) {
+ console.error('getExifDemoCallback failed with error: ' + err);
+ }
+}
+```
+
+### getExif10+
+
+getExif(callback: AsyncCallback<string>): void
+
+Obtains a JSON string consisting of the EXIF tags of this JPG image. This API uses an asynchronous callback to return the result.
+
+**CAUTION** This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and **ImageVideoKey.USER_COMMENT**. These two fields must be passed in via **fetchColumns**.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_IMAGEVIDEO
+
+**System capability**: SystemCapability.FileManagement.UserFileManager.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| callback | AsyncCallback<string> | Yes | Callback invoked to return the JSON string obtained.|
+
+**Supported EXIF tags**
+
+For details about the EXIF tags, see [image.PropertyKey](js-apis-image.md#propertykey7).
+
+| Key Value | Description |
+| --------------------------------------- | ----------------- |
+| BitsPerSample | Number of bits per pixel.|
+| Orientation | Image orientation.|
+| ImageLength | Image length.|
+| ImageWidth | Image width.|
+| GPSLatitude | GPS latitude of the image.|
+| GPSLongitude | GPS longitude of the image.|
+| GPSLatitudeRef | Longitude reference, for example, W or E.|
+| GPSLongitudeRef | Latitude reference, for example, N or S.|
+| DateTimeOriginal | Shooting time.|
+| ExposureTime | Exposure time.|
+| SceneType | Shooting scene type.|
+| ISOSpeedRatings | ISO sensitivity or speed.|
+| FNumber | f-number.|
+| DateTime | Date and time when the image was last modified.|
+| GPSTimeStamp | GPS timestamp.|
+| GPSDateStamp | GPS date stamp.|
+| ImageDescription | Image description.|
+| Make | Camera vendor.|
+| Model | Model.|
+| PhotoMode | Photo mode.|
+| SensitivityType | Sensitivity type.|
+| StandardOutputSensitivity | Standard output sensitivity.|
+| RecommendedExposureIndex | Recommended exposure index.|
+| ApertureValue | Aperture value.|
+| MeteringMode | Metering mode.|
+| LightSource | Light source.|
+| Flash | Flash status.|
+| FocalLength | Focal length.|
+| UserComment | User comment.|
+| PixelXDimension | Pixel X dimension.|
+| PixelYDimension | Pixel Y dimension.|
+| WhiteBalance | White balance.|
+| FocalLengthIn35mmFilm | Focal length in 35 mm film.|
+| ExposureBiasValue | Exposure compensation.|
+
+**Example**
+
+```ts
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+
+async function example() {
+ try {
+ console.info('getExifDemo');
+ let predicates = new dataSharePredicates.DataSharePredicates();
+ let fetchOptions = {
+ fetchColumns: [ 'all_exif', ImageVideoKey.USER_COMMENT],
+ predicates: predicates
+ };
+ let fetchResult = await mgr.getPhotoAssets(fetchOptions);
+ let fileAsset = await fetchResult.getFirstObject();
+ let userCommentKey = 'UserComment';
+ fileAsset.getExif((err, exifMessage) => {
+ if (exifMessage != undefined) {
+ let userComment = JSON.stringify(JSON.parse(exifMessage), [userCommentKey]);
+ } else {
+ console.error('getExif failed, message = ', err);
+ }
+ });
+ fetchResult.close();
+ } catch (err) {
+ console.error('getExifDemoCallback failed with error: ' + err);
+ }
+}
+```
+
+### setUserComment10+
+
+setUserComment(userComment: string): Promise<void>
+
+Sets user comment information of an image or video. This API uses a promise to return the result.
+
+**NOTE** This API can be used to modify the comment information of only images or videos.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
+
+**System capability**: SystemCapability.FileManagement.UserFileManager.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| userComment | string | Yes | User comment information to set, which cannot exceed 140 characters.|
+
+**Return value**
+
+| Type | Description |
+| --------------------------------------- | ----------------- |
+|Promise<void> | Promise that returns no value.|
+
+**Example**
+
+```ts
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+
+async function example() {
+ try {
+ console.info('setUserCommentDemo')
+ let predicates = new dataSharePredicates.DataSharePredicates();
+ let fetchOptions = {
+ fetchColumns: [],
+ predicates: predicates
+ };
+ let fetchResult = await mgr.getPhotoAssets(fetchOptions);
+ let fileAsset = await fetchResult.getFirstObject();
+ let userComment = 'test_set_user_comment';
+ await fileAsset.setUserComment(userComment);
+ } catch (err) {
+ console.error('setUserCommentDemoCallback failed with error: ' + err);
+ }
+}
+```
+
+### setUserComment10+
+
+setUserComment(userComment: string, callback: AsyncCallback<void>): void
+
+Sets user comment information of an image or video. This API uses an asynchronous callback to return the result.
+
+**NOTE** This API can be used to modify the comment information of only images or videos.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
+
+**System capability**: SystemCapability.FileManagement.UserFileManager.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ---------- |
+| userComment | string | Yes | User comment information to set, which cannot exceed 140 characters.|
+| callback | AsyncCallback<void> | Yes | Callback that returns no value.|
+
+**Example**
+
+```ts
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+
+async function example() {
+ try {
+ console.info('setUserCommentDemo')
+ let predicates = new dataSharePredicates.DataSharePredicates();
+ let fetchOptions = {
+ fetchColumns: [],
+ predicates: predicates
+ };
+ let fetchResult = await mgr.getPhotoAssets(fetchOptions);
+ let fileAsset = await fetchResult.getFirstObject();
+ let userComment = 'test_set_user_comment';
+ fileAsset.setUserComment(userComment, (err) => {
+ if (err === undefined) {
+ console.info('setUserComment successfully');
+ } else {
+ console.error('setUserComment failed with error: ' + err);
+ }
+ });
+ } catch (err) {
+ console.error('setUserCommentDemoCallback failed with error: ' + err);
+ }
+}
+```
+
## FetchResult
Provides APIs to manage the file retrieval result.
@@ -3962,6 +4383,7 @@ Defines the key information about an image or video file.
| DATE_TRASHED10+ | date_trashed | Date when the file was deleted. The value is the number of seconds between the time when the file is deleted and January 1, 1970. |
| HIDDEN10+ | hidden | Whether the file is hidden. |
| CAMERA_SHOT_KEY10+ | camera_shot_key | Key for the Untra Snamshot feature, which allows the camera to take photos or record videos with the screen off. (This parameter is available only for the system camera, and the key value is defined by the system camera.) |
+| USER_COMMENT10+ | user_comment | User comment information. |
## AlbumKey
diff --git a/en/application-dev/reference/apis/js-apis-useriam-userauth.md b/en/application-dev/reference/apis/js-apis-useriam-userauth.md
index a5771cf5e7764cb73b3f8184b52306b40bbe07bc..84dacee24d644d4f87ecf5eb41ba3b0befaf811d 100644
--- a/en/application-dev/reference/apis/js-apis-useriam-userauth.md
+++ b/en/application-dev/reference/apis/js-apis-useriam-userauth.md
@@ -1054,7 +1054,7 @@ Checks whether the specified authentication capability is supported.
| Name | Type | Mandatory| Description |
| -------------- | ---------------------------------- | ---- | -------------------------- |
-| authType | [UserAuthType](#userauthtype8) | Yes | Authentication type. Only **FACE** is supported.|
+| authType | [UserAuthType](#userauthtype8) | Yes | Authentication type.|
| authTrustLevel | [AuthTrustLevel](#authtrustlevel8) | Yes | Authentication trust level. |
**Error codes**
diff --git a/en/application-dev/reference/apis/js-apis-webview.md b/en/application-dev/reference/apis/js-apis-webview.md
index adea4c22a9473f43b8092d0314918537ecaa98b6..d0b51d00e6ddb980ac95cdeeb8a20de3db84c1a7 100644
--- a/en/application-dev/reference/apis/js-apis-webview.md
+++ b/en/application-dev/reference/apis/js-apis-webview.md
@@ -254,20 +254,20 @@ struct WebComponent {
.onClick(() => {
// Use the local port to send messages to HTML5.
try {
- console.log("In eTS side send true start");
+ console.log("In ArkTS side send true start");
if (this.nativePort) {
this.message.setString("helloFromEts");
this.nativePort.postMessageEventExt(this.message);
}
}
catch (error) {
- console.log("In eTS side send message catch error:" + error.code + ", msg:" + error.message);
+ console.log("In ArkTS side send message catch error:" + error.code + ", msg:" + error.message);
}
})
Web({ src: $rawfile('index.html'), controller: this.controller })
.onPageEnd((e)=>{
- console.log("In eTS side message onPageEnd init mesaage channel");
+ console.log("In ArkTS side message onPageEnd init mesaage channel");
// 1. Create a message port.
this.ports = this.controller.createWebMessagePorts(true);
// 2. Send port 1 to HTML5.
@@ -276,10 +276,10 @@ struct WebComponent {
this.nativePort = this.ports[0];
// 4. Set the callback.
this.nativePort.onMessageEventExt((result) => {
- console.log("In eTS side got message");
+ console.log("In ArkTS side got message");
try {
var type = result.getType();
- console.log("In eTS side getType:" + type);
+ console.log("In ArkTS side getType:" + type);
switch (type) {
case web_webview.WebMessageType.STRING: {
this.msg1 = "result type:" + typeof (result.getString());
@@ -652,71 +652,71 @@ struct WebComponent {
There are three methods for loading local resource files:
1. Using $rawfile
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
-
- @Entry
- @Component
- struct WebComponent {
- controller: web_webview.WebviewController = new web_webview.WebviewController();
-
- build() {
- Column() {
- Button('loadUrl')
- .onClick(() => {
- try {
- // Load a local resource file through $rawfile.
- this.controller.loadUrl($rawfile('index.html'));
- } catch (error) {
- console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
- }
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
+```ts
+// xxx.ets
+import web_webview from '@ohos.web.webview'
+
+@Entry
+@Component
+struct WebComponent {
+ controller: web_webview.WebviewController = new web_webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('loadUrl')
+ .onClick(() => {
+ try {
+ // Load a local resource file through $rawfile.
+ this.controller.loadUrl($rawfile('index.html'));
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ })
+ Web({ src: 'www.example.com', controller: this.controller })
+ }
+ }
+}
+```
2. Using the resources protocol
- ```ts
- // xxx.ets
- import web_webview from '@ohos.web.webview'
-
- @Entry
- @Component
- struct WebComponent {
- controller: web_webview.WebviewController = new web_webview.WebviewController();
-
- build() {
- Column() {
- Button('loadUrl')
- .onClick(() => {
- try {
- // Load a local resource file through the resource protocol.
- this.controller.loadUrl("resource://rawfile/index.html");
- } catch (error) {
- console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
- }
- })
- Web({ src: 'www.example.com', controller: this.controller })
- }
- }
- }
- ```
+```ts
+// xxx.ets
+import web_webview from '@ohos.web.webview'
+
+@Entry
+@Component
+struct WebComponent {
+ controller: web_webview.WebviewController = new web_webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('loadUrl')
+ .onClick(() => {
+ try {
+ // Load local resource files through the resource protocol.
+ this.controller.loadUrl("resource://rawfile/index.html");
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ })
+ Web({ src: 'www.example.com', controller: this.controller })
+ }
+ }
+}
+```
3. Using a sandbox path. For details, see the example of loading local resource files in the sandbox in [Web](../arkui-ts/ts-basic-components-web.md#web).
- HTML file to be loaded:
- ```html
-
-
-
-
- Hello World
-
-
- ```
+HTML file to be loaded:
+```html
+
+
+
+
+ Hello World
+
+
+```
### loadData
@@ -4320,6 +4320,107 @@ export default class EntryAbility extends UIAbility {
}
```
+### setCustomUserAgent10+
+
+setCustomUserAgent(userAgent: string): void
+
+Set a custom user agent.
+
+**System capability**: SystemCapability.Web.Webview.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---------------| ------- | ---- | ------------- |
+| userAgent | string | Yes | Information about the custom user agent.|
+
+**Error codes**
+
+For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md).
+
+| ID | Error Message |
+| -------- | ------------------------------------------------------------ |
+| 17100001 | Init error. The WebviewController must be associated with a Web component. |
+
+**Example**
+
+```ts
+// xxx.ets
+import web_webview from '@ohos.web.webview'
+
+@Entry
+@Component
+struct WebComponent {
+ controller: web_webview.WebviewController = new web_webview.WebviewController();
+ @State userAgent: string = 'test'
+
+ build() {
+ Column() {
+ Button('setCustomUserAgent')
+ .onClick(() => {
+ try {
+ this.controller.setCustomUserAgent(this.userAgent);
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ })
+ Web({ src: 'www.example.com', controller: this.controller })
+ }
+ }
+}
+```
+
+### getCustomUserAgent10+
+
+getCustomUserAgent(): string
+
+Obtains a custom user agent.
+
+**System capability**: SystemCapability.Web.Webview.Core
+
+**Return value**
+
+| Type | Description |
+| ------ | ------------------------- |
+| string | Information about the custom user agent.|
+
+**Error codes**
+
+For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md).
+
+| ID | Error Message |
+| -------- | ------------------------------------------------------------ |
+| 17100001 | Init error. The WebviewController must be associated with a Web component. |
+
+**Example**
+
+```ts
+// xxx.ets
+import web_webview from '@ohos.web.webview'
+
+@Entry
+@Component
+struct WebComponent {
+ controller: web_webview.WebviewController = new web_webview.WebviewController();
+ @State userAgent: string = ''
+
+ build() {
+ Column() {
+ Button('getCustomUserAgent')
+ .onClick(() => {
+ try {
+ this.userAgent = this.controller.getCustomUserAgent();
+ console.log("userAgent: " + this.userAgent);
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ })
+ Web({ src: 'www.example.com', controller: this.controller })
+ }
+ }
+}
+```
+
## WebCookieManager
Implements a **WebCookieManager** instance to manage behavior of cookies in **\** components. All **\** components in an application share a **WebCookieManager** instance.
diff --git a/en/application-dev/reference/apis/js-apis-wifiManager.md b/en/application-dev/reference/apis/js-apis-wifiManager.md
index d0a5734d47b2ada35e5d4dae36770cd58873769f..3b5ccb266a60c098525e6690e1dce15e3c1e137b 100644
--- a/en/application-dev/reference/apis/js-apis-wifiManager.md
+++ b/en/application-dev/reference/apis/js-apis-wifiManager.md
@@ -15,7 +15,7 @@ import wifiManager from '@ohos.wifiManager';
enableWifi(): void
-Enables WLAN.
+Enables WLAN. This API is an asynchronous interface. The **wifiStateChange** callback must be registered and listened for.
**System API**: This is a system API.
@@ -47,7 +47,7 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
disableWifi(): void
-Disables WLAN.
+Disables WLAN. This API is an asynchronous interface. The **wifiStateChange** callback must be registered and listened for.
**System API**: This is a system API.
@@ -583,7 +583,7 @@ Adds network configuration. This API uses a promise to return the result.
| **Type**| **Description**|
| -------- | -------- |
-| Promise<number> | Promise used to return the ID of the added network configuration. If **-1** is returned, the network configuration fails to be added.|
+ | Promise<number> | Promise used to return the ID of the added network configuration. If **-1** is returned, the network configuration fails to be added.|
**Error codes**
@@ -959,7 +959,7 @@ Removes the configuration of a candidate network. This API uses an asynchronous
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| networkId | number | Yes| ID of the network configuration to remove.|
-| callback | AsyncCallback<void> | Yes| Callback invoked to return the result. If the operation is successful, the value of **err** is **0**. If **err** is not **0**, an error has occurred.|
+ | callback | AsyncCallback<void> | Yes| Callback invoked to return the result. If the operation is successful, the value of **err** is **0**. If **err** is not **0**, an error has occurred.|
**Error codes**
@@ -2082,7 +2082,7 @@ Enumerates the Wi-Fi disconnection reasons.
enableHotspot(): void
-Enables this hotspot.
+Enables this hotspot. This API is an asynchronous interface. The **hotspotStateChange** callback must be registered and listened for.
**System API**: This is a system API.
@@ -2113,7 +2113,7 @@ For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorco
disableHotspot(): void
-Disables this hotspot.
+Disables this hotspot. This API is an asynchronous interface. The **hotspotStateChange** callback must be registered and listened for.
**System API**: This is a system API.
diff --git a/en/application-dev/reference/arkui-js-lite/Readme-EN.md b/en/application-dev/reference/arkui-js-lite/Readme-EN.md
index 4dbc7b08dbed8356f7cb907c3dbebff5c5b09bf5..82d21c003828d6a374fa9aeef402169fe4c0d0d5 100644
--- a/en/application-dev/reference/arkui-js-lite/Readme-EN.md
+++ b/en/application-dev/reference/arkui-js-lite/Readme-EN.md
@@ -1,37 +1,38 @@
# JavaScript-compatible Web-like Development Paradigm (ArkUI.Lite)
- Framework Overview
- - [File Organization](js-framework-file.md)
- - ["js" Tag](js-framework-js-tag.md)
- - [app.js](js-framework-js-file.md)
- - Syntax
- - [HML](js-framework-syntax-hml.md)
- - [CSS](js-framework-syntax-css.md)
- - [JavaScript](js-framework-syntax-js.md)
+ - [File Organization](js-framework-file.md)
+ - ["js" Tag](js-framework-js-tag.md)
+ - [app.js](js-framework-js-file.md)
+
+ - Syntax
+ - [HML](js-framework-syntax-hml.md)
+ - [CSS](js-framework-syntax-css.md)
+ - [JavaScript](js-framework-syntax-js.md)
- Universal Component Information
- - [Universal Events](js-common-events.md)
- - [Universal Attributes](js-common-attributes.md)
- - [Universal Styles](js-common-styles.md)
- - [Animation Styles](js-components-common-animation.md)
- - [Media Query](js-components-common-mediaquery.md)
+ - [Universal Events](js-common-events.md)
+ - [Universal Attributes](js-common-attributes.md)
+ - [Universal Styles](js-common-styles.md)
+ - [Animation Styles](js-components-common-animation.md)
+ - [Media Query](js-components-common-mediaquery.md)
- Container Components
- - [div](js-components-container-div.md)
- - [list](js-components-container-list.md)
- - [list-item](js-components-container-list-item.md)
- - [stack](js-components-container-stack.md)
- - [swiper](js-components-container-swiper.md)
+ - [div](js-components-container-div.md)
+ - [list](js-components-container-list.md)
+ - [list-item](js-components-container-list-item.md)
+ - [stack](js-components-container-stack.md)
+ - [swiper](js-components-container-swiper.md)
- Basic Components
- - [chart](js-components-basic-chart.md)
- - [image](js-components-basic-image.md)
- - [image-animator](js-components-basic-image-animator.md)
- - [input](js-components-basic-input.md)
- - [marquee](js-components-basic-marquee.md)
- - [picker-view](js-components-basic-picker-view.md)
- - [progress](js-components-basic-progress.md)
- - [qrcode](js-components-basic-qrcode.md)
- - [slider](js-components-basic-slider.md)
- - [switch](js-components-basic-switch.md)
- - [text](js-components-basic-text.md)
+ - [chart](js-components-basic-chart.md)
+ - [image](js-components-basic-image.md)
+ - [image-animator](js-components-basic-image-animator.md)
+ - [input](js-components-basic-input.md)
+ - [marquee](js-components-basic-marquee.md)
+ - [picker-view](js-components-basic-picker-view.md)
+ - [progress](js-components-basic-progress.md)
+ - [qrcode](js-components-basic-qrcode.md)
+ - [slider](js-components-basic-slider.md)
+ - [switch](js-components-basic-switch.md)
+ - [text](js-components-basic-text.md)
- Canvas Components
- - [canvas](js-components-canvas-canvas.md)
- - [CanvasRenderingContext2D](js-components-canvas-canvasrenderingcontext2d.md)
+ - [canvas](js-components-canvas-canvas.md)
+ - [CanvasRenderingContext2D](js-components-canvas-canvasrenderingcontext2d.md)
\ No newline at end of file
diff --git a/en/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md
index e9d71fc2ff680dfba5b95e7bae676854a1e68a28..8d1153d3bdaec49a99abcf0512613b3bb5f9b03c 100644
--- a/en/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md
+++ b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md
@@ -33,7 +33,7 @@ The ECMAScript 6.0 syntax is supported. Lite wearables only support the followin
```
- import router from '@system.router';
+ import router from '@ohos.router';
```
- Code reference
@@ -51,7 +51,7 @@ The ECMAScript 6.0 syntax is supported. Lite wearables only support the followin
| Attribute | Type | Description |
| ----- | --------------- | ---------------------------------------- |
| data | Object/Function | Data model of the page. If the attribute is of the function type, the return value must be of the object type. The name cannot start with a dollar sign ($) or underscore (_). Do not use reserved words (**for**, **if**, **show**, and **tid**). |
- | $refs | Object | DOM elements or child component instances that have registered the **ref** attribute. For an example, see [Obtaining a DOM Element](#obtaining-a-dom-element). |
+ | $refs | Object | DOM elements or child component instances that have registered the **ref** attribute. For an example, see [Obtaining a DOM Element](#obtaining-a-dom-element).|
## Obtaining a DOM Element
@@ -94,7 +94,7 @@ Use **$refs** to obtain a DOM element.
## Lifecycle APIs
- Page lifecycle APIs
- | Name | Type | Parameter | Return Value | Description | Triggered When |
+ | Name | Type | Parameter | Return Value | Description | Triggered When |
| --------- | -------- | ---- | ---- | ------ | ------------------- |
| onInit | Function | N/A | N/A | Listens for page initialization. | Page initialization is complete. This API is called only once in the page lifecycle.|
| onReady | Function | N/A | N/A | Listens for page creation.| A page is created. This API is called only once in the page lifecycle. |
@@ -116,7 +116,7 @@ Use **$refs** to obtain a DOM element.
- Show background page A on the foreground: onShow()
- Application lifecycle APIs
- | Name | Type | Parameter | Return Value | Description | Triggered When |
+ | Name | Type | Parameter | Return Value | Description | Triggered When |
| --------- | -------- | ---- | ---- | ---- | --------- |
| onCreate | Function | N/A | N/A | Listens for application creation.| The application is created.|
| onDestroy | Function | N/A | N/A | Listens for application exit.| The application exits.|
diff --git a/en/application-dev/reference/arkui-ts/figures/TimePickerDialog.gif b/en/application-dev/reference/arkui-ts/figures/TimePickerDialog.gif
index 44fe3a771a01e9fec2e155663c1f2f552d202b68..f6d64bcfcf619e12431c7b431606fe85b4731470 100644
Binary files a/en/application-dev/reference/arkui-ts/figures/TimePickerDialog.gif and b/en/application-dev/reference/arkui-ts/figures/TimePickerDialog.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212058482.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212058482.gif
deleted file mode 100644
index 0ea18f82170eb3309aefb8af24ef89f886718bdd..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212058482.gif and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219982708.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219982708.gif
index 738e50b17cf1c20514f17034ec08bba1cadf2893..2d852ce15286468dace1661d2ef9796274aff07d 100644
Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219982708.gif and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219982708.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219982729.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219982729.gif
new file mode 100644
index 0000000000000000000000000000000000000000..c5f6fec069ee84ed9a59ca6e457338a59f570f39
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219982729.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/list-alignListItem.gif b/en/application-dev/reference/arkui-ts/figures/list-alignListItem.gif
new file mode 100644
index 0000000000000000000000000000000000000000..60808894e3410f5c1bb92e4f241fd7b3590c150b
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/list-alignListItem.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/list1.gif b/en/application-dev/reference/arkui-ts/figures/list1.gif
deleted file mode 100644
index 3e09842f3905ddf22e145b044238340b07b480ca..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/list1.gif and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/richEditorCustomKeyboard.png b/en/application-dev/reference/arkui-ts/figures/richEditorCustomKeyboard.png
new file mode 100644
index 0000000000000000000000000000000000000000..bbaa41c203ba5e38ced3b00d498301dd46d222bd
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/richEditorCustomKeyboard.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/searchCustomKeyboard.png b/en/application-dev/reference/arkui-ts/figures/searchCustomKeyboard.png
new file mode 100644
index 0000000000000000000000000000000000000000..ba8371fea6802dc1b216d7bd2141f4d720d63099
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/searchCustomKeyboard.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/timePicker.gif b/en/application-dev/reference/arkui-ts/figures/timePicker.gif
index 57ba2404c92ca64f11dba247f081fc2da5aacf44..e8df1e6d0378e2f8dbc2054ec19f96f8cea3e606 100644
Binary files a/en/application-dev/reference/arkui-ts/figures/timePicker.gif and b/en/application-dev/reference/arkui-ts/figures/timePicker.gif differ
diff --git a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md
index ddc44429c9b5c501af18ace6b65806d776df2942..cf020b1411cd952d2dd16330bdd30d53f501f5ed 100644
--- a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md
+++ b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md
@@ -16,7 +16,7 @@ Since API version 9, this API is supported in ArkTS widgets.
| ---------- | ------------------------------------------| ---- | ------------------------------------------------------------ |
| duration | number | No | Animation duration, in ms. Default value: **1000** Unit: ms Since API version 9, this API is supported in ArkTS widgets. **NOTE** - The maximum animation duration on an ArkTS widget is 1000 ms. - A value less than 0 evaluates to the value **0**. - Floating-point values will be rounded down to integers. For example, if the value set is 1.2, **1** will be used.|
| tempo | number | No | Animation playback speed. A larger value indicates a higher animation playback speed. The value **0** indicates that no animation is applied. Default value: **1** **NOTE** A value less than 0 evaluates to the value **1**.|
-| curve | string \| [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve)9+ | No | Animation curve. The default curve is linear. Default value: **Curve.Linear** Since API version 9, this API is supported in ArkTS widgets.|
+| curve | string \| [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve)9+ | No | Animation curve. Default value: **Curve.EaseInOut** Since API version 9, this API is supported in ArkTS widgets.|
| delay | number | No | Delay of animation playback, in ms. The value **0** indicates that the playback is not delayed. Default value: **0** Value range: [0, +∞) **NOTE** - A value less than 0 evaluates to the value **0**. - Floating-point values will be rounded down to integers. For example, if the value set is 1.2, **1** will be used.|
| iterations | number | No | Number of times that the animation is played. Default value: **1** Value range: [-1, +∞) **NOTE** The value **-1** indicates that the animation is played for an unlimited number of times. The value **0** indicates that no animation is applied.|
| playMode | [PlayMode](ts-appendix-enums.md#playmode) | No | Animation playback mode. By default, the animation is played from the beginning after the playback is complete. Default value: **PlayMode.Normal** Since API version 9, this API is supported in ArkTS widgets. For details about the restrictions, see **Notes about PlayMode**.|
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md b/en/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md
index 5a8f52093e36bc198bb47b5fefdb60f0aac56cfd..732c575f94ea2e5bea7c463eeafadfcc4ad78f51 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md
@@ -22,7 +22,7 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| group | string | No| Group name.|
+| group | string | No| Group name. **NOTE** If there are multiple check box groups with the same group name, only the first check box group takes effect.|
## Attributes
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-navdestination.md b/en/application-dev/reference/arkui-ts/ts-basic-components-navdestination.md
index e637a22e1193f0fdb727b8ffe91e042ff167b6fd..2cf2de93c45d0935ff9ebfec2fcf0eb1f29f3883 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-navdestination.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-navdestination.md
@@ -25,7 +25,7 @@ In addition to the [backgroundColor](ts-universal-attributes-background.md) attr
| Name | Type | Description |
| ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
-| title | string \| [CustomBuilder](ts-types.md#custombuilder8) \| [NavigationCommonTitle](ts-basic-components-navigation.md#navigationcommontitle) \| [NavigationCustomTitle](ts-basic-components-navigation.md##navigationcustomtitle) | Page title. **NOTE** When the NavigationCustomTitle type is used to set the height, the **titleMode** attribute does not take effect. When the title string is too long: (1) If no subtitle is set, the string is scaled down, wrapped in two lines, and then clipped with an ellipsis (...); (2) If a subtitle is set, the subtitle is scaled down and then clipped with an ellipsis (...).|
+| title | string \| [CustomBuilder](ts-types.md#custombuilder8) \| [NavigationCommonTitle](ts-basic-components-navigation.md#navigationcommontitle) \| [NavigationCustomTitle](ts-basic-components-navigation.md##navigationcustomtitle) | Page title. **NOTE** When the NavigationCustomTitle type is used to set the height, the **titleMode** attribute does not take effect. When the title string is too long: (1) If no subtitle is set, the string is scaled down, wrapped in two lines, and then clipped with an ellipsis (...). (2) If a subtitle is set, the subtitle is scaled down and then clipped with an ellipsis (...). |
| hideTitleBar | boolean | Whether to hide the title bar. Default value: **false** **true**: Hide the title bar. **false**: Display the title bar.|
## Events
@@ -33,8 +33,8 @@ In addition to the [backgroundColor](ts-universal-attributes-background.md) attr
In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
-| Name | Description |
-| ---------------------------------------- | ---------------------------------------- |
-| onShown(callback: (param: unknown) => void)10+ | Called when the navigation destination page is displayed. **param**: parameter information of the navigation destination page. **NOTE** The **onShown** API will be changed to **onShown(callback: () => void)**.|
-| onHidden(callback: () => void)10+ | Called when the navigation destination page is hidden.|
-| onBackPressed(callback: () => boolean)10+ | Called when the back button is pressed. The value **true** means that the back button logic is overridden, and **false** means that the previous page is displayed. |
+| Name | Description |
+| ------------------------------------------------------- | ------------------------------------------------------------ |
+| onShown(callback: () => void)10+ | Called when the navigation destination page is displayed. |
+| onHidden(callback: () => void)10+ | Called when the navigation destination page is hidden. |
+| onBackPressed(callback: () => boolean)10+ | Called when the back button is pressed. The value **true** means that the back button logic is overridden, and **false** means that the previous page is displayed. |
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-navigation.md b/en/application-dev/reference/arkui-ts/ts-basic-components-navigation.md
index cad8cd31309b0e6098e0ab5b521d5c6f10ce0843..110905369abcd03d58cccdab4380d31aadf03f33 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-navigation.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-navigation.md
@@ -13,44 +13,54 @@ Supported
Since API version 9, it is recommended that this component be used together with the **[\](ts-basic-components-navrouter.md)** component.
-
## APIs
-**API 1**: Navigation()
+### Navigation
+
+Navigation()
+
+### Navigation10+
-**API 2**: Navigation(pathInfos: NavPathStack)10+
+Navigation(pathInfos: NavPathStack)10+
Binds a navigation stack to the **\** component.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | ----------------------------------- | ---- | ------------- |
-| pathInfos | [NavPathStack](#navpathstack10) | No | Information about the navigation stack.|
+| Name | Type | Mandatory | Description |
+| --------- | ------------------------------- | ---- | ------ |
+| pathInfos | [NavPathStack](#navpathstack10) | No | Information about the navigation stack.|
## Attributes
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
-| Name | Type | Description |
-| ----------------------------- | ---------------------------------------- | ---------------------------------------- |
-| title | [ResourceStr](ts-types.md#resourcestr)10+ \| [CustomBuilder](ts-types.md#custombuilder8)8+ \| [NavigationCommonTitle](#navigationcommontitle)9+ \| [NavigationCustomTitle](#navigationcustomtitle)9+ | Page title. **NOTE** When the NavigationCustomTitle type is used to set the height, the **titleMode** attribute does not take effect. When the title string is too long: (1) If no subtitle is set, the string is scaled down, wrapped in two lines, and then clipped with an ellipsis (...); (2) If a subtitle is set, the subtitle is scaled down and then clipped with an ellipsis (...).|
-| subTitle(deprecated) | string | Subtitle of the page. If this attribute is not set, no subtitle is displayed. This attribute is deprecated since API version 9. You are advised to use **title** instead.|
-| menus | Array<[NavigationMenuItem](#navigationmenuitem)> \| [CustomBuilder](ts-types.md#custombuilder8)8+ | Menu items in the upper right corner of the page. If this attribute is not set, no menu item is displayed. When the value type is Array\<[NavigationMenuItem](#navigationmenuitem)>, the menu shows a maximum of three icons in portrait mode and a maximum of five icons in landscape mode, with excess icons (if any) placed under the automatically generated **More** icon.|
-| titleMode | [NavigationTitleMode](#navigationtitlemode) | Display mode of the page title bar. Default value: **NavigationTitleMode.Free**|
-| toolBar(deprecated) | [object](#object) \| [CustomBuilder](ts-types.md#custombuilder8)8+ | Content of the toolbar. If this attribute is not set, no toolbar is displayed. **items**: items on the toolbar. **NOTE** Items are evenly distributed on the toolbar at the bottom. Text and icons are evenly distributed in each content area. If the text is too long, it is scaled down level by level, wrapped in two lines, and then clipped with an ellipsis (...). This API is deprecated since API version 10. You are advised to use **toolbarConfiguration** instead.|
+| Name | Type | Description |
+| ---------------------------------- | ---------------------------------------- | ---------------------------------------- |
+| title | [ResourceStr](ts-types.md#resourcestr)10+ \| [CustomBuilder](ts-types.md#custombuilder8)8+ \| [NavigationCommonTitle](#navigationcommontitle)9+ \| [NavigationCustomTitle](#navigationcustomtitle)9+ | Page title. **NOTE** When the NavigationCustomTitle type is used to set the height, the **titleMode** attribute does not take effect. When the title string is too long: (1) If no subtitle is set, the string is scaled down, wrapped in two lines, and then clipped with an ellipsis (...); (2) If a subtitle is set, the subtitle is scaled down and then clipped with an ellipsis (...).|
+| subTitle(deprecated) | string | Subtitle of the page. If this attribute is not set, no subtitle is displayed. This attribute is deprecated since API version 9. You are advised to use **title** instead.|
+| menus | Array<[NavigationMenuItem](#navigationmenuitem)> \| [CustomBuilder](ts-types.md#custombuilder8)8+ | Menu items in the upper right corner of the page. If this attribute is not set, no menu item is displayed. When the value type is Array<[NavigationMenuItem](#navigationmenuitem)>, the menu shows a maximum of three icons in portrait mode and a maximum of five icons in landscape mode, with excess icons (if any) placed under the automatically generated **More** icon.|
+| titleMode | [NavigationTitleMode](#navigationtitlemode) | Display mode of the page title bar. Default value: **NavigationTitleMode.Free**|
+| toolBar(deprecated) | [object](#object) \| [CustomBuilder](ts-types.md#custombuilder8)8+ | Content of the toolbar. If this attribute is not set, no toolbar is displayed. **items**: all items on the toolbar. **NOTE** Items are evenly distributed on the toolbar at the bottom. Text and icons are evenly distributed in each content area. If the text is too long, it is scaled down level by level, wrapped in two lines, and then clipped with an ellipsis (...). This API is deprecated since API version 10. You are advised to use **toolbarConfiguration** instead.|
| toolbarConfiguration10+ | Array<[ToolbarItem](#toolbaritem10)10+ > \| [CustomBuilder](ts-types.md#custombuilder8)8+ | Content of the toolbar. If this attribute is not set, no toolbar is displayed. **NOTE** When the value type is Array<[ToolbarItem](#ToolbarItem>, the toolbar exhibits the following features: Items are evenly distributed on the toolbar at the bottom. Text and icons are evenly distributed in each content area. If any item contains overlong text and there are fewer than five items, the following measures are taken: 1. Increase the item's width to accommodate the text until it is as large as the screen width; 2. Scale down the text level by level; 3. Wrap the text in two lines; 4. Clip the text with an ellipsis (...). The toolbar shows a maximum of five icons in portrait mode, with excess icons (if any) placed under the automatically generated **More** icon. In landscape mode, this attribute must be used together with Array<[NavigationMenuItem](#navigationmenuitem)> of the **menus** attribute; the toolbar at the bottom is automatically hidden, and all items on the toolbar are moved to the menu in the upper right corner of the screen. When the value type is [CustomBuilder](ts-types.md#custombuilder8), and the toolbar does not exhibit the preceding features except that items are evenly distributed on the toolbar at the bottom.|
-| hideToolBar | boolean | Whether to hide the toolbar. Default value: **false** **true**: Hide the toolbar. **false**: Display the toolbar.|
-| hideTitleBar | boolean | Whether to hide the title bar. Default value: **false** **true**: Hide the title bar. **false**: Display the title bar.|
-| hideBackButton | boolean | Whether to hide the back button. Default value: **false** **true**: Hide the back button. **false**: Display the back button. The back button in the title bar of the **\** component cannot be hidden. **NOTE** The back button works only when **titleMode** is set to **NavigationTitleMode.Mini**.|
-| navBarWidth9+ | [Length](ts-types.md#length) | Width of the navigation bar. Default value: **240** Unit: vp **NOTE** This attribute is valid only when the **\** component is split.|
-| navBarPosition9+ | [NavBarPosition](#navbarposition) | Position of the navigation bar. Default value: **NavBarPosition.Start** **NOTE** This attribute is valid only when the **\** component is split.|
-| mode9+ | [NavigationMode](#navigationmode) | Display mode of the navigation bar. Default value: **NavigationMode.Auto** At the default settings, the component adapts to a single column or two columns based on the component width. **NOTE** Available options are **Stack**, **Split**, and **Auto**.|
-| backButtonIcon9+ | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | Back button icon on the navigation bar. The back button in the title bar of the **\** component cannot be hidden.|
-| hideNavBar9+ | boolean | Whether to hide the navigation bar. This attribute is valid only when **mode** is set to **NavigationMode.Split**.|
-| navDestination10+ | builder: (name: string, param: unknown) => void | Creates a **\** component. **NOTE** The **builder** function is used, with the **name** and **param** parameters passed in. In the builder, a layer of custom components can be included outside the **\** component. However, no attributes or events can be set for the custom components. Otherwise, only blank components are displayed.|
-| navBarWidthRange10+ | [[Dimension](ts-types.md#dimension10), [Dimension](ts-types.md#dimension10)] | Minimum and maximum widths of the navigation bar (valid in dual-column mode). Default value: **240** for the minimum value; 40% of the component width (not greater than 432) for the maximum value Unit: vp Priority rules: Custom value > Default value Minimum value > Maximum value navBar > content If values conflict, the global value takes precedence, and the local minimum value depends on the container size.|
-| minContentWidth10+ | [Dimension](ts-types.md#dimension10) | Minimum width of the navigation bar content area (valid in dual-column mode). Default value: **360** Unit: vp Priority rules: Custom value > Default value Minimum value > Maximum value navBar > content If values conflict, the global value takes precedence, and the local minimum value depends on the container size. Breakpoint calculation in Auto mode: default 600 vp = minNavBarWidth (240 vp) + minContentWidth (360 vp)|
+| hideToolBar | boolean | Whether to hide the toolbar. Default value: **false** **true**: Hide the toolbar. **false**: Display the toolbar.|
+| hideTitleBar | boolean | Whether to hide the title bar. Default value: **false** **true**: Hide the title bar. **false**: Display the title bar.|
+| hideBackButton | boolean | Whether to hide the back button. Default value: **false** **true**: Hide the back button. **false**: Display the back button. The back button in the title bar of the **\** component cannot be hidden. **NOTE** The back button works only when **titleMode** is set to **NavigationTitleMode.Mini**.|
+| navBarWidth9+ | [Length](ts-types.md#length) | Width of the navigation bar. Default value: **240** Unit: vp **NOTE** This attribute is valid only when the **\** component is split.|
+| navBarPosition9+ | [NavBarPosition](#navbarposition) | Position of the navigation bar. Default value: **NavBarPosition.Start** **NOTE** This attribute is valid only when the **\** component is split.|
+| mode9+ | [NavigationMode](#navigationmode) | Display mode of the navigation bar. Default value: **NavigationMode.Auto** At the default settings, the component adapts to a single column or two columns based on the component width. **NOTE** Available options are **Stack**, **Split**, and **Auto**.|
+| backButtonIcon9+ | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | Back button icon on the navigation bar. The back button in the title bar of the **\** component cannot be hidden.|
+| hideNavBar9+ | boolean | Whether to hide the navigation bar. This attribute is valid only when **mode** is set to **NavigationMode.Split**.|
+| navDestination10+ | builder: (name: string, param: unknown) => void | Creates a **\** component. **NOTE** The **builder** function is used, with the **name** and **param** parameters passed in. In the builder, a layer of custom components can be included outside the **\** component. However, no attributes or events can be set for the custom components. Otherwise, only blank components are displayed.|
+| navBarWidthRange10+ | [[Dimension](ts-types.md#dimension10), [Dimension](ts-types.md#dimension10)] | Minimum and maximum widths of the navigation bar (valid in dual-column mode). Default value: **240** for the minimum value; 40% of the component width (not greater than 432) for the maximum value Unit: vp Priority rules: Custom value > Default value Minimum value > Maximum value navBar > content If values conflict, the global value takes precedence, and the local minimum value depends on the container size.|
+| minContentWidth10+ | [Dimension](ts-types.md#dimension10) | Minimum width of the navigation bar content area (valid in dual-column mode). Default value: **360** Unit: vp Priority rules: Custom value > Default value Minimum value > Maximum value navBar > content If values conflict, the global value takes precedence, and the local minimum value depends on the container size. Breakpoint calculation in Auto mode: default 600 vp = minNavBarWidth (240 vp) + minContentWidth (360 vp)|
+
+## Events
+
+| Name | Description |
+| ---------------------------------------- | ---------------------------------------- |
+| onTitleModeChange(callback: (titleMode: NavigationTitleMode) => void) | Called when **titleMode** is set to **NavigationTitleMode.Free** and the title bar mode changes as content scrolls.|
+| onNavBarStateChange(callback: (isVisible: boolean) => void) | Called when the navigation bar visibility status changes. The value **true** means that the navigation bar is displayed, and **false** means the opposite.|
## NavPathStack10+
@@ -64,9 +74,9 @@ Pushes the NavDestination page information specified by **info** to the stack.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ----------------------- | ---- | --------------- |
-| info | [NavPathInfo](#navpathinfo10) | Yes | Information about the navigation destination page. |
+| Name | Type | Mandatory | Description |
+| ---- | ----------------------------- | ---- | -------------------- |
+| info | [NavPathInfo](#navpathinfo10) | Yes | Information about the navigation destination page.|
### pushPathByName10+
@@ -76,10 +86,10 @@ Pushes the navigation destination page specified by **name** to the navigation s
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ----------------------- | ---- | --------------- |
-| name | string | Yes | Name of the navigation destination page. |
-| param | unknown | Yes | Parameter information of the navigation destination page. |
+| Name | Type | Mandatory | Description |
+| ----- | ------- | ---- | --------------------- |
+| name | string | Yes | Name of the navigation destination page. |
+| param | unknown | Yes | Parameter information of the navigation destination page.|
### pop10+
@@ -89,10 +99,10 @@ Pops the top element out of the navigation stack.
**Return value**
-| Type | Description |
-| ------ | -------- |
+| Type | Description |
+| ----------- | ------------------------ |
| NavPathInfo | Returns the information about the navigation destination page at the top of the stack.|
-| undefined | Returns **undefined** if the navigation stack is empty.|
+| undefined | Returns **undefined** if the navigation stack is empty. |
### popToName10+
@@ -102,14 +112,14 @@ Returns the navigation stack to the first navigation destination page that match
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ----------------------- | ---- | --------------- |
-| name | string | Yes | Name of the navigation destination page. |
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ------------------- |
+| name | string | Yes | Name of the navigation destination page.|
**Return value**
-| Type | Description |
-| ------ | -------- |
+| Type | Description |
+| ------ | ---------------------------------------- |
| number | Returns the index of the first navigation destination page that matches the value of **name** if it exists in the navigation stack; returns **-1** otherwise.|
### popToIndex10+
@@ -120,9 +130,9 @@ Returns the navigation stack to the navigation destination page that matches the
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ----------------------- | ---- | --------------- |
-| index | number | Yes | Index of the navigation destination page. |
+| Name | Type | Mandatory | Description |
+| ----- | ------ | ---- | ---------------------- |
+| index | number | Yes | Index of the navigation destination page.|
### moveToTop10+
@@ -132,14 +142,14 @@ Moves to the top of the navigation stack the first navigation destination page t
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ----------------------- | ---- | --------------- |
-| name | string | Yes | Name of the navigation destination page. |
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ------------------- |
+| name | string | Yes | Name of the navigation destination page.|
**Return value**
-| Type | Description |
-| ------ | -------- |
+| Type | Description |
+| ------ | ---------------------------------------- |
| number | Returns the index of the first navigation destination page that matches the value of **name** if it exists in the navigation stack; returns **-1** otherwise.|
### moveIndexToTop10+
@@ -150,9 +160,9 @@ Moves to the top of the navigation stack the navigation destination page that ma
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ----------------------- | ---- | --------------- |
-| index | number | Yes | Index of the navigation destination page. |
+| Name | Type | Mandatory | Description |
+| ----- | ------ | ---- | ---------------------- |
+| index | number | Yes | Index of the navigation destination page.|
### clear10+
@@ -168,8 +178,8 @@ Obtains the names of all navigation destination pages in the navigation stack.
**Return value**
-| Type | Description |
-| ------ | -------- |
+| Type | Description |
+| -------------- | -------------------------- |
| Array | Names of all navigation destination pages in the navigation stack.|
### getParamByIndex10+
@@ -180,16 +190,16 @@ Obtains the parameter information of the navigation destination page that matche
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ----------------------- | ---- | --------------- |
-| index | number | Yes | Index of the navigation destination page. |
+| Name | Type | Mandatory | Description |
+| ----- | ------ | ---- | ---------------------- |
+| index | number | Yes | Index of the navigation destination page.|
**Return value**
-| Type | Description |
-| ------ | -------- |
-| unknown | Returns the parameter information of the matching navigation destination page.|
-| undefined | Returns **undefined** if the passed index is invalid.|
+| Type | Description |
+| --------- | -------------------------- |
+| unknown | Returns the parameter information of the matching navigation destination page.|
+| undefined | Returns **undefined** if the passed index is invalid. |
### getParamByName10+
@@ -199,15 +209,15 @@ Obtains the parameter information of all the navigation destination pages that m
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ----------------------- | ---- | --------------- |
-| name | string | Yes | Name of the navigation destination page. |
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ------------------- |
+| name | string | Yes | Name of the navigation destination page.|
**Return value**
-| Type | Description |
-| ------ | -------- |
-| Array | Parameter information of all the matching navigation destination pages.|
+| Type | Description |
+| --------------- | --------------------------------- |
+| Array | Parameter information of all the matching navigation destination pages.|
### getIndexByName10+
@@ -217,15 +227,15 @@ Obtains the indexes information of all the navigation destination pages that mat
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ----------------------- | ---- | --------------- |
-| name | string | Yes | Name of the navigation destination page. |
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ------------------- |
+| name | string | Yes | Name of the navigation destination page.|
**Return value**
-| Type | Description |
-| ------ | -------- |
-| Array | Indexes of all the matching navigation destination pages.|
+| Type | Description |
+| -------------- | --------------------------------- |
+| Array | Indexes of all the matching navigation destination pages.|
### size10+
@@ -235,9 +245,9 @@ Obtains the stack size.
**Return value**
-| Type | Description |
-| ------ | -------- |
-| number | Stack size.|
+| Type | Description |
+| ------ | ------ |
+| number | Stack size.|
## NavPathInfo10+
@@ -249,52 +259,52 @@ constructor(name: string, param: unknown)
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ----------------------- | ---- | --------------- |
-| name | string | Yes | Name of the navigation destination page. |
-| param | unknown | No | Parameter information of the navigation destination page. |
+| Name | Type | Mandatory | Description |
+| ----- | ------- | ---- | --------------------- |
+| name | string | Yes | Name of the navigation destination page. |
+| param | unknown | No | Parameter information of the navigation destination page.|
## NavigationMenuItem
-| Name | Type | Mandatory | Description |
-| ------ | ----------------------- | ---- | --------------- |
-| value | string | Yes | Text of a menu item. |
-| icon | string | No | Icon path of a menu item.|
+| Name | Type | Mandatory | Description |
+| ------ | ------------- | ---- | --------------- |
+| value | string | Yes | Text of a menu item. |
+| icon | string | No | Icon path of a menu item.|
| action | () => void | No | Callback invoked when a menu item is selected. |
## object
-| Name | Type | Mandatory | Description |
-| ------ | ----------------------- | ---- | --------------- |
-| value | string | Yes | Text of a toolbar item. |
-| icon | string | No | Icon path of a toolbar item.|
+| Name | Type | Mandatory | Description |
+| ------ | ------------- | ---- | --------------- |
+| value | string | Yes | Text of a toolbar item. |
+| icon | string | No | Icon path of a toolbar item.|
| action | () => void | No | Callback invoked when a toolbar item is selected. |
## ToolbarItem10+
-| Name | Type | Mandatory| Description |
-| ---------- | ------------------------------------------------- | ---- | ----------------------------------------------------------- |
-| value | ResourceStr | Yes | Text of a toolbar item. |
-| icon | ResourceStr | No | Icon path of a toolbar item. |
-| action | () => void | No | Callback invoked when a toolbar item is selected. |
-| status | [ToolbarItemStatus](#toolbaritemstatus10) | No | Status of a toolbar item. Default value: **ToolbarItemStatus.NORMAL**|
-| activeIcon | ResourceStr | No | Icon path of the toolbar item in the active state. |
+| Name | Type | Mandatory | Description |
+| ---------- | ---------------------------------------- | ---- | ---------------------------------------- |
+| value | ResourceStr | Yes | Text of a toolbar item. |
+| icon | ResourceStr | No | Icon path of a toolbar item. |
+| action | () => void | No | Callback invoked when a toolbar item is selected. |
+| status | [ToolbarItemStatus](#toolbaritemstatus10) | No | Status of a toolbar item. Default value: **ToolbarItemStatus.NORMAL**|
+| activeIcon | ResourceStr | No | Icon path of the toolbar item in the active state. |
## ToolbarItemStatus10+
-| Name | Description |
-| -------- | ------------------------------------------------------------ |
+| Name | Description |
+| -------- | ---------------------------------------- |
| NORMAL | Normal state. In this state, the toolbar item takes on the default style and can switch to another state-specific style by responding to the hover, press, and focus events.|
| DISABLED | Disabled state. In this state, the toolbar item is disabled and does not allow for user interactions.|
| ACTIVE | Active state. In this state, the toolbar item can update its icon to the one specified by **activeIcon** by responding to a click event.|
## NavigationTitleMode
-| Name| Description |
-| ---- | ------------------------------------------------------------ |
-| Free | When the content is a scrollable component, the main title shrinks as the content scrolls down (the subtitle fades out with its size remaining unchanged) and restores when the content scrolls up to the top. **NOTE** The size linkage effect works only when **title** is set to **ResourceStr** or **NavigationCommonTitle**. If **title** is set to any other value type, the main title changes in mere location when pulled down.|
-| Mini | The title is fixed at mini mode. |
-| Full | The title is fixed at full mode. |
+| Name | Description |
+| ---- | ---------------------------------------- |
+| Free | When the content is a scrollable component, the main title shrinks as the content scrolls down (the subtitle fades out with its size remaining unchanged) and restores as the content scrolls up to the top. **NOTE** The size linkage effect works only when **title** is set to **ResourceStr** or **NavigationCommonTitle**. If **title** is set to any other value type, the main title changes in mere location when pulled down.|
+| Mini | The title is fixed at mini mode. |
+| Full | The title is fixed at full mode. |
## NavigationCommonTitle
@@ -322,7 +332,7 @@ constructor(name: string, param: unknown)
| Name | Description |
| ----- | ------------------------------------------------------------ |
| Stack | The navigation bar and content area are displayed independently of each other, which are equivalent to two pages. |
-| Split | The navigation bar and content area are displayed in different columns. |
+| Split | The navigation bar and content area are displayed in different columns. The values of **navBarWidthRange** are represented by [minNavBarWidth,maxNavBarWidth]. 1. When the value of **navBarWidth** is beyond the value range specified by **navBarWidthRange**, **navBarWidth** is set according to the following rules: Value of **navBarWidth** < Value of **minNavBarWidth**: The value of **navBarWidth** is changed to that of **minNavBarWidth**. Value of **navBarWidth** > Value of **maxNavBarWidth** and Component width - Value of **minContentWidth** - Divider width (1 vp) > Value of **maxNavBarWidth**: The value of **navBarWidth** is changed to that of **maxNavBarWidth**. Value of **navBarWidth** > Value of **maxNavBarWidth** and Component width - Value of **minContentWidth** - Divider width (1 vp) < Value of **minNavBarWidth**: The value of **navBarWidth** is changed to that of **minNavBarWidth**. Value of **navBarWidth** > Value of **maxNavBarWidth** and Component width - Value of **minContentWidth** - Divider width (1 vp) is within the value range specified by **navBarWidthRange**: The value of **navBarWidth** is changed to Component width - Value of **minContentWidth** - Divider width (1 vp). 2. When the value of **navBarWidth** is within the value range specified by **navBarWidthRange**, **navBarWidth** is set according to the following rules: Value of **minNavBarWidth** + Value of **minContentWidth** + Divider width (1 vp) > = Component width: The value of **navBarWidth** is changed to that of **minNavBarWidth**. Value of **minNavBarWidth** + Value of **minContentWidth** + Divider width (1 vp) < Component width and Value of **navBarWidth** + Value of **minContentWidth** + Divider width (1 vp) > = Component width: The value of **navBarWidth** is changed to Component width - Value of **minContentWidth** - Divider width (1 vp). Value of **minNavBarWidth** + Value of **minContentWidth** + Divider width (1 vp) < Component width and Value of **navBarWidth** + Value of **minContentWidth** + Divider width (1 vp) < Component width: The value of **navBarWidth** is the set value. 3. When the component size is decreased, the content area is shrunk until its width reaches the value defined by **minContentWidth**, and then the navigation bar is shrunk until its width reaches the value defined by **minNavBarWidth**; if the component size is further decreased, the content area is further shrunk until it disappears, and then navigation bar is shrunk. 4. When the navigation bar is set to a fixed size and the component size is continuously decreased, the navigation bar is shrunk. 5. If only **navBarWidth** is set, the width of the navigation bar is fixed at the value of **navBarWidth**, and the divider cannot be dragged.|
| Auto | In API version 9 and earlier versions: When the window width is greater than or equal to 520 vp, the Split mode is used. In other cases, the Stack mode is used. In API version 10 and later versions: When the window width is greater than or equal to 600 vp, the Split mode is used. In other cases, the Stack mode is used. 600 vp = minNavBarWidth (240 vp) + minContentWidth (360 vp).|
## TitleHeight
@@ -334,17 +344,10 @@ constructor(name: string, param: unknown)
> **NOTE**
+>
> Among the scrollable components, only **\** is supported.
-## Events
-
-| Name | Description |
-| ---------------------------------------- | ---------------------------------------- |
-| onTitleModeChange(callback: (titleMode: NavigationTitleMode) => void) | Called when **titleMode** is set to **NavigationTitleMode.Free** and the title bar mode changes as content scrolls.|
-| onNavBarStateChange(callback: (isVisible: boolean) => void) | Called when the navigation bar visibility status changes. The value **true** means that the navigation bar is displayed, and **false** means the opposite.|
-
-
## Example
```ts
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-richeditor.md b/en/application-dev/reference/arkui-ts/ts-basic-components-richeditor.md
index 23d1dd164423c71f692e07fe8600a791f94466e7..b492893437d12229d84e45fe345b23bb5a506839 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-richeditor.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-richeditor.md
@@ -27,6 +27,15 @@ RichEditor(value: RichEditorOptions)
The [universal attributes](ts-universal-attributes-size.md) are supported.
+> **NOTE**
+>
+> The default value of the **clip** attribute is **true**.
+
+| Name | Type | Description |
+| ------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
+| customKeyboard10+ | [CustomBuilder](ts-types.md#custombuilder8) | Custom keyboard. **NOTE** When a custom keyboard is set, activating the text box opens the specified custom component, instead of the system input method. The custom keyboard's height can be set through the **height** attribute of the custom component's root node, and its width is fixed at the default value. The custom keyboard is displayed on top of the current page, without compressing or raising the page. The custom keyboard cannot obtain the focus, but it blocks gesture events. By default, the custom keyboard is closed when the input component loses the focus.|
+
+
## Events
In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
@@ -209,7 +218,7 @@ Adds an image span.
updateSpanStyle(value: RichEditorUpdateTextSpanStyleOptions | RichEditorUpdateImageSpanStyleOptions): void
-Updates the text or image span style.
+Updates the text or image span style. If only part of a span is updated, the span is split into multiple spans based on the updated part and the unupdated part.
**Parameters**
@@ -299,7 +308,7 @@ Provides the text style information.
| fontColor | [ResourceColor](ts-types.md#resourcecolor) | No| Font color. Default value: **Color.Black**|
| fontSize | [Length](ts-types.md#length) \| number | No| Font size. Default value: **16fp**|
| fontStyle | [FontStyle](ts-appendix-enums.md#fontstyle) | No| Font style. Default value: **FontStyle.Normal**|
-| fontWeight | [FontWeight](ts-appendix-enums.md#fontweight) \| number \| string | No| Font weight. Default value: **FontWeight.Normal**|
+| fontWeight | [FontWeight](ts-appendix-enums.md#fontweight) \| number \| string | No| Font weight. For the number type, the value ranges from 100 to 900, at an interval of 100. A larger value indicates a heavier font weight. The default value is **400**. For the string type, only strings of the number type are supported, for example, **"400"**, **"bold"**, **"bolder"**, **"lighter"**, **"regular"**, and **"medium"**, which correspond to the enumerated values in **FontWeight**. Default value: **FontWeight.Normal**|
| fontFamily | [ResourceStr](ts-types.md#resourcestr) \| number \| string | No| Font family. Default value: **'HarmonyOS Sans'**. Currently, only the default font is supported. Default font: **'HarmonyOS Sans'**|
| decoration | { type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype), color?: [ResourceColor](ts-types.md#resourcecolor) } | No| Style and color of the text decorative line. Default value: { type: TextDecorationType.None, color: Color.Black }|
@@ -335,6 +344,8 @@ Provides the span range information.
## Example
+### Example 1
+
```ts
// xxx.ets
@Entry
@@ -484,3 +495,47 @@ struct Index {
}
```

+
+### Example 2
+
+```ts
+// xxx.ets
+@Entry
+@Component
+struct RichEditorExample {
+ controller: RichEditorController = new RichEditorController()
+
+ // Create a custom keyboard component.
+ @Builder CustomKeyboardBuilder() {
+ Column() {
+ Grid() {
+ ForEach([1, 2, 3, 4, 5, 6, 7, 8, 9, '*', 0, '#'], (item) => {
+ GridItem() {
+ Button(item + "")
+ .width(110).onClick(() => {
+ this.controller.addTextSpan(item + '', {
+ style:
+ {
+ fontColor: Color.Orange,
+ fontSize: 30
+ }
+ })
+ })
+ }
+ })
+ }.maxCount(3).columnsGap(10).rowsGap(10).padding(5)
+ }.backgroundColor(Color.Gray)
+ }
+
+ build() {
+ Column() {
+ RichEditor({ controller: this.controller })
+ // Bind the custom keyboard.
+ .customKeyboard(this.CustomKeyboardBuilder()).margin(10).border({ width: 1 })
+ .height(200)
+ }
+ }
+}
+```
+
+
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-search.md b/en/application-dev/reference/arkui-ts/ts-basic-components-search.md
index 10ae16a154852bbdedb8b408882852933da87f75..7c6b79a16898c80b42b96943ef522f367ba54aa2 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-search.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-search.md
@@ -12,7 +12,7 @@ Not supported
## APIs
-Search(options?: { value?: string; placeholder?: ResourceStr; icon?: string; controller?: SearchController })
+Search(options?: { value?: string, placeholder?: ResourceStr, icon?: string, controller?: SearchController })
**Parameters**
@@ -20,7 +20,7 @@ Search(options?: { value?: string; placeholder?: ResourceStr; icon?: string; con
| ----------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
| value | string | No | Text input in the search text box. Since API version 10, this parameter supports two-way binding through [$$](../../quick-start/arkts-two-way-sync.md).|
| placeholder | [ResourceStr](ts-types.md#resourcestr)10+ | No | Text displayed when there is no input. |
-| icon | string | No | Path to the search icon. By default, the system search icon is used. **NOTE** The icon data source can be a local or online image. - The supported formats include PNG, JPG, BMP, SVG, GIF, and pixelmap. - The Base64 string is supported in the following format: data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data], where [base64 data] is a Base64 string.|
+| icon | string | No | Path to the search icon. By default, the system search icon is used. **NOTE** The icon data source can be a local or online image. - The supported formats include PNG, JPG, BMP, SVG, GIF, and pixelmap. - The Base64 string is supported in the following format: data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data], where [base64 data] is a Base64 string. If this attribute and the **searchIcon** attribute are both set, the **searchIcon** attribute takes precedence.|
| controller | SearchController | No | Controller of the **\** component. |
## Attributes
@@ -41,11 +41,13 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| caretStyle10+ | [CaretStyle](#caretstyle10) | Caret style. Default value: { width: 1.5vp color: '#007DFF' } |
| enableKeyboardOnFocus10+ | boolean | Whether to enable the input method when the component obtains focus. Default value: **true** |
| selectionMenuHidden10+ | boolean | Whether to display the text selection menu when the text box is long-pressed or right-clicked. Default value: **false**|
+| customKeyboard10+ | [CustomBuilder](ts-types.md#custombuilder8) | Custom keyboard. **NOTE** When a custom keyboard is set, activating the text box opens the specified custom component, instead of the system input method. The custom keyboard's height can be set through the **height** attribute of the custom component's root node, and its width is fixed at the default value. The custom keyboard is displayed on top of the current page, without compressing or raising the page. The custom keyboard cannot obtain the focus, but it blocks gesture events. By default, the custom keyboard is closed when the input component loses the focus. You can also use the [stopEditing](#stopediting10) API to close the keyboard.|
+
## IconOptions10+
| Name| Type | Mandatory| Description |
| ------ | ------------------------------------------ | ---- | ----------- |
-| size | [Length](ts-types.md#length) | No | Icon size. |
+| size | [Length](ts-types.md#length) | No | Icon size. It cannot be set in percentage. |
| color | [ResourceColor](ts-types.md#resourcecolor) | No | Icon color. |
| src | [ResourceStr](ts-types.md#resourcestr) | No | Image source of the icon.|
@@ -60,7 +62,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name | Type | Mandatory| Description |
| --------- | ------------------------------------------ | ---- | ---------------- |
-| fontSize | [Length](ts-types.md#length) | No | Font size of the button.|
+| fontSize | [Length](ts-types.md#length) | No | Font size of the button. It cannot be set in percentage.|
| fontColor | [ResourceColor](ts-types.md#resourcecolor) | No | Font color of the button.|
## CancelButtonStyle10+
@@ -235,3 +237,46 @@ struct SearchButtoonExample {
```

+
+
+### Example 3
+
+```ts
+// xxx.ets
+@Entry
+@Component
+struct SearchExample {
+ controller: SearchController = new SearchController()
+ @State inputValue: string = ""
+
+ // Create a custom keyboard component.
+ @Builder CustomKeyboardBuilder() {
+ Column() {
+ Button('x').onClick(() => {
+ // Disable the custom keyboard.
+ this.controller.stopEditing()
+ })
+ Grid() {
+ ForEach([1, 2, 3, 4, 5, 6, 7, 8, 9, '*', 0, '#'], (item) => {
+ GridItem() {
+ Button(item + "")
+ .width(110).onClick(() => {
+ this.inputValue += item
+ })
+ }
+ })
+ }.maxCount(3).columnsGap(10).rowsGap(10).padding(5)
+ }.backgroundColor(Color.Gray)
+ }
+
+ build() {
+ Column() {
+ Search({ controller: this.controller, value: this.inputValue})
+ // Bind the custom keyboard.
+ .customKeyboard(this.CustomKeyboardBuilder()).margin(10).border({ width: 1 })
+ }
+ }
+}
+````
+
+
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-stepperitem.md b/en/application-dev/reference/arkui-ts/ts-basic-components-stepperitem.md
index 07b043411ed7ce7658cb575490e559e0dbd3aab0..daf26e98a24a303138f9f79c88c4340c73ba629a 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-stepperitem.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-stepperitem.md
@@ -26,6 +26,11 @@ StepperItem()
| nextLabel | string | Text label of the button on the right. The default value is **Start** for the last page and **Next** for the other pages.|
| status | [ItemState](#itemstate) | Display status of **nextLabel** in the stepper. Optional. Default value: **ItemState.Normal**|
+> **NOTE**
+>
+> - The **\** component does not support setting of the universal width attribute. By default, its width is the same as that of the parent **\** component.
+> - The **\** component does not support setting of the universal height attribute. Its height is the height of the parent **\** component minus the height of the label button.
+> - The **\** component does not support setting of the **aspectRadio** or **constrainSize** attribute, which may affect the length and width.
## ItemState
| Name | Description|
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md
index f8a2a0cba6a7b5dd36ff165a3df05cfd11dfede2..61accc536e8ad4a8a06ed06e879a8de4ca4028ae 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md
@@ -40,7 +40,7 @@ Among the [universal attributes](ts-universal-attributes-size.md) and [universal
| inputFilter8+ | { value: [ResourceStr](ts-types.md#resourcestr), error?: (value: string) => void } | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The regular expression can match single characters, but not strings. - **value**: regular expression to set. - **error**: filtered-out content to return when regular expression matching fails.|
| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed. Default value: **CopyOptions.LocalDevice** If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.|
| showPasswordIcon9+ | boolean | Whether to display the password icon at the end of the password text box. Default value: **true**|
-| style9+ | [TextInputStyle](#textinputstyle9) \| [TextContentStyle](ts-appendix-enums.md#textcontentstyle10) | Text input style. Default value: **TextInputStyle.Default** In the case of **TextInputStyle.Inline**, setting the text alignment mode is not available.|
+| style9+ | [TextInputStyle](#textinputstyle9) \| [TextContentStyle](ts-appendix-enums.md#textcontentstyle10) | Text input style. Default value: **TextInputStyle.Default**|
| textAlign9+ | [TextAlign](ts-appendix-enums.md#textalign) | Horizontal alignment of the text. Default value: **TextAlign.Start** **NOTE** Available options are **TextAlign.Start**, **TextAlign.Center**, and **TextAlign.End**. To set vertical alignment for the text, use the [align](ts-universal-attributes-location.md) attribute. The **align** attribute alone does not control the horizontal position of the text. In other words, **Alignment.TopStart**, **Alignment.Top**, and **Alignment.TopEnd** produce the same effect, top-aligning the text; **Alignment.Start**, **Alignment.Center**, and **Alignment.End** produce the same effect, centered-aligning the text vertically; **Alignment.BottomStart**, **Alignment.Bottom**, and **Alignment.BottomEnd** produce the same effect, bottom-aligning the text. |
| selectedBackgroundColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Background color of the selected text. If the opacity is not set, the color is opaque. For example, **0x80000000** indicates black with 50% opacity.|
| caretStyle10+ | { width: [Length](ts-types.md#length) } | Caret style. |
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md b/en/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md
index 6a48af10416c622cbf2726655a82711202093e56..1c4f04d875cf51f6868700329791bcd2298c7226 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md
@@ -76,6 +76,9 @@ struct TimePickerExample {
this.selectedTime.setHours(value.hour, value.minute)
console.info('select current date is: ' + JSON.stringify(value))
})
+ .disappearTextStyle({color: Color.Red, font: {size: 15, weight: FontWeight.Lighter}})
+ .textStyle({color: Color.Black, font: {size: 20, weight: FontWeight.Normal}})
+ .selectedTextStyle({color: Color.Blue, font: {size: 30, weight: FontWeight.Bolder}})
}.width('100%')
}
}
diff --git a/en/application-dev/reference/arkui-ts/ts-container-columnsplit.md b/en/application-dev/reference/arkui-ts/ts-container-columnsplit.md
index 594f3f24a30912af4e05a12d1c3dfe0a51957358..54c915981ad354d5c38f8fbb5e78dd149784ea94 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-columnsplit.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-columnsplit.md
@@ -1,18 +1,15 @@
# ColumnSplit
-The **\** component lays out child components vertically and inserts a horizontal divider between components.
+The **\** component lays out child components vertically and inserts a horizontal divider between every two child components.
> **NOTE**
>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-
-
## Child Components
Supported
-
## APIs
ColumnSplit()
@@ -20,17 +17,24 @@ ColumnSplit()
## Attributes
-| Name| Type| Description|
-| -------- | -------- | -------- |
-| resizeable | boolean | Whether the divider can be dragged. Default value: **false** |
+| Name | Type | Description |
+|-----------------------|-------------------------------------------------------------------|---------------------------------|
+| resizeable | boolean | Whether the divider can be dragged. Default value: **false** |
+| divider10+ | [ColumnSplitDividerStyle](#columnsplitdividerstyle10) \| null | Margin of the divider. - **DividerStyle**: distance between the divider and the child component above or below it. - Default value: **null**, indicating that the top and bottom margins of the divider are 0.|
+
+## ColumnSplitDividerStyle10+
+
+| Name | Type | Mandatory| Description |
+| ----------- | ------------- | ---- |--------------------------|
+| startMargin | [Dimension](ts-types.md#dimension10) | No | Distance between the divider and the child component above it. Default value: **0**|
+| endMargin | [Dimension](ts-types.md#dimension10) | No | Distance between the divider and the child component below it. Default value: **0**|
> **NOTE**
>
-> Similar to **\**, the divider of **\** can be dragged to a position that just fully holds a component.
->
-> Dragging is not supported in the Previewer. Check the drag effect on a real device.
+> Similar to **\**, the divider of **\** can change the height of the upper and lower child components, but only to the extent that the resultant height falls within the maximum and minimum heights of the child components.
>
-> The universal attributes **clip** and **margin** are not supported.
+> Universal attributes such as **clip** and **margin** are supported. If **clip** is not set, the default value **true** is used.
+
## Example
diff --git a/en/application-dev/reference/arkui-ts/ts-container-grid.md b/en/application-dev/reference/arkui-ts/ts-container-grid.md
index 6726cf4455e448bc64f7a54af59d4d2fb9477c6a..23e98d39e0f0eed4b1b6f9549ca1d28d283213be 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-grid.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-grid.md
@@ -63,6 +63,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| edgeEffect10+ | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | Scroll effect. The spring effect and shadow effect are supported. Default value: **EdgeEffect.None** |
| enableScrollInteraction10+ | boolean | Whether to support scroll gestures. When this attribute is set to **false**, scrolling by finger or mouse is not supported, but the scrolling controller API is not affected. Default value: **true** |
| nestedScroll10+ | [NestedScrollOptions](ts-container-scroll.md#nestedscrolloptions10) | Nested scrolling options. You can set the nested scrolling mode in the forward and backward directions to implement scrolling linkage with the parent component.|
+| friction10+ | number \| [Resource](ts-types.md#resource) | Friction coefficient. It applies only to gestures in the scrolling area, and it affects only indirectly the scroll chaining during the inertial scrolling process. Default value: **0.9** for wearable devices and **0.6** for non-wearable devices **NOTE** A value less than or equal to 0 evaluates to the default value.|
Depending on the settings of the **rowsTemplate** and **columnsTemplate** attributes, the **\** component supports the following layout modes:
@@ -111,7 +112,7 @@ In addition to the [universal events](ts-universal-events-click.md), the followi
| Name| Description|
| -------- | -------- |
| onScrollIndex(event: (first: number) => void) | Triggered when the first item displayed in the grid changes. It is triggered once when the grid is initialized. - **first**: index of the first item of the grid. If it changes, this event will be triggered.|
-| onItemDragStart(event: (event: ItemDragInfo, itemIndex: number) => (() => any) \| void) | Triggered when a grid item starts to be dragged. - **event**: See [ItemDragInfo](#itemdraginfo). - **itemIndex**: index of the dragged item. **NOTE** If **void** is returned, the drag operation cannot be performed. This event is triggered when the user long presses a grid item.|
+| onItemDragStart(event: (event: ItemDragInfo, itemIndex: number) => (() => any) \| void) | Triggered when a grid item starts to be dragged. - **event**: See [ItemDragInfo](#itemdraginfo). - **itemIndex**: index of the dragged item. **NOTE** If **void** is returned, the drag operation cannot be performed. This event is triggered when the user long presses a grid item. Drag detection also requires long press, and the event processing mechanism preferentially triggers child component events. Therefore, when **LongPressGesture** is bound to the grid item, the drag operation cannot be performed. In light of this, if both long press and drag operations are required, you can use universal drag events.|
| onItemDragEnter(event: (event: ItemDragInfo) => void) | Triggered when the dragged item enters the drop target of the grid. - **event**: See [ItemDragInfo](#itemdraginfo).|
| onItemDragMove(event: (event: ItemDragInfo, itemIndex: number, insertIndex: number) => void) | Triggered when the dragged item moves over the drop target of the grid. - **event**: See [ItemDragInfo](#itemdraginfo). - **itemIndex**: initial position of the dragged item. - **insertIndex**: index of the position to which the dragged item will be dropped.|
| onItemDragLeave(event: (event: ItemDragInfo, itemIndex: number) => void) | Triggered when the dragged item leaves the drop target of the grid. - **event**: See [ItemDragInfo](#itemdraginfo). - **itemIndex**: index of the dragged item.|
@@ -186,6 +187,7 @@ struct GridExample {
.columnsTemplate('1fr 1fr 1fr 1fr 1fr')
.columnsGap(10)
.rowsGap(10)
+ .friction(0.6)
.edgeEffect(EdgeEffect.Spring)
.scrollBar(BarState.On)
.onScrollIndex((first: number) => {
@@ -220,7 +222,7 @@ struct GridExample {
@Entry
@Component
struct GridExample {
- @State numbers: String[] = []
+ @State numbers: string[] = []
scroller: Scroller = new Scroller()
@State text: string = 'drag'
@@ -256,11 +258,6 @@ struct GridExample {
.width(80)
.height(80)
.textAlign(TextAlign.Center)
- .onTouch((event: TouchEvent) => {
- if (event.type === TouchType.Up) {
- this.text = day
- }
- })
}
})
}
@@ -275,9 +272,14 @@ struct GridExample {
.height(300)
.editMode(true) // Enable the grid to enter editing mode, where the user can drag the grid items.
.onItemDragStart((event: ItemDragInfo, itemIndex: number) => { // Triggered when a grid item starts to be dragged.
+ this.text = this.numbers[itemIndex]
return this.pixelMapBuilder() // Set the image to be displayed during dragging.
})
.onItemDrop((event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => { // Triggered when the dragged item is dropped on the drop target of the grid.
+ // If isSuccess is set to false, the item is dropped outside of the grid. If the value of insertIndex is greater than that of length, an item adding event occurs.
+ if (!isSuccess || insertIndex >= this.numbers.length) {
+ return
+ }
console.info('beixiang' + itemIndex + '', insertIndex + '') // itemIndex indicates the initial position of the dragged item. insertIndex indicates the position to which the dragged item will be dropped.
this.changeIndex(itemIndex, insertIndex)
})
diff --git a/en/application-dev/reference/arkui-ts/ts-container-list.md b/en/application-dev/reference/arkui-ts/ts-container-list.md
index c7eff1d8791375735a9d7dedc2baa217d41a32f1..38195901492db82a74671c4dcdbaff902f44e707 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-list.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-list.md
@@ -41,7 +41,7 @@ Since API version 9, this API is supported in ArkTS widgets.
| Name | Type | Mandatory | Description |
| ------------ | ---------------------------------------- | ---- | ---------------------------------------- |
-| space | number \| string | No | Spacing between list items along the main axis. Default value: **0** **NOTE** If the set value is a negative number, the default value will be used. If the value of **space** is less than the width of the list divider, the latter is used as the spacing.|
+| space | number \| string | No | Spacing between list items along the main axis. Default value: **0** **NOTE** If this parameter is set to a negative number or a value greater than or equal to the length of the list content area, the default value is used. If this parameter is set to a value less than the width of the list divider, the width of the list divider is used as the spacing.|
| initialIndex | number | No | Item displayed at the beginning of the viewport when the current list is loaded for the first time, that is, the first item to be displayed. Default value: **0** **NOTE** If the set value is a negative number or is greater than the index of the last item in the list, the value is invalid. In this case, the default value will be used.|
| scroller | [Scroller](ts-container-scroll.md#scroller) | No | Scroller, which can be bound to scrollable components. **NOTE** The scroller cannot be bound to other scrollable components.|
@@ -49,23 +49,24 @@ Since API version 9, this API is supported in ArkTS widgets.
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
-| Name | Type | Description |
-| ----------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
-| listDirection | [Axis](ts-appendix-enums.md#axis) | Direction in which the list items are arranged. Default value: **Axis.Vertical** Since API version 9, this API is supported in ArkTS widgets.|
-| divider | { strokeWidth: [Length](ts-types.md#length), color?:[ResourceColor](ts-types.md#resourcecolor), startMargin?: Length, endMargin?: Length } \| null | Style of the divider for the list items. By default, there is no divider. - **strokeWidth**: stroke width of the divider. - **color**: color of the divider. - **startMargin**: distance between the divider and the start edge of the list. - **endMargin**: distance between the divider and the end edge of the list. Since API version 9, this API is supported in ArkTS widgets. The sum of **endMargin** and **startMargin** cannot exceed the column width. **startMargin** and **endMargin** cannot be set in percentage. The divider is drawn between list items along the main axis, and not above the first list item and below the last list item. In multi-column mode, the value of **startMargin** is calculated from the start edge of the cross axis of each column. In other cases, it is calculated from the start edge of the cross axis of the list.|
-| scrollBar | [BarState](ts-appendix-enums.md#barstate) | Scrollbar status. Default value: **BarState.Off** Since API version 9, this API is supported in ArkTS widgets. **NOTE** In API version 9 and earlier versions, the default value is **BarState.Off**. In API version 10, the default value is **BarState.Auto**.|
-| cachedCount | number | Number of list items or list item groups to be preloaded (cached). It works only in [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md). A list item group is calculated as a whole, and all list items of the group are preloaded at the same time. For details, see [Minimizing White Blocks During Swiping](../../ui/arkts-performance-improvement-recommendation.md#minimizing-white-blocks-during-swiping). Default value: **1** Since API version 9, this API is supported in ArkTS widgets. **NOTE** In single-column mode, the number of the list items to be cached before and after the currently displayed one equals the value of **cachedCount**. In multi-column mode, the number of the list items to be cached is the value of **cachedCount** multiplied by the number of columns.|
-| editMode(deprecated) | boolean | Whether to enter editing mode. This API is deprecated since API version 9. For details about how to implement deletion of a selected list item, see [Example 3](#example-3). Default value: **false**|
-| edgeEffect | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | Edge scrolling effect. The spring effect and shadow effect are supported. Default value: **EdgeEffect.Spring** Since API version 9, this API is supported in ArkTS widgets.|
-| chainAnimation | boolean | Whether to display chained animations on this list when it slides or its top or bottom is dragged. The list items are separated with even space, and one item animation starts after the previous animation during basic sliding interactions. The chained animation effect is similar with spring physics. Default value: **false** - **false**: No chained animations are displayed. - **true**: Chained animations are displayed. Since API version 9, this API is supported in ArkTS widgets. **NOTE** When chained animations are in motion, the list divider is not displayed. The following prerequisites must be met for the chained animations to take effect: - The edge scrolling effect of the list is of the Spring type. - The multi-column mode is not enabled for the list.|
-| chainAnimationOptions10+ | [ChainAnimationOptions](#chainanimationoptions10) | Chained animation settings. **System API**: This is a system API. |
-| multiSelectable8+ | boolean | Whether to enable mouse frame selection. Default value: **false** - **false**: The mouse frame selection is disabled. - **true**: The mouse frame selection is enabled. Since API version 9, this API is supported in ArkTS widgets.|
-| lanes9+ | number \| [LengthConstrain](ts-types.md#lengthconstrain), gutter10+ ?:[Dimension](ts-types.md#dimension10) | In the following description, **listDirection** is set to **Axis.Vertical**: Number of columns in which the list items are arranged along the cross axis. Default value: **1** The rules are as follows: - If the value is set to a number, the column width is calculated by dividing the cross-axis width of the **\** component by the specified number. - If the value is set to {minLength, maxLength}, the number of columns is adjusted adaptively based on the width of the **\** component, ensuring that the width respects the {minLength, maxLength} constraints during adaptation. The **minLength** constraint is prioritized. - If the value is set to {minLength, maxLength}, and the cross-axis width constraint of the parent component is infinite, the parent component is arranged by column, and the column width is calculated based on the largest list item in the display area. - Each list item group occupies one row in multi-column mode. Its child list items are arranged based on the **lanes** attribute of the list. - If the value is set to {minLength, maxLength}, the number of columns is calculated based on the cross-axis width of the list item group. If the cross-axis width of the list item group is different from that of the list, the number of columns in the list item group may be different from that in the list. If the value is set to the **gutter** type, it indicates the column spacing. It takes effect when the number of columns is greater than 1. Default value: **0** This API is supported in ArkTS widgets.|
-| alignListItem9+ | [ListItemAlign](#listitemalign9) | Alignment mode of list items along the cross axis when: Cross-axis width of the **\** component > Cross-axis width of list items x Value of **lanes**. Default value: **ListItemAlign.Start** This API is supported in ArkTS widgets.|
-| sticky9+ | [StickyStyle](#stickystyle9) | Whether to pin the header to the top or the footer to the bottom in the **\** component. This attribute is used together with the **[\](ts-container-listitemgroup.md)** component. Default value: **StickyStyle.None** This API is supported in ArkTS widgets. **NOTE** The **sticky** attribute can be set to **StickyStyle.Header** or \| **StickyStyle.Footer** to support both the pin-to-top and pin-to-bottom features.|
-| scrollSnapAlign10+ | [ScrollSnapAlign](#scrollsnapalign10) | Alignment mode of list items when scrolling ends. Default value: **ScrollSnapAlign.NONE** **NOTE** This attribute is available only when the heights of list items are the same.|
-| enableScrollInteraction10+ | boolean | Whether to support scroll gestures. When this attribute is set to **false**, scrolling by finger or mouse is not supported, but the scrolling controller API is not affected. Default value: **true** |
-| nestedScroll10+ | [NestedScrollOptions](ts-container-scroll.md#nestedscrolloptions10) | Nested scrolling options. You can set the nested scrolling mode in the forward and backward directions to implement scrolling linkage with the parent component.|
+| Name | Type | Description |
+| ------------------------------------- | ---------------------------------------- | ---------------------------------------- |
+| listDirection | [Axis](ts-appendix-enums.md#axis) | Direction in which the list items are arranged. Default value: **Axis.Vertical** Since API version 9, this API is supported in ArkTS widgets.|
+| divider | { strokeWidth: [Length](ts-types.md#length), color?:[ResourceColor](ts-types.md#resourcecolor), startMargin?: Length, endMargin?: Length } \| null | Style of the divider for the list items. By default, there is no divider. - **strokeWidth**: stroke width of the divider. - **color**: color of the divider. - **startMargin**: distance between the divider and the start edge of the list. - **endMargin**: distance between the divider and the end edge of the list. Since API version 9, this API is supported in ArkTS widgets. The sum of **endMargin** and **startMargin** cannot exceed the column width. **startMargin** and **endMargin** cannot be set in percentage. The divider is drawn between list items along the main axis, and not above the first list item and below the last list item. In multi-column mode, the value of **startMargin** is calculated from the start edge of the cross axis of each column. In other cases, it is calculated from the start edge of the cross axis of the list.|
+| scrollBar | [BarState](ts-appendix-enums.md#barstate) | Scrollbar status. Default value: **BarState.Off** Since API version 9, this API is supported in ArkTS widgets. **NOTE** In API version 9 and earlier versions, the default value is **BarState.Off**. In API version 10, the default value is **BarState.Auto**.|
+| cachedCount | number | Number of list items or list item groups to be preloaded (cached). It works only in [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md). A list item group is calculated as a whole, and all list items of the group are preloaded at the same time. For details, see [Minimizing White Blocks During Swiping](../../ui/arkts-performance-improvement-recommendation.md#minimizing-white-blocks-during-swiping). Default value: **1** Since API version 9, this API is supported in ArkTS widgets. **NOTE** In single-column mode, the number of the list items to be cached before and after the currently displayed one equals the value of **cachedCount**. In multi-column mode, the number of the list items to be cached is the value of **cachedCount** multiplied by the number of columns.|
+| editMode(deprecated) | boolean | Whether to enter editing mode. This API is deprecated since API version 9. For details about how to implement deletion of a selected list item, see [Example 3](#example-3). Default value: **false**|
+| edgeEffect | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | Edge scrolling effect. The spring effect and shadow effect are supported. Default value: **EdgeEffect.Spring** Since API version 9, this API is supported in ArkTS widgets.|
+| chainAnimation | boolean | Whether to display chained animations on this list when it slides or its top or bottom is dragged. The list items are separated with even space, and one item animation starts after the previous animation during basic sliding interactions. The chained animation effect is similar with spring physics. Default value: **false** - **false**: No chained animations are displayed. - **true**: Chained animations are displayed. Since API version 9, this API is supported in ArkTS widgets. **NOTE** When chained animations are in motion, the list divider is not displayed. The following prerequisites must be met for the chained animations to take effect: - The edge scrolling effect of the list is of the Spring type. - The multi-column mode is not enabled for the list.|
+| chainAnimationOptions10+ | [ChainAnimationOptions](#chainanimationoptions10) | Chained animation settings. **System API**: This is a system API. |
+| multiSelectable8+ | boolean | Whether to enable mouse frame selection. Default value: **false** - **false**: The mouse frame selection is disabled. - **true**: The mouse frame selection is enabled. Since API version 9, this API is supported in ArkTS widgets.|
+| lanes9+ | number \| [LengthConstrain](ts-types.md#lengthconstrain), gutter10+ ?:[Dimension](ts-types.md#dimension10) | In the following description, **listDirection** is set to **Axis.Vertical**: Number of columns in which the list items are arranged along the cross axis. Default value: **1** The rules are as follows: - If the value is set to a number, the column width is calculated by dividing the cross-axis width of the **\** component by the specified number. - If the value is set to {minLength, maxLength}, the number of columns is adjusted adaptively based on the width of the **\** component, ensuring that the width respects the {minLength, maxLength} constraints during adaptation. The **minLength** constraint is prioritized. - If the value is set to {minLength, maxLength}, and the cross-axis width constraint of the parent component is infinite, the parent component is arranged by column, and the column width is calculated based on the largest list item in the display area. - Each list item group occupies one row in multi-column mode. Its child list items are arranged based on the **lanes** attribute of the list. - If the value is set to {minLength, maxLength}, the number of columns is calculated based on the cross-axis width of the list item group. If the cross-axis width of the list item group is different from that of the list, the number of columns in the list item group may be different from that in the list. If the value is set to the **gutter** type, it indicates the column spacing. It takes effect when the number of columns is greater than 1. Default value: **0** This API is supported in ArkTS widgets.|
+| alignListItem9+ | [ListItemAlign](#listitemalign9) | Alignment mode of list items along the cross axis when: Cross-axis width of the **\** component > Cross-axis width of list items x Value of **lanes**. Default value: **ListItemAlign.Start** This API is supported in ArkTS widgets.|
+| sticky9+ | [StickyStyle](#stickystyle9) | Whether to pin the header to the top or the footer to the bottom in the **\** component. This attribute is used together with the **[\](ts-container-listitemgroup.md)** component. Default value: **StickyStyle.None** This API is supported in ArkTS widgets. **NOTE** The **sticky** attribute can be set to **StickyStyle.Header** or \| **StickyStyle.Footer** to support both the pin-to-top and pin-to-bottom features.|
+| scrollSnapAlign10+ | [ScrollSnapAlign](#scrollsnapalign10) | Alignment mode of list items when scrolling ends. Default value: **ScrollSnapAlign.NONE** **NOTE** This attribute is available only when the heights of list items are the same.|
+| enableScrollInteraction10+ | boolean | Whether to support scroll gestures. When this attribute is set to **false**, scrolling by finger or mouse is not supported, but the scrolling controller API is not affected. Default value: **true**|
+| nestedScroll10+ | [NestedScrollOptions](ts-container-scroll.md#nestedscrolloptions10) | Nested scrolling options. You can set the nested scrolling mode in the forward and backward directions to implement scrolling linkage with the parent component. |
+| friction10+ | number \| [Resource](ts-types.md#resource) | Friction coefficient. It applies only to gestures in the scrolling area, and it affects only indirectly the scroll chaining during the inertial scrolling process. Default value: **0.9** for wearable devices and **0.6** for non-wearable devices **NOTE** A value less than or equal to 0 evaluates to the default value.|
## ListItemAlign9+
@@ -126,9 +127,9 @@ When list items are left-, right-, top-, or bottom-aligned, the items at the end
This API is available only when the heights of list items are the same.
-| Name | Description |
-| ------ | ------------------------------------------------------------ |
-| NONE | No alignment. This is the default value. When scrolling ends, the list items are not aligned. |
+| Name | Description |
+| ------ | ---------------------------------------- |
+| NONE | No alignment. This is the default value. When scrolling ends, the list items are not aligned. |
| START | The first item in the view is aligned at the start of the list. **NOTE** When the list hits the end, the items at the end must be completely displayed. In this case, the items at the start may not be aligned.|
| CENTER | The middle items in the view are aligned in the center of the list. **NOTE** The items at the start and end can be aligned in the center of the list. In this case, the list may have a blank area exposed, and the first or last item is aligned to the center.|
| END | The last item in the view is aligned at the end of the list. **NOTE** When the list hits the start, the items at the start must be completely displayed. In this case, the items at the end may not be aligned.|
@@ -155,23 +156,23 @@ This API is available only when the heights of list items are the same.
Since API version 9, this API is supported in ArkTS widgets.
-| Name | Description |
-| ------ | ------------------------------ |
+| Name | Description |
+| ------ | ---------------------------------------- |
| Idle | Idle. The list enters this state when an API in the controller is used to scroll the list or when the scrollbar is dragged. **NOTE** Since API version 10, the list enters this state when it is not scrolling or an API in the controller that does not apply an animation is called.|
-| Scroll | Scrolling. The list enters this state when the user drags the list to scroll. **NOTE** Since API version 10, the list also enters this state when the user drags the scrollbar or the mouse wheel to scroll the list. |
+| Scroll | Scrolling. The list enters this state when the user drags the list to scroll. **NOTE** Since API version 10, the list also enters this state when the user drags the scrollbar or the mouse wheel to scroll the list.|
| Fling | Inertial scrolling. The list enters this state when inertial scrolling occurs or when the list bounces back after being released from a fling. **NOTE** Since API version 10, the list enters this state when: inertial scrolling occurs after a fling; the list bounces back after being released from a fling; inertial scrolling occurs after quick dragging of the built-in scrollbar; scrolling occurs after an API in the controller that applies an animation is called.|
The table below lists the changes in the **ScrollState** enums.
-| Scenario | API version 9 and earlier |API version 10 and later |
-| ------ | ------------------------------ |------------------------------ |
-| Finger dragging | Scroll | Scroll |
-| Inertial scrolling | Fling | Fling |
-| Cross-boundary bouncing | Fling | Fling |
-| Scrolling by mouse wheel | Idle | Scroll |
-| Scrollbar dragging | Idle | Scroll |
-| Scrolling by the scrolling controller (with animation) | Idle | Fling |
-| Scrolling by the scrolling controller (without animation) | Idle | Idle |
+| Scenario | API Version 9 and Earlier| API Version 10 and Later|
+| ------------- | ---------------- | ---------------- |
+| Finger dragging | Scroll | Scroll |
+| Inertial scrolling | Fling | Fling |
+| Cross-boundary bouncing | Fling | Fling |
+| Scrolling by mouse wheel | Idle | Scroll |
+| Scrollbar dragging | Idle | Scroll |
+| Scrolling by the scrolling controller (with animation) | Idle | Fling |
+| Scrolling by the scrolling controller (without animation)| Idle | Idle |
> **NOTE**
>
@@ -213,6 +214,7 @@ struct ListExample {
}
.listDirection(Axis.Vertical) // Arrangement direction
.scrollBar(BarState.Off)
+ .friction(0.6)
.divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // Divider
.edgeEffect(EdgeEffect.Spring) // Set the edge scrolling effect to Spring.
.onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => {
@@ -264,6 +266,7 @@ struct ListLanesExample {
}
.height(300)
.width("90%")
+ .friction(0.6)
.border({ width: 3, color: Color.Red })
.lanes({ minLength: 40, maxLength: 40 })
.alignListItem(this.alignListItem)
@@ -283,7 +286,7 @@ struct ListLanesExample {
}
```
-
+
### Example 3
@@ -327,6 +330,7 @@ struct ListExample{
}, item => item)
}.width('90%')
.scrollBar(BarState.Off)
+ .friction(0.6)
}.width('100%')
Button('edit list')
diff --git a/en/application-dev/reference/arkui-ts/ts-container-rowsplit.md b/en/application-dev/reference/arkui-ts/ts-container-rowsplit.md
index 4a2fe8e741369350691f6f46ebeb929adbcc208c..6ad3efe53622d76410255e7896c3e273ecaca2d1 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-rowsplit.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-rowsplit.md
@@ -1,6 +1,6 @@
# RowSplit
-The **\** lays out child components horizontally and inserts a vertical divider between child components.
+The **\** lays out child components horizontally and inserts a vertical divider between every two child components.
> **NOTE**
>
@@ -19,15 +19,13 @@ RowSplit()
| Name| Type| Description|
| -------- | -------- | -------- |
-| resizeable | boolean | Whether the divider can be dragged. Default value: **false** |
+| resizeable | boolean | Whether the divider can be dragged. Default value: **false** |
> **NOTE**
>
-> Similar to **\**, the divider of **\** can be dragged to a position that just fully holds a component.
->
-> Dragging is not supported in the Previewer. Check the drag effect on a real device.
+> The divider of **\** can change the width of the left and right child components, but only to the extent that the resultant width falls within the maximum and minimum widths of the child components.
>
-> The universal attributes **clip** and **margin** are not supported.
+> Universal attributes such as **clip** and **margin** are supported. If **clip** is not set, the default value **true** is used.
## Example
@@ -54,4 +52,4 @@ struct RowSplitExample {
}
```
-
+
diff --git a/en/application-dev/reference/arkui-ts/ts-container-scroll.md b/en/application-dev/reference/arkui-ts/ts-container-scroll.md
index 8c13e893b7a6ceea454cfbef8511153c5eda4bfb..b6eda086a1bde6b6a2b6d3f0ab5ec3e2a752f1f5 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-scroll.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-scroll.md
@@ -37,6 +37,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| edgeEffect | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | Scroll effect. For details, see **EdgeEffect**. Default value: **EdgeEffect.None**|
| enableScrollInteraction10+ | boolean | Whether to support scroll gestures. When this attribute is set to **false**, scrolling by finger or mouse is not supported, but the scrolling controller API is not affected. Default value: **true** |
| nestedScroll10+ | [NestedScrollOptions](#nestedscrolloptions10) | Nested scrolling options. You can set the nested scrolling mode in the forward and backward directions to implement scrolling linkage with the parent component.|
+| friction10+ | number \| [Resource](ts-types.md#resource) | Friction coefficient. It applies only to gestures in the scrolling area, and it affects only indirectly the scroll chaining during the inertial scrolling process. Default value: **0.9** for wearable devices and **0.6** for non-wearable devices **NOTE** A value less than or equal to 0 evaluates to the default value.|
## ScrollDirection
| Name | Description |
@@ -84,8 +85,8 @@ Scrolls to the specified position.
| Name | Type | Mandatory| Description |
| --------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
-| xOffset | number \| string | Yes | Horizontal scrolling offset. **NOTE** This parameter cannot be set in percentage. This parameter is valid only when the scroll axis is the x-axis.|
-| yOffset | number \| string | Yes | Vertical scrolling offset. **NOTE** This parameter cannot be set in percentage. This parameter is valid only when the scroll axis is the y-axis.|
+| xOffset | number \| string | Yes | Horizontal scrolling offset. **NOTE** This parameter cannot be set in percentage. If the value is less than 0, no operation is performed. That is, this parameter does not take effect. This parameter is valid only when the scroll axis is the x-axis.|
+| yOffset | number \| string | Yes | Vertical scrolling offset. **NOTE** This parameter cannot be set in percentage. If the value is less than 0, no operation is performed. That is, this parameter does not take effect. This parameter is valid only when the scroll axis is the y-axis.|
| animation | {duration?: number, curve?: [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve)10+ } \| boolean10+ | No | Animation configuration, which includes the following: - **duration**: scrolling duration. - **curve**: scrolling curve. - **boolean**: whether to enable the default spring animation. Default value: { duration: 1000, curve: Curve.Ease } boolean: false **NOTE** A value less than 0 evaluates to the default value. Currently, the **\**, **\**, **\**, and **\** support the **Boolean** type and **ICurve**.|
@@ -243,6 +244,7 @@ struct ScrollExample {
.scrollBar(BarState.On) // The scrollbar is always displayed.
.scrollBarColor(Color.Gray) // Color of the scrollbar.
.scrollBarWidth(10) // The scrollbar width is 10.
+ .friction(0.6)
.edgeEffect(EdgeEffect.None)
.onScroll((xOffset: number, yOffset: number) => {
console.info(xOffset + ' ' + yOffset)
@@ -325,6 +327,7 @@ struct NestedScroll {
.width("100%")
.height("50%")
.edgeEffect(EdgeEffect.None)
+ .friction(0.6)
.onReachStart(() => {
this.listPosition = 0
})
@@ -399,6 +402,7 @@ struct StickyNestedScroll {
}.width("100%")
}
.edgeEffect(EdgeEffect.Spring)
+ .friction(0.6)
.backgroundColor('#DCDCDC')
.scrollBar(BarState.Off)
.width('100%')
diff --git a/en/application-dev/reference/arkui-ts/ts-container-swiper.md b/en/application-dev/reference/arkui-ts/ts-container-swiper.md
index 52263bc0068469f680c269d4599c281394ca34c9..0756ef290138140a62b2602cd7860d03da07929c 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-swiper.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-swiper.md
@@ -134,12 +134,12 @@ Describes the left and right arrow attributes.
| Name | Type | Mandatory. | Description |
| ---------------- | ---------------------------------------- | ---- | ---------------------------------------- |
-| isShowBackground | boolean | No | Whether to show the background for the arrow. Default value: **false** |
+| showBackground | boolean | No | Whether to show the background for the arrow. Default value: **false** |
| isSidebarMiddle | boolean | No | Whether the arrow is shown on either side of the navigation point indicator. Default value: **false** (the arrow is shown on either side of the navigation point indicator)|
| backgroundSize | [Length](ts-types.md#length) | No | Size of the background. On both sides of the navigation point indicator: Default value: **24vp** On both sides of the component: Default value: **32vp** This parameter cannot be set in percentage.|
-| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the background. On both sides of the navigation point indicator: Default value: **'\#19182431'** On both sides of the component: Default value: **'\#00000000'**|
-| arrowSize | [Length](ts-types.md#length) | No | Size of the arrow. On both sides of the navigation point indicator: Default value: **18vp** On both sides of the component: Default value: **24vp** **NOTE** If **isShowBackground** is set to **true**, the value of **arrowSize** is 3/4 of the value of **backgroundSize**. This parameter cannot be set in percentage.|
-| arrowColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the arrow. Default value: **\#182431** |
+| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the background. On both sides of the navigation point indicator: Default value: **'\#00000000'** On both sides of the component: Default value: **'\#19182431'**|
+| arrowSize | [Length](ts-types.md#length) | No | Size of the arrow. On both sides of the navigation point indicator: Default value: **18vp** On both sides of the component: Default value: **24vp** **NOTE** If **showBackground** is set to **true**, the value of **arrowSize** is 3/4 of the value of **backgroundSize**. This parameter cannot be set in percentage.|
+| arrowColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the arrow. Default value: **'\#182431'** |
## SwiperAutoFill10+
@@ -219,7 +219,7 @@ struct SwiperExample {
.duration(1000)
.itemSpace(0)
.displayArrow({
- isShowBackground:true,
+ showBackground:true,
isSidebarMiddle:true,
backgroundSize:24,
backgroundColor:Color.White,
diff --git a/en/application-dev/reference/arkui-ts/ts-container-waterflow.md b/en/application-dev/reference/arkui-ts/ts-container-waterflow.md
index 70e392f7164156d01da02d69b9b0e6fdb3f77903..122157b3c8e51e1d26d141d66892d3d3b12c3454 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-waterflow.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-waterflow.md
@@ -46,6 +46,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| layoutDirection | [FlexDirection](ts-appendix-enums.md#flexdirection) |Main axis direction of the layout. Default value: **FlexDirection.Column**|
| enableScrollInteraction10+ | boolean | Whether to support scroll gestures. When this attribute is set to **false**, scrolling by finger or mouse is not supported, but the scrolling controller API is not affected. Default value: **true** |
| nestedScroll10+ | [NestedScrollOptions](ts-container-scroll.md#nestedscrolloptions10) | Nested scrolling options. You can set the nested scrolling mode in the forward and backward directions to implement scrolling linkage with the parent component.|
+| friction10+ | number \| [Resource](ts-types.md#resource) | Friction coefficient. It applies only to gestures in the scrolling area, and it affects only indirectly the scroll chaining during the inertial scrolling process. Default value: **0.9** for wearable devices and **0.6** for non-wearable devices **NOTE** A value less than or equal to 0 evaluates to the default value.|
The priority of **layoutDirection** is higher than that of **rowsTemplate** and **columnsTemplate**. Depending on the **layoutDirection** settings, there are three layout modes:
@@ -278,6 +279,7 @@ struct WaterflowDemo {
minHeight: 0,
maxHeight: '100%'
})
+ .friction(0.6)
.columnsGap(10)
.rowsGap(5)
.onReachStart(() => {
diff --git a/en/application-dev/reference/arkui-ts/ts-explicit-animation.md b/en/application-dev/reference/arkui-ts/ts-explicit-animation.md
index 93b2912e0d4105efc88fb8ce4189095d75a04422..76528e41f75b3e29d9b89c29725b310b55fb38e2 100644
--- a/en/application-dev/reference/arkui-ts/ts-explicit-animation.md
+++ b/en/application-dev/reference/arkui-ts/ts-explicit-animation.md
@@ -25,7 +25,7 @@ Since API version 9, this API is supported in ArkTS widgets.
| -------- | -------- | -------- |
| duration | number | Animation duration, in ms. Default value: **1000** Since API version 9, this API is supported in ArkTS widgets. **NOTE** - The maximum animation duration on an ArkTS widget is 1000 ms. If the set value exceeds the limit, the value **1000** will be used. - A value less than 0 evaluates to the value **0**. - Floating-point values will be rounded down to integers. For example, if the value set is 1.2, **1** will be used.|
| tempo | number | Animation playback speed. A larger value indicates faster animation playback, and a smaller value indicates slower animation playback. The value **0** means that there is no animation. Default value: **1.0** **NOTE** A value less than 0 evaluates to the value **1**.|
-| curve | [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve) \| string | Animation curve. Default value: **Curve.Linear** Since API version 9, this API is supported in ArkTS widgets.|
+| curve | [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve) \| string | Animation curve. Default value: **Curve.EaseInOut** Since API version 9, this API is supported in ArkTS widgets.|
| delay | number | Delay of animation playback, in ms. By default, the playback is not delayed. Default value: **0** **NOTE** - A value less than 0 evaluates to the value **0**. - Floating-point values will be rounded down to integers. For example, if the value set is 1.2, **1** will be used.|
| iterations | number | Number of times that the animation is played. By default, the animation is played once. The value **-1** indicates that the animation is played for an unlimited number of times. Default value: **1**|
| playMode | [PlayMode](ts-appendix-enums.md#playmode) | Animation playback mode. By default, the animation is played from the beginning after the playback is complete. Default value: **PlayMode.Normal** Since API version 9, this API is supported in ArkTS widgets. For details about the restrictions, see **Notes about PlayMode**.|
diff --git a/en/application-dev/reference/arkui-ts/ts-gesture-settings.md b/en/application-dev/reference/arkui-ts/ts-gesture-settings.md
index 8761afbe8aa8bfaeb3c80de85d2ebdb5b8161a97..cbdd532ae7e18391204d0e1de15ce05e5af750f8 100644
--- a/en/application-dev/reference/arkui-ts/ts-gesture-settings.md
+++ b/en/application-dev/reference/arkui-ts/ts-gesture-settings.md
@@ -52,10 +52,10 @@ The component binds gesture objects of different **GestureType**s through gestur
| repeat | boolean | Whether the event is triggered repeatedly. This attribute is used for the **LongPressGesture** event.|
| offsetX | number | Offset of the gesture event on the x-axis, in vp. This attribute is used for the **PanGesture** event. A positive value means to pan from left to right, and a negative value means the opposite.|
| offsetY | number | Offset of the gesture event on the y-axis, in vp. This attribute is used for the **PanGesture** event. A positive value means to pan from top to bottom, and a negative value means the opposite.|
-| angle | number | Rotation angle for the **RotationGesture** event; angle of the swipe gesture for the **SwipeGesture** event, that is, the change in the included angle between the line segment created by the two fingers and the horizontal direction. **NOTE** Angle calculation method: After a swipe gesture is recognized, a line connecting the two fingers is identified as the initial line. As the fingers swipe, the line between the fingers rotates. Based on the coordinates of the initial line's and current line's end points, an arc tangent function is used to calculate the respective included angle of the points relative to the horizontal direction by using the following formula: Rotation angle = arctan2(cy2-cy1,cx2-cx1) – arctan2(y2-y1,x2-x1) The initial line is used as the coordinate system. The clockwise rotation is 0 to 180 degrees, and the counter-clockwise rotation is –180 to 0 degrees.|
+| angle | number | Rotation angle for the **RotationGesture** event; angle of the swipe gesture for the **SwipeGesture** event, that is, the change in the included angle between the line segment created by the two fingers and the horizontal direction. **NOTE** Angle calculation method: After a swipe gesture is recognized, a line connecting the two fingers is identified as the initial line. As the fingers swipe, the line between the fingers rotates. Based on the coordinates of the initial line's and current line's end points, an arc tangent function is used to calculate the respective included angle of the points relative to the horizontal direction by using the following formula: Rotation angle = arctan2(cy2-cy1,cx2-cx1) - arctan2(y2-y1,x2-x1) The initial line is used as the coordinate system. The clockwise rotation is 0 to 180 degrees, and the counter-clockwise rotation is –180 to 0 degrees.|
| scale | number | Scale ratio. This attribute is used for the **PinchGesture** event.|
-| pinchCenterX | number | X-coordinate of the center of the pinch gesture, in vp, relative to the upper left corner of the current component. This attribute is used for the **PinchGesture** event.|
-| pinchCenterY | number | Y-coordinate of the center of the pinch gesture, in vp, relative to the upper left corner of the current component. This attribute is used for the **PinchGesture** event.|
+| pinchCenterX | number | X coordinate of the center of the pinch gesture, in vp, relative to the upper left corner of the current component. This attribute is used for the **PinchGesture** event.|
+| pinchCenterY | number | Y coordinate of the center of the pinch gesture, in vp, relative to the upper left corner of the current component. This attribute is used for the **PinchGesture** event.|
| speed8+ | number | Swipe gesture speed, that is, the average swipe speed of all fingers. The unit is vp/s. This attribute is used for the **SwipeGesture** event.|
| fingerList8+ | [FingerInfo](#fingerinfo)[] | Information about all fingers that trigger the event. This attribute is used for the **LongPressGesture** and **TapGesture** events.|
| timestamp8+ | number | Timestamp of the event.|
@@ -80,10 +80,10 @@ The component binds gesture objects of different **GestureType**s through gestur
| Name| Type| Description|
| -------- | -------- | -------- |
| id | number | Index of a finger.|
-| globalX | number | X-coordinate relative to the upper left corner of the application window.|
-| globalY | number | Y-coordinate relative to the upper left corner of the application window.|
-| localX | number | X-coordinate relative to the upper left corner of the current component.|
-| localY | number | Y-coordinate relative to the upper left corner of the current component.|
+| globalX | number | X coordinate relative to the upper left corner of the application window.|
+| globalY | number | Y coordinate relative to the upper left corner of the application window.|
+| localX | number | X coordinate relative to the upper left corner of the current component.|
+| localY | number | Y coordinate relative to the upper left corner of the current component.|
## SourceTool
| Name| Description|
diff --git a/en/application-dev/reference/arkui-ts/ts-methods-timepicker-dialog.md b/en/application-dev/reference/arkui-ts/ts-methods-timepicker-dialog.md
index bbb16d3d03209f0b955b5c47092e280ef45950db..77fa5b3113ea4d9885d7771460488b2294e75459 100644
--- a/en/application-dev/reference/arkui-ts/ts-methods-timepicker-dialog.md
+++ b/en/application-dev/reference/arkui-ts/ts-methods-timepicker-dialog.md
@@ -46,6 +46,9 @@ struct TimePickerDialogExample {
.onClick(() => {
TimePickerDialog.show({
selected: this.selectTime,
+ disappearTextStyle: {color: Color.Red, font: {size: 15, weight: FontWeight.Lighter}},
+ textStyle: {color: Color.Black, font: {size: 20, weight: FontWeight.Normal}},
+ selectedTextStyle: {color: Color.Blue, font: {size: 30, weight: FontWeight.Bolder}},
onAccept: (value: TimePickerResult) => {
// Set selectTime to the time when the OK button is clicked. In this way, when the dialog box is displayed again, the selected time is the time when the operation was confirmed last time.
this.selectTime.setHours(value.hour, value.minute)
@@ -65,6 +68,9 @@ struct TimePickerDialogExample {
TimePickerDialog.show({
selected: this.selectTime,
useMilitaryTime: true,
+ disappearTextStyle: {color: Color.Red, font: {size: 15, weight: FontWeight.Lighter}},
+ textStyle: {color: Color.Black, font: {size: 20, weight: FontWeight.Normal}},
+ selectedTextStyle: {color: Color.Blue, font: {size: 30, weight: FontWeight.Bolder}},
onAccept: (value: TimePickerResult) => {
this.selectTime.setHours(value.hour, value.minute)
console.info("TimePickerDialog:onAccept()" + JSON.stringify(value))
diff --git a/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md b/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md
index fd98aadd3525b1d6d37262125bdc544833e9d129..7220808c63086d39e8fbc37bfad65281a19d4615 100644
--- a/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md
+++ b/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md
@@ -9,9 +9,9 @@ The motion path animation is used to animate a component along a custom path.
## Attributes
-| Name| Type| Default Value| Description|
-| -------- | -------- | -------- | -------- |
-| motionPath | { path: string, from?: number, to?: number, rotatable?: boolean } **NOTE** In a path, **start** and **end** can be used to replace the start point and end point. Example: 'Mstart.x start.y L50 50 Lend.x end.y Z' For more information, see [Path Drawing](../../ui/ui-js-components-svg-path.md).| { '', 0.0, 1.0, false } | Motion path of the component. - **path**: motion path of the translation animation. The value is an SVG path string. - **from**: start point of the motion path. Default value: **0.0** Value range: [0, 1] A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**. - **to**: end point of the motion path. Default value: **1.0** Value range: [0, 1] A value less than 0 evaluates to the value **0**. A value larger than 1 evaluates to the value **1**. - **rotatable**: whether to rotate along the path. |
+| Name| Type| Description|
+| -------- | -------- | -------- |
+| motionPath | { path: string, from?: number, to?: number, rotatable?: boolean } | Motion path of the component. - **path**: motion path of the translation animation. The value is an SVG path string. In the value, **start** and **end** can be used in place of the start point and end point, for example, **'Mstart.x start.y L50 50 Lend.x end.y Z'**. For details, see [Path Drawing](../../ui/ui-js-components-svg-path.md). If this parameter is set to an empty string, the path animation is not set. - **from**: start point of the motion path. Default value: **0.0** Value range: [0, 1] A value less than 0 or greater than 1 evaluates to the default value **0**. - **to**: end point of the motion path. Default value: **1.0** Value range: [0, 1] A value less than 0 or greater than 1 evaluates to the default value **1**, provided that the value of **to** is greater than or equal to the value of **from**. - **rotatable**: whether to rotate along the path. Default value: **false**|
## Example
diff --git a/en/application-dev/reference/arkui-ts/ts-pixel-units.md b/en/application-dev/reference/arkui-ts/ts-pixel-units.md
index 26ae5a8713858fed4427021145353a500a35b8a7..0038a918fb7504af0855df3d5b276754bd6dc4c2 100644
--- a/en/application-dev/reference/arkui-ts/ts-pixel-units.md
+++ b/en/application-dev/reference/arkui-ts/ts-pixel-units.md
@@ -2,17 +2,17 @@
ArkUI provides four pixel units, with vp as the reference data unit.
->**Notes:**
+>**NOTE**
>
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-| Name | Description |
-| ---- | ---------------------------------------- |
-| px | Physical pixel unit of the screen. |
+| Name| Description |
+| ---- | ------------------------------------------------------------ |
+| px | Physical pixel unit of the screen. |
| vp | Pixel unit specific to the screen density. Pixels in this unit are converted into physical pixels of the screen based on the screen pixel density. This unit is used for values whose unit is not specified. On a screen with an actual width of 1440 physical pixels, 1 vp is approximately equal to 3 px.|
-| fp | Font pixel, which is similar to vp and varies according to the system font size. |
-| lpx | Logical pixel unit of the window. It is the ratio of the actual screen width to the logical width (configured by **designWidth**). For example, if **designWidth** is set to **720** (default value), then 1 lpx is equal to 2 px for a screen with an actual width of 1440 physical pixels.|
+| fp | Font pixel, which is similar to vp and varies according to the system font size.|
+| lpx | Logical pixel unit of the window. It is the ratio of the actual screen width to the logical width (configured by [designWidth](../../quick-start/module-configuration-file.md#pages)). For example, if **designWidth** is set to **720** (default value), then 1 lpx is equal to 2 px for a screen with an actual width of 1440 physical pixels.|
## Pixel Unit Conversion
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-size.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-size.md
index 6fd2297759a6b00af39abef6b3253a34e39b3a6d..f8234616bfd15632c89b93f1cd0e0d504c9595e7 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-size.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-size.md
@@ -16,24 +16,22 @@ The size attributes set the width, height, and margin of a component.
| height | [Length](ts-types.md#length) | Height of the component. By default, the height required to fully hold the component content is used. If the height of the component is greater than that of the parent container, the range of the parent container is drawn. Since API version 9, this API is supported in ArkTS widgets. Since API version 10, this API supports the calc calculation feature.|
| size | { width?: [Length](ts-types.md#length), height?: [Length](ts-types.md#length) } | Size of the component. Since API version 9, this API is supported in ArkTS widgets. Since API version 10, this API supports the calc calculation feature.|
| padding | [Padding](ts-types.md#padding) \| [Length](ts-types.md#length) | Padding of the component. When the parameter is of the **Length** type, the four paddings take effect. Default value: **0** When **padding** is set to a percentage, the width of the parent container is used as the basic value. Since API version 9, this API is supported in ArkTS widgets. Since API version 10, this API supports the calc calculation feature.|
-| margin | [Margin](ts-types.md#margin) \| [Length](ts-types.md#length) | Margin of the component. When the parameter is of the **Length** type, the four margins take effect. Default value: **0** When **margin** is set to a percentage, the width of the parent container is used as the basic value. Since API version 9, this API is supported in ArkTS widgets. Since API version 10, this API supports the calc calculation feature.|
+| margin | [Margin](ts-types.md#margin) \| [Length](ts-types.md#length) | Margin of the component. When the parameter is of the **Length** type, the four margins take effect. Default value: **0** When **margin** is set to a percentage, the width of the parent container is used as the basic value. When child components are laid out along the cross axis of the **\**, **\**, or **\** container, the cross axis size of the child components and the margins add up to the total size of the container. For example, if the width of the **\** container is 100, the width of the child component is 50, the left margin is 10, and the right margin is 20, then the actual horizontal offset of the child component is 20. Since API version 9, this API is supported in ArkTS widgets. Since API version 10, this API supports the calc calculation feature.|
| constraintSize | { minWidth?: [Length](ts-types.md#length), maxWidth?: [Length](ts-types.md#length), minHeight?: [Length](ts-types.md#length), maxHeight?: [Length](ts-types.md#length) } | Constraint size of the component, which is used to limit the size range during component layout. **constraintSize** takes precedence over **width** and **height**. Learn [how the value of this attribute affects the width and height](#impact-of-constraintsize-on-widthheight). Default value: { minWidth: 0, maxWidth: Infinity, minHeight: 0, maxHeight: Infinity } Since API version 9, this API is supported in ArkTS widgets. Since API version 10, this API supports the calc calculation feature.|
## Impact of constraintSize on width/height
-| Size Arrangement | Result |
+| Default Value | Result |
| ---------------------------------------- | ------------------ |
-| minWidth/minHeight < width/height < maxWidth/maxHeight | width/height |
-| minWidth/minHeight < maxWidth/maxHeight < width/height | maxWidth/maxHeight |
-| maxWidth/maxHeight < minWidth/minHeight < width/height | minWidth/minHeight |
-| maxWidth/maxHeight < width/height < minWidth/minHeight | minWidth/minHeight |
-| width/height < maxWidth/maxHeight < minWidth/minHeight | minWidth/minHeight |
-| width/height < minWidth/minHeight < maxWidth/maxHeight | minWidth/minHeight |
-| minWidth/minHeight = maxWidth/maxHeight | minWidth/minHeight |
-| minWidth/minHeight < maxWidth/maxHeight = width/height | maxWidth/maxHeight |
-| maxWidth/maxHeight < minWidth/minHeight = width/height | minWidth/minHeight |
-| width/height = minWidth/minHeight < maxWidth/maxHeight | minWidth/minHeight |
-| width/height = maxWidth/maxHeight < minWidth/minHeight | minWidth/minHeight |
+| / | max(minWidth/minHeight, min(maxWidth/maxHeight, width/height)) |
+| maxWidth/maxHeight | max(minWidth/minHeight, width/height) |
+| minWidth/minHeight | min(maxWidth/maxHeight, width/height) |
+|width/height|In the case of maxWidth/maxHeight > minWidth/minHeight, the layout logic of the component is used, and the result is between maxWidth/maxHeight and minWidth/minHeight. In other cases, the result is max(minWidth/minHeight, maxWidth, maxHeight).|
+|maxWidth/maxHeight && width/height| minWidth/minHeight |
+|minWidth/minHeight && width/height| The layout logic of the component is used. The final result does not exceed maxWidth/maxHeight.|
+|maxWidth/maxHeight && minWidth/minHeight| Width/Height, which may be stretched or compressed based on other layout attributes.|
+maxWidth/maxHeight && minWidth/minHeight && width/height|The layout restrictions passed by the parent container are used for layout.|
+
## Example
```ts
diff --git a/en/application-dev/reference/errorcodes/Readme-EN.md b/en/application-dev/reference/errorcodes/Readme-EN.md
index 6fb0ba6ab8a22d3f47b0826e42d854ae62e84f62..421a8b0132d59233dd3ba47c8fe5c8d9137233f1 100644
--- a/en/application-dev/reference/errorcodes/Readme-EN.md
+++ b/en/application-dev/reference/errorcodes/Readme-EN.md
@@ -24,7 +24,8 @@
- [Audio Error Codes](errorcode-audio.md)
- [Media Error Codes](errorcode-media.md)
- [AVSession Management Error Codes](errorcode-avsession.md)
-- Resource Manager
+ - [Camera Error Codes](errorcode-camera.md)
+- Resource Management
- [I18N Error Codes](errorcode-i18n.md)
- [Resource Manager Error Codes](errorcode-resource-manager.md)
- Background Task
@@ -55,11 +56,13 @@
- [Network Connection Management Error Codes](errorcode-net-connection.md)
- [Ethernet Connection Error Codes](errorcode-net-ethernet.md)
- [Network Sharing Error Codes](errorcode-net-sharing.md)
+ - [Policy Management Error Codes](errorcode-net-policy.md)
- [mDNS Error Codes](errorcode-net-mdns.md)
- [Traffic Management Error Codes](errorcode-net-statistics.md)
+ - [VPN Error Codes](errorcode-net-vpn.md)
- Connectivity
- [Bluetooth Error Codes](errorcode-bluetoothManager.md)
- - [Wi-Fi Error Codes](errorcode-wifi.md)
+ - [Wi-Fi Error Codes](errorcode-wifi.md)
- [NFC Error Codes](errorcode-nfc.md)
- [SE Error Codes](errorcode-se.md)
- [RPC Error Codes](errorcode-rpc.md)
@@ -86,7 +89,7 @@
- [Device Management Error Codes](errorcode-device-manager.md)
- [Location Subsystem Error Codes](errorcode-geoLocationManager.md)
- [Screen Hopping Error Codes](errorcode-devicestatus.md)
- - [Screen Hopping Error Codes (to Be Deprecated)](errorcode-multimodalinput.md)
+ - [Screen Hopping Error Codes (To Be Deprecated Soon)](errorcode-multimodalinput.md)
- [Sensor Error Codes](errorcode-sensor.md)
- [Vibrator Error Codes](errorcode-vibrator.md)
- [System Parameter Error Codes](errorcode-system-parameterV9.md)
@@ -94,7 +97,7 @@
- [Update Error Codes](errorcode-update.md)
- Customization
- [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md)
-- Common Library Library
+- Common Library
- [Common Library Error Codes](errorcode-utils.md)
- Test
- [UiTest Error Codes](errorcode-uitest.md)
diff --git a/en/application-dev/reference/errorcodes/errorcode-ability.md b/en/application-dev/reference/errorcodes/errorcode-ability.md
index dd6da1a775f5299935206b19929464d09bc43ba9..c3c3b7b4e4ffcb931f214dfcb2e75546ba1f4b15 100644
--- a/en/application-dev/reference/errorcodes/errorcode-ability.md
+++ b/en/application-dev/reference/errorcodes/errorcode-ability.md
@@ -76,7 +76,7 @@ Visibility verification fails.
**Solution**
-Check whether the application meets the visibility restriction of the started application.
+Check whether **exported** under the **Ability** field in the **module.json5** file of the application is set to **true**. If this parameter is set to **true**, the ability can be invoked by other applications. If this parameter is set to **false**, the ability cannot be invoked by other applications.
## 16000006 Cross-User Operation Is Not Allowed
diff --git a/en/application-dev/reference/errorcodes/errorcode-bundle.md b/en/application-dev/reference/errorcodes/errorcode-bundle.md
index e247f85658e0fa7bd297c2eed514ae386b71157d..96cf176b04628409a830a66df844257e92746a1e 100644
--- a/en/application-dev/reference/errorcodes/errorcode-bundle.md
+++ b/en/application-dev/reference/errorcodes/errorcode-bundle.md
@@ -784,3 +784,59 @@ During application installation, the code signature file of the installation pac
1. Ensure that the module corresponding to the code signature file is contained in the installation package.
2. Provide a valid path of the code signature file.
3. Use the code signature file that matches the installation package.
+
+## 17700049 Update Failure Because of Incorrect Bundle Name
+
+**Error Message**
+
+Failed to install the HAP because the bundleName is different from the bundleName of the caller application.
+
+**Description**
+
+During the update of an enterprise MDM application, the bundleName passed in is different from that of the caller.
+
+**Possible Causes**
+
+The HAP or HSP to be installed does not belong to the current application.
+
+**Solution**
+
+Ensure that the HAP or HSP to be installed belongs to the current application.
+
+## 17700050 Enterprise Device Verification Failure
+
+**Error Message**
+
+Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device.
+
+**Description**
+
+Users try to install an enterprise Normal or MDM application on a non-enterprise device.
+
+**Possible Causes**
+
+The device is not an enterprise device.
+
+**Solution**
+
+1. Use an enterprise device.
+
+2. Ensure that **const.bms.allowenterprisebundle** is set to **true**.
+
+## 17700051 Update Failure Because of Incorrect Distribution Type
+
+**Error Message**
+
+Failed to install the HAP because the distribution type of caller application is not enterprise_mdm.
+
+**Description**
+
+During the update of an enterprise MDM application, the distribution type of the caller is not enterprise MDM.
+
+**Possible Causes**
+
+The distribution type of the caller is not enterprise MDM.
+
+**Solution**
+
+Ensure that the signature file of the application is correctly configured.
diff --git a/en/application-dev/reference/errorcodes/errorcode-camera.md b/en/application-dev/reference/errorcodes/errorcode-camera.md
new file mode 100644
index 0000000000000000000000000000000000000000..8eb2f58d1cc666a40fb5a5125ab70333f794b51e
--- /dev/null
+++ b/en/application-dev/reference/errorcodes/errorcode-camera.md
@@ -0,0 +1,185 @@
+# Camera Error Codes
+
+> **NOTE**
+>
+> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
+
+## 7400101 Invalid Parameter
+
+**Error Message**
+
+Parameter missing or parameter type incorrect.
+
+**Error Description**
+
+A parameter passed in the API is invalid.
+
+**Possible Cause**
+
+The parameter is invalid. For example, the parameter value is not within the range supported.
+
+**Solution**
+
+Pass the correct parameters in the API.
+
+## 7400102 Invalid Operation
+
+**Error Message**
+
+Operation not allowed.
+
+**Error Description**
+
+The operation is not performed in the specified mode.
+
+**Possible Cause**
+
+The API execution sequence is incorrect. For example, the **commitConfig** API is called in prior to **beginConfig**.
+
+**Solution**
+
+Perform operations according to the API reference and guide.
+
+## 7400103 Session Not Configured
+
+**Error Message**
+
+Session not config.
+
+**Error Description**
+
+An operation that requires session configuration is performed before the session is configured.
+
+**Possible Cause**
+
+For example, the **start()** API is called before the session is configured.
+
+**Solution**
+
+Configure the session first.
+
+## 7400104 Session Not Running
+
+**Error Message**
+
+Session not running.
+
+**Error Description**
+
+An operation that requires a running session is performed before the session runs.
+
+**Possible Cause**
+
+For example, the **capture()** API is called before the session runs.
+
+**Solution**
+
+Perform the operation to run the session first.
+
+## 7400105 Session Configuration Locked
+
+**Error Message**
+
+Session config locked.
+
+**Error Description**
+
+The session configuration is locked.
+
+**Possible Cause**
+
+Another thread has locked the session configuration.
+
+**Solution**
+
+Wait until the session configuration is unlocked.
+
+## 7400106 Device Configuration Locked
+
+**Error Message**
+
+Device setting locked.
+
+**Error Description**
+
+The device configuration is locked.
+
+**Possible Cause**
+
+Another thread has locked the device configuration.
+
+**Solution**
+
+Wait until the device configuration is unlocked.
+
+## 7400107 Camera Conflict
+
+**Error Message**
+
+Can not use camera cause of conflict.
+
+**Error Description**
+
+The camera cannot be used due to a conflict.
+
+**Possible Cause**
+
+The opened camera conflicts with the local camera to be used.
+
+**Solution**
+
+Wait until the conflicting camera is released.
+
+## 7400108 Camera Disabled Due to Security Reasons
+
+**Error Message**
+
+Camera disabled cause of security reason.
+
+**Error Description**
+
+The camera cannot be used due to security policies.
+
+**Possible Cause**
+
+The application running in the background attempts to open the camera.
+
+**Solution**
+
+Switch the application to the foreground first.
+
+## 7400109 Camera Preempted
+
+**Error Message**
+
+Can not use camera cause of preempted.
+
+**Error Description**
+
+The camera cannot be used because it is preempted.
+
+**Possible Cause**
+
+Two applications attempt to open the same camera simultaneously.
+
+**Solution**
+
+N/A
+
+## 7400201 Camera Service Error
+
+**Error Message**
+
+Camera service fatal error.
+
+**Error Description**
+
+The camera service is abnormal.
+
+**Possible Cause**
+
+For example, the camera service is restarted or cross-process invoking is abnormal.
+
+**Solution**
+
+Create the service again.
diff --git a/en/application-dev/reference/errorcodes/errorcode-datashare.md b/en/application-dev/reference/errorcodes/errorcode-datashare.md
index 192b79dc395171fa84f9682d02707be49eda2021..84542f3ea183af35c254e08865456ec88ce024ee 100644
--- a/en/application-dev/reference/errorcodes/errorcode-datashare.md
+++ b/en/application-dev/reference/errorcodes/errorcode-datashare.md
@@ -23,9 +23,13 @@ The **DataShareHelper** class fails to be created.
**Solution**
1. Obtain the correct URI.
+
2. Check that the context of the stage model is used.
+
3. Check whether the client has the read or write permission on data. Perform the following steps:
+
(1) Obtain the data provider bundle name in the path of the URI. For example, the bundle name in uri = "datashareproxy://com.acts.ohos.data.datasharetest/test" is **com.acts.ohos.data.datasharetest**.
+
(2) Obtain the configuration based on the bundle name. For example, run **bm dump --bundle-name com.acts.ohos.data.datasharetest** to obtain the **DataShareExtension** configuration, and check whether the data consumer has **readPermission** or **writePermission**.
## 15700011 Failed to Add or Delete a Template
diff --git a/en/application-dev/reference/errorcodes/errorcode-enterpriseDeviceManager.md b/en/application-dev/reference/errorcodes/errorcode-enterpriseDeviceManager.md
index 0e391ecb073dd2c6d3c5bc36d07ae30529c67c9e..bcc365da444dd5985db3ba4e8ce494077f8c54eb 100644
--- a/en/application-dev/reference/errorcodes/errorcode-enterpriseDeviceManager.md
+++ b/en/application-dev/reference/errorcodes/errorcode-enterpriseDeviceManager.md
@@ -4,25 +4,25 @@
>
> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
-## 9200001 Application Not a Device Administrator
+## 9200001 DeviceAdmin Not Enabled
**Error Message**
-The application is not a administrator of the device.
+The application is not an administrator of the device.
**Description**
-This error code is reported when the calling application is not an administrator of the device.
+This error code is reported when the caller is not an enabled device administrator application.
**Possible Causes**
-The calling application has not been enabled as an administrator of the device.
+The enterprise device management APIs can be called only by a device administrator application that has been enabled.
**Solution**
-Make sure the application is enabled as an administrator of the device.
+Check that the caller is an enabled device administrator application.
-## 9200002 Insufficient Permission for Systsm Administration
+## 9200002 Permission Denied
**Error Message**
@@ -30,15 +30,15 @@ The administrator application does not have permission to manage the device.
**Description**
-This error code is reported when the API requires a permission level higher than that granted to the calling application.
+This error code is reported when the device administrator application does not have the permission to call the API.
**Possible Causes**
-The application is a device administrator application, and the called API is restricted to a device super administrator application.
+The device administrator application cannot call the APIs that are accessible only by a super device administrator application.
**Solution**
-Make sure the enabled device administrator type is the same as that required by the called API.
+Check that the device administrator type enabled for the caller is the same as that required by the API.
## 9200003 Invalid Administrator Ability Component
@@ -48,18 +48,17 @@ The administrator ability component is invalid.
**Description**
-This error code is reported when the administrator ability component specified in the input parameters is invalid.
+This error code is reported when the specified device administrator ability component is invalid.
**Possible Causes**
-The specified administrator ability component is invalid due to any of the following:
-1. The administrator ability component does not exist when the application is enabled as a device administrator application.
-2. The administrator ability component is not valid in an enterprise setting.
+1. The administrator ability component does not exist when the device administrator application is enabled.
+2. The administrator ability component is not a valid enterprise administrator ability component.
**Solution**
-1. Make sure the name of the device administrator ability component is included in the application bundle when the application is enabled as a device administrator application.
-2. Make sure the administrator ability component inherits the **EnterpriseAdminExtensionAbility** component defined by the enterprise device administrator framework.
+1. Check that the name of the administrator ability component is included in the application bundle when the application is enabled as a device administrator application.
+2. Check that the administrator ability component inherits the **EnterpriseAdminExtensionAbility** component defined by the enterprise device management framework.
## 9200004 Failed to Enable the Device Administrator Application
@@ -69,20 +68,19 @@ Failed to activate the administrator application of the device.
**Description**
-This error code is reported when the application fails to be enabled as a device administrator application.
+This error code is reported when an application fails to be enabled as a device administrator application.
**Possible Causes**
-
-1. Multiple applications are enabled as super device administrators (SDAs).
-2. The application has been enabled as a device administrator, and the device administrator type has changed.
-3. Multiple device administrator ability components of the same application are enabled.
+1. Multiple applications are enabled as the super device administrator application.
+2. The application has been enabled as a device administrator application with a different administrator type.
+3. Multiple device administrator ability components are enabled for the same application.
**Solution**
-1. Make sure only one application is enabled as SDA.
-2. Check whether the application has been enabled as a device administrator and whether the device administrator type changes when it is enabled again. If this is the case, disable the device administrator and enable it again.
-3. Check whether any ability component in the application has been enabled as the device administrator. Only one ability component in an application can be enabled as the device administrator.
+1. Check that only one super device administrator application exists.
+2. Check whether the current application has been enabled as a device administrator with a different device administrator type. If yes, disable the device administrator application and try again.
+3. Check whether a device administrator ability component has been enabled for the application. Only one device administrator ability component can be enabled for an application.
## 9200005 Failed to Disable the Device Administrator Application
@@ -92,19 +90,18 @@ Failed to deactivate the administrator application of the device.
**Description**
-This error code is reported when the application to disable has not been enabled as a device administrator application or the attempt to disable the device administrator application is made by a device administrator application.
+This error code is reported when the operation for disabling a device administrator application fails.
**Possible Causes**
-
-1. The application to disable has not been enabled as a device administrator application.
-2. The attempt to disable the device administrator application is made by a device administrator application.
+1. The application to be disabled is not an enabled device administrator application.
+2. The caller cannot disable other device administrator applications.
**Solution**
-1. Check whether the target application has been enabled as a device administrator application.
-2. Check whether the specified ability component in the target application has been enabled as a device administrator.
-3. Check whether the attempt to disable the device administrator application is made by a device administrator application.
+1. Check that the target device administrator application has been enabled.
+2. Check that the specified device administrator ability component of the target device administrator application has been enabled.
+3. Check that the device administrator application to be disabled is the caller itself.
## 9200006 Invalid User ID
@@ -114,20 +111,19 @@ The specified user ID is invalid.
**Description**
-This error code is reported when the application calls an API to set the user policy but the specified user ID does not exist or the specified user ID is different from the caller user ID.
+This error code is reported when the specified user ID does not exist or the specified user ID is different from the caller's user ID.
**Possible Causes**
-
-1. The user ID used to set a user policy does not exist.
-2. The specified user ID is different from the caller user ID, and the application is not a super device administrator (SDA) application.
+1. The user ID specified for setting a user policy does not exist.
+2. The specified user ID is different from the caller's user ID when the application is not a super device administrator application.
**Solution**
-1. Make sure the user ID specified in the called API is valid.
-2. Check whether the caller user ID and the specified user ID are the same. In non-SDA mode, policies cannot be set across users.
+1. Check that the specified user ID is valid.
+2. Check that caller's user ID is the same as the specified user ID. If the application is not a super device administrator application, policies cannot be set across users.
-## 9200007 System Service Error
+## 9200007 System Ability Error
**Error Message**
@@ -135,21 +131,20 @@ The system ability work abnormally.
**Description**
-This error code is reported when the enterprise device management service is not working correctly.
+This error code is reported when the enterprise device management ability is not working properly.
**Possible Causes**
-
-1. The enterprise device management service is not started properly.
+1. The EnterpriseAdminAbility is not started.
2. The RPC object for enterprise device management cannot be obtained.
-3. Other services on which the enterprise device management service depends are not started properly or the RPC object cannot be obtained for them.
-4. A system exception occurs during the running of the enterprise device management service.
+3. Other abilities, on which the EnterpriseAdminAbility depends, are not started, or the RPC object cannot be obtained.
+4. A system exception occurs during the running of EnterpriseAdminAbility.
**Solution**
Try again later or restart the device.
-## 9200008 Invalid System Event Subscription
+## 9200008 Invalid System Subscription Event
**Error Message**
@@ -165,4 +160,45 @@ The enterprise device management module does not support subscription to the spe
**Solution**
-Make sure the event to subscribe to is a valid management event supported by the enterprise device management module.
+Check that the specified event is valid and supported by the enterprise device management module.
+
+## 9200009 Failed to Grant Permissions to the Application
+
+**Error Message**
+
+Authorize permission to the application failed.
+
+**Description**
+
+This error code is reported when the super device administrator application fails to grant administrator rights to other applications.
+
+**Possible Causes**
+
+The target application is not installed by the administrator.
+
+**Solution**
+
+Check that the target application has been installed by the administrator.
+
+## 9201002 Failed to Install the Application
+
+**Error Message**
+
+The application installation failed.
+
+**Description**
+
+This error code is reported when a device administrator application fails to install an enterprise application.
+
+**Possible Causes**
+
+1. The application installation path is empty or invalid, or does not exist.
+2. The operation attempts to install multiple apps with different bundle names.
+3. The application to be installed already exists when the installation parameter flag is 0.
+4. The user ID is invalid.
+
+**Solution**
+
+1. Check that the application installation path is valid.
+2. Check that all the installation parameters are valid.
+3. Check that the same application is installed.
diff --git a/en/application-dev/reference/errorcodes/errorcode-geoLocationManager.md b/en/application-dev/reference/errorcodes/errorcode-geoLocationManager.md
index dc6a45cfa530873862570dfaa50eb0d00a3766cb..9ee64ae1ded01f042fde5ce24488183d54cf2668 100644
--- a/en/application-dev/reference/errorcodes/errorcode-geoLocationManager.md
+++ b/en/application-dev/reference/errorcodes/errorcode-geoLocationManager.md
@@ -6,7 +6,7 @@
## 3301000 Location Service Unavailable
-**Error Message**
+**Error Information**
Location service is unavailable.
@@ -28,7 +28,7 @@ Stop calling the API.
## 3301100 Location Service Unavailable Because of Switch Toggled Off
-**Error Message**
+**Error Information**
The location switch is off.
@@ -44,15 +44,15 @@ The location service switch is toggled off, which makes basic functions such as
Display a prompt asking for enabling the location service.
-## 3301200 Failure to Obtain the Positioning Result
+## 3301200 Failed to Obtain the Positioning Result
-**Error Message**
+**Error Information**
Failed to obtain the geographical location.
**Description**
-This error code is reported when the location service fails, and no positioning result is obtained.
+This error code is reported if the location service has failed, leading to a failure to obtain the positioning result.
**Possible Causes**
@@ -64,15 +64,15 @@ This error code is reported when the location service fails, and no positioning
Initiate a positioning request again.
-## 3301300 Reverse Geocoding Query Failure
+## 3301300 Query Failed During Reverse Geocoding
-**Error Message**
+**Error Information**
Reverse geocoding query failed.
**Description**
-This error code is reported for a reverse geocoding query failure.
+This error code is reported if the query during reverse geocoding has failed.
**Possible Causes**
@@ -80,17 +80,17 @@ Network connection is poor, which makes the request fail to be sent from the dev
**Solution**
-Try the reverse geocoding query again.
+Perform a query again.
-## 3301400 Geocoding Query Failure
+## 3301400 Query Failed During Geocoding
-**Error Message**
+**Error Information**
Geocoding query failed.
**Description**
-This error code is reported for a geocoding query failure.
+This error code is reported if the query during geocoding has failed.
**Possible Causes**
@@ -98,17 +98,17 @@ Network connection is poor, which makes the request fail to be sent from the dev
**Solution**
-Try the geocoding query again.
+Perform a query again.
-## 3301500 Area Information Query Failure
+## 3301500 Area Information Query Failed
-**Error Message**
+**Error Information**
Failed to query the area information.
**Description**
-This error code is reported for the failure to query the area information (including the country code).
+This error code is reported if the query of the area information (including the country code) has failed.
**Possible Causes**
@@ -118,15 +118,15 @@ The correct area information is not found.
Stop calling the API for querying the country code.
-## 3301600 Geofence Operation Failure
+## 3301600 Geofence Operation Failed
-**Error Message**
+**Error Information**
Failed to operate the geofence.
**Description**
-This error code is reported when an operation (like adding, deleting, pausing, and resuming) fails to be performed on the geofence.
+This error code is reported if a geofence operation, for example, adding, deleting, pausing, or resuming a geofence, has failed.
**Possible Causes**
@@ -140,13 +140,13 @@ Stop calling the geofence operation API.
## 3301700 No Response to the Request
-**Error Message**
+**Error Information**
No response to the request.
**Description**
-This error code is reported when no response is received for an asynchronous request that requires a user to click a button for confirmation or requires a response from the GNSS chip or network server.
+This error code is reported if no response is received for an asynchronous request that requires a user to click a button for confirmation or requires a response from the GNSS chip or network server.
**Possible Causes**
@@ -159,3 +159,25 @@ This error code is reported when no response is received for an asynchronous req
**Solution**
Stop calling relevant APIs.
+
+## 3301800 Failed to Start Wi-Fi or Bluetooth Scanning
+
+**Error Information**
+
+Failed to start WiFi or Bluetooth scanning.
+
+**Description**
+
+This error code is reported if Wi-Fi or Bluetooth scanning fails to start.
+
+**Possible Causes**
+
+1. The Wi-Fi or Bluetooth service incurs an internal error.
+
+2. Power consumption control is activated because of low battery level.
+
+3. Wi-Fi or Bluetooth is not enabled.
+
+**Solution**
+
+Turn off Wi-Fi or Bluetooth, and then turn it on again.
diff --git a/en/application-dev/reference/errorcodes/errorcode-hiappevent.md b/en/application-dev/reference/errorcodes/errorcode-hiappevent.md
index e0b7e16e0510883addf190635795e08c35a68502..11ac6f8288c316c21a1b410cabfaa42e5e62c7c7 100644
--- a/en/application-dev/reference/errorcodes/errorcode-hiappevent.md
+++ b/en/application-dev/reference/errorcodes/errorcode-hiappevent.md
@@ -1,4 +1,4 @@
-# Application Event Logging Error Codes
+# Application Event Logging Error Codes
> **NOTE**
>
@@ -63,8 +63,8 @@ This error code is reported if the **write** API is called to perform applicatio
The specified event name does not comply with the following rules:
-- The event name contains only digits, lowercase letters, and underscores (\_).
-- The event name starts with a lowercase letter and does not end with an underscore (\_).
+- An event name contains only digits, letters, and underscores (_).
+- An event name starts with a letter or dollar sign ($) and does not end with an underscore (_).
- The event name is not empty and contains a maximum of 48 characters.
**Solution**
@@ -119,11 +119,11 @@ This error code is reported if the **write** API is called to perform applicatio
**Possible Causes**
-The specified event parameter name does not comply with the following rules:
+The specified event name does not comply with the following rules:
-- The event parameter name contains only digits, lowercase letters, and underscores (\_).
-- The event parameter name starts with a lowercase letter and does not end with an underscore (\_).
-- The event parameter name is not empty and contains a maximum of 16 characters.
+- An event name contains only digits, letters, and underscores (_).
+- An event name starts with a letter or dollar sign ($) and does not end with an underscore (_).
+- An event parameter name is not empty and contains a maximum of 16 characters.
**Solution**
@@ -163,7 +163,7 @@ The specified watcher name does not comply with the following rules:
- The watcher name can contain only digits, lowercase letters, and underscores (\_).
- The watcher name starts with a lowercase letter and does not end with an underscore (\_).
-- The watcher name is not empty and contains a maximum of 32 characters.
+- A watcher name is not empty and contains a maximum of 32 characters.
**Solution**
diff --git a/en/application-dev/reference/errorcodes/errorcode-i18n.md b/en/application-dev/reference/errorcodes/errorcode-i18n.md
index 6b269c17442bcd97f5235ac85079356c9964cb46..96a13011fcf36420d6f17054db5d9e513c151dd0 100644
--- a/en/application-dev/reference/errorcodes/errorcode-i18n.md
+++ b/en/application-dev/reference/errorcodes/errorcode-i18n.md
@@ -1,4 +1,4 @@
-# i18n Error Codes
+# I18N Error Codes
> **NOTE**
>
@@ -8,7 +8,7 @@
**Error Message**
-Unspported para value.
+param value not valid
**Description**
@@ -17,25 +17,7 @@ This error code is reported if an I18N API is called with invalid parameter valu
**Possible Causes**
Invalid parameter values are probably due to incorrect parameter types.
-
-**Solution**
-
-Check whether the parameter type is correct.
-
-## 890002 Incorrect Configuration Option
-
-**Error Message**
-
-param value not valid
-
-**Description**
-
-This error code is reported if an I18N API is called with invalid option values specified.
-
-**Possible Causes**
-
-Invalid option values are probably due to incorrect option types.
-
+
**Solution**
-Check whether the option type is correct.
+Check whether the parameter types are correct.
diff --git a/en/application-dev/reference/errorcodes/errorcode-net-vpn.md b/en/application-dev/reference/errorcodes/errorcode-net-vpn.md
new file mode 100644
index 0000000000000000000000000000000000000000..f8b7e31afaa81bcf033e31568f1f5678f38039ff
--- /dev/null
+++ b/en/application-dev/reference/errorcodes/errorcode-net-vpn.md
@@ -0,0 +1,61 @@
+# VPN Error Codes
+
+> **NOTE**
+>
+> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
+
+## 2203001 Failed to Create a VPN
+
+**Error Information**
+
+VPN creation denied, please check the user type.
+
+**Description**
+
+This error code is reported if a VPN fails to be created.
+
+**Possible Causes**
+
+The login user does not have the operation permission. Specifically, the GUEST user does not have the permission to call the **setUp** API.
+
+**Solution**
+
+Check the type of the login user.
+
+
+## 2203002 VPN Already Exists
+
+**Error Information**
+
+VPN exist already, please execute destroy first.
+
+**Description**
+
+This error code is reported if a VPN already exists.
+
+**Possible Causes**
+
+The VPN has been created.
+
+**Solution**
+
+Call the **destroy** API to destroy the existing VPN, and then call the **setUp** API.
+
+
+## 2203004 Invalid Descriptor
+
+**Error Information**
+
+Invalid socket file descriptor.
+
+**Description**
+
+This error code is reported if the socket file descriptor is invalid.
+
+**Possible Causes**
+
+A TCP socket connection fails to be established.
+
+**Solution**
+
+Check whether a TCP socket connection is set up successfully.
diff --git a/en/application-dev/reference/errorcodes/errorcode-universal.md b/en/application-dev/reference/errorcodes/errorcode-universal.md
index 308f3cf3bb5e17e0ef9c2a133a52afb4ccf43d2a..27950bafa4de98bb2bca73a25d63da411ee43b6b 100644
--- a/en/application-dev/reference/errorcodes/errorcode-universal.md
+++ b/en/application-dev/reference/errorcodes/errorcode-universal.md
@@ -44,7 +44,7 @@ BusinessError 401: Parameter error. The type of "${parameterName}" must be ${val
**Description**
-This error code is reported when a parameter error occurs.
+This error code is reported when a parameter error occurs. Regardless of whether the API is synchronous or asynchronous, this type of error is generally thrown in synchronous mode.
**Possible Causes**
diff --git a/en/application-dev/reference/native-apis/_mind_spore.md b/en/application-dev/reference/native-apis/_mind_spore.md
index e52fc4f327ea142c3f8a0c5777c5b8ce8de67ec0..2eba42c904f9a2feea671afe115f7cb7e2a79880 100644
--- a/en/application-dev/reference/native-apis/_mind_spore.md
+++ b/en/application-dev/reference/native-apis/_mind_spore.md
@@ -33,7 +33,7 @@ Provides APIs related to MindSpore Lite model inference.
| Name | Description |
| ------------------------------------------------------------ | ---------------------------------------------------- |
| [OH_AI_TensorHandleArray](_o_h___a_i___tensor_handle_array.md) | Defines the tensor array structure, which is used to store the tensor array pointer and tensor array length.|
-| [OH_AI_ShapeInfo](_o_h___a_i___shape_info.md) | Dimension information. The maximum dimension is set by **MS_MAX_SHAPE_NUM**. |
+| [OH_AI_ShapeInfo](_o_h___a_i___shape_info.md) | Defines dimension information. The maximum dimension is set by **MS_MAX_SHAPE_NUM**. |
| [OH_AI_CallBackParam](_o_h___a_i___call_back_param.md) | Defines the operator information passed in a callback. |
@@ -109,18 +109,19 @@ Provides APIs related to MindSpore Lite model inference.
| [OH_AI_DeviceInfoSetFrequency](#oh_ai_deviceinfosetfrequency) ([OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info, int frequency) | Sets the NPU frequency type. This function is available only for NPU devices. |
| [OH_AI_DeviceInfoGetFrequency](#oh_ai_deviceinfogetfrequency) (const [OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info) | Obtains the NPU frequency type. This function is available only for NPU devices. |
| [OH_AI_GetAllNNRTDeviceDescs](#oh_ai_getallnnrtdevicedescs) (size_t \*num) | Obtains the descriptions of all NNRt devices in the system. |
-| [OH_AI_DestroyAllNNRTDeviceDescs](#oh_ai_destroyallnnrtdevicedescs) ([NNRTDeviceDesc](#nnrtdevicedesc) \*\*desc) | Destroys the array of NNRT descriptions obtained by [OH_AI_GetAllNNRTDeviceDescs](#oh_ai_getallnnrtdevicedescs).|
+| [OH_AI_GetElementOfNNRTDeviceDescs](#oh_ai_getelementofnnrtdevicedescs) (NNRTDeviceDesc \*descs, size_t index) | Obtains the pointer to an element in the NNRt device description array.|
+| [OH_AI_DestroyAllNNRTDeviceDescs](#oh_ai_destroyallnnrtdevicedescs) ([NNRTDeviceDesc](#nnrtdevicedesc) \*\*desc) | Destroys the NNRt device description array obtained by [OH_AI_GetAllNNRTDeviceDescs](#oh_ai_getallnnrtdevicedescs).|
| [OH_AI_GetDeviceIdFromNNRTDeviceDesc](#oh_ai_getdeviceidfromnnrtdevicedesc) (const [NNRTDeviceDesc](#nnrtdevicedesc) \*desc) | Obtains the NNRt device ID from the specified NNRt device description. Note that this ID is valid only for NNRt devices.|
| [OH_AI_GetNameFromNNRTDeviceDesc](#oh_ai_getnamefromnnrtdevicedesc) (const [NNRTDeviceDesc](#nnrtdevicedesc) \*desc) | Obtains the NNRt device name from the specified NNRt device description. |
| [OH_AI_GetTypeFromNNRTDeviceDesc](#oh_ai_gettypefromnnrtdevicedesc) (const [NNRTDeviceDesc](#nnrtdevicedesc) \*desc) | Obtains the NNRt device type from the specified NNRt device description. |
| [OH_AI_CreateNNRTDeviceInfoByName](#oh_ai_creatennrtdeviceinfobyname) (const char \*name) | Searches for the NNRt device with the specified name and creates the NNRt device information based on the information about the first found NNRt device.|
| [OH_AI_CreateNNRTDeviceInfoByType](#oh_ai_creatennrtdeviceinfobytype) ([OH_AI_NNRTDeviceType](#oh_ai_nnrtdevicetype) type) | Searches for the NNRt device with the specified type and creates the NNRt device information based on the information about the first found NNRt device.|
-| [OH_AI_DeviceInfoSetDeviceId](#oh_ai_deviceinfosetdeviceid) ([OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info, size_t device_id) | Sets the ID of an NNRt device. This API is available only for NNRt devices. |
-| [OH_AI_DeviceInfoGetDeviceId](#oh_ai_deviceinfogetdeviceid) (const [OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info) | Obtains the ID of an NNRt device. This API is available only for NNRt devices. |
-| [OH_AI_DeviceInfoSetPerformanceMode](#oh_ai_deviceinfosetperformancemode) ([OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info, [OH_AI_PerformanceMode](#oh_ai_performancemode) mode) | Sets the performance mode of an NNRt device. This API is available only for NNRt devices. |
-| [OH_AI_DeviceInfoGetPerformanceMode](#oh_ai_deviceinfogetperformancemode) (const [OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info) | Obtains the performance mode of an NNRt device. This API is available only for NNRt devices. |
-| [OH_AI_DeviceInfoSetPriority](#oh_ai_deviceinfosetpriority) ([OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info, [OH_AI_Priority](#oh_ai_priority) priority) | Sets the priority of an NNRT task. This API is available only for NNRt devices. |
-| [OH_AI_DeviceInfoGetPriority](#oh_ai_deviceinfogetpriority) (const [OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info) | Obtains the priority of an NNRT task. This API is available only for NNRt devices. |
+| [OH_AI_DeviceInfoSetDeviceId](#oh_ai_deviceinfosetdeviceid) ([OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info, size_t device_id) | Sets the ID of an NNRt device. This function is available only for NNRt devices. |
+| [OH_AI_DeviceInfoGetDeviceId](#oh_ai_deviceinfogetdeviceid) (const [OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info) | Obtains the ID of an NNRt device. This function is available only for NNRt devices. |
+| [OH_AI_DeviceInfoSetPerformanceMode](#oh_ai_deviceinfosetperformancemode) ([OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info, [OH_AI_PerformanceMode](#oh_ai_performancemode) mode) | Sets the performance mode of an NNRt device. This function is available only for NNRt devices. |
+| [OH_AI_DeviceInfoGetPerformanceMode](#oh_ai_deviceinfogetperformancemode) (const [OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info) | Obtains the performance mode of an NNRt device. This function is available only for NNRt devices. |
+| [OH_AI_DeviceInfoSetPriority](#oh_ai_deviceinfosetpriority) ([OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info, [OH_AI_Priority](#oh_ai_priority) priority) | Sets the priority of an NNRt task. This function is available only for NNRt devices. |
+| [OH_AI_DeviceInfoGetPriority](#oh_ai_deviceinfogetpriority) (const [OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info) | Obtains the priority of an NNRt task. This function is available only for NNRt devices. |
| [OH_AI_ModelCreate](#oh_ai_modelcreate) () | Creates a model object. |
| [OH_AI_ModelDestroy](#oh_ai_modeldestroy) ([OH_AI_ModelHandle](#oh_ai_modelhandle) \*model) | Destroys a model object. |
| [OH_AI_ModelBuild](#oh_ai_modelbuild) ([OH_AI_ModelHandle](#oh_ai_modelhandle) model, const void \*model_data, size_t data_size, [OH_AI_ModelType](#oh_ai_modeltype) model_type, const [OH_AI_ContextHandle](#oh_ai_contexthandle) model_context) | Loads and builds a MindSpore model from the memory buffer. |
@@ -131,9 +132,10 @@ Provides APIs related to MindSpore Lite model inference.
| [OH_AI_ModelGetOutputs](#oh_ai_modelgetoutputs) (const [OH_AI_ModelHandle](#oh_ai_modelhandle) model) | Obtains the output tensor array structure of a model. |
| [OH_AI_ModelGetInputByTensorName](#oh_ai_modelgetinputbytensorname) (const [OH_AI_ModelHandle](#oh_ai_modelhandle) model, const char \*tensor_name) | Obtains the input tensor of a model by tensor name. |
| [OH_AI_ModelGetOutputByTensorName](#oh_ai_modelgetoutputbytensorname) (const [OH_AI_ModelHandle](#oh_ai_modelhandle) model, const char \*tensor_name) | Obtains the output tensor of a model by tensor name. |
+| [OH_AI_DeviceInfoAddExtension](#oh_ai_deviceinfoaddextension) ([OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) device_info, const char \*name, const char \*value, size_t value_size) | Adds extended configuration in the form of key/value pairs to the device information. This function is available only for NNRt device information.|
| [OH_AI_TensorCreate](#oh_ai_tensorcreate) (const char \*name, [OH_AI_DataType](#oh_ai_datatype) type, const int64_t \*shape, size_t shape_num, const void \*data, size_t data_len) | Creates a tensor object. |
| [OH_AI_TensorDestroy](#oh_ai_tensordestroy) ([OH_AI_TensorHandle](#oh_ai_tensorhandle) \*tensor) | Destroys a tensor object. |
-| [OH_AI_TensorClone](#oh_ai_tensorclone) ([OH_AI_TensorHandle](#oh_ai_tensorhandle) tensor) | Deeply copies a tensor. |
+| [OH_AI_TensorClone](#oh_ai_tensorclone) ([OH_AI_TensorHandle](#oh_ai_tensorhandle) tensor) | Clones a tensor. |
| [OH_AI_TensorSetName](#oh_ai_tensorsetname) ([OH_AI_TensorHandle](#oh_ai_tensorhandle) tensor, const char \*name) | Sets the tensor name. |
| [OH_AI_TensorGetName](#oh_ai_tensorgetname) (const [OH_AI_TensorHandle](#oh_ai_tensorhandle) tensor) | Obtains the tensor name. |
| [OH_AI_TensorSetDataType](#oh_ai_tensorsetdatatype) ([OH_AI_TensorHandle](#oh_ai_tensorhandle) tensor, [OH_AI_DataType](#oh_ai_datatype) type) | Sets the data type of a tensor. |
@@ -147,7 +149,7 @@ Provides APIs related to MindSpore Lite model inference.
| [OH_AI_TensorGetMutableData](#oh_ai_tensorgetmutabledata) (const [OH_AI_TensorHandle](#oh_ai_tensorhandle) tensor) | Obtains the pointer to variable tensor data. If the data is empty, memory will be allocated. |
| [OH_AI_TensorGetElementNum](#oh_ai_tensorgetelementnum) (const [OH_AI_TensorHandle](#oh_ai_tensorhandle) tensor) | Obtains the number of tensor elements. |
| [OH_AI_TensorGetDataSize](#oh_ai_tensorgetdatasize) (const [OH_AI_TensorHandle](#oh_ai_tensorhandle) tensor) | Obtains the number of bytes of the tensor data. |
-
+| [OH_AI_TensorSetUserData](#oh_ai_tensorsetuserdata) ([OH_AI_TensorHandle](#oh_ai_tensorhandle) tensor, void \*data, size_t data_size) | Sets the tensor as the user data. This function allows you to reuse user data as the model input, which helps to reduce data copy by one time.|
## Macro Description
@@ -893,7 +895,7 @@ OH_AI_API void OH_AI_DestroyAllNNRTDeviceDescs (NNRTDeviceDesc ** desc)
**Description**
-Destroys the array of NNRT descriptions obtained by [OH_AI_GetAllNNRTDeviceDescs](#oh_ai_getallnnrtdevicedescs).
+Destroys the NNRt device description array obtained by [OH_AI_GetAllNNRTDeviceDescs](#oh_ai_getallnnrtdevicedescs).
**Parameters**
@@ -955,7 +957,7 @@ OH_AI_API size_t OH_AI_DeviceInfoGetDeviceId (const OH_AI_DeviceInfoHandle devic
**Description**
-Obtains the ID of an NNRt device. This API is available only for NNRt devices.
+Obtains the ID of an NNRt device. This function is available only for NNRt devices.
**Parameters**
@@ -1025,7 +1027,7 @@ OH_AI_API int OH_AI_DeviceInfoGetFrequency (const OH_AI_DeviceInfoHandle device_
**Description**
-Obtains the NPU frequency type. This API is available only for NPU devices.
+Obtains the NPU frequency type. This function is available only for NPU devices.
**Parameters**
@@ -1047,7 +1049,7 @@ OH_AI_API OH_AI_PerformanceMode OH_AI_DeviceInfoGetPerformanceMode (const OH_AI_
**Description**
-Obtains the performance mode of an NNRt device. This API is available only for NNRt devices.
+Obtains the performance mode of an NNRt device. This function is available only for NNRt devices.
**Parameters**
@@ -1073,7 +1075,7 @@ OH_AI_API OH_AI_Priority OH_AI_DeviceInfoGetPriority (const OH_AI_DeviceInfoHand
**Description**
-Obtains the priority of an NNRT task. This API is available only for NNRt devices.
+Obtains the priority of an NNRt task. This function is available only for NNRt devices.
**Parameters**
@@ -1143,7 +1145,7 @@ OH_AI_API void OH_AI_DeviceInfoSetDeviceId (OH_AI_DeviceInfoHandle device_info,
**Description**
-Sets the ID of an NNRt device. This API is available only for NNRt devices.
+Sets the ID of an NNRt device. This function is available only for NNRt devices.
**Parameters**
@@ -1204,7 +1206,7 @@ OH_AI_API void OH_AI_DeviceInfoSetPerformanceMode (OH_AI_DeviceInfoHandle device
**Description**
-Sets the performance mode of an NNRt device. This API is available only for NNRt devices.
+Sets the performance mode of an NNRt device. This function is available only for NNRt devices.
**Parameters**
@@ -1227,7 +1229,7 @@ OH_AI_API void OH_AI_DeviceInfoSetPriority (OH_AI_DeviceInfoHandle device_info,
**Description**
-Sets the priority of an NNRt task. This API is available only for NNRt devices.
+Sets the priority of an NNRt task. This function is available only for NNRt devices.
**Parameters**
@@ -1951,3 +1953,90 @@ Sets the tensor shape.
| tensor | Handle of the tensor object. |
| shape | Shape array. |
| shape_num | Length of the tensor shape array.|
+
+
+### OH_AI_TensorSetUserData()
+
+```
+OH_AI_API OH_AI_Status OH_AI_TensorSetUserData (OH_AI_TensorHandle tensor, void * data, size_t data_size )
+```
+
+**Description**
+
+Sets the tensor as the user data.
+
+This function allows you to reuse user data as the model input, which helps to reduce data copy by one time.
+
+> **NOTE** The user data is type of external data for the tensor and is not automatically released when the tensor is destroyed. The caller needs to release the data separately. In addition, the caller must ensure that the user data is valid during use of the tensor.
+
+**Parameters**
+
+| Name| Description|
+| -------- | -------- |
+| tensor | Handle of the tensor object.|
+| data | Start address of user data.|
+| data_size | Length of the user data length.|
+
+**Returns**
+
+Execution status code. The value **OH_AI_STATUS_SUCCESS** indicates that the operation is successful. If the operation fails, an error code is returned.
+
+**Since**
+
+10
+
+
+### OH_AI_DeviceInfoAddExtension()
+
+```
+OH_AI_API OH_AI_Status OH_AI_DeviceInfoAddExtension (OH_AI_DeviceInfoHandle device_info, const char * name, const char * value, size_t value_size )
+```
+
+**Description**
+
+Adds extended configuration in the form of key/value pairs to the device information. This function is available only for NNRt device information.
+
+>**NOTE** Key value pairs currently supported include {"CachePath": "YourCachePath"}, {"CacheVersion": "YourCacheVersion"}, and {"QuantParam": "YourQuantConfig"}. Replace the actual value as required.
+
+**Parameters**
+
+| Name| Description|
+| -------- | -------- |
+| device_info | [OH_AI_DeviceInfoHandle](#oh_ai_deviceinfohandle) that points to a device information instance.|
+| name | Key in an extended key/value pair. The value is a C string.|
+| value | Start address of the value in an extended key/value pair.|
+| value_size | Length of the value in an extended key/value pair.|
+
+**Returns**
+
+Status code enumerated by **OH_AI_Status**. The value **OH_AI_STATUS_SUCCESS** indicates that the operation is successful. If the operation fails, an error code is returned.
+
+**Since**
+
+10
+
+
+### OH_AI_GetElementOfNNRTDeviceDescs()
+
+```
+OH_AI_API NNRTDeviceDesc* OH_AI_GetElementOfNNRTDeviceDescs (NNRTDeviceDesc * descs, size_t index )
+```
+
+**Description**
+
+Obtains the pointer to an element in the NNRt device description array.
+
+**Parameters**
+
+| Name| Description|
+| -------- | -------- |
+| descs | NNRt device description array.|
+| index | Index of an array element.|
+
+**Returns**
+
+Pointer to an element in the NNRt device description array.
+
+**Since**
+
+10
diff --git a/en/application-dev/reference/native-apis/_o_h___cursor.md b/en/application-dev/reference/native-apis/_o_h___cursor.md
index d2574c8aba7d46bc93c9ed77920d6990562834c8..84aaa7846bd2f3e41d2748e5c92bea291f39a3c6 100644
--- a/en/application-dev/reference/native-apis/_o_h___cursor.md
+++ b/en/application-dev/reference/native-apis/_o_h___cursor.md
@@ -36,4 +36,4 @@ It provides APIs to access the result set obtained by querying the RDB store.
| [getReal](_r_d_b.md#getreal) | Pointer to the function used to obtain the value of the double type based on the specified column and the current row.|
| [getBlob](_r_d_b.md#getblob) | Pointer to the function used to obtain the value in the form of a byte array based on the specified column and the current row.|
| [isNull](_r_d_b.md#isnull-12) | Pointer to the function used to check whether the value in the specified column is null.|
-| [close](_r_d_b.md#close) | Pointer to the function used to close a result set.|
+| [destroy](_r_d_b.md#destroy-14) | Pointer to the function used to close a result set.|
diff --git a/en/application-dev/reference/native-apis/_o_h___predicates.md b/en/application-dev/reference/native-apis/_o_h___predicates.md
index c02ac4d93e38e7bd4437eb2f697724c29234812c..330c556eb8958c4c58fe0bc71f638e2eefdb7857 100644
--- a/en/application-dev/reference/native-apis/_o_h___predicates.md
+++ b/en/application-dev/reference/native-apis/_o_h___predicates.md
@@ -3,7 +3,7 @@
## Overview
-Defines the predicates.
+Defines the predicates used for RDB stores.
**Since**
@@ -45,4 +45,4 @@ Defines the predicates.
| [in](_r_d_b.md#in) | Pointer to the function used to set a predicates object to match the field with the value within the specified range.|
| [notIn](_r_d_b.md#notin) | Pointer to the function used to set a predicates object to match the field with the value out of the specified range.|
| [clear](_r_d_b.md#clear-12) | Pointer to the function used to clear a predicates instance.|
-| [destroyPredicates](_r_d_b.md#destroypredicates) | Destroys an **OH_Predicates** object and reclaims the memory occupied.|
+| [destroy](_r_d_b.md#destroy-24) | Destroys an **OH_Predicates** object and reclaims the memory occupied.|
diff --git a/en/application-dev/reference/native-apis/_o_h___rdb___config.md b/en/application-dev/reference/native-apis/_o_h___rdb___config.md
index dd038af19093f2130667e78a7b38e0dc43d9c448..70a7672747f7e1e2a06f4bb9a8d94646373b3472 100644
--- a/en/application-dev/reference/native-apis/_o_h___rdb___config.md
+++ b/en/application-dev/reference/native-apis/_o_h___rdb___config.md
@@ -21,6 +21,9 @@ Defines the RDB store configuration.
| Name| Description|
| -------- | -------- |
-| [path](_r_d_b.md#path) | Path of the database file.|
+| [selfSize](_r_d_b.md#selfsize) | Size of the struct.|
+| [dataBaseDir](_r_d_b.md#databasedir) | Path of the database file.|
+| [bundleName](_r_d_b.md#bundlename) | Bundle name.|
+| [moduleName](_r_d_b.md#modulename) | Module name. |
| [isEncrypt](_r_d_b.md#isencrypt) | Whether to encrypt the RDB store.|
-| [securityLevel](_r_d_b.md#securitylevel) | RDB store security level [OH_Rdb_SecurityLevel](_r_d_b.md#oh_rdb_securitylevel).|
+| [securityLevel](_r_d_b.md#securitylevel) | Security level of the RDB store.|
diff --git a/en/application-dev/reference/native-apis/_o_h___v_bucket.md b/en/application-dev/reference/native-apis/_o_h___v_bucket.md
index ff0386db852df79e82e58139dfb1177a26b79036..359cec1890d31aba76b5fe823f2e02acefe7db0b 100644
--- a/en/application-dev/reference/native-apis/_o_h___v_bucket.md
+++ b/en/application-dev/reference/native-apis/_o_h___v_bucket.md
@@ -29,4 +29,4 @@ Defines the types of the key and value in a KV pair.
| [putBlob](_r_d_b.md#putblob) | Puts a const uint8_t value into the **OH_VBucket** object in the given column.|
| [putNull](_r_d_b.md#putnull) | Puts a null value into the **OH_VBucket** object in the given column.|
| [clear](_r_d_b.md#clear-22) | Clears an **OH_VBucket** object.|
-| [destroyValuesBucket](_r_d_b.md#destroyvaluesbucket) | Destroys an **OH_VBucket** object and reclaims the memory occupied.|
+| [destroy](_r_d_b.md#destroy-34) | Destroys an **OH_VBucket** object and reclaims the memory occupied.|
diff --git a/en/application-dev/reference/native-apis/_o_h___v_object.md b/en/application-dev/reference/native-apis/_o_h___v_object.md
index 4c6232eecf485ea13ba9496e32265ff2af56a461..9b602248db6f0290a8951535791ae5f7b78161bb 100644
--- a/en/application-dev/reference/native-apis/_o_h___v_object.md
+++ b/en/application-dev/reference/native-apis/_o_h___v_object.md
@@ -26,4 +26,4 @@ Defines the allowed data field types.
| [putDouble](_r_d_b.md#putdouble) | Converts a single parameter or an array of the int64 type into a value of the OH_VObject type.|
| [putText](_r_d_b.md#puttext-22) | Converts a character array of the char type to a value of the OH_VObject type.|
| [putTexts](_r_d_b.md#puttexts) | Converts a string array of the char type to a value of the OH_VObject type.|
-| [destroyValueObject](_r_d_b.md#destroyvalueobject) | Destroys an OH_VObject object and reclaims the memory occupied.|
+| [destroy](_r_d_b.md#destroy-44) | Destroys an OH_VObject object and reclaims the memory occupied.|
diff --git a/en/application-dev/reference/native-apis/_r_d_b.md b/en/application-dev/reference/native-apis/_r_d_b.md
index 48b4394514d3da53f00cfc0272496f8b864220e2..a205c56fbe20135647f559b53d81f887de28ca53 100644
--- a/en/application-dev/reference/native-apis/_r_d_b.md
+++ b/en/application-dev/reference/native-apis/_r_d_b.md
@@ -5,7 +5,7 @@
The relational database (RDB) store manages data based on relational models. The RDB store provides a complete mechanism for managing local databases based on the underlying SQLite. It provides a series of methods for performing operations, such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements to satisfy different needs in complicated scenarios.
-\@syscap SystemCapability.DistributedDataManager.RelationalStore.Core
+\@SystemCapability.DistributedDataManager.RelationalStore.Core
**Since**
@@ -19,11 +19,11 @@ The relational database (RDB) store manages data based on relational models. The
| Name| Description|
| -------- | -------- |
-| [oh_cursor.h](oh__cursor_8h.md) | Provides APIs to access the result set obtained by querying the RDB store. File to include: \|
+| [oh_cursor.h](oh__cursor_8h.md) | Defines the APIs for accessing the result set obtained by querying the RDB store. File to include: \ |
| [oh_predicates.h](oh__predicates_8h.md) | Defines the predicates for RDB stores. File to include: \|
-| [oh_value_object.h](oh__value__object_8h.md) | Provides type conversion methods. File to include: \|
+| [oh_value_object.h](oh__value__object_8h.md) | Defines type conversion methods. File to include: \ |
| [oh_values_bucket.h](oh__values__bucket_8h.md) | Defines the types of the key and value in a key-value (KV) pair. File to include: \|
-| [relational_store.h](relational__store_8h.md) | Provides APIs to manage an RDB store. File to include: \|
+| [relational_store.h](relational__store_8h.md) | Defines the APIs for managing an RDB store. File to include: \ |
| [relational_store_error_code.h](relational__store__error__code_8h.md) | Declares the error codes used for RDB stores. File to include: \|
@@ -43,10 +43,13 @@ The relational database (RDB) store manages data based on relational models. The
| Name| Description|
| -------- | -------- |
+| [OH_ColumnType](#oh_columntype) | Enumerates the field types in an RDB store.|
| [OH_Cursor](#oh_cursor) | Indicates a result set.|
+| [OH_OrderType](#oh_ordertype) | Enumerates the sorting types.|
| [OH_Predicates](#oh_predicates) | Indicates a **predicates** object.|
| [OH_VObject](#oh_vobject) | Indicates the allowed data field types.|
| [OH_VBucket](#oh_vbucket) | Indicates the types of the key and value in a KV pair.|
+| [OH_Rdb_SecurityLevel](#oh_rdb_securitylevel) | Enumerates the RDB store security levels.|
| [OH_Rdb_ErrCode](#oh_rdb_errcode) | Indicates error codes.|
@@ -69,7 +72,7 @@ The relational database (RDB) store manages data based on relational models. The
| [OH_Rdb_CreatePredicates](#oh_rdb_createpredicates) (const char \*table) | Creates an [OH_Predicates](_o_h___predicates.md) instance.|
| [OH_Rdb_GetOrOpen](#oh_rdb_getoropen) (const [OH_Rdb_Config](_o_h___rdb___config.md) \*config, int \*errCode) | Obtains an [OH_Rdb_Store](_o_h___rdb___store.md) instance for RDB store operations.|
| [OH_Rdb_CloseStore](#oh_rdb_closestore) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store) | Destroys an [OH_Rdb_Store](_o_h___rdb___store.md) object and reclaims the memory occupied by the object.|
-| [OH_Rdb_DeleteStore](#oh_rdb_deletestore) (const char \*path) | Deletes an RDB store with the specified database file configuration.|
+| [OH_Rdb_DeleteStore](#oh_rdb_deletestore) (const [OH_Rdb_Config](_o_h___rdb___config.md) \*config) | Deletes an RDB store with the specified database file configuration.|
| [OH_Rdb_Insert](#oh_rdb_insert) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, const char \*table, [OH_VBucket](_o_h___v_bucket.md) \*valuesBucket) | Inserts a row of data into a table.|
| [OH_Rdb_Update](#oh_rdb_update) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, [OH_VBucket](_o_h___v_bucket.md) \*valuesBucket, [OH_Predicates](_o_h___predicates.md) \*predicates) | Updates data in an RDB store based on specified conditions.|
| [OH_Rdb_Delete](#oh_rdb_delete) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, [OH_Predicates](_o_h___predicates.md) \*predicates) | Deletes data from an RDB store based on specified conditions.|
@@ -102,7 +105,7 @@ The relational database (RDB) store manages data based on relational models. The
| [OH_Cursor::getReal](#getreal) | Pointer to the function used to obtain the value of the double type based on the specified column and the current row.|
| [OH_Cursor::getBlob](#getblob) | Pointer to the function used to obtain the value in the form of a byte array based on the specified column and the current row.|
| [OH_Cursor::isNull](#isnull-12) | Pointer to the function used to check whether the value in the specified column is null.|
-| [OH_Cursor::close](#close) | Pointer to the function used to close a result set. |
+| [OH_Cursor::destroy](#destroy-14) | Pointer to the function used to close the result set.|
| [OH_Predicates::id](#id-14) | Unique identifier of the **OH_Predicates** struct.|
| [OH_Predicates::equalTo](#equalto) | Pointer to the function used to set a predicates object to match the field whose value is equal to the specified value.|
| [OH_Predicates::notEqualTo](#notequalto) | Pointer to the function used to set a predicates object to match the field whose value is not equal to the specified value.|
@@ -127,13 +130,13 @@ The relational database (RDB) store manages data based on relational models. The
| [OH_Predicates::in](#in) | Pointer to the function used to set a predicates object to match the field with the value within the specified range.|
| [OH_Predicates::notIn](#notin) | Pointer to the function used to set a predicates object to match the field with the value out of the specified range.|
| [OH_Predicates::clear](#clear-12) | Pointer to the function used to clear a predicates instance.|
-| [OH_Predicates::destroyPredicates](#destroypredicates) | Destroys an [OH_Predicates](_o_h___predicates.md) object and reclaims the memory occupied.|
+| [OH_Predicates::destroy](#destroy-24) | Destroys an [OH_Predicates](_o_h___predicates.md) object and reclaims the memory occupied.|
| [OH_VObject::id](#id-24) | Unique identifier of the **OH_VObject** struct.|
| [OH_VObject::putInt64](#putint64-22) | Converts a single parameter or an array of the int64 type into a value of the [OH_VObject](_o_h___v_object.md) type.|
| [OH_VObject::putDouble](#putdouble) | Converts a single parameter or an array of the double type into a value of the [OH_VObject](_o_h___v_object.md) type.|
| [OH_VObject::putText](#puttext-22) | Converts a character array of the char type to a value of the [OH_VObject](_o_h___v_object.md) type.|
| [OH_VObject::putTexts](#puttexts) | Converts a string array of the char type to a value of the [OH_VObject](_o_h___v_object.md) type.|
-| [OH_VObject::destroyValueObject](#destroyvalueobject) | Destroys an [OH_VObject](_o_h___v_object.md) object and reclaims the memory occupied.|
+| [OH_VObject::destroy](#destroy-44) | Destroys an [OH_VObject](_o_h___v_object.md) object and reclaims the memory occupied.|
| [OH_VBucket::id](#id-34) | Unique identifier of the **OH_VBucket** struct.|
| [OH_VBucket::capability](#capability) | Number of the KV pairs in the struct.|
| [OH_VBucket::putText](#puttext-12) | Puts a char value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.|
@@ -142,18 +145,31 @@ The relational database (RDB) store manages data based on relational models. The
| [OH_VBucket::putBlob](#putblob) | Puts a const uint8_t value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.|
| [OH_VBucket::putNull](#putnull) | Puts a null value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.|
| [OH_VBucket::clear](#clear-22) | Clears an [OH_VBucket](_o_h___v_bucket.md) object.|
-| [OH_VBucket::destroyValuesBucket](#destroyvaluesbucket) | Destroys an [OH_VBucket](_o_h___v_bucket.md) object and reclaims the memory occupied.|
-| [OH_Rdb_Config::path](#path) | Path of the database file.|
+| [OH_VBucket::destroy](#destroy-34) | Destroys an [OH_VBucket](_o_h___v_bucket.md) object and reclaims the memory occupied.|
+| [OH_Rdb_Config::selfSize](#selfsize) | Size of the struct.|
+| [OH_Rdb_Config::dataBaseDir](#databasedir) | Path of the database file.|
+| [OH_Rdb_Config::bundleName](#bundlename) | Bundle name.|
+| [OH_Rdb_Config::moduleName](#modulename) | Module name. |
| [OH_Rdb_Config::isEncrypt](#isencrypt) | Whether to encrypt the RDB store.|
-| [OH_Rdb_Config::securityLevel](#securitylevel) | Set the RDB store security level [OH_Rdb_SecurityLevel](#oh_rdb_securitylevel).|
+| [OH_Rdb_Config::securityLevel](#securitylevel) | Sets the RDB store security level [OH_Rdb_SecurityLevel](#oh_rdb_securitylevel). |
| [OH_Rdb_Store::id](#id-44) | Unique identifier of the **OH_Rdb_Store** struct.|
## Type Description
-### OH_Cursor
+### OH_ColumnType
+
+```
+typedef enum OH_ColumnType OH_ColumnType
+```
+**Description**
+
+Enumerates the field types in an RDB store.
+
+
+### OH_Cursor
```
typedef struct OH_Cursor OH_Cursor
@@ -166,8 +182,18 @@ Indicates a result set.
It provides APIs to access the result set obtained by querying the RDB store.
-### OH_Predicates
+### OH_OrderType
+
+```
+typedef enum OH_OrderType OH_OrderType
+```
+**Description**
+
+Enumerates the sorting types.
+
+
+### OH_Predicates
```
typedef struct OH_Predicates OH_Predicates
@@ -180,7 +206,6 @@ Indicates a **predicates** object.
### OH_Rdb_ErrCode
-
```
typedef enum OH_Rdb_ErrCode OH_Rdb_ErrCode
```
@@ -190,8 +215,18 @@ typedef enum OH_Rdb_ErrCode OH_Rdb_ErrCode
Indicates an error code.
-### OH_VBucket
+### OH_Rdb_SecurityLevel
+```
+typedef enum OH_Rdb_SecurityLevel OH_Rdb_SecurityLevel
+```
+
+**Description**
+
+Enumerates the RDB store security levels.
+
+
+### OH_VBucket
```
typedef struct OH_VBucket OH_VBucket
@@ -204,7 +239,6 @@ Indicates the types of the key and value in a KV pair.
### OH_VObject
-
```
typedef struct OH_VObject OH_VObject
```
@@ -219,7 +253,6 @@ Indicates the allowed data field types.
### OH_ColumnType
-
```
enum OH_ColumnType
```
@@ -239,7 +272,6 @@ Enumerates the field types in an RDB store.
### OH_OrderType
-
```
enum OH_OrderType
```
@@ -256,7 +288,6 @@ Enumerates the sorting types.
### OH_Rdb_ErrCode
-
```
enum OH_Rdb_ErrCode
```
@@ -323,7 +354,6 @@ Enumerates the error codes.
### OH_Rdb_SecurityLevel
-
```
enum OH_Rdb_SecurityLevel
```
@@ -345,7 +375,6 @@ Enumerates the RDB store security levels.
### OH_Rdb_Backup()
-
```
int OH_Rdb_Backup (OH_Rdb_Store * store, const char * databasePath )
```
@@ -372,7 +401,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### OH_Rdb_BeginTransaction()
-
```
int OH_Rdb_BeginTransaction (OH_Rdb_Store * store)
```
@@ -398,7 +426,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### OH_Rdb_CloseStore()
-
```
int OH_Rdb_CloseStore (OH_Rdb_Store * store)
```
@@ -424,7 +451,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### OH_Rdb_Commit()
-
```
int OH_Rdb_Commit (OH_Rdb_Store * store)
```
@@ -450,7 +476,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### OH_Rdb_CreatePredicates()
-
```
OH_Predicates* OH_Rdb_CreatePredicates (const char * table)
```
@@ -476,9 +501,8 @@ Returns the pointer to the [OH_Predicates](_o_h___predicates.md) instance create
### OH_Rdb_CreateValueObject()
-
```
-OH_VObject* OH_Rdb_CreateValueObject (void )
+OH_VObject* OH_Rdb_CreateValueObject (void)
```
**Description**
@@ -496,9 +520,8 @@ Returns the pointer to the [OH_VObject](_o_h___v_object.md) instance created if
### OH_Rdb_CreateValuesBucket()
-
```
-OH_VBucket* OH_Rdb_CreateValuesBucket (void )
+OH_VBucket* OH_Rdb_CreateValuesBucket (void)
```
**Description**
@@ -516,7 +539,6 @@ Returns the pointer to the [OH_VBucket](_o_h___v_bucket.md) instance created if
### OH_Rdb_Delete()
-
```
int OH_Rdb_Delete (OH_Rdb_Store * store, OH_Predicates * predicates )
```
@@ -543,9 +565,8 @@ Returns the number of affected rows if the operation is successful; returns an e
### OH_Rdb_DeleteStore()
-
```
-int OH_Rdb_DeleteStore (const char * path)
+int OH_Rdb_DeleteStore (const OH_Rdb_Config * config)
```
**Description**
@@ -565,7 +586,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### OH_Rdb_Execute()
-
```
int OH_Rdb_Execute (OH_Rdb_Store * store, const char * sql )
```
@@ -592,7 +612,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### OH_Rdb_ExecuteQuery()
-
```
OH_Cursor* OH_Rdb_ExecuteQuery (OH_Rdb_Store * store, const char * sql )
```
@@ -619,7 +638,6 @@ Returns the pointer to the [OH_Cursor](_o_h___cursor.md) instance if the operati
### OH_Rdb_GetOrOpen()
-
```
OH_Rdb_Store* OH_Rdb_GetOrOpen (const OH_Rdb_Config * config, int * errCode )
```
@@ -646,7 +664,6 @@ Returns the pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance create
### OH_Rdb_GetVersion()
-
```
int OH_Rdb_GetVersion (OH_Rdb_Store * store, int * version )
```
@@ -673,7 +690,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### OH_Rdb_Insert()
-
```
int OH_Rdb_Insert (OH_Rdb_Store * store, const char * table, OH_VBucket * valuesBucket )
```
@@ -701,7 +717,6 @@ Returns the row ID if the operation is successful; returns an error code otherwi
### OH_Rdb_Query()
-
```
OH_Cursor* OH_Rdb_Query (OH_Rdb_Store * store, OH_Predicates * predicates, const char *const * columnNames, int length )
```
@@ -730,7 +745,6 @@ Returns the pointer to the [OH_Cursor](_o_h___cursor.md) instance if the operati
### OH_Rdb_Restore()
-
```
int OH_Rdb_Restore (OH_Rdb_Store * store, const char * databasePath )
```
@@ -744,7 +758,7 @@ Restores an RDB store from the specified database backup file.
| Name| Description|
| -------- | -------- |
| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
-| databasePath | Pointer to the path of the RDB store backup file.|
+| databasePath | Pointer to the destination directory in which the RDB store is backed up.|
**Returns**
@@ -757,7 +771,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### OH_Rdb_RollBack()
-
```
int OH_Rdb_RollBack (OH_Rdb_Store * store)
```
@@ -783,7 +796,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### OH_Rdb_SetVersion()
-
```
int OH_Rdb_SetVersion (OH_Rdb_Store * store, int version )
```
@@ -797,7 +809,7 @@ Sets the RDB store version.
| Name| Description|
| -------- | -------- |
| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
-| version | Version number to set.|
+| version | Pointer to the version number.|
**Returns**
@@ -810,7 +822,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### OH_Rdb_Update()
-
```
int OH_Rdb_Update (OH_Rdb_Store * store, OH_VBucket * valuesBucket, OH_Predicates * predicates )
```
@@ -841,7 +852,6 @@ Returns the number of affected rows if the operation is successful; returns an e
### andOperate
-
```
OH_Predicates*(* OH_Predicates::andOperate) (OH_Predicates *predicates)
```
@@ -869,7 +879,6 @@ Returns the predicates with the AND operator.
### beginWrap
-
```
OH_Predicates*(* OH_Predicates::beginWrap) (OH_Predicates *predicates)
```
@@ -897,7 +906,6 @@ Returns the predicates with a left parenthesis.
### between
-
```
OH_Predicates*(* OH_Predicates::between) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
```
@@ -925,9 +933,19 @@ Returns the predicates created.
[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md).
-### capability
+### bundleName
+
+```
+const char* OH_Rdb_Config::bundleName
+```
+
+**Description**
+
+Application bundle name.
+### capability
+
```
uint16_t OH_VBucket::capability
```
@@ -939,7 +957,6 @@ Number of the KV pairs in the struct.
### clear [1/2]
-
```
OH_Predicates*(* OH_Predicates::clear) (OH_Predicates *predicates)
```
@@ -965,7 +982,6 @@ Returns the cleared predicates.
### clear [2/2]
-
```
int(* OH_VBucket::clear) (OH_VBucket *bucket)
```
@@ -989,16 +1005,26 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
[OH_VBucket](_o_h___v_bucket.md).
-### close
+### dataBaseDir
+```
+const char* OH_Rdb_Config::dataBaseDir
+```
+
+**Description**
+
+Path of the database file.
+
+
+### destroy [1/4]
```
-int(* OH_Cursor::close) (OH_Cursor *cursor)
+int(* OH_Cursor::destroy) (OH_Cursor *cursor)
```
**Description**
-Pointer to the function used to close a result set.
+Pointer to the function used to close the result set.
**Parameters**
@@ -1015,11 +1041,10 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
[OH_Cursor](_o_h___cursor.md).
-### destroyPredicates
-
+### destroy [2/4]
```
-int(* OH_Predicates::destroyPredicates) (OH_Predicates *predicates)
+int(* OH_Predicates::destroy) (OH_Predicates *predicates)
```
**Description**
@@ -1041,22 +1066,21 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
[OH_Predicates](_o_h___predicates.md).
-### destroyValueObject
-
+### destroy [3/4]
```
-int(* OH_VObject::destroyValueObject) (OH_VObject *valueObject)
+int(* OH_VBucket::destroy) (OH_VBucket *bucket)
```
**Description**
-Destroys an [OH_VObject](_o_h___v_object.md) object and reclaims the memory occupied.
+Destroys an [OH_VBucket](_o_h___v_bucket.md) object and reclaims the memory occupied.
**Parameters**
| Name| Description|
| -------- | -------- |
-| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance.|
+| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.|
**Returns**
@@ -1064,25 +1088,24 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
**See**
-[OH_VObject](_o_h___v_object.md).
-
+[OH_VBucket](_o_h___v_bucket.md).
-### destroyValuesBucket
+### destroy [4/4]
```
-int(* OH_VBucket::destroyValuesBucket) (OH_VBucket *bucket)
+int(* OH_VObject::destroy) (OH_VObject *valueObject)
```
**Description**
-Destroys an [OH_VBucket](_o_h___v_bucket.md) object and reclaims the memory occupied.
+Destroys an [OH_VObject](_o_h___v_object.md) object and reclaims the memory occupied.
**Parameters**
| Name| Description|
| -------- | -------- |
-| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.|
+| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance.|
**Returns**
@@ -1090,12 +1113,11 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
**See**
-[OH_VBucket](_o_h___v_bucket.md).
+[OH_VObject](_o_h___v_object.md).
### distinct
-
```
OH_Predicates*(* OH_Predicates::distinct) (OH_Predicates *predicates)
```
@@ -1123,7 +1145,6 @@ Returns the predicates created.
### endWrap
-
```
OH_Predicates*(* OH_Predicates::endWrap) (OH_Predicates *predicates)
```
@@ -1151,7 +1172,6 @@ Returns the predicates object with a right parenthesis.
### equalTo
-
```
OH_Predicates*(* OH_Predicates::equalTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
```
@@ -1181,7 +1201,6 @@ Returns the predicates created.
### getBlob
-
```
int(* OH_Cursor::getBlob) (OH_Cursor *cursor, int32_t columnIndex, unsigned char *value, int length)
```
@@ -1210,7 +1229,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### getColumnCount
-
```
int(* OH_Cursor::getColumnCount) (OH_Cursor *cursor, int *count)
```
@@ -1237,7 +1255,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### getColumnIndex
-
```
int(* OH_Cursor::getColumnIndex) (OH_Cursor *cursor, const char *name, int *columnIndex)
```
@@ -1265,7 +1282,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### getColumnName
-
```
int(* OH_Cursor::getColumnName) (OH_Cursor *cursor, int32_t columnIndex, char *name, int length)
```
@@ -1294,7 +1310,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### getColumnType
-
```
int(* OH_Cursor::getColumnType) (OH_Cursor *cursor, int32_t columnIndex, OH_ColumnType *columnType)
```
@@ -1322,7 +1337,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### getInt64
-
```
int(* OH_Cursor::getInt64) (OH_Cursor *cursor, int32_t columnIndex, int64_t *value)
```
@@ -1350,7 +1364,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### getReal
-
```
int(* OH_Cursor::getReal) (OH_Cursor *cursor, int32_t columnIndex, double *value)
```
@@ -1378,7 +1391,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### getRowCount
-
```
int(* OH_Cursor::getRowCount) (OH_Cursor *cursor, int *count)
```
@@ -1405,7 +1417,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### getSize
-
```
int(* OH_Cursor::getSize) (OH_Cursor *cursor, int32_t columnIndex, size_t *size)
```
@@ -1433,7 +1444,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### getText
-
```
int(* OH_Cursor::getText) (OH_Cursor *cursor, int32_t columnIndex, char *value, int length)
```
@@ -1462,7 +1472,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### goToNextRow
-
```
int(* OH_Cursor::goToNextRow) (OH_Cursor *cursor)
```
@@ -1488,7 +1497,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### greaterThan
-
```
OH_Predicates*(* OH_Predicates::greaterThan) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
```
@@ -1518,7 +1526,6 @@ Returns the predicates created.
### greaterThanOrEqualTo
-
```
OH_Predicates*(* OH_Predicates::greaterThanOrEqualTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
```
@@ -1548,7 +1555,6 @@ Returns the predicates created.
### groupBy
-
```
OH_Predicates*(* OH_Predicates::groupBy) (OH_Predicates *predicates, char const *const *fields, int length)
```
@@ -1578,7 +1584,6 @@ Returns the predicates created.
### id [1/4]
-
```
int64_t OH_Predicates::id
```
@@ -1590,7 +1595,6 @@ Unique identifier of the **OH_Predicates** struct.
### id [2/4]
-
```
int64_t OH_VObject::id
```
@@ -1602,7 +1606,6 @@ Unique identifier of the **OH_VObject** struct.
### id [3/4]
-
```
int64_t OH_VBucket::id
```
@@ -1614,7 +1617,6 @@ Unique identifier of the **OH_VBucket** struct.
### id [4/4]
-
```
int64_t OH_Rdb_Store::id
```
@@ -1626,7 +1628,6 @@ Unique identifier of the **OH_Rdb_Store** struct.
### in
-
```
OH_Predicates*(* OH_Predicates::in) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
```
@@ -1656,7 +1657,6 @@ Returns the predicates created.
### isEncrypt
-
```
bool OH_Rdb_Config::isEncrypt
```
@@ -1668,7 +1668,6 @@ Whether to encrypt the RDB store.
### isNotNull
-
```
OH_Predicates*(* OH_Predicates::isNotNull) (OH_Predicates *predicates, const char *field)
```
@@ -1697,7 +1696,6 @@ Returns the predicates created.
### isNull [1/2]
-
```
int(* OH_Cursor::isNull) (OH_Cursor *cursor, int32_t columnIndex, bool *isNull)
```
@@ -1725,7 +1723,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### isNull [2/2]
-
```
OH_Predicates*(* OH_Predicates::isNull) (OH_Predicates *predicates, const char *field)
```
@@ -1754,7 +1751,6 @@ Returns the predicates created.
### lessThan
-
```
OH_Predicates*(* OH_Predicates::lessThan) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
```
@@ -1784,7 +1780,6 @@ Returns the predicates created.
### lessThanOrEqualTo
-
```
OH_Predicates*(* OH_Predicates::lessThanOrEqualTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
```
@@ -1814,7 +1809,6 @@ Returns the predicates created.
### like
-
```
OH_Predicates*(* OH_Predicates::like) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
```
@@ -1844,7 +1838,6 @@ Returns the predicates created.
### limit
-
```
OH_Predicates*(* OH_Predicates::limit) (OH_Predicates *predicates, unsigned int value)
```
@@ -1871,9 +1864,19 @@ Returns the predicates created.
[OH_Predicates](_o_h___predicates.md).
-### notBetween
+### moduleName
+
+```
+const char* OH_Rdb_Config::moduleName
+```
+
+**Description**
+
+Module name.
+### notBetween
+
```
OH_Predicates*(* OH_Predicates::notBetween) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
```
@@ -1903,7 +1906,6 @@ Returns the predicates created.
### notEqualTo
-
```
OH_Predicates*(* OH_Predicates::notEqualTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
```
@@ -1933,7 +1935,6 @@ Returns the predicates created.
### notIn
-
```
OH_Predicates*(* OH_Predicates::notIn) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
```
@@ -1963,7 +1964,6 @@ Returns the predicates created.
### offset
-
```
OH_Predicates*(* OH_Predicates::offset) (OH_Predicates *predicates, unsigned int rowOffset)
```
@@ -1992,7 +1992,6 @@ Returns the predicates created.
### orderBy
-
```
OH_Predicates*(* OH_Predicates::orderBy) (OH_Predicates *predicates, const char *field, OH_OrderType type)
```
@@ -2022,7 +2021,6 @@ Returns the predicates created.
### orOperate
-
```
OH_Predicates*(* OH_Predicates::orOperate) (OH_Predicates *predicates)
```
@@ -2048,21 +2046,8 @@ Returns the predicates with the OR operator.
[OH_Predicates](_o_h___predicates.md).
-### path
-
-
-```
-const char* OH_Rdb_Config::path
-```
-
-**Description**
-
-Path of the database file.
-
-
### putBlob
-
```
int(* OH_VBucket::putBlob) (OH_VBucket *bucket, const char *field, const uint8_t *value, uint32_t size)
```
@@ -2091,7 +2076,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### putDouble
-
```
int(* OH_VObject::putDouble) (OH_VObject *valueObject, double *value, uint32_t count)
```
@@ -2119,7 +2103,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### putInt64 [1/2]
-
```
int(* OH_VBucket::putInt64) (OH_VBucket *bucket, const char *field, int64_t value)
```
@@ -2147,7 +2130,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### putInt64 [2/2]
-
```
int(* OH_VObject::putInt64) (OH_VObject *valueObject, int64_t *value, uint32_t count)
```
@@ -2175,7 +2157,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### putNull
-
```
int(* OH_VBucket::putNull) (OH_VBucket *bucket, const char *field)
```
@@ -2202,14 +2183,13 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### putReal
-
```
int(* OH_VBucket::putReal) (OH_VBucket *bucket, const char *field, double value)
```
**Description**
-Puts the double value into the {OH_VBucket} object of the given column name.
+Puts a double value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.
**Parameters**
@@ -2230,7 +2210,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### putText [1/2]
-
```
int(* OH_VBucket::putText) (OH_VBucket *bucket, const char *field, const char *value)
```
@@ -2245,7 +2224,7 @@ Puts a char value into the [OH_VBucket](_o_h___v_bucket.md) object in the given
| -------- | -------- |
| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.|
| field | Pointer to the column name in the database table.|
-| value | Pointer to the char value to put.|
+| value | Pointer to the value to put.|
**Returns**
@@ -2258,7 +2237,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### putText [2/2]
-
```
int(* OH_VObject::putText) (OH_VObject *valueObject, const char *value)
```
@@ -2285,7 +2263,6 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### putTexts
-
```
int(* OH_VObject::putTexts) (OH_VObject *valueObject, const char **value, uint32_t count)
```
@@ -2313,11 +2290,21 @@ Returns **RDB_OK** is the operation is successful; returns an error code otherwi
### securityLevel
-
```
-enum OH_Rdb_SecurityLevel OH_Rdb_Config::securityLevel
+int OH_Rdb_Config::securityLevel
```
**Description**
Set the RDB store security level [OH_Rdb_SecurityLevel](#oh_rdb_securitylevel).
+
+
+### selfSize
+
+```
+int OH_Rdb_Config::selfSize
+```
+
+**Description**
+
+Size of the struct.
diff --git a/en/application-dev/reference/native-apis/context_8h.md b/en/application-dev/reference/native-apis/context_8h.md
index 743fdbc9dbfe3d3d4b3b464b0301999631980790..2445e715d0d08dd3d6442848e33a8f6487722788 100644
--- a/en/application-dev/reference/native-apis/context_8h.md
+++ b/en/application-dev/reference/native-apis/context_8h.md
@@ -52,15 +52,17 @@ Provides **Context** APIs for configuring runtime information.
| [OH_AI_DeviceInfoSetFrequency](_mind_spore.md#oh_ai_deviceinfosetfrequency) ([OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info, int frequency) | Sets the NPU frequency type. This function is available only for NPU devices.|
| [OH_AI_DeviceInfoGetFrequency](_mind_spore.md#oh_ai_deviceinfogetfrequency) (const [OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info) | Obtains the NPU frequency type. This function is available only for NPU devices.|
| [OH_AI_GetAllNNRTDeviceDescs](_mind_spore.md#oh_ai_getallnnrtdevicedescs) (size_t \*num) | Obtains the descriptions of all NNRt devices in the system.|
-| [OH_AI_DestroyAllNNRTDeviceDescs](_mind_spore.md#oh_ai_destroyallnnrtdevicedescs) ([NNRTDeviceDesc](_mind_spore.md#nnrtdevicedesc) \*\*desc) | Destroys the array of NNRT descriptions obtained by [OH_AI_GetAllNNRTDeviceDescs](_mind_spore.md#oh_ai_getallnnrtdevicedescs).|
+| [OH_AI_GetElementOfNNRTDeviceDescs](_mind_spore.md#oh_ai_getelementofnnrtdevicedescs) (NNRTDeviceDesc \*descs, size_t index) | Obtains the pointer to an element in the NNRt device description array.|
+| [OH_AI_DestroyAllNNRTDeviceDescs](_mind_spore.md#oh_ai_destroyallnnrtdevicedescs) ([NNRTDeviceDesc](_mind_spore.md#nnrtdevicedesc) \*\*desc) | Destroys the NNRt device description array obtained by [OH_AI_GetAllNNRTDeviceDescs](_mind_spore.md#oh_ai_getallnnrtdevicedescs).|
| [OH_AI_GetDeviceIdFromNNRTDeviceDesc](_mind_spore.md#oh_ai_getdeviceidfromnnrtdevicedesc) (const [NNRTDeviceDesc](_mind_spore.md#nnrtdevicedesc) \*desc) | Obtains the NNRt device ID from the specified NNRt device description. Note that this ID is valid only for NNRt devices.|
| [OH_AI_GetNameFromNNRTDeviceDesc](_mind_spore.md#oh_ai_getnamefromnnrtdevicedesc) (const [NNRTDeviceDesc](_mind_spore.md#nnrtdevicedesc) \*desc) | Obtains the NNRt device name from the specified NNRt device description.|
| [OH_AI_GetTypeFromNNRTDeviceDesc](_mind_spore.md#oh_ai_gettypefromnnrtdevicedesc) (const [NNRTDeviceDesc](_mind_spore.md#nnrtdevicedesc) \*desc) | Obtains the NNRt device type from the specified NNRt device description.|
| [OH_AI_CreateNNRTDeviceInfoByName](_mind_spore.md#oh_ai_creatennrtdeviceinfobyname) (const char \*name) | Searches for the NNRt device with the specified name and creates the NNRt device information based on the information about the first found NNRt device.|
| [OH_AI_CreateNNRTDeviceInfoByType](_mind_spore.md#oh_ai_creatennrtdeviceinfobytype) ([OH_AI_NNRTDeviceType](_mind_spore.md#oh_ai_nnrtdevicetype) type) | Searches for the NNRt device with the specified type and creates the NNRt device information based on the information about the first found NNRt device.|
-| [OH_AI_DeviceInfoSetDeviceId](_mind_spore.md#oh_ai_deviceinfosetdeviceid) ([OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info, size_t device_id) | Sets the ID of an NNRt device. This API is available only for NNRt devices.|
-| [OH_AI_DeviceInfoGetDeviceId](_mind_spore.md#oh_ai_deviceinfogetdeviceid) (const [OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info) | Obtains the ID of an NNRt device. This API is available only for NNRt devices.|
-| [OH_AI_DeviceInfoSetPerformanceMode](_mind_spore.md#oh_ai_deviceinfosetperformancemode) ([OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info, [OH_AI_PerformanceMode](_mind_spore.md#oh_ai_performancemode) mode) | Sets the performance mode of an NNRt device. This API is available only for NNRt devices.|
-| [OH_AI_DeviceInfoGetPerformanceMode](_mind_spore.md#oh_ai_deviceinfogetperformancemode) (const [OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info) | Obtains the performance mode of an NNRt device. This API is available only for NNRt devices.|
-| [OH_AI_DeviceInfoSetPriority](_mind_spore.md#oh_ai_deviceinfosetpriority) ([OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info, [OH_AI_Priority](_mind_spore.md#oh_ai_priority) priority) | Sets the priority of an NNRT task. This API is available only for NNRt devices.|
-| [OH_AI_DeviceInfoGetPriority](_mind_spore.md#oh_ai_deviceinfogetpriority) (const [OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info) | Obtains the priority of an NNRT task. This API is available only for NNRt devices.|
+| [OH_AI_DeviceInfoSetDeviceId](_mind_spore.md#oh_ai_deviceinfosetdeviceid) ([OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info, size_t device_id) | Sets the ID of an NNRt device. This function is available only for NNRt devices.|
+| [OH_AI_DeviceInfoGetDeviceId](_mind_spore.md#oh_ai_deviceinfogetdeviceid) (const [OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info) | Obtains the ID of an NNRt device. This function is available only for NNRt devices.|
+| [OH_AI_DeviceInfoSetPerformanceMode](_mind_spore.md#oh_ai_deviceinfosetperformancemode) ([OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info, [OH_AI_PerformanceMode](_mind_spore.md#oh_ai_performancemode) mode) | Sets the performance mode of an NNRt device. This function is available only for NNRt devices.|
+| [OH_AI_DeviceInfoGetPerformanceMode](_mind_spore.md#oh_ai_deviceinfogetperformancemode) (const [OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info) | Obtains the performance mode of an NNRt device. This function is available only for NNRt devices.|
+| [OH_AI_DeviceInfoSetPriority](_mind_spore.md#oh_ai_deviceinfosetpriority) ([OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info, [OH_AI_Priority](_mind_spore.md#oh_ai_priority) priority) | Sets the priority of an NNRt task. This function is available only for NNRt devices.|
+| [OH_AI_DeviceInfoGetPriority](_mind_spore.md#oh_ai_deviceinfogetpriority) (const [OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info) | Obtains the priority of an NNRt task. This function is available only for NNRt devices.|
+| [OH_AI_DeviceInfoAddExtension](_mind_spore.md#oh_ai_deviceinfoaddextension) ([OH_AI_DeviceInfoHandle](_mind_spore.md#oh_ai_deviceinfohandle) device_info, const char \*name, const char \*value, size_t value_size) | Adds extended configuration in the form of key/value pairs to the device information. This function is available only for NNRt device information.|
diff --git a/en/application-dev/reference/native-apis/oh__cursor_8h.md b/en/application-dev/reference/native-apis/oh__cursor_8h.md
index d51368c059814c2f7e4f0daa34e7cc0e6484254b..16c0e0bd4e097d4570c9ff93fa2b26b11bb13488 100644
--- a/en/application-dev/reference/native-apis/oh__cursor_8h.md
+++ b/en/application-dev/reference/native-apis/oh__cursor_8h.md
@@ -30,6 +30,7 @@ A result set is a set of results returned by **query()**.
| Name| Description|
| -------- | -------- |
+| [OH_ColumnType](_r_d_b.md#oh_columntype) | Enumerates the field types in an RDB store.|
| [OH_Cursor](_r_d_b.md#oh_cursor) | Indicates a result set.|
@@ -37,4 +38,4 @@ A result set is a set of results returned by **query()**.
| Name| Description|
| -------- | -------- |
-| [OH_ColumnType](_r_d_b.md#oh_columntype) { TYPE_NULL = 0, TYPE_INT64, TYPE_REAL, TYPE_TEXT, TYPE_BLOB } | Enumerates the field types in an RDB store.|
+| [OH_ColumnType](_r_d_b.md#oh_columntype) { TYPE_NULL = 0, TYPE_INT64, TYPE_REAL, TYPE_TEXT, TYPE_BLOB } | Enumerates the field types in an RDB store.|
diff --git a/en/application-dev/reference/native-apis/oh__predicates_8h.md b/en/application-dev/reference/native-apis/oh__predicates_8h.md
index 7da0125f074e26e2a21e3d5d16a8e10dc15a48ec..725453e018dd277fa03d4572fd17c879d7917d38 100644
--- a/en/application-dev/reference/native-apis/oh__predicates_8h.md
+++ b/en/application-dev/reference/native-apis/oh__predicates_8h.md
@@ -28,6 +28,7 @@ Defines the predicates for RDB stores.
| Name| Description|
| -------- | -------- |
+| [OH_OrderType](_r_d_b.md#oh_ordertype) | Enumerates the sorting types.|
| [OH_Predicates](_r_d_b.md#oh_predicates) | Indicates a **predicates** object. |
@@ -35,4 +36,4 @@ Defines the predicates for RDB stores.
| Name| Description|
| -------- | -------- |
-| [OH_OrderType](_r_d_b.md#oh_ordertype) { ASC = 0, DESC = 1 } | Enumerates the sorting types.|
+| [OH_OrderType](_r_d_b.md#oh_ordertype) { ASC = 0, DESC = 1 } | Enumerates the sorting types.|
diff --git a/en/application-dev/reference/native-apis/relational__store_8h.md b/en/application-dev/reference/native-apis/relational__store_8h.md
index 6336866e5364f0294bd9c0a678d7cfe02e15d283..1b3f43ebd11ad385d7525b3533665f829eefcae7 100644
--- a/en/application-dev/reference/native-apis/relational__store_8h.md
+++ b/en/application-dev/reference/native-apis/relational__store_8h.md
@@ -1,4 +1,4 @@
-# relation_store.h
+# relational_store.h
## Overview
@@ -25,6 +25,13 @@ Provides APIs to manage a relational database (RDB) store.
| [OH_Rdb_Store](_o_h___rdb___store.md) | Defines the RDB store type.|
+### Types
+
+| Name| Description|
+| -------- | -------- |
+| [OH_Rdb_SecurityLevel](_r_d_b.md#oh_rdb_securitylevel) | Defines the RDB store security levels. |
+
+
### Enums
| Name| Description|
@@ -41,7 +48,7 @@ Provides APIs to manage a relational database (RDB) store.
| [OH_Rdb_CreatePredicates](_r_d_b.md#oh_rdb_createpredicates) (const char \*table) | Creates an [OH_Predicates](_o_h___predicates.md) instance.|
| [OH_Rdb_GetOrOpen](_r_d_b.md#oh_rdb_getoropen) (const [OH_Rdb_Config](_o_h___rdb___config.md) \*config, int \*errCode) | Obtains an [OH_Rdb_Store](_o_h___rdb___store.md) instance for RDB store operations.|
| [OH_Rdb_CloseStore](_r_d_b.md#oh_rdb_closestore) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store) | Destroys an [OH_Rdb_Store](_o_h___rdb___store.md) object and reclaims the memory occupied by the object.|
-| [OH_Rdb_DeleteStore](_r_d_b.md#oh_rdb_deletestore) (const char \*path) | Deletes an RDB store with the specified database file configuration.|
+| [OH_Rdb_DeleteStore](_r_d_b.md#oh_rdb_deletestore) (const [OH_Rdb_Config](_o_h___rdb___config.md) \*config) | Deletes an RDB store with the specified database file configuration.|
| [OH_Rdb_Insert](_r_d_b.md#oh_rdb_insert) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, const char \*table, [OH_VBucket](_o_h___v_bucket.md) \*valuesBucket) | Inserts a row of data into a table.|
| [OH_Rdb_Update](_r_d_b.md#oh_rdb_update) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, [OH_VBucket](_o_h___v_bucket.md) \*valuesBucket, [OH_Predicates](_o_h___predicates.md) \*predicates) | Updates data in an RDB store based on specified conditions.|
| [OH_Rdb_Delete](_r_d_b.md#oh_rdb_delete) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, [OH_Predicates](_o_h___predicates.md) \*predicates) | Deletes data from an RDB store based on specified conditions.|
diff --git a/en/application-dev/reference/native-apis/tensor_8h.md b/en/application-dev/reference/native-apis/tensor_8h.md
index bf194ef55a762a07924826925ec1f0817ac28f6c..f7eca094007354ef70bf150a3260c764c89225a8 100644
--- a/en/application-dev/reference/native-apis/tensor_8h.md
+++ b/en/application-dev/reference/native-apis/tensor_8h.md
@@ -5,10 +5,11 @@
Provides APIs for creating and modifying tensor information.
-**Since:**
+**Since**
+
9
-**Related Modules:**
+**Related Modules**
[MindSpore](_mind_spore.md)
@@ -18,28 +19,29 @@ Provides APIs for creating and modifying tensor information.
### Types
-| Name | Description |
+| Name| Description|
| -------- | -------- |
-| [OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) | Defines the handle of a tensor object. |
+| [OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) | Defines the handle of a tensor object.|
### Functions
-| Name | Description |
+| Name| Description|
| -------- | -------- |
-| [OH_AI_TensorCreate](_mind_spore.md#oh_ai_tensorcreate) (const char \*name, [OH_AI_DataType](_mind_spore.md#oh_ai_datatype) type, const int64_t \*shape, size_t shape_num, const void \*data, size_t data_len) | Creates a tensor object. |
-| [OH_AI_TensorDestroy](_mind_spore.md#oh_ai_tensordestroy) ([OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) \*tensor) | Destroys a tensor object. |
-| [OH_AI_TensorClone](_mind_spore.md#oh_ai_tensorclone) ([OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor) | Clones a tensor. |
-| [OH_AI_TensorSetName](_mind_spore.md#oh_ai_tensorsetname) ([OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor, const char \*name) | Sets the name of a tensor. |
-| [OH_AI_TensorGetName](_mind_spore.md#oh_ai_tensorgetname) (const [OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor) | Obtains the name of a tensor. |
-| [OH_AI_TensorSetDataType](_mind_spore.md#oh_ai_tensorsetdatatype) ([OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor, [OH_AI_DataType](_mind_spore.md#oh_ai_datatype) type) | Sets the data type of a tensor. |
-| [OH_AI_TensorGetDataType](_mind_spore.md#oh_ai_tensorgetdatatype) (const [OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor) | Obtains the data type of a tensor. |
-| [OH_AI_TensorSetShape](_mind_spore.md#oh_ai_tensorsetshape) ([OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor, const int64_t \*shape, size_t shape_num) | Sets the shape of a tensor. |
-| [OH_AI_TensorGetShape](_mind_spore.md#oh_ai_tensorgetshape) (const [OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor, size_t \*shape_num) | Obtains the shape of a tensor. |
-| [OH_AI_TensorSetFormat](_mind_spore.md#oh_ai_tensorsetformat) ([OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor, [OH_AI_Format](_mind_spore.md#oh_ai_format) format) | Sets the tensor data format. |
-| [OH_AI_TensorGetFormat](_mind_spore.md#oh_ai_tensorgetformat) (const [OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor) | Obtains the tensor data format. |
-| [OH_AI_TensorSetData](_mind_spore.md#oh_ai_tensorsetdata) ([OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor, void \*data) | Sets the tensor data. |
-| [OH_AI_TensorGetData](_mind_spore.md#oh_ai_tensorgetdata) (const [OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor) | Obtains the pointer to tensor data. |
-| [OH_AI_TensorGetMutableData](_mind_spore.md#oh_ai_tensorgetmutabledata) (const [OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor) | Obtains the pointer to variable tensor data. If the data is empty, memory will be allocated. |
-| [OH_AI_TensorGetElementNum](_mind_spore.md#oh_ai_tensorgetelementnum) (const [OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor) | Obtains the number of tensor elements. |
-| [OH_AI_TensorGetDataSize](_mind_spore.md#oh_ai_tensorgetdatasize) (const [OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor) | Obtains the number of bytes of the tensor data. |
+| [OH_AI_TensorCreate](_mind_spore.md#oh_ai_tensorcreate) (const char \*name, OH_AI_DataType type, const int64_t \*shape, size_t shape_num, const void \*data, size_t data_len) | Creates a tensor object.|
+| [OH_AI_TensorDestroy](_mind_spore.md#oh_ai_tensordestroy) (OH_AI_TensorHandle \*tensor) | Destroys a tensor object.|
+| [OH_AI_TensorClone](_mind_spore.md#oh_ai_tensorclone) (OH_AI_TensorHandle tensor) | Clones a tensor.|
+| [OH_AI_TensorSetName](_mind_spore.md#oh_ai_tensorsetname) (OH_AI_TensorHandle tensor, const char \ *name) | Sets the tensor name.|
+| [OH_AI_TensorGetName](_mind_spore.md#oh_ai_tensorgetname) (const OH_AI_TensorHandle tensor) | Obtains the tensor name.|
+| [OH_AI_TensorSetDataType](_mind_spore.md#oh_ai_tensorsetdatatype) (OH_AI_TensorHandle tensor, OH_AI_DataType type) | Sets the data type of a tensor.|
+| [OH_AI_TensorGetDataType](_mind_spore.md#oh_ai_tensorgetdatatype) (const OH_AI_TensorHandle tensor) | Obtains the tensor type.|
+| [OH_AI_TensorSetShape](_mind_spore.md#oh_ai_tensorsetshape) (OH_AI_TensorHandle tensor, const int64_t \*shape, size_t shape_num) | Sets the tensor shape.|
+| [OH_AI_TensorGetShape](_mind_spore.md#oh_ai_tensorgetshape) (const OH_AI_TensorHandle tensor, size_t \*shape_num) | Obtains the tensor shape.|
+| [OH_AI_TensorSetFormat](_mind_spore.md#oh_ai_tensorsetformat) (OH_AI_TensorHandle tensor, OH_AI_Format format) | Sets the tensor data format.|
+| [OH_AI_TensorGetFormat](_mind_spore.md#oh_ai_tensorgetformat) (const OH_AI_TensorHandle tensor) | Obtains the tensor data format.|
+| [OH_AI_TensorSetData](_mind_spore.md#oh_ai_tensorsetdata) (OH_AI_TensorHandle tensor, void \*data) | Sets the tensor data.|
+| [OH_AI_TensorGetData](_mind_spore.md#oh_ai_tensorgetdata) (const OH_AI_TensorHandle tensor) | Obtains the pointer to tensor data.|
+| [OH_AI_TensorGetMutableData](_mind_spore.md#oh_ai_tensorgetmutabledata) (const OH_AI_TensorHandle tensor) | Obtains the pointer to variable tensor data. If the data is empty, memory will be allocated.|
+| [OH_AI_TensorGetElementNum](_mind_spore.md#oh_ai_tensorgetelementnum) (const OH_AI_TensorHandle tensor) | Obtains the number of tensor elements.|
+| [OH_AI_TensorGetDataSize](_mind_spore.md#oh_ai_tensorgetdatasize) (const OH_AI_TensorHandle tensor) | Obtains the number of bytes of the tensor data.|
+| [OH_AI_TensorSetUserData](_mind_spore.md#oh_ai_tensorsetuserdata) ([OH_AI_TensorHandle](_mind_spore.md#oh_ai_tensorhandle) tensor, void \*data, size_t data_size) | Sets the tensor as the user data. This function allows you to reuse user data as the model input, which helps to reduce data copy by one time.|
diff --git a/en/application-dev/reference/native-lib/third_party_libc/musl-peculiar-symbol.md b/en/application-dev/reference/native-lib/third_party_libc/musl-peculiar-symbol.md
index fb04373e8259db189a558efa722dbeb343bcf413..8bf719c5413ec4604ee973eefda858d230459397 100644
--- a/en/application-dev/reference/native-lib/third_party_libc/musl-peculiar-symbol.md
+++ b/en/application-dev/reference/native-lib/third_party_libc/musl-peculiar-symbol.md
@@ -1,4 +1,4 @@
-# libc Symbols Not Exported
+# Native API Symbols Not Exported
|Type|Symbol|Remarks|
| --- | --- | --- |
diff --git a/en/application-dev/reference/native-lib/third_party_libc/musl-permission-control-symbol.md b/en/application-dev/reference/native-lib/third_party_libc/musl-permission-control-symbol.md
index 83ccf5a885735cee2663d0b4e20609f46dc81446..91c73bc25c943c48bf7879ab0440ad5bc651451d 100644
--- a/en/application-dev/reference/native-lib/third_party_libc/musl-permission-control-symbol.md
+++ b/en/application-dev/reference/native-lib/third_party_libc/musl-permission-control-symbol.md
@@ -1,4 +1,4 @@
-# libc Symbols That May Fail to Call Due to Permission Control
+# Native API Symbols That May Fail to Call Due to Permission Control
Before using the following interfaces, ensure that the application entity has the corresponding permission.
diff --git a/en/application-dev/reference/native-lib/third_party_libc/musl.md b/en/application-dev/reference/native-lib/third_party_libc/musl.md
index 3474196fdd04bcfb4f8ed53612e8f0a75c5723b1..8ff5d3915c61e81b97a84c222f8206550c97e541 100644
--- a/en/application-dev/reference/native-lib/third_party_libc/musl.md
+++ b/en/application-dev/reference/native-lib/third_party_libc/musl.md
@@ -11,17 +11,19 @@ For details about the differences between musl and glibc, see [Functional differ
C11 is implemented by [libc, libm, and libdl](https://en.cppreference.com/w/c/header).
-libc: provides thread-related interfaces and a majority of standard interfaces.
+- libc: provides thread-related interfaces and a majority of standard interfaces.
-libm: provides mathematical library interfaces. Currently, OpenHarmony provides a link to libm, and the interfaces are defined in libc.
-libdl: provides dynamic linker interfaces such as dlopen. Currently, OpenHarmony provides a link to libdl, and the interfaces are defined in libc.
+- libm: provides mathematical library interfaces. Currently, OpenHarmony provides a link to libm, and the interfaces are defined in libc.
+
+- libdl: provides dynamic linker interfaces such as dlopen. Currently, OpenHarmony provides a link to libdl, and the interfaces are defined in libc.
+
## musl Version
1.2.0
-From OpenHarmony 4.0, musl 1.2.3 is supported.
+OpenHarmony 4.0 supports musl 1.2.3.
## Supported Capabilities
OpenHarmony provides header files and library interfaces that are compatible (not fully compatible) with C99, C11, and POSIX, and supports Armv7-A, Arm64, and x86_64 architectures.
@@ -35,32 +37,36 @@ To better adapt to the basic features of OpenHarmony devices, such as high perfo
4. **dlopen()** can directly load uncompressed files in a .zip package.
### Debugging Capabilities
-The libc provides dynamic settings of the basic log functions (disabled by default) for developers to view internal exceptions of the libc. You can set the **param** to enable or disable the log functions, without recompiling the libc. However, you are advised not to use the log functions in official release versions because they affect the running performance.
+The libc provides dynamic enabling of debug logging (disabled by default). The debug logs help you learn about exceptions of the libc. With this function, you only need to set **param**, which eliminates the need for rebuilding the libc. However, you are advised not to enable debug logging in official versions because it affects the running performance.
#### 1. musl.log
-Set **musl.log.enable** to **true** to enable the **musl.log** function. To print other logs, you need to enable this function first.
+Set **musl.log.enable** to **true** to enable printing of musl debug logs. You need to enable musl.log before printing other logs.
```
-setparam musl.log.enable true
+param set musl.log.enable true
```
-#### 2. Loader log function
-The loader starts applications and invokes dlopen() and dlclose() in libc. To view exceptions in the dynamic loading process, enable the loader log function.
-* Enable the loader log of all applications (exercise caution when using this function).
+#### 2. Loader logging
+The loader starts applications and invokes **dlopen** and **dlclose** in the libc. To view exceptions during the loading process, you need to enable the loader logging function. The following describes common operations.
+* Enable the loader logging for all applications. Exercise caution when enabling this function because a large number of logs will be generated.
```
param set musl.log.ld.app true
```
-* Enable the loader log of the specified application. {app_name} specifies the target application.
+* Enable the loader logging for an application specified by {app_name}.
```
param set musl.log.ld.all false
param set musl.log.ld.app.{app_name} true
```
-* Enable the loader log of all applications except the specified application.
+* Enable the loader logging for all applications except the specified application.
```
param set musl.log.ld.all true
param set musl.log.ld.app.{app_name} false
```
## Interfaces Not Supported by musl
-[libc Symbols Not Exported](musl-peculiar-symbol.md)
-[libc Symbols That May Fail to Call Due to Permission Control](musl-permission-control-symbol.md)
+
+[Native API Symbols Not Exported](musl-peculiar-symbol.md)
+
+[Native API Symbols That May Fail to Call Due to Permission Control](musl-permission-control-symbol.md)
+
+
diff --git a/en/application-dev/reference/syscap.md b/en/application-dev/reference/syscap.md
index f5db3a40c6ecaa666a828191f695d7ddeda92c6f..b4dc9df76e9ca814ec081d3b7d4a609c3d308053 100644
--- a/en/application-dev/reference/syscap.md
+++ b/en/application-dev/reference/syscap.md
@@ -110,11 +110,11 @@ You can use either the ArtTS or native API to determine whether an API is availa
- Method 2: Import a module using the **import** API. If the current device does not support the module, the import result is **undefined**. Before using an API, you must make sure the API is available.
```ts
- import geolocation from '@ohos.geolocation';
+ import geolocationManager from '@ohos.geoLocationManager';
- if (geolocation) {
- geolocation.getCurrentLocation((location) => {
- console.log(location.latitude, location.longitude);
+ if (geolocationManager) {
+ geolocationManager.getCurrentLocation((location) => {
+ console.log('current location: ' + JSON.stringify(location));
});
} else {
console.log('This device does not support location information.');
diff --git a/en/application-dev/security/cert-guidelines.md b/en/application-dev/security/cert-guidelines.md
index 817471a5aacf0073290194bf8574e429fd650bd3..46f15dd6f71e74ceef96dffe8f0fbc3917f41ce7 100644
--- a/en/application-dev/security/cert-guidelines.md
+++ b/en/application-dev/security/cert-guidelines.md
@@ -34,7 +34,7 @@ The table below describes the APIs used in this guide.
| X509Cert | getPublicKey() : cryptoFramework.PubKey | Obtains the certificate public key. |
| X509Cert | checkValidityWithDate(date: string) : void | Checks the certificate validity period. |
| X509Cert | getVersion() : number | Obtains the certificate version. |
-| X509Cert | getSerialNumber() : number | Obtains the certificate serial number. |
+| X509Cert | getCertSerialNumber() : bigint10+ | Obtains the certificate serial number.|
| X509Cert | getIssuerName() : DataBlob | Obtains the certificate issuer. |
| X509Cert | getSubjectName() : DataBlob | Obtains the certificate subject. |
| X509Cert | getNotBeforeTime() : string | Obtains the time from which the certificate takes effect. |
@@ -489,7 +489,7 @@ function certChainValidatorSample() {
data: encodingData,
// Number of certificates. It is 2 in this example.
count: 2,
- // Certificate format. PEM and DER are supported. In this example, the certificate is in PEM format.
+ // Certificate format. Only PEM and DER are supported. In this example, the certificate is in PEM format.
encodingFormat: cryptoCert.EncodingFormat.FORMAT_PEM
};
@@ -572,4 +572,4 @@ function crlEntrySample() {
}
});
}
-```
+```
\ No newline at end of file
diff --git a/en/application-dev/security/permission-group-list.md b/en/application-dev/security/permission-group-list.md
index 79e1b286ea5a95be65b379aaad212868d878bc77..321da782b1120c6394cd01d9563dc32197b561dc 100644
--- a/en/application-dev/security/permission-group-list.md
+++ b/en/application-dev/security/permission-group-list.md
@@ -86,3 +86,7 @@ The following lists the permission groups supported currently. For details about
## Installed Bundle List
- ohos.permission.GET_INSTALLED_BUNDLE_LIST
+
+## Bluetooth
+
+- ohos.permission.ACCESS_BLUETOOTH
diff --git a/en/application-dev/security/permission-list.md b/en/application-dev/security/permission-list.md
index 138f98bd08423c303fe73489104251f7638f0102..2b46db1e6555e0e408b026deb7ff35d54d789fdc 100644
--- a/en/application-dev/security/permission-list.md
+++ b/en/application-dev/security/permission-list.md
@@ -2520,7 +2520,7 @@ Allows an application to manage the upload sessions.
## ohos.permission.PREPARE_APP_TERMINATE
-Allows an application to perform customized pre-termination actions before being terminated.
+Allows an application to perform customized actions before being terminated.
**Permission level**: normal
@@ -2731,3 +2731,15 @@ Allows an application to restore pre-installed applications.
**Enable via ACL**: TRUE
**Start version**: 10
+
+## ohos.permission.GET_DOMAIN_ACCOUNTS
+
+Allows an application to obtain domain account information.
+
+**Permission level**: system_basic
+
+**Authorization mode**: system_grant
+
+**Enable via ACL**: TRUE
+
+**Start version**: 10
diff --git a/en/application-dev/security/userauth-guidelines.md b/en/application-dev/security/userauth-guidelines.md
index f2bac259a83a5b595b69875cd99f47afda0b27e2..a245754fbf8432cdb018300a780f9c101d22267d 100644
--- a/en/application-dev/security/userauth-guidelines.md
+++ b/en/application-dev/security/userauth-guidelines.md
@@ -1,11 +1,12 @@
# User Authentication Development
->  **NOTE**
-> This guide applies to the SDK for API version 9.
+> **NOTE**
+>
+> This guide applies to the SDK for API version 10.
## When to Use
-User authentication supports facial recognition and fingerprint recognition and can be used in identity authentication scenarios such as device unlocking, application login, and payment.
+OpenHarmony supports PIN authentication, facial authentication, and fingerprint authentication, which can be used in identity authentication scenarios such as device unlocking, app login, and payment.
## Available APIs
@@ -18,23 +19,23 @@ Before authentication, you must specify the [authentication type](../reference/a
| API | Description |
| ---------- | ----------------------- |
| getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel): void | Checks whether the device supports the specified authentication type and level.|
-| getAuthInstance(challenge : Uint8Array, authType : UserAuthType, authTrustLevel : AuthTrustLevel): AuthInstance | Obtains an **AuthInstance** instance for user authentication.|
-| on(name : AuthEventKey, callback : AuthEvent) : void | Subscribes to the user authentication events of the specified type.|
-| off(name : AuthEventKey) : void | Unsubscribes from the user authentication events of the specific type.|
-| start: void | Starts user authentication. |
-| cancel: void | Cancel this user authentication. |
+| getUserAuthInstance(authParam: AuthParam, widgetParam: WidgetParam): UserAuthInstance | Obtains a **UserAuthInstance** instance for user authentication. The user authentication widget is supported.|
+| on(type: 'result', callback: IAuthCallback): void | Subscribes to the user authentication result.|
+| off(type: 'result', callback?: IAuthCallback): void | Unsubscribes from the user authentication result.|
+| start(): void | Starts user authentication. |
+| cancel(): void | Cancel this user authentication. |
## Checking Authentication Capabilities Supported by a Device
### How to Develop
-1. Apply for the permission. Configure the **ohos.permission.ACCESS_BIOMETRIC** permission in **requestPermissions** in the **module.json5** file. For more information, see [module.json5](../quick-start/module-configuration-file.md).
+1. Apply for the permission. Configure the **ohos.permission.ACCESS_BIOMETRIC** permission in **requestPermissions** in the **module.json5** file. For more information, see [module.json5](../quick-start/module-configuration-file.md).
2. Specify the [authentication type](../reference/apis/js-apis-useriam-userauth.md#userauthtype8) and [authentication trust level](../reference/apis/js-apis-useriam-userauth.md#authtrustlevel8), and call [getAvailableStatus](../reference/apis/js-apis-useriam-userauth.md#useriam_userauthgetavailablestatus9) to check whether the current device supports the authentication capabilities.
```js
import userIAM_userAuth from '@ohos.userIAM.userAuth';
-
+
// Check whether the authentication capabilities are supported.
try {
userIAM_userAuth.getAvailableStatus(userIAM_userAuth.UserAuthType.FACE, userIAM_userAuth.AuthTrustLevel.ATL1);
@@ -48,127 +49,56 @@ Before authentication, you must specify the [authentication type](../reference/a
### How to Develop
-1. Apply for the permission. Configure the **ohos.permission.ACCESS_BIOMETRIC** permission in **requestPermissions** in the **module.json5** file. For more information, see [module.json5](../quick-start/module-configuration-file.md).
+1. Apply for the permission. Configure the **ohos.permission.ACCESS_BIOMETRIC** permission in **requestPermissions** in the **module.json5** file. For more information, see [module.json5](../quick-start/module-configuration-file.md).
2. Specify the challenge, [authentication type](../reference/apis/js-apis-useriam-userauth.md#userauthtype8), and [authentication trust level](../reference/apis/js-apis-useriam-userauth.md#authtrustlevel8) to obtain an authentication object.
-3. Use [on](../reference/apis/js-apis-useriam-userauth.md#on9) to subscribe to the authentication result.
+3. Call [on](../reference/apis/js-apis-useriam-userauth.md#on10) to subscribe to the authentication result.
-4. Use [start](../reference/apis/js-apis-useriam-userauth.md#start9) to initiate an authentication and return the authentication result through [callback](../reference/apis/js-apis-useriam-userauth.md#callback9).
+4. Call [start](../reference/apis/js-apis-useriam-userauth.md#start10) to start authentication and return the authentication result through the [callback](../reference/apis/js-apis-useriam-userauth.md#callback10).
-5. Use [off](../reference/apis/js-apis-useriam-userauth.md#off9) to unsubscribe from the authentication result.
+5. Call [off](../reference/apis/js-apis-useriam-userauth.md#off10) to unsubscribe from the authentication result.
```js
import userIAM_userAuth from '@ohos.userIAM.userAuth';
-
- let challenge = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
- let authType = userIAM_userAuth.UserAuthType.FACE;
- let authTrustLevel = userIAM_userAuth.AuthTrustLevel.ATL1;
-
- // Obtain an authentication object.
- let auth;
- try {
- auth = userIAM_userAuth.getAuthInstance(challenge, authType, authTrustLevel);
- console.log("get auth instance success");
- } catch (error) {
- console.log("get auth instance failed" + error);
- }
-
- // Subscribe to the authentication result.
+
+ const authParam = {
+ challenge: new Uint8Array([49, 49, 49, 49, 49, 49]),
+ authType: [userAuth.UserAuthType.PIN],
+ authTrustLevel: 10000,
+ };
+ const widgetParam = {
+ title:'Enter password',
+ navigationButtonText: 'Back',
+ windowMode: userAuth.WindowModeType.DIALOG_BOX,
+ };
+ let userAuthInstance;
try {
- auth.on("result", {
- callback: (result: userIAM_userAuth.AuthResultInfo) => {
- console.log("authV9 result " + result.result);
- console.log("authV9 token " + result.token);
- console.log("authV9 remainAttempts " + result.remainAttempts);
- console.log("authV9 lockoutDuration " + result.lockoutDuration);
+ // Obtain an authentication object.
+ userAuthInstance = userIAM_userAuth.getUserAuthInstance(authParam, widgetParam);
+ console.log('get userAuth instance success');
+ // Subscribe to the authentication result.
+ userAuthInstance.on('result', {
+ onResult (result) {
+ console.log('userAuthInstance callback result = ' + JSON.stringify(result));
}
});
- console.log("subscribe authentication event success");
+ console.log('auth on success');
+ userAuthInstance.start();
+ console.log('auth start success');
} catch (error) {
- console.log("subscribe authentication event failed " + error);
+ console.log('auth on catch error: ' + JSON.stringify(error));
}
-
- // Start user authentication.
- try {
- auth.start();
- console.info("authV9 start auth success");
- } catch (error) {
- console.info("authV9 start auth failed, error = " + error);
- }
-
// Unsubscribe from the authentication result.
try {
- auth.off("result");
- console.info("cancel subscribe authentication event success");
- } catch (error) {
- console.info("cancel subscribe authentication event failed, error = " + error);
- }
- ```
-
-## Performing Authentication and Subscribing to Authentication Tip Information
-
-### How to Develop
-
-1. Apply for the permission. Configure the **ohos.permission.ACCESS_BIOMETRIC** permission in **requestPermissions** in the **module.json5** file. For more information, see [module.json5](../quick-start/module-configuration-file.md).
-
-2. Specify the challenge, [authentication type](../reference/apis/js-apis-useriam-userauth.md#userauthtype8), and [authentication trust level](../reference/apis/js-apis-useriam-userauth.md#authtrustlevel8) to obtain an authentication object.
-
-3. Use [on](../reference/apis/js-apis-useriam-userauth.md#on9) to subscribe to the authentication tip information.
-
-4. Use [start](../reference/apis/js-apis-useriam-userauth.md#start9) to initiate an authentication and return the tip information through [callback](../reference/apis/js-apis-useriam-userauth.md#callback9).
-
-5. Use [off](../reference/apis/js-apis-useriam-userauth.md#off9) to unsubscribe from the authentication tip information.
-
- ```js
- import userIAM_userAuth from '@ohos.userIAM.userAuth';
-
- let challenge = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
- let authType = userIAM_userAuth.UserAuthType.FACE;
- let authTrustLevel = userIAM_userAuth.AuthTrustLevel.ATL1;
-
- // Obtain an authentication object.
- let auth;
- try {
- auth = userIAM_userAuth.getAuthInstance(challenge, authType, authTrustLevel);
- console.log("get auth instance success");
- } catch (error) {
- console.log("get auth instance failed" + error);
- }
-
- // Subscribe to authentication tip information.
- try {
- auth.on("tip", {
- callback : (result : userIAM_userAuth.TipInfo) => {
- switch (result.tip) {
- case userIAM_userAuth.FaceTips.FACE_AUTH_TIP_TOO_BRIGHT:
- // Do something.
- case userIAM_userAuth.FaceTips.FACE_AUTH_TIP_TOO_DARK:
- // Do something.
- default:
- // Do others.
- }
+ userAuthInstance.off('result', {
+ onResult (result) {
+ console.log('auth off result: ' + JSON.stringify(result));
}
});
- console.log("subscribe authentication event success");
- } catch (error) {
- console.log("subscribe authentication event failed " + error);
- }
-
- // Start user authentication.
- try {
- auth.start();
- console.info("authV9 start auth success");
- } catch (error) {
- console.info("authV9 start auth failed, error = " + error);
- }
-
- // Unsubscribe from authentication tip information.
- try {
- auth.off("tip");
- console.info("cancel subscribe tip information success");
+ console.log('auth off success');
} catch (error) {
- console.info("cancel subscribe tip information failed, error = " + error);
+ console.log('auth catch error: ' + JSON.stringify(error));
}
```
@@ -176,43 +106,44 @@ Before authentication, you must specify the [authentication type](../reference/a
### How to Develop
-1. Apply for the permission. Configure the **ohos.permission.ACCESS_BIOMETRIC** permission in **requestPermissions** in the **module.json5** file. For more information, see [module.json5](../quick-start/module-configuration-file.md).
+1. Apply for the permission. Configure the **ohos.permission.ACCESS_BIOMETRIC** permission in **requestPermissions** in the **module.json5** file. For more information, see [module.json5](../quick-start/module-configuration-file.md).
2. Specify the challenge, [authentication type](../reference/apis/js-apis-useriam-userauth.md#userauthtype8), and [authentication trust level](../reference/apis/js-apis-useriam-userauth.md#authtrustlevel8) to obtain an authentication object.
-3. Use [start](../reference/apis/js-apis-useriam-userauth.md#start9) to initiate an authentication.
+3. Call [start](../reference/apis/js-apis-useriam-userauth.md#start10) to start authentication.
-4. Use [cancel](../reference/apis/js-apis-useriam-userauth.md#cancel9) to cancel this authentication.
+4. Call [cancel](../reference/apis/js-apis-useriam-userauth.md#cancel10) to cancel this authentication.
```js
import userIAM_userAuth from '@ohos.userIAM.userAuth';
-
- let challenge = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
- let authType = userIAM_userAuth.UserAuthType.FACE;
- let authTrustLevel = userIAM_userAuth.AuthTrustLevel.ATL1;
-
- // Obtain an authentication object.
- let auth;
- try {
- auth = userIAM_userAuth.getAuthInstance(challenge, authType, authTrustLevel);
- console.log("get auth instance success");
- } catch (error) {
- console.log("get auth instance failed" + error);
- }
-
- // Start user authentication.
+
+ const authParam = {
+ challenge: new Uint8Array([49, 49, 49, 49, 49, 49]),
+ authType: [userAuth.UserAuthType.PIN],
+ authTrustLevel: 10000,
+ };
+ const widgetParam = {
+ title:'Enter password',
+ navigationButtonText: 'Back',
+ windowMode: userAuth.WindowModeType.DIALOG_BOX,
+ };
+ let userAuthInstance;
try {
- auth.start();
- console.info("authV9 start auth success");
+ // Obtain an authentication object.
+ userAuthInstance = userIAM_userAuth.getUserAuthInstance(authParam, widgetParam);
+ console.log('get userAuth instance success');
+ // Start user authentication.
+ userAuthInstance.start();
+ console.log('auth start success');
} catch (error) {
- console.info("authV9 start auth failed, error = " + error);
+ console.log('auth catch error: ' + JSON.stringify(error));
}
-
+
// Cancel the authentication.
try {
- auth.cancel();
- console.info("cancel auth success");
+ userAuthInstance.cancel();
+ console.log('auth cancel success');
} catch (error) {
- console.info("cancel auth failed, error = " + error);
+ console.log('auth catch error: ' + JSON.stringify(error));
}
```
diff --git a/en/application-dev/task-management/figures/bgtask_choice.png b/en/application-dev/task-management/figures/bgtask_choice.png
index a5200006128dcead88e00da8434b4621e6c36472..8ac048571e10bf6ba902bf844ba2a7e02d5a9ddb 100644
Binary files a/en/application-dev/task-management/figures/bgtask_choice.png and b/en/application-dev/task-management/figures/bgtask_choice.png differ
diff --git a/en/application-dev/task-management/work-scheduler.md b/en/application-dev/task-management/work-scheduler.md
index ca419ee8142d7cf281b2e0ce30e6e64a37b01694..22c012478ff92d8ab81e0490b8cad570ad17362e 100644
--- a/en/application-dev/task-management/work-scheduler.md
+++ b/en/application-dev/task-management/work-scheduler.md
@@ -62,8 +62,8 @@ The table below lists the APIs used for developing deferred tasks. For details a
| -------- | -------- |
| startWork(work: WorkInfo): void; | Starts a deferred task.|
| stopWork(work: WorkInfo, needCancel?: boolean): void; | Stops a deferred task.|
-| getWorkStatus(workId: number, callback: AsyncCallback<WorkInfo>): void; | Obtains the status of a deferred task. This API uses an asynchronous callback to return the result.|
-| getWorkStatus(workId: number): Promise<WorkInfo>; | Obtains the status of a deferred task. This API uses a promise to return the result.|
+| getWorkStatus(workId: number, callback: AsyncCallback<WorkInfo>): void; | Obtains the information about a deferred task. This API uses an asynchronous callback to return the result.|
+| getWorkStatus(workId: number): Promise<WorkInfo>; | Obtains the information about a deferred task. This API uses a promise to return the result.|
| obtainAllWorks(callback: AsyncCallback<void>): Array<WorkInfo>; | Obtains all the deferred tasks. This API uses an asynchronous callback to return the result.|
| obtainAllWorks(): Promise<Array<WorkInfo>>; | Obtains all the deferred tasks. This API uses a promise to return the result.|
| stopAndClearWorks(): void; | Stops and clears all the deferred tasks.|
@@ -77,7 +77,7 @@ The table below lists the APIs used for developing deferred tasks. For details a
| bundleName | string | Bundle name of the application that requests the deferred task.|
| abilityName | string | Name of the ability to be notified by a deferred task scheduling callback. This parameter is mandatory.|
| networkType | [NetworkType](../reference/apis/js-apis-resourceschedule-workScheduler.md#networktype) | Network type.|
-| isCharging | boolean | Whether the device is charging.|
+| isCharging | boolean | Whether the device needs to enter the charging state to trigger deferred task scheduling.|
| chargerType | [ChargingType](../reference/apis/js-apis-resourceschedule-workScheduler.md#chargingtype) | Charging type.|
| batteryLevel | number | Battery level.|
| batteryStatus | [BatteryStatus](../reference/apis/js-apis-resourceschedule-workScheduler.md#batterystatus) | Battery status.|
diff --git a/en/application-dev/tools/lldb-tool.md b/en/application-dev/tools/lldb-tool.md
index 630d9b3ee25a3cd13ab9fade2ffb508822b3a181..f1a14e5a58343e99548b78cc1300b7b8041db749 100644
--- a/en/application-dev/tools/lldb-tool.md
+++ b/en/application-dev/tools/lldb-tool.md
@@ -2,7 +2,7 @@
## Overview
Low Lever Debugger (LLDB) is a next-generation high-performance debugger.
-LLDB is developed based on the [llvm15.0.4](https://github.com/llvm/llvm-project/releases/tag/llvmorg-15.0.4) and supports debugging on the home screen and OpenHarmony devices or simulators.
+LLDB is developed based on [LLVM 15.0.4](https://github.com/llvm/llvm-project/releases/tag/llvmorg-15.0.4) and supports debugging on the home screen and OpenHarmony devices or emulators.
## How to Obtain
Obtain the OpenHarmony SDK from http://ci.openharmony.cn/workbench/cicd/dailybuild.
@@ -45,7 +45,7 @@ For example, for Windows, **lldb.exe** is stored in the following path after the
### Remote Debugging
-> **Note: During remote debugging, the LLDB server and LLDB must be used together.**
+> **Note: During remote debugging, lldb-server and lldb must be used together.**
- Debugging the OHOS device on the Windows platform (Arm architecture)
- Debugging the OHOS device on the Windows platform (AArch64 architecture)
- Debugging the simulator on the Windows platform
@@ -99,11 +99,11 @@ For example, for Windows, **lldb.exe** is stored in the following path after the
## Functions Provided by LLDB
- Loading a program to LLDB
- Setting a breakpoint
-- Setting an observation point
+- Setting a watchpoint
- Starting or attaching to a program
- Executing a control program
- Checking the thread status
- Checking the stack frame status
## References
-For details about other functions and commands, see [LLDB Usage Guide](https://gitee.com/openharmony/third_party_llvm-project/blob/master/lldb/README.md)
+For details about other functions and commands, see [LLDB](https://gitee.com/openharmony/third_party_llvm-project/blob/master/lldb/README.md)
diff --git a/en/application-dev/ui/arkts-common-components-text-input.md b/en/application-dev/ui/arkts-common-components-text-input.md
index e76dad1901b43ac15aa3e4b9ea2432da3db1ac9a..afdb55200529144c482cb5382c938e21e47cd591 100644
--- a/en/application-dev/ui/arkts-common-components-text-input.md
+++ b/en/application-dev/ui/arkts-common-components-text-input.md
@@ -125,8 +125,6 @@ TextInput()
In this example, the text box is used to submit forms on the user login or registration page.
-
-
```ts
@Entry
@Component
@@ -148,4 +146,4 @@ struct TextInputSample {
```
-
+
diff --git a/en/application-dev/ui/arkts-layout-development-create-list.md b/en/application-dev/ui/arkts-layout-development-create-list.md
index 32c4322ae5247bbf8ac79b29667593d660795806..cbb633c5d19bda73a973fff66574dd537dd51f2c 100644
--- a/en/application-dev/ui/arkts-layout-development-create-list.md
+++ b/en/application-dev/ui/arkts-layout-development-create-list.md
@@ -299,7 +299,7 @@ List() {
})
```
-This example draws a divider with a stroke thickness of 1 vp from a position 60 vp away from the start edge of the list to a position 10 vp away from the end edge of the list. The effect is shown in Figure 8.
+This example draws a divider with a stroke thickness of 1 vp from a position 60 vp away from the start edge of the list to a position 10 vp away from the end edge of the list. The effect is shown in Figure 9.
>**NOTE**
>
@@ -653,8 +653,6 @@ The following describes the implementation of the pull-and-refresh feature:
3. Listen for the finger lift event. If the movement reaches the maximum value, trigger data loading and display the refresh view. After the loading is complete, hide the view.
- You can also use the third-party component [PullToRefresh](https://gitee.com/openharmony-sig/PullToRefresh) to implement this feature.
-
## Editing a List
diff --git a/en/application-dev/ui/arkts-routing.md b/en/application-dev/ui/arkts-routing.md
index 5ccf781293c12b40eedfb6949b0ef268c79d4699..ef6b72ab27dbd5847ceb16f9b732aadbff1ec402 100644
--- a/en/application-dev/ui/arkts-routing.md
+++ b/en/application-dev/ui/arkts-routing.md
@@ -11,23 +11,26 @@ Page redirection is an important part of the development process. When using an
**Figure 1** Page redirection

-The **Router** module provides two redirection modes: [router.pushUrl()](../reference/apis/js-apis-router.md#routerpushurl9) and [router.replaceUrl()](../reference/apis/js-apis-router.md#routerreplaceurl9). The two modes determine whether the target page will replace the current page.
+The **Router** module provides two redirection modes: [router.pushUrl()](../reference/apis/js-apis-router.md#routerpushurl9) and [router.replaceUrl()](../reference/apis/js-apis-router.md#routerreplaceurl9). Whether the target page will replace the current page depends on the mode used.
-- **router.pushUrl()**: The target page does not replace the current page. Instead, it is pushed into the [page stack](../application-models/page-mission-stack.md). In this way, the state of the current page can be retained, and users can return to the current page by pressing the back button or calling the [router.back()](../reference/apis/js-apis-router.md#routerback) API.
+- **router.pushUrl()**: The target page is pushed into the [page stack](../application-models/page-mission-stack.md) and does not replace the current page. In this mode, the state of the current page is retained, and users can return to the current page by pressing the back button or calling the [router.back()](../reference/apis/js-apis-router.md#routerback) API.
-- **router.replaceUrl()**: The target page replaces the current page and destroys the current page. In this way, the resources of the current page can be released, and users cannot return to the current page.
+- **router.replaceUrl()**: The target page replaces and destroys the current page. In this mode, the resources of the current page can be released, and users cannot return to the current page.
>**NOTE**
>
->The maximum capacity of a page stack is 32 pages. If this limit is exceeded, the [router.clear()](../reference/apis/js-apis-router.md#routerclear) API can be called to clear the historical page stack and free the memory.
+>- When creating a page, configure the route to this page by following instructions in [Building the Second Page](../quick-start/start-with-ets-stage.md).
+>
+>
+>- The maximum capacity of a page stack is 32 pages. If this limit is exceeded, the [router.clear()](../reference/apis/js-apis-router.md#routerclear) API can be called to clear the historical page stack and free the memory.
-The **Router** module also provides two instance modes: **Standard** and **Single**. The two modes determine whether the target URL corresponds to multiple instances.
+The **Router** module also provides two instance modes: **Standard** and **Single**. Depending on the mode, the target URL is mapped to one or more instances.
-- **Standard**: standard instance mode, which is the default instance mode. Each time this API is called, a target page is created and pushed to the top of the stack.
+- **Standard**: multi-instance mode. It is the default instance mode. In this mode, the target page is added to the top of the page stack, regardless of whether a page with the same URL exists in the stack.
-- **Single**: singleton mode. If the URL of the target page already exists in the page stack, the page with the same URL closest to the top of the stack is moved to the top of the stack and reloaded. If the URL of the target page does not exist in the page stack, the page is redirected in standard mode.
+- **Single**: singleton mode. In this mode, if the URL of the target page already exists in the page stack, the page closest to the top of the stack with the same URL is moved to the top of the stack and becomes the new page. If the URL of the target page does not exist in the page stack, the page is redirected in standard mode.
-Before using the **Router** module, you need to import it to the code.
+Before using the **Router** module, import it first.
```ts
@@ -54,7 +57,7 @@ import router from '@ohos.router';
>**NOTE**
>
- >In **Standard** instance mode, the **router.RouterMode.Standard** parameter can be omitted.
+ >In standard (multi-instance) mode, the **router.RouterMode.Standard** parameter can be omitted.
- Scenario 2: There is a login page (**Login**) and a personal center page (**Profile**). After a user successfully logs in from the **Login** page, the **Profile** page is displayed. At the same time, the **Login** page is destroyed, and the application exits when the back button is pressed. In this scenario, you can use the **replaceUrl()** API and use the Standard instance mode (which can also be omitted).
@@ -76,7 +79,7 @@ import router from '@ohos.router';
>**NOTE**
>
- >In **Standard** instance mode, the **router.RouterMode.Standard** parameter can be omitted.
+ >In standard (multi-instance) mode, the **router.RouterMode.Standard** parameter can be omitted.
- Scenario 3: There is a setting page (**Setting**) and a theme switching page (**Theme**). You want to click a theme option on the **Setting** page to go to the **Theme** page. In addition, you want to ensure that only one **Theme** page exists in the page stack at a time. When the back button is clicked on the **Theme** page, the **Setting** page is displayed. In this scenario, you can use the **pushUrl()** API and use the **Single** instance mode.
@@ -115,7 +118,7 @@ import router from '@ohos.router';
The preceding scenarios do not involve parameter transfer.
-If you need to transfer some data to the target page during redirection, you can add a **params** attribute and specify an object as a parameter when invoking an API of the **Router** module. Example:
+If you need to transfer data to the target page during redirection, you can add a **params** attribute and specify an object as a parameter when invoking an API of the **Router** module. Example:
```ts
@@ -150,11 +153,11 @@ function onJumpClick(): void {
}
```
-On the target page, you can call the [getParams()](../reference/apis/js-apis-router.md#routergetparams) API of the **Router** module to obtain the transferred parameters. Example:
+On the target page, you can call the [getParams()](../reference/apis/js-apis-router.md#routergetparams) API of the **Router** module to obtain the passed parameters. Example:
```ts
-const params = router.getParams(); // Obtain the transferred parameter object.
+const params = router.getParams(); // Obtain the passed parameters.
const id = params['id']; // Obtain the value of the id attribute.
const age = params['info'].age; // Obtain the value of the age attribute.
```
@@ -162,13 +165,13 @@ const age = params['info'].age; // Obtain the value of the age attribute.
## Page Return
-After a user completes an operation on a page, the user usually needs to return to the previous page or a specified page. In this case, the page return function is required. During the return process, the data may need to be transferred to the target page, which requires the data transfer function.
+Implement the page return feature so that users can return to the previous page or a specified page. You can pass parameters to the target page during the return process.
**Figure 2** Page return

-Before using the **Router** module, you need to import it to the code.
+Before using the **Router** module, import it first.
```ts
@@ -195,7 +198,7 @@ You can use any of the following methods to return to a page:
});
```
- This method allows you to return to a specified page. You need to specify the path of the target page. For this method to work, the target page must it exist in the page stack.
+ This method allows uesrs to return to a page with the specified path. For this method to work, the target page must exist in the page stack.
- Method 3: Return to the specified page and transfer custom parameter information.
@@ -209,14 +212,14 @@ You can use any of the following methods to return to a page:
});
```
- This method not only allows you to return to the specified page, but also transfer custom parameter information when returning. The parameter information can be obtained and parsed by invoking the **router.getParams()** API on the target page.
+ This method not only allows you to return to the specified page, but also pass in custom parameter information during the return process. The parameter information can be obtained and parsed by invoking the **router.getParams()** API on the target page.
On the target page, call the **router.getParams()** API at the position where parameters need to be obtained, for example, in the **onPageShow()** lifecycle callback:
```ts
onPageShow() {
- const params = router.getParams(); // Obtain the transferred parameter object.
+ const params = router.getParams(); // Obtain the passed parameters.
const info = params['info']; // Obtain the value of the info attribute.
}
```
@@ -243,7 +246,7 @@ Such a dialog box can be in the [default style](#default-confirmation-dialog-box
To implement this function, you can use the [router.showAlertBeforeBackPage()](../reference/apis/js-apis-router.md#routershowalertbeforebackpage9) and [router.back()](../reference/apis/js-apis-router.md#routerback) APIs provided by the **Router** module.
-Before using the **Router** module, you need to import it to the code.
+Before using the **Router** module, import it first.
```ts
@@ -272,17 +275,16 @@ function onBackClick(): void {
The **router.showAlertBeforeBackPage()** API receives an object as a parameter. The object contains the following attributes:
-- **message**: content of the dialog box. The value is of the string type.
- If the API is successfully called, the confirmation dialog box is displayed on the target page. Otherwise, an exception is thrown and the error code and error information is obtained through **err.code** and **err.message**.
-
- When the user clicks the back button, a confirmation dialog box is displayed, prompting the user to confirm their operation. If the user selects Cancel, the application stays on the current page. If the user selects OK, the **router.back()** API is triggered and the redirection is performed based on the parameters.
+**message**: content of the dialog box. The value is of the string type.
+If the API is successfully called, the confirmation dialog box is displayed on the target page. Otherwise, an exception is thrown and the error code and error information is obtained through **err.code** and **err.message**.
+When the user clicks the back button, a confirmation dialog box is displayed, prompting the user to confirm their operation. If the user selects Cancel, the application stays on the current page. If the user selects OK, the **router.back()** API is triggered and the redirection is performed based on the parameters.
### Custom Confirmation Dialog Box
To implement a custom confirmation dialog box, use APIs in the [PromptAction](../reference/apis/js-apis-promptAction.md#promptactionshowdialog) module or customize a popup window. This topic uses the APIs in the **PromptAction** module an example to describe how to implement a custom confirmation dialog box.
-Before using the **Router** module, you need to import it to the code.
+Before using the **Router** module, import it first.
```ts
@@ -324,3 +326,63 @@ function onBackClick() {
```
When the user clicks the back button, the custom confirmation dialog box is displayed, prompting the user to confirm their operation. If the user selects Cancel, the application stays on the current page. If the user selects OK, the **router.back()** API is triggered and the redirection is performed based on the parameters.
+
+## Named Route
+
+To redirect to a [page in a shared package](../quick-start/shared-guide.md), you can use [router.pushNamedRoute()](../reference/apis/js-apis-router.md#routerpushnamedroute10).
+
+Before using the **Router** module, import it first.
+
+
+```ts
+import router from '@ohos.router';
+```
+
+In the target page in the [shared package](../quick-start/shared-guide.md), name the [@Entry decorated custom component](../quick-start/arkts-create-custom-components.md#entryoptions10).
+
+```ts
+// library/src/main/ets/pages/Index.ets
+@Entry({ routeName : 'myPage' })
+@Component
+struct MyComponent {
+}
+```
+
+When the configuration is successful, import the named route page to the page from which you want to redirect.
+
+```ts
+// entry/src/main/ets/pages/Index.ets
+import router from '@ohos.router';
+import 'library/src/main/ets/Index.ets' // Import the named route page from the shared package library.
+
+@Entry
+@Component
+struct Index {
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Text('Hello World')
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ .margin({ top: 20 })
+ .backgroundColor('#ccc')
+ .onClick(() => { // Click to go to a page in another shared package.
+ try {
+ router.pushNamedRoute({
+ name: 'myPage',
+ params: {
+ data1: 'message',
+ data2: {
+ data3: [123, 456, 789]
+ }
+ }
+ })
+ } catch (err) {
+ console.error(`pushNamedRoute failed, code is ${err.code}, message is ${err.message}`);
+ }
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
diff --git a/en/application-dev/ui/figures/TextInputGIF.gif b/en/application-dev/ui/figures/TextInputGIF.gif
new file mode 100644
index 0000000000000000000000000000000000000000..c38397c38c3546a2bad44646e3b1782867ef545b
Binary files /dev/null and b/en/application-dev/ui/figures/TextInputGIF.gif differ
diff --git a/en/application-dev/ui/figures/en-us_image_0000001563060653.png b/en/application-dev/ui/figures/en-us_image_0000001563060653.png
deleted file mode 100644
index 71b01bc206f9432451fa91e99f3f46283649634a..0000000000000000000000000000000000000000
Binary files a/en/application-dev/ui/figures/en-us_image_0000001563060653.png and /dev/null differ
diff --git a/en/application-dev/website.md b/en/application-dev/website.md
index 971d5da44e52069e1ed435aed02e0017386994d6..19113046f8c26cbaa7d4d8b28c0228b1fa0f28f6 100644
--- a/en/application-dev/website.md
+++ b/en/application-dev/website.md
@@ -144,7 +144,7 @@
- [Component Startup Rules (Stage Model)](application-models/component-startup-rules.md)
- Inter-Device Application Component Interaction (Continuation)
- [Continuation Overview](application-models/inter-device-interaction-hop-overview.md)
- - [Cross-Device Migration (for System Applications Only)](application-models/hop-cross-device-migration.md)
+ - [Cross-Device Migration](application-models/hop-cross-device-migration.md)
- [Multi-device Collaboration (for System Applications Only)](application-models/hop-multi-device-collaboration.md)
- [Subscribing to System Environment Variable Changes](application-models/subscribe-system-environment-variable-changes.md)
- Process Model
@@ -558,6 +558,7 @@
- [Network Connection Management](connectivity/net-connection-manager.md)
- [MDNS Management](connectivity/net-mdns.md)
- [Traffic Management](connectivity/net-statistics.md)
+ - [VPN Management](connectivity/net-vpn.md)
- IPC & RPC
- [IPC & RPC Overview](connectivity/ipc-rpc-overview.md)
- [IPC & RPC Development](connectivity/ipc-rpc-development-guideline.md)
@@ -910,6 +911,7 @@
- UI Page
- [@ohos.animator (Animator)](reference/apis/js-apis-animator.md)
- [@ohos.arkui.componentSnapshot (Component Snapshot)](reference/apis/js-apis-arkui-componentSnapshot.md)
+ - [@ohos.arkui.componentUtils (componentUtils)](reference/apis/js-apis-arkui-componentUtils.md)
- [@ohos.arkui.dragController (DragController)](reference/apis/js-apis-arkui-dragController.md)
- [@ohos.arkui.drawableDescriptor (DrawableDescriptor)](reference/apis/js-apis-arkui-drawableDescriptor.md)
- [@ohos.arkui.inspector (Layout Callback)](reference/apis/js-apis-arkui-inspector.md)
@@ -936,12 +938,15 @@
- [WebGL](reference/apis/js-apis-webgl.md)
- [WebGL2](reference/apis/js-apis-webgl2.md)
- Multimedia
+ - [@ohos.app.ability.MediaControlExtensionAbility (ExtensionAbility for Media Playback Control)](reference/apis/js-apis-app-ability-MediaControlExtensionAbility.md)
- [@ohos.multimedia.audio (Audio Management)](reference/apis/js-apis-audio.md)
- [@ohos.multimedia.avsession (AVSession Management)](reference/apis/js-apis-avsession.md)
- [@ohos.multimedia.camera (Camera Management)](reference/apis/js-apis-camera.md)
- [@ohos.multimedia.image (Image Processing)](reference/apis/js-apis-image.md)
- [@ohos.multimedia.media (Media)](reference/apis/js-apis-media.md)
- [@ohos.multimedia.systemSoundManager (System Sound Management)](reference/apis/js-apis-systemSoundManager.md)
+ - application
+ - [MediaControlExtensionContext (ExtensionAbility Context for Media Playback Control)](reference/apis/js-apis-inner-application-MediaControlExtensionContext.md)
- multimedia
- [ringtonePlayer (Ringtone Player)](reference/apis/js-apis-inner-multimedia-ringtonePlayer.md)
- Resource Management
@@ -1016,6 +1021,7 @@
- [@ohos.net.sharing (Network Sharing)](reference/apis/js-apis-net-sharing.md)
- [@ohos.net.socket (Socket Connection)](reference/apis/js-apis-socket.md)
- [@ohos.net.statistics (Traffic Management)](reference/apis/js-apis-net-statistics.md)
+ - [@ohos.net.vpn (VPN Management)](reference/apis/js-apis-net-vpn.md)
- [@ohos.net.webSocket (WebSocket Connection)](reference/apis/js-apis-webSocket.md)
- [@ohos.request (Upload and Download)](reference/apis/js-apis-request.md)
- Connectivity
@@ -1085,9 +1091,10 @@
- [@ohos.charger (Charging Type)](reference/apis/js-apis-charger.md)
- [@ohos.cooperate (Screen Hopping)](reference/apis/js-apis-devicestatus-cooperate.md)
- [@ohos.deviceAttest (Device Attestation)](reference/apis/js-apis-deviceAttest.md)
+ - [@ohos.deviceStatus.dragInteraction (Drag)](reference/apis/js-apis-devicestatus-draginteraction.md)
- [@ohos.deviceInfo (Device Information)](reference/apis/js-apis-device-info.md)
- - [@ohos.distributedDeviceManager (Device Management)](reference/apis/js-apis-distributedDeviceManager.md)
- - [@ohos.distributedHardware.deviceManager (Device Management)](reference/apis/js-apis-device-manager.md)
+ - [@ohos.distributedDeviceManager (Device Management) (Recommended)](reference/apis/js-apis-distributedDeviceManager.md)
+ - [@ohos.distributedHardware.deviceManager (Device Management) (To Be Deprecated Soon)](reference/apis/js-apis-device-manager.md)
- [@ohos.driver.deviceManager (Peripheral Management)](reference/apis/js-apis-driver-deviceManager.md)
- [@ohos.geoLocationManager (Geolocation Manager)](reference/apis/js-apis-geoLocationManager.md)
- [@ohos.multimodalInput.gestureEvent (Gesture Input Event)](reference/apis/js-apis-multimodalinput-gestureevent.md)
@@ -1119,7 +1126,6 @@
- [DriverExtensionContext](reference/apis/js-apis-inner-application-driverExtensionContext.md)
- Account Management
- [@ohos.account.appAccount (App Account Management)](reference/apis/js-apis-appAccount.md)
- - [@ohos.account.appAccount.AuthorizationExtensionAbility (App AuthorizationExtensionAbility)](reference/apis/js-apis-appAccount-authorizationExtensionAbility.md)
- [@ohos.account.distributedAccount (Distributed Account Management)](reference/apis/js-apis-distributed-account.md)
- [@ohos.account.osAccount (OS Account Management)](reference/apis/js-apis-osAccount.md)
- Customization
@@ -1347,6 +1353,7 @@
- [GridRow](reference/arkui-ts/ts-container-gridrow.md)
- [Grid](reference/arkui-ts/ts-container-grid.md)
- [GridItem](reference/arkui-ts/ts-container-griditem.md)
+ - [Hyperlink](reference/arkui-ts/ts-container-hyperlink.md)
- [List](reference/arkui-ts/ts-container-list.md)
- [ListItem](reference/arkui-ts/ts-container-listitem.md)
- [ListItemGroup](reference/arkui-ts/ts-container-listitemgroup.md)
@@ -1362,6 +1369,7 @@
- [Swiper](reference/arkui-ts/ts-container-swiper.md)
- [Tabs](reference/arkui-ts/ts-container-tabs.md)
- [TabContent](reference/arkui-ts/ts-container-tabcontent.md)
+ - [UIExtensionComponent](reference/arkui-ts/ts-container-ui-extension-component.md)
- [WaterFlow](reference/arkui-ts/ts-container-waterflow.md)
- Media Components
- [Video](reference/arkui-ts/ts-media-components-video.md)
@@ -1614,6 +1622,7 @@
- [Audio Error Codes](reference/errorcodes/errorcode-audio.md)
- [Media Error Codes](reference/errorcodes/errorcode-media.md)
- [AVSession Management Error Codes](reference/errorcodes/errorcode-avsession.md)
+ - [Camera Error Codes](reference/errorcodes/errorcode-camera.md)
- Resource Management
- [I18N Error Codes](reference/errorcodes/errorcode-i18n.md)
- [Resource Manager Error Codes](reference/errorcodes/errorcode-resource-manager.md)
@@ -1633,7 +1642,7 @@
- [DataShare Error Codes](reference/errorcodes/errorcode-datashare.md)
- [Distributed Data Object Error Codes](reference/errorcodes/errorcode-distributed-dataObject.md)
- [Distributed KV Store Error Codes](reference/errorcodes/errorcode-distributedKVStore.md)
- - [Preferences Error Codes](reference/errorcodes/errorcode-preferences.md)
+ - [User Preference Error Codes](reference/errorcodes/errorcode-preferences.md)
- File Management
- [File Management Error Codes](reference/errorcodes/errorcode-filemanagement.md)
- Telephony Service
@@ -1648,6 +1657,7 @@
- [Policy Management Error Codes](reference/errorcodes/errorcode-net-policy.md)
- [mDNS Error Codes](reference/errorcodes/errorcode-net-mdns.md)
- [Traffic Management Error Codes](reference/errorcodes/errorcode-net-statistics.md)
+ - [VPN Error Codes](reference/errorcodes/errorcode-net-vpn.md)
- Connectivity
- [Bluetooth Error Codes](reference/errorcodes/errorcode-bluetoothManager.md)
- [Wi-Fi Error Codes](reference/errorcodes/errorcode-wifi.md)
@@ -1667,7 +1677,7 @@
- [Time and Time Zone Service Error Codes](reference/errorcodes/errorcode-time.md)
- [Webview Error Codes](reference/errorcodes/errorcode-webview.md)
- Account Management
- - [Account Error Codes](reference/errorcodes/errorcode-account.md)
+ - [Account Management Error Codes](reference/errorcodes/errorcode-account.md)
- Device Management
- [Power Consumption Statistics Error Codes](reference/errorcodes/errorcode-batteryStatistics.md)
- [Brightness Error Codes](reference/errorcodes/errorcode-brightness.md)
diff --git a/en/contribute/template/js-template.md b/en/contribute/template/js-template.md
index 9f7cedd5b58e0a7f8c2a9582ce1adabe26f76879..215f3717a231ec96fd59532cee924e70319ea3cd 100644
--- a/en/contribute/template/js-template.md
+++ b/en/contribute/template/js-template.md
@@ -9,13 +9,13 @@
| | Item | Writing Instruction |
| ---- | --------------------------------- | ------------------------------------------------------------ |
| 1 | Customer-oriented mindset | **Stand in the shoes of developers and provide the use cases, parameter selection principles, recommendations/tips, sample code, and anything else that a developer will need to develop the API.**|
-| 2 | Upload path | Upload markdown files to **docs/en/application-dev/reference/apis**. Upload images to **docs/en/application-dev/reference/apis/figures**. In addition, reference the image path in the markdown file as follows: ****, ****, or ****.|
+| 2 | Upload path | Upload markdown files to **docs/en/application-dev/reference/apis**. Upload images to **docs/en/application-dev/reference/apis/figures**. In addition, reference the image path in the markdown file as follows: **\![]\(figures/exampleImage.jpg)**, **\![]\(figures/exampleImage.png)**, or **\![]\(figures/exampleImage.gif)**.|
| 3 | File name | Provide one JS API reference document for each d.ts file. Name the file in the format of **js-apis-exampleModule.md**, where **exampleModule** is a variable and must be the same as the actual module name. Examples: For @ohos.multimedia.audio in the Multimedia subsystem, the JS API file name is **js-apis-audio.md**. For @ohos.telephony.sms in the Telephony subsystem, the JS API file name is **js-apis-sms.md**.|
| 4 | Directory update | After uploading an API reference document, update the **Readme-EN.md** file in **docs/en/application-dev/reference/apis**. The directories are automatically arranged in alphabetical order.|
| 5 | Document structure | - Module description - Initial version description - Modules to Import/Usage description - API description (attributes, constants, methods, enums, and custom types) The order in which APIs are described in the document must be consistent with that in which they appear in the code. If some APIs have a logical sequence, pay attention to their sequence in the API reference document.|
| 6 | Initial version description | 1. Use the greater-than sign (**>**) followed by a space to indent the description about the initial version of the module. Unless otherwise marked, all APIs in the module have the same initial version. 2. When introducing an API to an existing module, use the **** tag to mark its earliest version. The format is **versionNumber+ **, for example, **7+ **. If an attribute is added to an existing module, suffix the **** tag to the new attribute name, for example, **newAttribute7+ **. If a method is added to an existing module, suffix the **** tag to the method name, for example, **sim.getSimIccId7+ **. The same rule applies to new interfaces, classes, and enums.|
| 7 | Deprecated API description | Do not delete the deprecated content from the document. Instead, suffix **deprecated** as a superscript to the content, and use the greater-than sign (**>**) to introduce the initial version and deprecated version. Example: abandonmentMethod(deprecated) > This API is supported since API version 4 and deprecated since API version 7. You are advised to use [newMethod]\(#newmethod) instead.|
-| 8 | Permission description | Provide the same permission description as that defined in the code for each method, enum, and attribute. 1. If only one permission is required for using the API, use the following format: **Required permissions**: ohos.permission.examplePermission 2. If multiple permissions are required for using the API, provide the permissions with **and** or **or** in the following format: **Required permissions**: ohos.permission.examplePermissionA and ohos.permission.examplePermissionB **Required permissions**: ohos.permission.examplePermissionA or ohos.permission.examplePermissionB |
+| 8 | Permission description | Provide the same permission description as that defined in the code for each method, enum, and attribute. 1. If only one permission is required for using the API, use the following format: **Required permissions**: ohos.permission.examplePermission 2. If multiple permissions are required for using the API, provide the permissions with **and** or **or** in the following format: **Required permissions**: ohos.permission.examplePermissionA and ohos.permission.examplePermissionB **Required permissions**: ohos.permission.examplePermissionA or ohos.permission.examplePermissionB|
| 9 | @syscap | 1. Provide a description for every API in the following format, wherein *A.B* indicates a specific system capability. **System capability**: SystemCapability.*A.B* 2. There are two cases for adding system capability information to a table (of attributes, enums, constants, or variables). 1) If all the items in a table require the same system capability, add the following information to the front of the table: **System capability**: SystemCapability.*A.B* 2) If the items in a table require different system capabilities, list the system capability for each item in the table.|
| 10 | @system api | 1. If all APIs of the module are system APIs, add the following sentence to the next line of the initial version description: The APIs provided by this module are system APIs. 2. If an API is a system API that can be used only by original equipment manufacturers (OEMs), add the following sentence to the API description: **System API**: This is a system API.|
| 11 | @FAModelOnly @StageModelOnly | 1. If a module is implemented only for a specific ability model, add the following sentence to the next line of the initial version description: The APIs of this module can be used only in the FA model. Or The APIs of this module can be used only in the stage model. 2. If an API is implemented only for a specific ability model, add the following sentence to the API description: **Model restriction**: This API can be used only in the FA model. Or **Model restriction**: This API can be used only in the stage model.|
diff --git a/en/contribute/template/ts-template.md b/en/contribute/template/ts-template.md
index 056d5db24ee5eae44e5a0e914f97d4ba58784415..6d3bda93a28e9f8fdada2a23e9ea41a8ad3b5bdf 100644
--- a/en/contribute/template/ts-template.md
+++ b/en/contribute/template/ts-template.md
@@ -9,14 +9,14 @@
| | Item | Writing Instruction |
| ---- | ----------- | ---------------------------------------- |
| 1 | Customer-oriented mindset | **Stand in the shoes of developers and provide the use cases, parameter selection principles, recommendations/tips, sample code, and anything else that a developer will need to develop the component.**|
-| 2 | Upload path | Upload markdown files to `docs/en/application-dev/reference/arkui-ts`. Upload images to `docs/en/application-dev/reference/arkui-ts/figures`. In addition, reference the image path in the markdown file as follows: ``, ``, or ``.|
-| 3 | File name | Provide one TS component reference document for each .d.ts file. Name the file in the format of `ts-componentClassName-componentName.md`. Examples: For the basic component **\**, the reference file name is `ts-basic-component-text.md`. For the container component **\**, the reference file name is `js-container-component-list.md`. |
-| 4 | Directory update | After uploading a TS component reference document, update the `Readme-EN.md` file in `docs/en/application-dev/reference/arkui-ts`. |
-| 5 | Document structure | - Component description - Initial version description - Modules to import/Usage description - Permission description - APIs, attributes, events, objects, enums, and custom types The order in which APIs are described in the document must be consistent with that in which they appear in the code. If some APIs have a logical sequence, pay attention to their sequence in the document. |
-| 6 | Initial version description | 1. Use the greater-than sign (`>`) followed by a space to indent the description about the initial version of the component. Unless otherwise marked, all APIs in the component have the same initial version. 2. When introducing an API to an existing component, use the `` tag to mark its initial version. The format is `versionNumber+ `, for example, `7+ `. When introducing an attribute to an existing API, use the `` tag to mark its initial version. The format is `newAttributeversionNumber+ `, for example, `newAttribute7+ `. |
+| 2 | Upload path | Upload markdown files to `docs/en/application-dev/reference/arkui-ts`. Upload images to **docs/en/application-dev/reference/arkui-ts/figures**. In addition, reference the image path in the markdown file as follows: **\![]\(figures/exampleImage.jpg)**, **\![]\(figures/exampleImage.png)**, or **\![]\(figures/exampleImage.gif)**.|
+| 3 | File name | Provide one TS component reference document for each .d.ts file. Name the file in the format of `ts-componentClassName-componentName.md`. Examples: For the basic component **\**, the reference file name is `ts-basic-component-text.md`. For the container component **\**, the reference file name is `js-container-component-list.md`.|
+| 4 | Directory update | After uploading a TS component reference document, update the `Readme-EN.md` file in `docs/en/application-dev/reference/arkui-ts`.|
+| 5 | Document structure | - Component description - Initial version description - Modules to import/Usage description - Permission description - APIs, attributes, events, objects, enums, and custom types The order in which APIs are described in the document must be consistent with that in which they appear in the code. If some APIs have a logical sequence, pay attention to their sequence in the document.|
+| 6 | Initial version description | 1. Use the greater-than sign (`>`) followed by a space to indent the description about the initial version of the component. Unless otherwise marked, all APIs in the component have the same initial version. 2. When introducing an API to an existing component, use the `` tag to mark its initial version. The format is `versionNumber+ `, for example, `7+ `. When introducing an attribute to an existing API, use the `` tag to mark its initial version. The format is `newAttributeversionNumber+ `, for example, `newAttribute7+ `.|
| 7 | Deprecated API description | Do not delete the deprecated content from the document. Instead, suffix `deprecated` as a superscript to the content, and use the greater-than sign (`>`) to introduce the substitute API plus a link to the API description. Example: abandonmentMethod(deprecated) > This API is no longer maintained since API version 7. You are advised to use [newMethod]\(#newmethod) instead.|
-| 8 | Permission description | Use "Required Permissions" as a level-2 heading. 1. If a specific permission required for using the component can be requested only by system applications, provide the description in the following format: ohos.permission.examplePermission (available only to system applications) 2. If a specific permission required for using the component can be requested by all applications, provide the description in the following format: ohos.permission.examplePermission 3. If multiple permissions are required for using the component, provide the permissions with `and` or `or` in the following format: ohos.permission.examplePermissionA and ohos.permission.examplePermissionB ohos.permission.examplePermissionA or ohos.permission.examplePermissionB |
-| 9 | @system api | 1. If all APIs of the component are system APIs, add the following sentence to the next line of the initial version description: The APIs provided by this component are system APIs. 2. If an API is a system API that can be used only by original equipment manufacturers (OEMs), add the following sentence to the API description: **System API**: This is a system API. |
+| 8 | Permission description | Use "Required Permissions" as a level-2 heading. 1. If a specific permission required for using the component can be requested only by system applications, provide the description in the following format: ohos.permission.examplePermission (available only to system applications) 2. If a specific permission required for using the component can be requested by all applications, provide the description in the following format: ohos.permission.examplePermission 3. If multiple permissions are required for using the component, provide the permissions with `and` or `or` in the following format: ohos.permission.examplePermissionA and ohos.permission.examplePermissionB ohos.permission.examplePermissionA or ohos.permission.examplePermissionB|
+| 9 | @system api | 1. If all APIs of the component are system APIs, add the following sentence to the next line of the initial version description: The APIs provided by this component are system APIs. 2. If an API is a system API that can be used only by original equipment manufacturers (OEMs), add the following sentence to the API description: **System API**: This is a system API.|
| 10 | Sample code programming language | Use code blocks to provide sample code, and mark the programming language ts by adding `// xxx.ets` at the beginning of every sample code block.|
| 11 | Link | Link format: [Link text]\(Link content) Cross-folder link format: [markdown file name]\(\.\./../xxx/xxx.md). One `./` indicates one upper-level folder. Intra-topic link format: [Interface A7+ ]\(#xxxa7). The text in the intra-topic link must be the same as the title to be linked. In the link, all letters must be in lowercase, and no special character (except the hyphen) or tag is included.|
diff --git a/en/device-dev/device-test/Readme-EN.md b/en/device-dev/device-test/Readme-EN.md
index 4ca9e2c13290f008cf73f231874cf598cb1edc0b..f7fd5978e51c8f2d17c636952239539af78b7c9f 100644
--- a/en/device-dev/device-test/Readme-EN.md
+++ b/en/device-dev/device-test/Readme-EN.md
@@ -2,5 +2,5 @@
- [Development Self-Test Framework User Guide](developer_test.md)
- [xDevice User Guide](xdevice.md)
+- [Smartperf-Host User Guide](smartperf-host.md)
- [XTS Test Case Development Guide](xts.md)
-
diff --git a/en/device-dev/device-test/developer_test.md b/en/device-dev/device-test/developer_test.md
index a3d699e62c32a222ab10d8a8c24cf0babd48267d..d31659033970f2d9750776724a54e3857dbb5172 100644
--- a/en/device-dev/device-test/developer_test.md
+++ b/en/device-dev/device-test/developer_test.md
@@ -95,7 +95,7 @@ Click [here](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-co
6. Install the NFS server if the device outputs results only through the serial port.
- >  **NOTE**
+ > **NOTE**
>
> This operation applies to small-system or mini-system devices, not standard-system devices.
@@ -260,7 +260,7 @@ The test framework supports multiple types of tests and provides different test
{
// Set a teardown function, which will be called after all test cases.
}
- ```
+ ```
5. Add implementation of the test cases, including test case comments and logic.
```
@@ -279,11 +279,11 @@ The test framework supports multiple types of tests and provides different test
EXPECT_EQ(4, actual);
}
```
- >  **NOTE**
- >
- > The value of **@tc.require** must start with AR/SR or issue, for example, **issueI56WJ7**.
+ > **NOTE**
+ >
+ > The value of **@tc.require** must start with AR/SR or issue, for example, **issueI56WJ7**.
-- The following uses base_object_test.cpp as an example to describe how to compile a multi-thread test case:
+- The following uses **base_object_test.cpp** as an example to describe how to compile a multi-thread test case:
```
// The test case file header comment and test case comment are the same as those in the single-thread test case example.
@@ -345,16 +345,17 @@ The test framework supports multiple types of tests and provides different test
The procedure is as follows:
1. Add comment information to the test case file header.
- > **NOTE** The standard is the same as that of the single-thread test case.
+ > **NOTE**
+ >
+ > The standard is the same as that of the single-thread test case.
- 2. Add the test framework header file and namespace.
```
#include
#include
#include
using namespace testing::ext;
- using namespace testing::mt;
- ```
+ using namespace testing::mt;
+ ```
3. Add the header file of the test class.
```
#include "base_object.h"
@@ -364,9 +365,11 @@ The test framework supports multiple types of tests and provides different test
class AAFwkBaseObjectTest : public testing::Test {......}
```
- > **NOTE** The standard is the same as that of the single-thread test case.
+
- 5. Add implementation of the test cases, including test case comments and logic.
+ > **NOTE**
+ >
+ > The standard is the same as that of the single-thread test case.
```
// Step 1 Set the function to be tested to return the factorial result.
@@ -379,7 +382,7 @@ The test framework supports multiple types of tests and provides different test
printf("Factorial Function Result : %d! = %d\n", n, result);
return result;
}
-
+
// Step 2 Use an assertion to compare the obtained result with the expected result.
void factorial_test()
{
@@ -388,13 +391,13 @@ The test framework supports multiple types of tests and provides different test
std::ostringstream oss;
oss << this_id;
std::string this_id_str = oss.str();
- long int thread_id = atol(this_id_str.c_str());
- printf("running thread...: %ld\n", thread_id); // Output the ID of the running thread.
+ long int thread_id = atol(this_id_str.c_str());
+ printf("running thread...: %ld\n", thread_id); // Output the ID of the running thread.
EXPECT_EQ(ret, 6);
}
// GTEST_RUN_TASK(TestFunction) is a multi-thread startup function. The parameter is a custom function.
- // If SET_THREAD_NUM() is not called, the default value 10 will be used.
+ // If SET_THREAD_NUM() is not called, the default value 10 will be used.
HWTEST_F(AAFwkBaseObjectTest, Factorial_test_001, TestSize.Level1)
{
SET_THREAD_NUM(4); // Set the number of threads. It can be dynamically set in the same test suite.
@@ -404,7 +407,7 @@ The test framework supports multiple types of tests and provides different test
}
// HWMTEST_F(TEST_SUITE, TEST_TC, TEST_LEVEL, THREAD_NUM)
- // THREAD_NUM can be used to set the number of threads for executing a test case.
+ // THREAD_NUM can be used to set the number of threads for executing a test case.
// HWMTEST_F creates a specified number of threads and executes the tested function.
HWMTEST_F(AAFwkBaseObjectTest, Factorial_test_002, TestSize.Level1, 6)
{
@@ -412,12 +415,14 @@ The test framework supports multiple types of tests and provides different test
factorial_test();
printf("Factorial_test_002 END\n");
}
- // Add the multi-thread API MTEST_ADD_TASK(THREAD_ID,ThreadTestFunc). Multiple threads are registered but are not executed in this test case. Instead, they are executed later in a unified manner. This API is applicable to the multi-thread test in the scenario where multiple test cases are combined.
- // THREAD_ID is used to distinguish threads and starts from 0. You can also use a random thread ID by passing in RANDOM_THREAD_ID. In this scenario, each thread ID is unique.
- // Add the multi-thread API MTEST_POST_RUN() to execute the previously registered threads in a unified manner.
+ // Add the multi-thread API MTEST_ADD_TASK(THREAD_ID,ThreadTestFunc). Multiple threads are registered but are not executed in this test case. Instead, they are executed later in a unified manner. This API is applicable to the multi-thread test in the scenario where multiple test cases are combined.
+ // THREAD_ID is used to distinguish threads and starts from 0. You can also use a random thread ID by passing in RANDOM_THREAD_ID. In this scenario, each thread ID is unique.
+ // Add the multi-thread API MTEST_POST_RUN() to execute the previously registered threads in a unified manner.
```
- > **NOTE** The comments for multi-thread test cases are the same as those of single-thread test cases.
-
+ > **NOTE**
+ >
+ > The comments for multi-thread test cases are the same as those of single-thread test cases.
+
- About C++ test case templates:
The following test case templates are provided for your reference.
@@ -590,7 +595,7 @@ The test framework supports multiple types of tests and provides different test
expect(info != null).assertEqual(true)
})
```
- >  **NOTE**
+ > **NOTE**
>
> The value of **@tc.require** must start with AR/SR or issue, for example, **issueI56WJ7**.
@@ -660,7 +665,7 @@ The following provides templates for different languages for your reference.
```
module_output_path = "developertest/calculator"
```
- >  **NOTE**
+ > **NOTE**
>
> The output path is the *Part name*/*Module name*.
@@ -673,7 +678,7 @@ The following provides templates for different languages for your reference.
include_dirs = [ "../../../include" ]
}
```
- >  **NOTE**
+ > **NOTE**
>
> Generally, the dependency directories are configured here and directly referenced in the build script of the test case.
@@ -698,7 +703,7 @@ The following provides templates for different languages for your reference.
}
```
- >  **NOTE**
+ > **NOTE**
>
> Set the test type based on actual requirements. The following test types are available:
> - **ohos_unittest**: unit test
@@ -719,7 +724,7 @@ The following provides templates for different languages for your reference.
deps = [":CalculatorSubTest"]
}
```
- >  **NOTE**
+ > **NOTE**
>
> Grouping test cases by test type allows you to execute a specific type of test cases when required.
@@ -764,7 +769,7 @@ The following provides templates for different languages for your reference.
```
module_output_path = "developertest/app_info"
```
- >  **NOTE**
+ > **NOTE**
>
> The output path is the *Part name*/*Module name*.
@@ -774,7 +779,7 @@ The following provides templates for different languages for your reference.
ohos_js_unittest("GetAppInfoJsTest") {
}
```
- >  **NOTE**
+ > **NOTE**
>
> - Use the **ohos_js_unittest** template to define the JavaScript test suite. Pay attention to the difference between JavaScript and C++.
> - The file generated for the JavaScript test suite must be in .hap format and named after the test suite name defined here. The test suite name must end with **JsTest**.
@@ -861,7 +866,7 @@ The following provides templates for different languages for your reference.
deps = [ ":GetAppInfoJsTest" ]
}
```
- >  **NOTE**
+ > **NOTE**
>
> Grouping test cases by test type allows you to execute a specific type of test cases when required.
@@ -924,7 +929,7 @@ The following provides templates for different languages for your reference.
```
want_output_path = "developertest/stage_test"
```
- >  **NOTE**
+ > **NOTE**
>
> The output path is the *Part name*/*Module name*.
@@ -934,7 +939,7 @@ The following provides templates for different languages for your reference.
ohos_js_stage_unittest("ActsBundleMgrStageEtsTest") {
}
```
- >  **NOTE**
+ > **NOTE**
>
> Use the **ohos_js_stage_unittest** template to define the ArkTS test suite for the stage model.
@@ -979,7 +984,7 @@ The following provides templates for different languages for your reference.
deps = [ ":GetAppInfoJsTest" ]
}
```
- >  **NOTE**
+ > **NOTE**
>
> Grouping test cases by test type allows you to execute a specific type of test cases when required.
@@ -1010,7 +1015,7 @@ Configure the part build file to associate with specific test cases.
"//test/testfwk/developer_test/examples/calculator/test:fuzztest"
}
```
->  **NOTE**
+> **NOTE**
>
> **test_list** contains the test cases of the corresponding module.
@@ -1043,7 +1048,7 @@ Perform the following steps:
resource_config_file = "//system/subsystem/partA/test/resource/calculator/ohos_test.xml"
}
```
- >  **NOTE**
+ > **NOTE**
>
>- **target_name** indicates the test suite name defined in the **BUILD.gn** file in the **test** directory. **preparer** indicates the action to perform before the test suite is executed.
>- **src="res"** indicates that the test resources are in the **resource** directory under the **test** directory. **src="out"** indicates that the test resources are in the **out/release/$(*part*)** directory.
@@ -1103,7 +1108,7 @@ Before executing test cases, you need to modify the configuration in **developer
```
->  **NOTE**
+> **NOTE**
>
> If HDC is connected to the device before the test cases are executed, you only need to configure the device IP address and port number, and retain the default settings for other parameters.
@@ -1115,7 +1120,7 @@ Test cases cannot be built on Windows. You need to run the following command to
./build.sh --product-name {product_name} --build-target make_test
```
->  **NOTE**
+> **NOTE**
>
>- **product-name**: specifies the name of the product to be compiled.
>- **build-target**: specifies the test case to build. **make_test** indicates all test cases. You can specify the test cases based on requirements.
@@ -1127,7 +1132,7 @@ When the build is complete, the test cases are automatically saved in **out/ohos
2. Copy **developertest** and **xdevice** from the Linux environment to the **Test** directory on Windows, and copy the test cases to the **testcase** directory.
- >  **NOTE**
+ > **NOTE**
>
> Port the test framework and test cases from the Linux environment to the Windows environment for subsequent execution.
@@ -1142,7 +1147,7 @@ When the build is complete, the test cases are automatically saved in **out/ohos
D:\Test\testcase\tests
```
- >  **NOTE**
+ > **NOTE**
>
> **\** indicates whether to build test cases. **\** indicates the path for searching for test cases.
@@ -1206,7 +1211,7 @@ To enable test cases to be executed on a remote Linux server or a Linux VM, map
hdc_std kill
hdc_std -m -s 0.0.0.0:8710
```
- >  **NOTE**
+ > **NOTE**
>
> The IP address and port number are default values.
@@ -1214,7 +1219,7 @@ To enable test cases to be executed on a remote Linux server or a Linux VM, map
```
hdc_std -s xx.xx.xx.xx:8710 list targets
```
- >  **NOTE**
+ > **NOTE**
>
> Enter the IP address of the device to test.
@@ -1347,7 +1352,7 @@ You can obtain the test result in the following directory:
```
test/developertest/reports/xxxx_xx_xx_xx_xx_xx
```
->  **NOTE**
+> **NOTE**
>
> The test report folder is automatically generated.
@@ -1355,9 +1360,9 @@ The folder contains the following files:
| Type | Description |
| ------------------------------------ | ------------------ |
| result/ | Test cases in standard format.|
-| log/plan_log_xxxx_xx_xx_xx_xx_xx.log | Test case logs. |
-| summary_report.html | Test report summary. |
-| details_report.html | Detailed test report. |
+| log/plan_log_xxxx_xx_xx_xx_xx_xx.log | Test case logs. |
+| summary_report.html | Test report summary. |
+| details_report.html | Detailed test report. |
@@ -1372,6 +1377,7 @@ When GCDA data is available, you can execute the test cases as follows for subsy
run -tp partname
run -tp partname1 partname2
+
2. Before compiling the version, modify the compilation options. Add **-- coverage** to the **cflags**, **cflags_cc**, and **ldflags** options in the **build.gn** file of the involved subsystem.
ldflags = [ "--coverage" ]
@@ -1379,6 +1385,7 @@ When GCDA data is available, you can execute the test cases as follows for subsy
C++: cflags_cc = [ "--coverage" ]
**Recommended**: You can also refer to the mode for the window subsystem. For details, see the files in this [pull request](https://gitee.com/openharmony/window_window_manager/pulls/1274/files).
+
3. To execute coverage test cases, perform the following to install the dependencies:
1. Run the **sudo apt install lcov** command to install lcov.
@@ -1403,7 +1410,9 @@ When GCDA data is available, you can execute the test cases as follows for subsy
run -t UT -ss *Subsystem name* -tp **Part name** -cov coverage
run -t UT MST ST -tp *Part name* -cov coverage
- Note: The **-cov coverage** parameter must be added to the preceding commands.
+ > **NOTE**
+ >
+ > The **-cov coverage** parameter must be added to the preceding commands.
6. Obtain the coverage report from the following paths:
diff --git a/en/device-dev/get-code/sourcecode-acquire.md b/en/device-dev/get-code/sourcecode-acquire.md
index bda7306a445adef5ce83ea0195fc0d0f5a18bd8e..6d6555dfe4cd4bca3e46256d83618917bafc071d 100644
--- a/en/device-dev/get-code/sourcecode-acquire.md
+++ b/en/device-dev/get-code/sourcecode-acquire.md
@@ -201,12 +201,12 @@ The table below provides only the sites for downloading the latest OpenHarmony L
| Hi3516 solution-Linux (binary)| 3.0 | [Download](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz.sha256) | 418.1 MB |
| RELEASE-NOTES | 3.0 | [Download](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.0-LTS/en/release-notes/OpenHarmony-v3.0-LTS.md)| - | - |
| **Source Code of the Latest Release**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**|
-| Full code base (for mini, small, and standard systems) | 4.0 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/code-v4.0-Beta1.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/code-v4.0-Beta1.tar.gz.sha256)| 26.2 GB |
-| Hi3861 solution (binary) | 4.0 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/hispark_pegasus.tar.gz) | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/hispark_pegasus.tar.gz.sha256)| 25.1 MB |
-| Hi3516 solution-LiteOS (binary)| 4.0 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/hispark_taurus_LiteOS.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/hispark_taurus_LiteOS.tar.gz.sha256)| 287.6 MB |
-| Hi3516 solution-Linux (binary) | 4.0 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/hispark_taurus_Linux.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/hispark_taurus_Linux.tar.gz.sha256)| 186.4 MB |
-| RK3568 standard system solution (binary) | 4.0 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/dayu200_standard_arm32.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/dayu200_standard_arm32.tar.gz.sha256)| 4.5 GB |
-| RELEASE-NOTES | 4.0 Beta1 | [Download](../../release-notes/OpenHarmony-v4.0-beta1.md)| - | - |
+| Full code base (for mini, small, and standard systems) | 4.0 Beta2 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta2/code-v4.0-Beta2.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta2/code-v4.0-Beta2.tar.gz.sha256)| 27.7 GB |
+| Hi3861 solution (binary) | 4.0 Beta2 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta2/hispark_pegasus.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta2/hispark_pegasus.tar.gz.sha256)| 27.5 MB |
+| Hi3516 solution-LiteOS (binary)| 4.0 Beta2 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta2/hispark_taurus_LiteOS.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta2/hispark_taurus_LiteOS.tar.gz.sha256)| 300.9 MB |
+| Hi3516 solution-Linux (binary) | 4.0 Beta2 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta2/hispark_taurus_Linux.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta2/hispark_taurus_Linux.tar.gz.sha256)| 192.4 MB |
+| RK3568 standard system solution (binary) | 4.0 Beta2 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta2/dayu200_standard_arm32.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta2/dayu200_standard_arm32.tar.gz.sha256)| 5.2 GB |
+| RELEASE-NOTES | 4.0 Beta1 | [Download](../../release-notes/OpenHarmony-v4.0-beta2.md) | - | - |
| **Compiler Toolchain**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**|
| Compiler toolchain| - | [Download](https://repo.huaweicloud.com/openharmony/os/2.0/tool_chain/)| - | - |
diff --git a/en/device-dev/subsystems/Readme-EN.md b/en/device-dev/subsystems/Readme-EN.md
index 996d167977dbd065df2c730b565bcfa7790cb3ba..b523ddf6c05fe9da6f17719966cdf5b4e3c01675 100644
--- a/en/device-dev/subsystems/Readme-EN.md
+++ b/en/device-dev/subsystems/Readme-EN.md
@@ -24,8 +24,6 @@
- [Using Cargo2gn](subsys-build-cargo2gn-guide.md)
- [FAQs](subsys-build-FAQ.md)
- [ArkCompiler Development](subsys-arkcompiler-guide.md)
-- Graphics
- - [Graphics Overview](subsys-graphics-overview.md)
- ArkUI
- [Custom Window Title Bar Development](subsys-arkui-customize_titlebar.md)
- Small-System Graphics
diff --git a/en/device-dev/subsystems/subsys-boot-overview.md b/en/device-dev/subsystems/subsys-boot-overview.md
index 2636bc078baedad412e0e96ab6fcf022bf0328b0..24e184b3dbe611885e1c697d33621ea13fd70dc1 100644
--- a/en/device-dev/subsystems/subsys-boot-overview.md
+++ b/en/device-dev/subsystems/subsys-boot-overview.md
@@ -11,45 +11,45 @@ The following figure shows the context structure of the Startup subsystem.
When the system is powered on, the kernel loads and starts services and applications as follows:
-1. The kernel loads the init process, which is specified by **cmdline** of the kernel when the bootloader starts the kernel.
-2. After the init process is started, **tmpfs** and **procfs** are mounted and basic **dev** nodes are created to establish a basic root file system.
-3. The init process starts the ueventd process to listen for device hot-swap events in the kernel and creates **dev** nodes for related devices as well as partitions for the block device.
-4. After mounting partitions (**system** and **vendor**) of the block device, the init process scans for the init startup script of each system service and starts the respective system ability (SA).
+1. The kernel loads the init process, which is specified by `cmdline` of the kernel when the bootloader starts the kernel.
+2. After the init process is started, `tmpfs` and `procfs` are mounted and basic `dev` nodes are created to establish a basic root file system.
+3. The init process starts the ueventd process to listen for device hot-swap events in the kernel and creates `dev` nodes for related devices as well as partitions for the block device.
+4. After mounting partitions (`system` and `vendor`) of the block device, the init process scans for the init startup script of each system service and starts the respective system ability (SA).
5. Each SA registers with the samgr process, which serves as the service registration center. The samgr process assigns each SA with an ID, which will be used by an application to access the desired SA.
-6. The foundation process sends the application startup request to the appspawn process. The foundation implements application lifecycle management. It is a special SA service process that provides the user program management framework and basic services.
-7. The appspawn process directly spawns the application process, eliminating the need for the application to load the JS runtime environment. This reduces the application startup time.
+6. The foundation process implements application lifecycle management. It is a special SA service process that provides the user program management framework and basic services.
+7. For an application, loading of the JS running environment involves a great deal of preparations. To reduce the application startup time, the appspawn process directly spawns an application process once receiving an application startup request from the foundation process.
The Startup subsystem consists of the following modules:
-- init module
+- init Module
- This module corresponds to the init process, which is the first user-mode process started after the kernel is initialized. After the init process starts, it reads and parses the **init.cfg** file. Based on the parsing result, the init module executes the commands listed in Table 2 in [Job Management](../subsystems/subsys-boot-init-jobs.md) and starts the key system service processes in sequence with corresponding permissions granted.
+ This module corresponds to the init process, which is the first user-space process started after the kernel is initialized. After the init process starts, it reads and parses the `init.cfg` file. Based on the parsing result, the init module executes the commands listed in Table 2 in [Job Management](../subsystems/subsys-boot-init-jobs.md#available-apis) and starts the key system service processes in sequence with corresponding permissions granted.
- ueventd module
- This module listens for **netlink** events about hot swap of kernel device drivers and dynamically manages the **dev** node of the corresponding device based on the event type.
+ This module listens for **netlink** events about hot plug of kernel device drivers and dynamically manages the `dev` node of the corresponding device based on the event type.
-- appspawn module
+- appspawn Module
This module spawns application processes upon receiving commands from the foundation, configures permissions for new processes, and calls the entry function of the application framework.
-- bootstrap module
+- bootstrap Module
- This module provides entry identifiers for starting services and features. When SAMGR is started, the entry function identified by bootstrap is called and system services are started.
+ This module provides entry identifiers for starting services and features. When samgr is started, the entry function identified by bootstrap is called and system services are started.
-- syspara module
+- syspara
This module provides APIs for obtaining device information, such as the product name, brand name, and manufacturer name, based on the OpenHarmony Product Compatibility Specifications (PCS). It also provides APIs for setting and obtaining system attributes.
## Constraints
- The source code directory of the Startup subsystem varies according to the platform.
+ The source code directory of the Startup subsystem varies according to the platform.
- **Table 1** Directories and applicable platforms of the Startup subsystem
+ **Table 1** Directories and applicable platforms of the Startup subsystem
-| Source Code Directory| Applicable Platform|
+| Name| Applicable Platform|
| -------- | -------- |
| base/startup/appspawn_lite | Small-system devices (reference memory ≥ 1 MiB), for example, Hi3516D V300 and Hi3518E V300|
| base/startup/bootstrap_lite | Mini-system devices (reference memory ≥ 128 KiB), for example, Hi3861 V100|
@@ -57,14 +57,14 @@ The Startup subsystem consists of the following modules:
| base/startup/syspara_lite | - Mini-system devices (reference memory ≥ 128 KiB), for example, Hi3861 V100 - Small-system devices (reference memory ≥ 1 MiB), for example, Hi3516D V300 and Hi3518E V300|
- init module
- - To start a system service, you first need to write a boot script file named **init.cfg**, in which you define the service name, path of executable files, permissions, etc.
- - The boot script of each system service is installed in the **/system/etc/init** directory. The init process scans this directory for the boot script to execute.
+ - To start a system service, you first need to write a boot script file named `init.cfg`, in which you define the service name, path of executable files, permissions, etc.
+ - The boot script of each system service is installed in the `/system/etc/init` directory. The init process scans this directory for the boot script to execute.
-- When porting a new chip platform, you need to add the **/vendor/etc/init/init.{hardware}.cfg** file that contains the platform-level initialization configuration. This file is used to implement platform-level initialization, for example, installing the ko driver and configuring information on the related **/proc** nodes.
+- When porting a new chip platform, you need to add the `/vendor/etc/init/init.{hardware}.cfg` file that contains the platform-level initialization configuration. This file is used to implement platform-level initialization, for example, installing the ko driver and configuring information on the related `/proc` nodes.
> **NOTE**
- >
- > The configuration file **init.cfg** must be in JSON format.
+ >
+ > The configuration file `init.cfg` must be in JSON format.
- bootstrap module: The zInit code must be configured in the link script.
@@ -83,67 +83,67 @@ By default, the OpenHarmony standard system supports the images listed in the fo
On each development board, you need to partition the memory to store the preceding images. When the SoC starts, the bootloader loads the images as follows:
- Initializes hardware such as the ROM and RAM, and loads the partition table information.
-- Loads the **boot.img** file based on the partition table and parses and loads the **ramdisk.img** file to the memory.
-- Prepares the partition table information and ramdisk address and enters the kernel, so that the kernel loads the ramdisk image and starts the init process.
-- Waits until the init process prepares the initial file system and mounts **required.fstab** (including **system.img** and **vendor.img**) to the file system.
-- Scans the boot scripts in the **etc/init** directory in **system.img** and **vendor.img** and runs each boot command.
+- Loads the `boot.img` file based on the partition table and parses and loads the `ramdisk.img` file to the memory.
+- Prepares the partition table information and ramdisk address and enters the kernel, so that the kernel loads the the ramdisk image and starts the init process.
+- Waits until the init process prepares the initial file system and mounts `required.fstab` (including `system.img` and `vendor.img`) to the file system.
+- Scans the boot scripts in the `etc/init` directory in `system.img` and `vendor.img` and runs each boot command.
### U-Boot Process
-[U-Boot](https://elinux.org/U-Boot) is used as an example to describe the key image loading process. When U-Boot starts the system, it passes the boot information to the system by using **bootargs**.
+[U-Boot](https://elinux.org/U-Boot) is used as an example to describe the key image loading process. When U-Boot starts the system, it passes the boot information to the system by using `bootargs`.
-- **boot.img** loading and parsing
+- `boot.img` loading and parsing
- - **boot.img** format
+ - `boot.img` format
- **boot.img** building and loading vary depending on the platform. The implementation on mainstream OpenHarmony platforms is as follows:
+ `boot.img` building and loading varies depending on the platform. The implementation on mainstream OpenHarmony platforms is as follows:
- - Hi3516D V300
+ - Hi3516DV300
- On this platform, the **boot.img** file uses the flattened image tree (FIT) format. It is generated by the Mkimage tool by packing the **zImage-dtb** and **cpio** images, which are generated after kernel compilation, based on the information in the **.its** file.
+ On this platform, the `boot.img` file uses the flattened image tree (FIT) format. It is generated by the Mkimage tool by packing the `ramdisk.img` files, which are packed by using `zImage-dtb` or `cpio` during kernel building, based on the information in the `its` file.
The related files and tool are described as follows:
- 1. **.its** file
+ 1. `its` file
- An image source file that describes the information about the image to be generated. You need to create the file, for example, the **ohos.its** file on the Hi3516 platform.
+ An image source file that describes the information about the image to be generated. You need to create the file, for example, the `ohos.its` file on the Hi3516 platform.
2. Mkimage packaging tool
- A tool that parses **its** files and packs the corresponding images based on the image configuration to generate an **itb** file, that is, **boot.img**.
+ A tool that parses `its` files and packs the corresponding images based on the image configuration to generate an `itb` file, that is, `boot.img`.
- 3. ramdisk
+ 3. `ramdisk` image
- An image file generated by packing **cpio** images.
+ A `ramdisk.img` file packed by using `cpio`.
- 4. zImage-dtb
+ 4. `zImage-dtb` image
- An image file that contains the compressed kernel image and device description file image.
+ An image that contains the compressed kernel image and device description file image.
- rk3568
- On this platform, the **boot.img** file is named **boot_linux.img**. The packaged files are different from those on the Hi3516D V300 platform.
+ On this platform, the `boot.img` file is named `boot_linux.img`. The packaged files are different from those on the Hi3516D V300 platform.
1. Image
- Image file generated after kernel compilation.
+ Image file generated after kernel building.
2. toybrick.dtb
- A file that is similar to the device description file image generated after dts compilation.
+ A file that is similar to the device description file image generated through `dts` building.
3. ramdisk.img
- An image file generated by packing **cpio** images.
+ A `ramdisk.img` file packed by using `cpio`.
- U-Boot loading
- The ramdisk boot process is supported. In this scenario, you need to modify the product configuration file in **productdefine** and enable ramdisk generation by setting **enable_ramdisk**. The ramdisk processing method varies according to the platform. Take the Hi3516D V300 platform as an example. You need to change the original U-Boot parameter to **root=/dev/ram0 initrd=0x84000000,0x292e00**.
+ The ramdisk boot process is supported. In this scenario, you need to modify the product configuration file in `productdefine` and enable ramdisk generation by setting `enable_ramdisk`. The ramdisk processing method varies according to the platform. Take the Hi3516D V300 platform as an example. You need to change the original U-Boot parameter to `root=/dev/ram0 initrd=0x84000000,0x292e00`.
- Kernel start
- When the U-Boot starts the kernel, it can pass key information to the kernel through **bootargs**. The information varies according to the platform. The main fields are described in the table below.
+ When U-Boot starts the kernel, it can pass key information to the kernel through `bootargs`. The information varies according to the platform. The main fields are described in the table below.
| Name | Example | Description |
| ----------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
@@ -151,53 +151,53 @@ On each development board, you need to partition the memory to store the precedi
| init | /init | |
| blkdevparts | mmcblk0:1M(boot),15M(kernel),200M(system),200M(vendor), 2M(misc),20M(updater),-(userdata) | Partition table information. The kernel creates physical partitions based on the information. |
| hardware | Hi3516D V300, rk3568, etc. | (Mandatory information) Hardware platform.|
- | root | /dev/ram0 (Hi3516D V00) , root=PARTUUID=614e0000-0000 rw (rk3568) | Boot device loaded by the kernel.|
+ | root | /dev/ram0 (Hi3516DV00), root=PARTUUID=614e0000-0000 rw (rk3568) | Boot device loaded by the kernel.|
| rootfstype | ext4 | Type of the root file system.|
- | default_boot_device | soc/10100000.himci.eMMC | (Recommended information) Default boot device. In the first phase of the boot process, a soft link will be created for the required device based on this field.|
- | ohos.required_mount.xxx | /dev/block/platform/soc/10100000.himci.eMMC/by-name/xxx@/usr@ext4@ro,barrier=1@wait,required | The fstab information is first read from cmdline. If this fails, the system will try to read the information from the **fstab.required** file.|
+ | default_boot_device | soc/10100000.himci.eMMC | (Recommended information) Default boot device. In the first phase of the boot process, a soft link will be created for the `required` partition device based on this field.|
+ | ohos.required_mount.xxx | /dev/block/platform/soc/10100000.himci.eMMC/by-name/xxx@/usr@ext4@ro,barrier=1@wait,required | The fstab information is first read from cmdline. If this fails, the system will try to read the information from the `fstab.required` file.|
-- Mounting of required partitions
+- Mounting of `required` partitions
- A required partition is one that is essential for system boot. It must be mounted before level-2 boot. For mandatory images like system and vendor images, the corresponding block device files must be created before mounting. This is usually done based on UEVENT events reported by the kernel. The init process needs to know the main device directory of the storage device. The bootloader passes the primary device directory of the storage device to the init process through **default_boot_device**.
+ A `required` partition is one that is essential for system boot. It must be mounted before level-2 boot. For mandatory images like system and vendor images, the corresponding block device files must be created before mounting. This is usually done based on the **uevent** messages reported by the kernel. The init process needs to know the main device directory of the storage device. The bootloader process passes the primary device directory of the storage device to the init process through `default_boot_device`.
- Currently, the init process obtains required partition information in two ways. The init process first reads the required partition information through the **bootargs** in **/proc/cmdline**. If the attempt fails, the init process reads the **fstab.required** file in the ramdisk image.
+ Currently, the init process obtains `required` partition information in two ways. The init process first reads the `required` partition information through `bootargs` in `/proc/cmdline`. If the attempt fails, the init process reads the `fstab.required` file in the ramdisk image.
- Logic of block device creation
- Preparation
- 1. The init process reads the required fstab information from **cmdline**. If the attempt fails, the init process reads the **fstab.required** file to obtain **PARTNAME** of the block devices that must be mounted, for example, **system** or **vendor**.
- 2. Create a socket for receiving uevent messages reported by the kernel and read **default_boot_device** from **/proc/cmdline**.
- 3. Traverse the **/sys/devices** directory with the fstab information and socket handle to get the kernel prepared for reporting uevent messages.
+ 1. The init process reads the `fstab.required` file from `cmdline`. If the attempt fails, the init process reads the `fstab.required` file to obtain `PARTNAME` of the block devices that must be mounted, for example, `system` or `vendor`.
+ 2. Create a socket for receiving **uevent** messages reported by the kernel and read `default_boot_device` from `/proc/cmdline`.
+ 3. Traverse the `/sys/devices` directory with the fstab information and socket handle to get the kernel prepared for reporting **uevent** messages.
- - Event triggering
+ - Trigger event
- 1. Use **ueventd** to trigger the kernel to report a uevent message.
- 2. Check whether **partitionName** in the uevent message matches with device information in the required fstab.
- 3. If they match, format the device node path and proceed with device node creation.
+ 1. Use **ueventd** to trigger the kernel to report a **uevent** message.
+ 2. Check whether `partitionName` in the **uevent** message matches with device information in the `fstab.required` file.
+ 3. If they match, format the device node path and proceed with device node creation.
- - Device node creation
+ - Creating Nodes
- 1. Format the path of the soft link to be created for required block device nodes. A soft link helps facilitate access to device nodes in user mode and improve their readability.
- 2. Create device nodes based on the primary and secondary device numbers passed in the uevent message, and the device node path and soft link path obtained in the previous steps. Meanwhile, create a soft link for them.
+ 1. Format the path of the soft link to be created for required block device nodes. A soft link helps facilitate access to device nodes in user mode and improve their readability.
+ 2. Create device nodes based on the primary and secondary device numbers passed in the **uevent** message, and the device node path and soft link path obtained in the previous steps. Meanwhile, create a soft link for them.
Up to now, the creation of block device nodes is complete.
- - Mapping with **default_boot_device**
+ - Mapping with `default_boot_device`
- The kernel writes **bootargs** information to **/proc/cmdline**. The information includes **default_boot_device**, which specifies the primary device directory required for system boot. The content prefixed with **ohos.required_mount.** is the partition mounting information required for system boot. It should be the same as that in the **fstab.required** file. In addition, the block device node in the partition mounting information should be a device node pointed by the soft link under **by-name** in the **default_boot_device** directory. For example, if the value of **default_boot_device** is **soc/10100000.himci.eMMC**, then the value of **ohos.required_mount.system** contains **/dev/block/platform/soc/10100000.himci.eMMC/by-name/system**, which is the soft link pointing to the system device node.
+ The kernel writes `bootargs` information to `/proc/cmdline`. The information includes `default_boot_device`, which specifies the primary device directory required for system boot. The content prefixed with `ohos.required_mount.` is the partition mounting information required for system boot. It should be the same as that in the `fstab.required` file. In addition, the block device node in the partition mounting information should be a device node pointed by the soft link under `by-name` in the `default_boot_device` directory. For example, if the value of `default_boot_device` is `soc/10100000.himci.eMMC`, then the value of `ohos.required_mount.system` contains `/dev/block/platform/soc/10100000.himci.eMMC/by-name/system`, which is the soft link pointing to the system device node.
- During creation of a block device node, the device path will be matched against the value of **default_boot_device**. If the matching is successful, a soft link pointing to the real block device node will be created in **/dev/block/by-name**. In this way, device node access is made irrelevant to the chip platform.
+ During creation of a block device node, the device path will be matched against the value of `default_boot_device`. If the matching is successful, a soft link pointing to the real block device node will be created in `/dev/block/by-name`. In this way, device node access is made irrelevant to the chip platform.
- Example
- This example assumes the **system** partition as the required partition on the Hi3516D V300 platform to illustrate the boot process. During this process, the init process reads the required fstab information, creates a block device node, and mounts it to the required partition. The following provides the key code snippets and log information as reference for debugging.
+ This example assumes the `system` partition as the `required` partition on the Hi3516D V300 platform to illustrate the boot process. During this process, the init process reads the `fstab.required` file, creates a block device node, and mounts it to the `required` partition. The following provides the key code snippets and log information as reference for debugging.
> **NOTE**
- >
+ >
> The code snippets below are exhibited in the logical sequence. They are not neighboring to each other in the source code.
- 1. Obtain required device information.
+ 1. Obtain `required` partition device information.
```
Fstab* LoadRequiredFstab(void)
{
@@ -209,20 +209,20 @@ On each development board, you need to partition the memory to store the precedi
if (access(fstabFile, F_OK) != 0) {
fstabFile = "/system/etc/fstab.required";
}
- INIT_ERROR_CHECK(access(fstabFile, F_OK) == 0, abort(), "Failed to get fstab.required");
+ INIT_ERROR_CHECK(access(fstabFile, F_OK) == 0, abort(), "Failed get fstab.required");
fstab = ReadFstabFromFile(fstabFile, false);
}
return fstab;
}
```
- The preceding code provides two methods for the init process to obtain the fstab information. First, the init process calls **LoadFstabFromCommandLine()** to read the fstab information from **cmdline**. If the attempt fails, the init process reads the **fstab.required** file to obtain the fstab information.
+ The preceding code provides two methods for the init process to obtain the fstab information. First, the init process calls `LoadFstabFromCommandLine()` to read the fstab information from `cmdline`. If the attempt fails, the init process outputs log information and continues to read the `fstab.required` file for the fstab information.
- For the **system** partition, the key information read from **devices** is as follows:
+ For the `system` partition, the key information read from `devices` is as follows:
```
/dev/block/platform/fe310000.sdhci/by-name/system
```
- 2. Create a socket and trigger the kernel to report a uevent message.
+ 2. Create a socket and trigger the kernel to report a **uevent** message.
```
static int StartUeventd(char **requiredDevices, int num)
{
@@ -238,15 +238,15 @@ On each development board, you need to partition the memory to store the precedi
}
```
- 3. Read information from **cmdline** to obtain **default_boot_device**.
+ 3. Read information from `cmdline` to obtain `default_boot_device`.
```
char *buffer = ReadFileData("/proc/cmdline");
int ret = GetProcCmdlineValue("default_boot_device", buffer, bootDevice, CMDLINE_VALUE_LEN_MAX);
- INIT_CHECK_ONLY_ELOG(ret == 0, "Failed to get default_boot_device value from cmdline");
+ INIT_CHECK_ONLY_ELOG(ret == 0, "Failed get default_boot_device value from cmdline");
```
- In this example, the value of **default_boot_device** is **soc/10100000.himci.eMMC**. The value is stored in the global variable **bootDevice** and will be matched with the path of the **system** partition device when a soft link is created.
+ In this example, the value of `default_boot_device` is `soc/10100000.himci.eMMC`. The value is stored in the global variable `bootDevice` and will be matched with the path of the `system` partition device when a soft link is created.
- 4. Process the uevent message of the required partition device.
+ 4. Process the **uevent** message of the `required` partition device.
```
if (uevent->partitionName == NULL) {
INIT_LOGI("Match with %s for %s", devices[i], uevent->syspath);
@@ -264,11 +264,11 @@ On each development board, you need to partition the memory to store the precedi
break;
}
```
- In this step, the device information in **devices** is matched with the uevent message reported by the kernel. The value of **uevent->partitionName** should be **system** for the uevent message of the **system** partition device. If the value matches the **/dev/block/platform/fe310000.sdhci/by-name/system** field in **devices**, the uevent message of the **system** partition device will be processed.
+ In this step, the device information in `devices` is matched with the **uevent** message reported by the kernel. The value of `uevent -> partitionName` should be `system` for the **uevent** message of the `system` partition device. If the value matches the `/dev/block/platform/fe310000.sdhci/by-name/system` field in `devices`, the **uevent** message of the `system` partition device will be processed.
- 5. Create the required device node and the corresponding soft link.
+ 5. Create the `required` partition device node and the corresponding soft link.
- The first thing is to format the path of the corresponding soft link. In this step, the value of **default_boot_device** in **bootargs** will be matched with the path of the required device node in the uevent message, so as to create a platform-irrelevant soft link that points to the device node. The key code is as follows:
+ The first thing is to format the path of the corresponding soft link. In this step, the value of `default_boot_device` in `bootargs` will be matched with the path of the required device node in the **uevent** message, so as to create a platform-irrelevant soft link that points to the device node. The key code is as follows:
```
if (STRINGEQUAL(bus, "/sys/bus/platform")) {
INIT_LOGV("Find a platform device: %s", parent);
@@ -285,29 +285,28 @@ On each development board, you need to partition the memory to store the precedi
```
The key variables in the code are as follows:
- - **bus**: a string that saves the path of the bus connected to the current device.
- - **parent**: a string that stores the device path obtained from **syspath** in the uevent message.
- - **links**: a pointer to the memory that stores the soft link path.
- - **bootDevice**: a string that stores the value of **default_boot_device** in **bootargs**
-
- According to the code, the corresponding soft link is created for the device only when the type of the connected bus is **platform**. The path of the soft link is as follows:
+ - `bus`: a string that saves the path of the bus connected to the current device.
+ - `parent`: a string that stores the device path obtained from `uevent -> syspath` in the **uevent** message.
+ - `links`: a pointer to the memory that stores the soft link path.
+ - `bootDevice`: a string that stores the value of `default_boot_device` in `bootargs`.
+ According to the code, the corresponding soft link is created for the device only when the type of the connected bus is `platform`. The path of the soft link is as follows:
```
/dev/block/platform/soc/10100000.himci.eMMC/by-name
```
- A platform-irrelevant soft link is created only when the device path matches that in **bootDevice**.
+ A platform-irrelevant soft link is created only when the device path matches that in `bootDevice`.
For the **system** partition device, the path is as follows:
```
/sys/devices/platform/soc/10100000.himci.eMMC/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p5
```
- Therefore, when processing the uevent message of the device, the init process compares the device path with that in **bootDevice**, that is, **soc/10100000.himci.eMMC**. If they match, a soft link will be created as follows:
+ Therefore, when processing the **uevent** message of the device, the init process compares the device path with that in `bootDevice`, that is, `soc/10100000.himci.eMMC`. If they match, a soft link will be created as follows:
```
/dev/block/by-name/system
```
- After the soft link path is formatted, the init process creates the device node and soft link based on the information in the uevent message. Up to now, the creation of a device node for the system partition is complete.
+ After the soft link path is formatted, the init process creates the device node and soft link based on the information in the **uevent** message. Up to now, the creation of a device node for the `system` partition is complete.
- 6. Mount the required partition.
+ 6. Mount the `required` partition.
After a device node is created, mount it to the corresponding partition. The code is as follows:
```
@@ -320,45 +319,47 @@ On each development board, you need to partition the memory to store the precedi
return rc;
}
```
- Therefore, when "Mount required partitions" is displayed, the required partition device is ready for mounting. During the mounting process, the following key information is printed:
+ Therefore, when "Mount required partitions" is displayed, the `required` partition device is ready for mounting. During the mounting process, the following key information is printed:
```
BEGET_LOGE("Unsupported file system \" %s \"", item->fsType);
- // The current file system type is not supported.
-
+ ```
+ The current file system type is not supported.
+ ```
BEGET_LOGE("Cannot get stat of \" %s \", err = %d", target, errno);
- // Failed to obtain the mount point directory.
-
+ ```
+ The attempt to obtain the mount point directory has failed.
+ ```
BEGET_LOGE("Failed to create dir \" %s \", err = %d", target, errno);
- // Failed to create the mount point directory.
-
+ ```
+ The attempt to create the mount point directory has failed.
+ ```
BEGET_LOGI("Mount %s to %s successful", item->deviceName, item->mountPoint);
- // The device is successfully mounted. The output also contains the name of the mounted device and information about the mount point.
```
+ The device is successfully mounted. The output also contains the name of the mounted device and information about the mount point.
+- Mounting of the `vendor` partition
-- Mounting of vendor partitions
-
- After mounting required partitions, the init process scans each script file in the **vendor** partition. The initialization scripts related to the chip or development board are named in the format of **/vendor/etc/init.{ohos.boot.hardware}.cfg**. Wherein, **/vendor/etc/fstab.{ohos.boot.hardware}** represents the extended mount partition file; **hardware** is sourced from **bootargs**, which is passed from the bootloader to the kernel.
+After mounting required partitions, the init process scans each script file in the `vendor` partition. The initialization scripts related to the chip or development board is named in the format of `/vendor/etc/init.{ohos.boot.hardware}.cfg`. Wherein, `/vendor/etc/fstab.{ohos.boot.hardware}` represents the extended mount partition file; `hardware` is sourced from `bootargs`, which is passed from the bootloader to the kernel.
### Boot Loading Without ramdisk
-Certain development boards do not use the ramdisk boot mode. For these boards, the boot process is implemented by directly loading the **system.img** file through the kernel. In such case, you need to modify the product configuration file in **productdefine**. Specifically, you need to turn off the **enable_ramdisk** switch to disable ramdisk generation so that the init process does not boot from ramdisk to system.
+Certain development boards do not use the ramdisk boot mode. For these boards, the boot process is implemented by directly loading the `system.img` file through the kernel. In such case, you need to modify the product configuration file in `productdefine`. Specifically, you need to turn off the `enable_ramdisk` switch to disable ramdisk generation so that the init process does not boot from ramdisk to system.
-Boot loading in this scenario is similar to that in the preceding section. The only difference is as follows: If ramdisk is used, the init process mounts **system.img** to the **/usr** directory and then switches to the **/usr** directory using **chroot**. If ramdisk is not used, the init process directly runs the **init.cfg** file.
+The boot loading process in this scenario is similar to that in the preceding section. The only difference is as follows: If ramdisk is used, the init process mounts `system.img` to the `/usr` directory and then switches to the `/usr` directory using `chroot`. If ramdisk is not used, the init process directly runs the `init.cfg` file.
-For boot loading without ramdisk (that is, system as root), the block device where the root file system is located is passed to the kernel through **bootargs**, for example, **root=/dev/mmcblk0p5 and rootfstype=ext4**. During initialization of the root file system, the kernel parses the **root** field in **bootargs** to complete mounting of the root file system.
+For the boot loading process without ramdisk, that is, system as root, the block device where the root file system is located is passed to the kernel through `bootargs`, for example, `root=/dev/mmcblk0p5, rootfstype=ext4`. During initialization of the root file system, the kernel parses the `root` field in `bootargs` to complete mounting of the root file system.
### Partition A/B Booting
-Currently, OpenHarmony supports booting from partitions A and B (active and standby system partitions), both of which are configured in the same device storage. During the booting process, the system partition to load is determined based on the slot of the active partition. Partition A/B booting is supported only for the system partition and chipset partition.
+Currently, OpenHarmony supports booting from partitions A and B (active and standby system partitions), both of which are configured in the same device storage. During the booting process, the system partition to load is determined based on the slot of the active partition. Partition A/B booting is supported only for the `system` and `chipset` partitions.
- bootslots
- Number of the supported boot partitions. If **bootslots** is set to **2**, the system can boot from both system partitions A and B. If **bootslots** is set to **1**, partition A/B booting is not supported and the system can boot only from the default system partition.
+ Number of the supported boot partitions. If `bootslots` is set to `2`, the system can boot from both system partitions A and B. If `bootslots` is set to `1`, partition A/B booting is not supported and the system can boot only from the default system partition.
- In the initial phase of init process startup, the system reads the **bootslots** value to determine whether partition A/B booting is supported. If yes, the system continues to determine the system partition to mount. If not, the system mounts the system partition based on the default fstab. The API for the init process to obtain the **bootslots** value is as follows:
+ In the initial phase of init process startup, the system reads the `bootslots` value to determine whether partition A/B booting is supported. If yes, the system continues to determine the system partition to mount. If not, the system mounts the system partition based on the default fstab. The API for the init process to obtain the `bootslots` value is as follows:
```
int GetBootSlots(void)
{
@@ -368,16 +369,16 @@ Currently, OpenHarmony supports booting from partitions A and B (active and stan
return GetSlotInfoFromCmdLine("bootslots");
}
```
- After normal system startup, you can obtain the **bootslots** value from the system parameter **ohos.boot.bootslots** to check whether the current system supports partition A/B booting. The command for obtaining **ohos.boot.bootslots** is as follows:
+ After normal system startup, you can obtain the `bootslots` value from the system parameter `ohos.boot.bootslots` to check whether the current system supports partition A/B booting. The command for obtaining `ohos.boot.bootslots` is as follows:
```
param get ohos.boot.bootslots
```
- currentslot
- Current system partition, for example, partition A or partition B. The value of **currentslot** is a number. For example, **1** indicates partition A, and **2** indicates partition B.
+ Current system partition, for example, partition A or partition B. The value of `currentslot` is a number. For example, `1` indicates partition A, and `2` indicates partition B.
- In the initial phase of startup, the init process determines whether the system supports partition A/B booting based on **bootslots**. If the system does not support partition A/B booting, the init process directly boots from the default system partition instead of obtaining the **currentslot** value. If the system supports partition A/B booting, the init process obtains the **currentslot** value and determines whether partition A or partition B is the current system partition. The API for the init process to obtain the **currentslot** value is as follows:
+ In the initial phase of startup, the init process determines whether the system supports partition A/B booting based on `bootslots`. If the system does not support partition A/B booting, the init process directly boots from the default system partition instead of obtaining the `currentslot` value. If the system supports partition A/B booting, the init process obtains the `currentslot` value and determines whether partition A or partition B is the current system partition. The API for the init process to obtain the `currentslot` value is as follows:
```
int GetCurrentSlot(void)
{
@@ -396,10 +397,10 @@ Currently, OpenHarmony supports booting from partitions A and B (active and stan
}
```
-- Partition A/B booting process
+- Partition A/B Booting Process
- 1. Obtain the **currentslot** value to determine whether partition A or partition B is the current system partition.
- 2. Construct new partition mounting configuration based on the original fstab file, and add the suffix **a** or **b** to the partitions that support partition A/B booting, that is, system and chipset partitions.
+ 1. Obtain the `currentslot` value to determine whether partition A or partition B is the current system partition.
+ 2. Construct new partition mounting configuration based on the original `fstab` file, and add the suffix `_a` or `_b` to the partitions that support partition A/B booting, that is, system and chipset partitions.
3. Mount the partition added with the corresponding suffix and enter the second phase of startup. This phase occurs in partition A or B and concludes the partition A/B booting process.
The API for constructing new partition mounting configuration is as follows:
@@ -420,7 +421,7 @@ Currently, OpenHarmony supports booting from partitions A and B (active and stan
}
```
-- Development example
+- Development Example
The following uses the rk3568 platform as an example to illustrate how to change from default partition booting to partition A/B booting.
@@ -429,50 +430,51 @@ Currently, OpenHarmony supports booting from partitions A and B (active and stan

Use the original image to construct images of the partitions used for partition A/B booting, and test the partition A/B booting function.
- - Copy the **system** and **vendor** images, and add the suffix **\_b** to them.
- - Add partitions **system_b** and **vendor_b** to the partition table in **parameter.txt**.
+ - Copy the `system` and `vendor` images, and add the suffix `_b` to them.
+ - Add partitions `system_b` and `vendor_b` to the partition table in the `parameter.txt` file.
2. Burn the images of the partitions used for partition A/B booting.
- - Import the partition configuration to the rk3568 burning tool, and select the **parameter.txt** file containing the **system_b** and **vendor_b** partitions.
- - Select images (including **system_b** and **vendor_b** images) based on the new partition table configuration, and then burn the images.
+ - Import the partition configuration to the rk3568 burning tool, and select the `parameter.txt` file containing the `system_b` and `vendor_b` partitions.
+ - Select images (including `system_b` and `vendor_b` images) based on the new partition table configuration, and then burn the images.
3. After the configuration is complete, perform the following:
- 1. Run the **cat /proc/cmdline** command. If the command output contains **bootslot=2**, the system supports partition A/B booting.
+ 1. Run the `cat /proc/cmdline` command. If the command output contains `bootslot=2`, the system supports partition A/B booting.

- 2. Run the **param get ohos.boot.bootslot** command. If the command output contains **2**, the **bootslot** information is successfully written to the **parameter.txt**.
+ 2. Run the `param get ohos.boot.bootslot` command. If the command output contains `2`, the `bootslot` information is successfully written to the `parameter.txt` file.
- 3. Run the **ls -l /dev/block/by-name** command. If the command output contains **system_b** and **vendor_b**, device nodes are successfully created in partition B.
+ 3. Run the `ls -l /dev/block/by-name` command. If the command output contains `system_b` and `vendor_b`, device nodes are successfully created in partition B.

- 4. Run the **df -h** command to check the partitions mounted to the system.
+ 4. Run the `df -h` command to check the partitions mounted to the system.

- As shown in the figure, partition **mmcblk0p6** is mounted to the root file system (represented by a slash), and partition **mmcblk0p7** is mounted to **/vendor**. Based on the command output in step 3, **mmcblk0p6** is the **system** partition, and **mmcblk0p7** is the **vendor** partition. That is, the mounted partitions are the default partitions, that is, **system** and **vendor** partitions without suffixes. In other words, partition A is the default partition.
+ As shown in the figure, partition `mmcblk0p6` is mounted to the root file system (represented by a slash), and partition `mmcblk0p7` is mounted to `/vendor`. Based on the command output in step 3, `mmcblk0p6` is the `system` partition, and `mmcblk0p7` is the `vendor` partition. That is, the mounted partitions are the default partitions, that is, `system` and `vendor` partitions without suffixes. In other words, partition A is the default partition.
Next, let's try booting from partition B.
- 1) Run the **partitionslot setactive 2** command to set the slot of the active partition to **2**, that is, the slot of partition B.
+ 1. Run the `partitionslot setactive 2` command to set the slot of the active partition to `2`, that is, the slot of partition B.
- 
+ 
- 2) Run the **partitionslot getslot** command to check the configured slot.
+ 2. Run the `partitionslot getslot` command to check the configured slot.
- 
+ 
- If **current slot** is **2**, the slot of the active partition is successfully set to **2**.
+ If `current slot: 2` is `2`, the slot of the active partition is successfully set to `2`.
- 3) Upon restarting, run the **df -h** command to check the partitions mounted to the system.
- According to the command output, partition **mmcblk0p11** is mounted to the root file system, and partition **mmcblk0p12** is mounted to **/vendor**.
+ 3. Upon restarting, run the `df -h` command to check the partitions mounted to the system.
+
+ According to the command output, partition `mmcblk0p11` is mounted to the root file system, and partition `mmcblk0p12` is mounted to `/vendor`.
- 
+ 
- 4) Run the **ls -l /dev/block/by-name** command again.
+ 4. Run the `ls -l /dev/block/by-name` command again.
- 
+ 
- **mmcblk0p11** corresponds to **system_b**, and **mmcblk0p12** corresponds to **vendor_b**. That is, the system is successfully booted from partition B.
+ `mmcblk0p11` corresponds to `system_b`, and `mmcblk0p12` corresponds to `vendor_b`. That is, the system is successfully booted from partition B.
diff --git a/en/device-dev/subsystems/subsys-dfx-hidumper.md b/en/device-dev/subsystems/subsys-dfx-hidumper.md
index bd1c46cdd275fc17d2858d9d2d2c65acd67633ee..6bbdda182b0ca2265b23e16f844f9844d35625b8 100644
--- a/en/device-dev/subsystems/subsys-dfx-hidumper.md
+++ b/en/device-dev/subsystems/subsys-dfx-hidumper.md
@@ -191,3 +191,9 @@ The procedure is as follows:
```
hidumper -t [timeout]
```
+
+19. Run the **hidumper --mem-smaps pid [-v]** command to obtain the detailed memory usage of the specified process.
+
+ ```
+ hidumper --mem-smaps pid [-v]
+ ```
diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md b/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md
index 613c624e1a155a1a97e6e042eb9b4a906947ee76..95bdd78be0231342ffac333ca4f15c43654cd5e2 100644
--- a/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md
+++ b/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md
@@ -4,156 +4,319 @@
## Overview
-### Introduction
+### Function Introduction
-HiSysEvent supports listening for events across processes. You can register a listener to listen for concerned events on a real-time basis. For example, you can enable the battery module to listen for power consumption events for power usage analysis.
+HiSysEvent supports listening for events across processes. You can register a listener to listen for concerned events on a real-time basis. For example, you can enable the battery module to subscribe to power consumption events for power usage analysis.
### Constraints
-Before subscribing to system events, you need to configure HiSysEvent logging. For details, see [HiSysEvent Logging Configuration](../subsystems/subsys-dfx-hisysevent-logging-config.md).
+Before listening for system events, you need to configure HiSysEvent logging. For details, see [HiSysEvent Logging Configuration](../subsystems/subsys-dfx-hisysevent-logging-config.md).
-## Development Guidelines
-
+## How to Develop
### Available APIs
- **Table 1** Description of HiSysEventListener APIs
+#### C++ APIs
-| API| Description|
-| -------- | -------- |
-| int32_t HiSysEventManager::AddListener(std::shared_ptr<HiSysEventListener> listener, std::vector<ListenerRule>& rules) | Registers a listener for system events. You can listen for certain events by specifying rules. Input arguments: - **listener**: callback object for system events. - **rules**: rules for event listening. Return value: - **0**: Registration is successful. - A negative value: Registration has failed.|
-| int32_t HiSysEventManager::RemoveListener(std::shared_ptr<HiSysEventListener> listener) | Removes the listener for system events. Input arguments: - **listener**: callback object for system events. Return value: - **0**: Canceling registration is successful. - A negative value: Canceling registration has failed. |
+HiSysEvent is implemented using the APIs provided by the **HiSysEventManager** class. For details, see the [API Header Files](/base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent_manager/include/).
- **Table 2** Description of ListenerRule
+> **NOTE**
+>
+> For details about the **RuleType** argument in the constructor of **ListenerRule**, see Table 4 in [HiSysEvent Query](subsys-dfx-hisysevent-query.md).
+
+ **Table 1** Description of C++ HiSysEventManager APIs
-| API| Description|
+| Name| Description|
| -------- | -------- |
-| ListenerRule(const std::string& tag, RuleType ruleType = RuleType::WHOLE_WORD) | Constructor used to create a **ListenerRule** object based on the event tag. Input arguments: - **tag**: event tag for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, lowercase letters, and digits. - **ruleType**: type of the **ListenerRule** object. The value is an enum defined by **RuleType**.|
-| ListenerRule(const std::string& domain, const std::string& eventName, RuleType ruleType = RuleType::WHOLE_WORD) | Constructor used to create a **ListenerRule** object based on the event domain and event name. Input arguments: - **domain**: event domain for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, digits, and underscores. - **eventName**: event name for the **ListenerRule** object. The value is a string of 1 to 32 characters, including uppercase letters, digits, and underscores. - **ruleType**: type of the **ListenerRule** object. The value is an enum defined by **RuleType**.|
-| ListenerRule(const std::string& domain, const std::string& eventName, const std::string& tag, RuleType ruleType = RuleType::WHOLE_WORD) | Constructor used to create a **ListenerRule** object based on the event domain, event name, and event tag. Input arguments: - **tag**: event tag for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, lowercase letters, and digits. - **domain**: event domain for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, digits, and underscores. - **eventName**: event name for the **ListenerRule** object. The value is a string of 1 to 32 characters, including uppercase letters, digits, and underscores. - **ruleType**: type of the **ListenerRule** object. The value is an enum defined by **RuleType**.|
+| int32_t HiSysEventManager::AddListener(std::shared_ptr<HiSysEventListener> listener, std::vector<ListenerRule>& rules) | Adds a listener to listen for system events based on the specified rules. Input arguments: - **listener**: listener for system events. - **rules**: event listening rules. Return value: - **0**: The listener is added successfully. - A negative value: The listener fails to be added.|
+| int32_t HiSysEventManager::RemoveListener(std::shared_ptr<HiSysEventListener> listener) | Removes the listener for system events. Input arguments: - **listener**: listener for system events. Return value: - **0**: The listener is removed successfully. - A negative value: The listener fails to be removed. |
- **Table 3** Description of RuleType
+ **Table 2** Description of ListenerRule
-| Value| Description|
+| Name| Description|
| -------- | -------- |
-| WHOLE_WORD | Whole word matching|
-| PREFIX | Prefix matching|
-| REGULAR | Regular expression matching|
+| ListenerRule(const std::string& tag, RuleType ruleType = RuleType::WHOLE_WORD) | Constructor used to create a **ListenerRule** object based on the event tag. Input arguments: - **tag**: event tag for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, lowercase letters, and digits. - **ruleType**: type of the **ListenerRule** object. The value is an enum defined by **RuleType**.|
+| ListenerRule(const std::string& domain, const std::string& eventName, RuleType ruleType = RuleType::WHOLE_WORD) | Constructor used to create a **ListenerRule** object based on the event domain and event name. Input arguments: - **domain**: event domain for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, digits, and underscores. - **eventName**: event name for the **ListenerRule** object. The value is a string of 1 to 32 characters, including uppercase letters, digits, and underscores. - **ruleType**: type of the **ListenerRule** object. The value is an enum defined by **RuleType**.|
+| ListenerRule(const std::string& domain, const std::string& eventName, const std::string& tag, RuleType ruleType = RuleType::WHOLE_WORD) | Constructor used to create a **ListenerRule** object based on the event domain, event name, and event tag. Input arguments: - **tag**: event tag for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, lowercase letters, and digits. - **domain**: event domain for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, digits, and underscores. - **eventName**: event name for the **ListenerRule** object. The value is a string of 1 to 32 characters, including uppercase letters, digits, and underscores. - **ruleType**: type of the **ListenerRule** object. The value is an enum defined by **RuleType**.|
- **Table 4** Description of HiSysEventListener
+ **Table 3** Description of HiSysEventListener
-| API| Description|
+| Name| Description|
| -------- | -------- |
-| void HiSysEventListener::OnEvent(std::shared_ptr<HiSysEventRecord> sysEvent) | Callback object for system events. Input arguments: - **sysEvent**: real-time system events. Return value: None.|
-| void HiSysEventListener::OnServiceDied() | Callback object for service exceptions. Input arguments: None. Return value: None.|
+| void HiSysEventListener::OnEvent(std::shared_ptr<HiSysEventRecord> sysEvent) | Callback object for system events. Input arguments: - **sysEvent**: real-time system event. Return value: None.|
+| void HiSysEventListener::OnServiceDied() | Callback object for service exceptions. Input arguments: None. Return value: None.|
-**Table 5** Description of HiSysEventRecord
-| API| Description|
+ **Table 4** Description of HiSysEventRecord
+| Name| Description|
| -------- | -------- |
-|std::string HiSysEventRecord::AsJson()|Obtains the content of a system event. Input arguments: None. Return value: Content of the system event.|
-|std::string HiSysEventRecord::GetDomain()|Obtains the domain name of a system event. Input arguments: None. Return value: Domain name of the system event.|
-|std::string HiSysEventRecord::GetEventName()|Obtains the name of a system event. Input arguments: None. Return value: Name of the system event.|
-|HiSysEvent::EventType HiSysEventRecord::GetEventType()|Obtains the type of a system event. Input arguments: None. Return value: Type of the system event.|
-|std::string HiSysEventRecord::GetLevel()|Obtains the level of a system event. Input arguments: None. Return value: Level of the system event.|
-|std::string HiSysEventRecord::GetTag()|Obtains the tag of a system event. Input arguments: None. Return value: Tag of the system event.|
-|std::string HiSysEventRecord::GetTimeZone()|Obtains the time zone of a system event. Input arguments: None. Return value: Time zone, in the format of **+0800**.|
-|int HiSysEventRecord::GetTraceFlag()|Obtains the distributed call chain tracing flag of a system event. Input arguments: None. Return value: Distributed call chain tracing flag.|
-|int64_t HiSysEventRecord::GetPid()|Obtains the ID of the process that flushes a system event to the disk. Input arguments: None. Return value: Process ID.|
-|int64_t HiSysEventRecord::GetTid()|Obtains the thread ID of the process that flushes a system event to the disk. Input arguments: None. Return value: Thread ID.|
-|int64_t HiSysEventRecord::GetUid()|Obtains the user ID of the process that flushes a system event to the disk. Input arguments: None. Return value: User ID.|
-|uint64_t HiSysEventRecord::GetPspanId()|Obtains the parent span ID of the distributed call chain tracing task. Input arguments: None. Return value: Parent span ID of the distributed call chain tracing task.|
-|uint64_t HiSysEventRecord::GetSpandId()|Obtains the span ID of the distributed call chain tracing task. Input arguments: None. Return value: Span ID of the distributed call chain tracing task.|
-|uint64_t HiSysEventRecord::GetTime()|Obtains the timestamp of a system event. Input arguments: None. Return value: Timestamp of the system event.|
-|uint64_t HiSysEventRecord::GetTraceId()|Obtains the ID of the distributed call chain tracing task. Input arguments: None. Return value: ID of the distributed call chain tracing task.|
-|void HiSysEventRecord::GetParamNames(std::vector<std::string>& params)|Obtains all key names of a system event. Input arguments: - **params**: key name array reference. Return value: None.|
-|int HiSysEventRecord::GetParamValue(const std::string& param, int64_t& value)|Parses the value of the **param** key in a system event into an int64\_t value. Input arguments: - **param**: key name. - **value**: int64\_t reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
-|int HiSysEventRecord::GetParamValue(const std::string& param, uint64_t& value)|Parses the value of the **param** key in a system event into a uint64\_t value. Input arguments: - **param**: key name. - **value**: uint64\_t reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
-|int HiSysEventRecord::GetParamValue(const std::string& param, double& value)|Parses the value of the **param** key in a system event into a double value. Input arguments: - **param**: key name. - **value**: double reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
-|int HiSysEventRecord::GetParamValue(const std::string& param, std::string& value)|Parses the value of the **param** key in a system event into a string value. Input arguments: - **param**: key name. - **value**: std::string reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
-|int HiSysEventRecord::GetParamValue(const std::string& param, std::vector<int64_t>& value)|Parses the value of the **param** key in a system event into an int64\_t array. Input arguments: - **param**: key name. - **value**: int64\_t array reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
-|int HiSysEventRecord::GetParamValue(const std::string& param, std::vector<uint64_t>& value)|Parses the value of the **param** key in a system event into a uint64\_t array. Input arguments: - **param**: key name. - **value**: uint64\_t array reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
-|int HiSysEventRecord::GetParamValue(const std::string& param, std::vector<double>& value)|Parses the value of the **param** key in a system event into a double array. Input arguments: - **param**: key name. - **value**: double array reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
-|int HiSysEventRecord::GetParamValue(const std::string& param, std::vector<std::string>& value)|Parses the value of the **param** key in a system event into a string array. Input arguments: - **param**: key name. - **value**: std::string array reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
-
-
-## How to Develop
-
-
-### **C++**
-
-The following provides an example of how to use C++ APIs of **HiSysEvent**.
-
-1. Develop the source code.
- Import the **DemoListener.h** header file, which contains the **DemoListener** class for implementing the custom event callback.
-
- ```
- #ifndef DEMO_LISTENER_H
- #define DEMO_LISTENER_H
-
- #include "hisysevent_listener.h"
-
- #include
-
- class DemoListener : public OHOS::HiviewDFX::HiSysEventListener {
- public:
- explicit DemoListener() : HiSysEventListener() {}
- virtual ~DemoListener() {}
-
- public:
- void OnEvent(std::shared_ptr sysEvent);
- void OnServiceDied();
- };
-
- #endif // DEMO_LISTENER_H
- ```
-
- Create the **DemoListener.cpp** file, and add the implementation logic of the custom event callback API in the **DemoListener** class.
-
- ```
- #include "demo_listener.h"
-
- #include
-
- void DemoListener::OnEvent(std::shared_ptr sysEvent)
- {
- if (sysEvent == nullptr) {
- return;
+|std::string HiSysEventRecord::AsJson()|Obtains the content of a system event. Input arguments: None. Return value: Content of the system event.|
+|std::string HiSysEventRecord::GetDomain()|Obtains the domain name of a system event. Input arguments: None. Return value: Domain name of the system event.|
+|std::string HiSysEventRecord::GetEventName()|Obtains the name of a system event. Input arguments: None. Return value: Name of the system event.|
+|HiSysEvent::EventType HiSysEventRecord::GetEventType()|Obtains the type of a system event. Input arguments: None. Return value: Type of the system event.|
+|std::string HiSysEventRecord::GetLevel()|Obtains the level of a system event. Input arguments: None. Return value: Level of the system event.|
+|std::string HiSysEventRecord::GetTag()|Obtains the tag of a system event. Input arguments: None. Return value: Tag of the system event.|
+|std::string HiSysEventRecord::GetTimeZone()|Obtains the time zone of a system event. Input arguments: None. Return value: Time zone, in the format of **+0800**.|
+|int HiSysEventRecord::GetTraceFlag()|Obtains the distributed call chain tracing flag of a system event. Input arguments: None. Return value: Distributed call chain tracing flag.|
+|int64_t HiSysEventRecord::GetPid()|Obtains the ID of the process that flushes a system event to the disk. Input arguments: None. Return value: Process ID.|
+|int64_t HiSysEventRecord::GetTid()|Obtains the thread ID of the process that flushes a system event to the disk. Input arguments: None. Return value: Thread ID.|
+|int64_t HiSysEventRecord::GetUid()|Obtains the user ID of the process that flushes a system event to the disk. Input arguments: None. Return value: User ID.|
+|uint64_t HiSysEventRecord::GetPspanId()|Obtains the parent span ID of the distributed call chain tracing task. Input arguments: None. Return value: Parent span ID of the distributed call chain tracing task.|
+|uint64_t HiSysEventRecord::GetSpandId()|Obtains the span ID of the distributed call chain tracing task. Input arguments: None. Return value: Span ID of the distributed call chain tracing task.|
+|uint64_t HiSysEventRecord::GetTime()|Obtains the timestamp of a system event. Input arguments: None. Return value: Timestamp.|
+|uint64_t HiSysEventRecord::GetTraceId()|Obtains the ID of the distributed call chain tracing task. Input arguments: None. Return value: ID of the distributed call chain tracing task.|
+|void HiSysEventRecord::GetParamNames(std::vector<std::string>& params)|Obtains all key names of a system event. Input arguments: - **params**: key name array reference. Return value: None.|
+|int HiSysEventRecord::GetParamValue(const std::string& param, int64_t& value)|Parses the value of the **param** key in a system event into an int64\_t value. Input arguments: - **param**: key name. - **value**: int64\_t reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
+|int HiSysEventRecord::GetParamValue(const std::string& param, uint64_t& value)|Parses the value of the **param** key in a system event into a uint64\_t value. Input arguments: - **param**: key name. - **value**: uint64\_t reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
+|int HiSysEventRecord::GetParamValue(const std::string& param, double& value)|Parses the value of the **param** key in a system event into a double value. Input arguments: - **param**: key name. - **value**: double reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
+|int HiSysEventRecord::GetParamValue(const std::string& param, std::string& value)|Parses the value of the **param** key in a system event into a string value. Input arguments: - **param**: key name. - **value**: std::string reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
+|int HiSysEventRecord::GetParamValue(const std::string& param, std::vector<int64_t>& value)|Parses the value of the **param** key in a system event into an int64\_t array. Input arguments: - **param**: key name. - **value**: int64\_t array reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
+|int HiSysEventRecord::GetParamValue(const std::string& param, std::vector<uint64_t>& value)|Parses the value of the **param** key in a system event into a uint64\_t array. Input arguments: - **param**: key name. - **value**: uint64\_t array reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
+|int HiSysEventRecord::GetParamValue(const std::string& param, std::vector<double>& value)|Parses the value of the **param** key in a system event into a double array. Input arguments: - **param**: key name. - **value**: double array reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
+|int HiSysEventRecord::GetParamValue(const std::string& param, std::vector<std::string>& value)|Parses the value of the **param** key in a system event into a string array. Input arguments: - **param**: key name. - **value**: std::string array reference. Return value: - **0**: Parsing is successful. - **-1**: Parsing failed due to initialization error. - **-2**: Parsing failed due to nonexistent key name. - **-3**: Parsing failed due to type mismatch.|
+
+#### C APIs
+
+HiSysEvent listening is implemented using the API provided in the following table. For details, see the [API Header Files](/base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent_manager/include/).
+
+> **NOTE**
+>
+> For details about the **HiSysEventRecord** argument in the **OnEvent** callback of **HiSysEventWatcher**, see Table 11 and Table 12 in [HiSysEvent Query](subsys-dfx-hisysevent-query.md).
+
+ **Table 5** Description of C HiSysEventManager APIs
+
+| Name | Description |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+| int OH_HiSysEvent_Add_Watcher(HiSysEventWatcher* watcher, HiSysEventWatchRule rules[], size_t ruleSize); | Adds a listener to listen for system events based on the specified rules. Input arguments: - **watcher**: watcher for system events. - **rules**: array of event listening rules. - **ruleSize**: length of the array of event listening rules. Return value: - **0**: The listener is added successfully. - A negative value: The listener fails to be added.|
+| int OH_HiSysEvent_Remove_Watcher(HiSysEventWatcher* watcher); | Remove the watcher for system events. Input arguments: - **watcher**: watcher for system events. Return value: - **0**: The watcher is removed successfully. - A negative value: The watcher fails to be removed. |
+
+
+ **Table 6** Description of the HiSysEventWatcher structure
+| Field | Type | Description |
+| ------------- | -------------------------------------------------- | ------------------------------------------------------------ |
+| OnEvent | void (*)(HiSysEventRecord record); | Callback object for system events. Input arguments: - **record**: real-time system event. Return value: None.|
+| OnServiceDied | void (*)(); | Callback object for service exceptions. Input arguments: None. Return value: None. |
+
+ **Table 7** Description of the HiSysEventWatchRule structure
+| Field | Type | Description |
+| ------------- | --------- | ---------------------------------- |
+| domain | char[] | Event domain. |
+| name | char[] | Event name. |
+| tag | char[] | Event tag. |
+| ruleType | int | Event matching rule. For details about the values, see Table 4 in [HiSysEvent Query](subsys-dfx-hisysevent-query.md). |
+| eventType | int | Event type. For details about the values, see Table 3 in [HiSysEvent Query](subsys-dfx-hisysevent-query.md). The value **0** indicates all event types. |
+
+### How to Develop
+
+#### C++ HiSysEvent Listening
+
+1. Import the corresponding header file.
+
+ ```c++
+ #include "hisysevent_manager.h"
+ ```
+
+2. Implement the callback API for the service domain.
+
+ ```c++
+ class TestListener : public OHOS::HiviewDFX::HiSysEventListener {
+ public:
+ void OnEvent(std::shared_ptr record)
+ {
+ if (record == nullptr) {
+ return;
+ }
+ std::cout << record->AsJson() << std::endl;
+ }
+
+ void OnServiceDied()
+ {
+ std::cout << std::string("service disconnect, exit") << std::endl;
+ exit(0);
+ }
+ };
+ ```
+
+3. Call the listening API while passing in parameters such as **listener** and **rules**. When the service ends, disable event listening.
+
+ ```c++
+ auto testListener = std::make_shared();
+ // Add a ListenerRule object based on the event tag, with RuleType left unspecified (in this case, ruleType is defaulted to WHOLE_WORD).
+ ListenerRule tagRule("dfx");
+ // Add a ListenerRule object based on the event tag, with RuleType set as REGULAR.
+ ListenerRule regRule("dfx.*", RuleType::REGULAR);
+ // Add a ListenerRule object based on the event domain and event name, with RuleType set as PREFIX.
+ ListenerRule domainNameRule("HIVIEWDFX", "APP_USAGE", RuleType::PREFIX);
+ std::vector sysRules;
+ sysRules.push_back(tagRule);
+ sysRules.push_back(regRule);
+ sysRules.push_back(domainNameRule);
+ // Start event listening.
+ auto ret = HiSysEventManager::AddEventListener(testListener, sysRules);
+ // Remove the listener when the service ends.
+ if (ret == 0) {
+ HiSysEventManager::RemoveListener(testListener);
+ }
+ ```
+
+#### C HiSysEvent Listening
+
+1. Import the corresponding header file.
+
+ ```c++
+ #include "hisysevent_manager_c.h"
+ ```
+
+2. Implement the callback API for the service domain.
+
+ ```c++
+ void OnEventTest(HiSysEventRecord record)
+ {
+ printf("OnEventTest: event=%s", record.jsonStr);
+ }
+
+ void OnServiceDiedTest()
+ {
+ printf("OnServiceDied");
+ }
+ ```
+
+3. Call the listening API while passing in parameters such as **watcher** and **rules**. When the service ends, disable event listening.
+
+ ```c++
+ HiSysEventWatcher watcher;
+ watcher.OnEvent = OnEventTest;
+ watcher.OnServiceDied = OnServiceDiedTest;
+ // Add a HiSysEventWatchRule object based on the event tag, with RuleType left unspecified (in this case, ruleType is defaulted to WHOLE_WORD).
+ constexpr char DFX_TAG[] = "dfx";
+ HiSysEventWatchRule tagRule;
+ (void)strcpy_s(tagRule.tag, strlen(DFX_TAG) + 1, DFX_TAG);
+ tagRule.ruleType = 1;
+ tagRule.eventType = 0;
+ // Add a HiSysEventWatchRule object based on the event tag, with RuleType set as REGULAR.
+ constexpr char DFX_PATTERN_TAG[] = "dfx.*";
+ HiSysEventWatchRule regRule;
+ (void)strcpy_s(regRule.tag, strlen(DFX_PATTERN_TAG) + 1, DFX_PATTERN_TAG);
+ regRule.ruleType = 3;
+ regRule.eventType = 0;
+ // Add a HiSysEventWatchRule object based on the event domain and event name, with RuleType set as PREFIX.
+ constexpr char DOMAIN[] = "HIVIEWDFX";
+ constexpr char NAME[] = "APP_USAGE";
+ HiSysEventWatchRule domainNameRule;
+ (void)strcpy_s(domainNameRule.domain, strlen(DOMAIN) + 1, DOMAIN);
+ (void)strcpy_s(domainNameRule.name, strlen(NAME) + 1, NAME);
+ domainNameRule.ruleType = 2;
+ domainNameRule.eventType = 0;
+ // Start event listening.
+ HiSysEventWatchRule rules[] = {tagRule, regRule, domainNameRule};
+ int ret = OH_HiSysEvent_Add_Watcher(&watcher, rules, sizeof(rules) / sizeof(HiSysEventWatchRule));
+ // Remove the watcher when the service ends.
+ if (ret == 0) {
+ ret = OH_HiSysEvent_Remove_Watcher(&watcher);
+ }
+ ```
+
+### Development Examples
+
+#### C++ HiSysEvent Listening
+
+Suppose you want to enable listening for all events whose domain is **HIVIEWDFX** and name is **PLUGIN_LOAD**. The sample code is as follows:
+
+1. Add the **libhisysevent** and **libhisyseventmanager** dependencies of the **hisysevent** component to the **BUILD.gn** file of the service module.
+
+ ```c++
+ external_deps = [
+ "hisysevent:libhisysevent",
+ "hisysevent:libhisyseventmanager",
+ ]
+ ```
+
+2. Call the listening API in the **TestEventListening()** function. When the service ends, disable event listening.
+
+ ```c++
+ #include
+
+ #include "hisysevent_manager.h"
+
+ using namespace OHOS::HiviewDFX;
+
+ class TestListener : public HiSysEventQueryCallback {
+ public:
+ void OnEvent(std::shared_ptr record)
+ {
+ if (record == nullptr) {
+ return;
+ }
+ std::cout << record->AsJson() << std::endl;
+ }
+
+ void OnServiceDied()
+ {
+ std::cout << std::string("service disconnect, exit") << std::endl;
+ exit(0);
+ }
+ };
+
+ void TestEventListening()
+ {
+ auto testListener = std::make_shared();
+ ListenerRule domainNameRule("HIVIEWDFX", "PLUGIN_LOAD", RuleType::WHOLE_WORD);
+ std::vector sysRules;
+ sysRules.push_back(domainNameRule);
+ auto ret = HiSysEventManager::AddEventListener(testListener, sysRules);
+ if (ret == 0) {
+ HiSysEventManager::RemoveListener(testListener);
+ }
+ }
+ ```
+
+#### C HiSysEvent Listening
+
+Suppose you want to enable listening for all events whose domain is **HIVIEWDFX** and name is **PLUGIN_LOAD**. The sample code is as follows:
+
+1. Add the **libhisysevent** and **libhisyseventmanager** dependencies of the **hisysevent** component to the **BUILD.gn** file of the service module.
+
+ ```c++
+ external_deps = [ "hisysevent:libhisyseventmanager" ]
+
+ // for strcpy_s
+ deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
+ ```
+
+2. Call the listening API in the **TestEventListening()** function. When the service ends, disable event listening.
+
+ ```c++
+ #include